codecombat/app/lib
gosnat 939509849c Update GoalManager.coffee
Justification:

For a negative goal like saveThangs, let's say you have 5 thangs on the save list.  As things stand, if you don't have a HowMany defined, then the number of needed deaths to fail is 

numNeeded = _.size(stateThangs) - Math.min((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.min(1, 5) + 1
numNeeded = 5

So you would only fail the goal if all 5 thangs you were supposed to save died.  This is contrary to the comment right above this line:

# saveThangs: by default we would want to save all the Thangs, which means that we would want none of them to be "done"

Therefore, I think it should be Math.max rather than Math.min.

numNeeded = _.size(stateThangs) - Math.max((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.max(1, 5) + 1
numNeeded = 1

So any of the Thangs on the save list dying is enough to fail the goal.

As a double check, what if the level designer designated a HowMany of 5?

numNeeded = _.size(stateThangs) - Math.max((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.max(5, 5) + 1
numNeeded = 1

So this is consistent.
2014-05-05 14:08:41 -05:00
..
scripts Listed a few new levels. 2014-04-25 15:00:46 -07:00
simulator Simulate properly even if Simulator Supermodel starts fully loaded. 2014-04-29 16:54:57 -07:00
sprites Some bug fixes to get Anya import to work. 2014-04-16 09:25:34 -07:00
surface Hid level done button better. Avoiding building wizard sprite when not needed. 2014-05-01 14:36:26 -07:00
world Update GoalManager.coffee 2014-05-05 14:08:41 -05:00
AsyncCloner.coffee Switching from the slow _.cloneDeep to the fast $.extend 2014-03-18 13:08:26 -07:00
AudioPlayer.coffee Added volume manipulation, adjusted panning parameters 2014-03-05 20:12:42 -08:00
auth.coffee Push for george 2014-04-24 15:27:37 -07:00
Bus.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
CocoClass.coffee Fixed destroy to not break stopListening, which uses off. 2014-03-24 14:27:10 -07:00
contact.coffee Adding contact form for employers to contact candidates. 2014-04-10 14:59:32 -07:00
deltas.coffee Added i18n population action to the level editor. 2014-04-22 17:56:41 -07:00
errors.coffee Fixed showing generic errors. 2014-03-04 12:06:31 -08:00
FacebookHandler.coffee Refactored user authentication again. Now the user object is inserted into main.html, which was renamed from index.html so the express static middleware wouldn't serve it. 2014-04-02 13:12:24 -07:00
forms.coffee Fixed account settings page. 2014-01-27 16:07:17 -08:00
God.coffee Give focus back to spell view on palette click. 2014-03-23 16:48:30 -07:00
GPlusHandler.coffee A bit of error handling. 2014-04-13 14:48:36 -07:00
image_filter.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
LevelBus.coffee Fixed common programmables not being saved 2014-04-10 14:08:20 -07:00
LevelLoader.coffee Fixed #934 2014-05-01 15:44:50 -07:00
LinkedInHandler.coffee Code review of 97d3b6. 2014-04-25 10:46:43 -07:00
NameLoader.coffee Merge branch 'master' into feature/loading-views 2014-04-25 14:31:58 -07:00
Router.coffee Refactored user authentication again. Now the user object is inserted into main.html, which was renamed from index.html so the express static middleware wouldn't serve it. 2014-04-02 13:12:24 -07:00
storage.coffee Fix console.warning bug that prevents page from loading 2014-04-16 00:03:43 +01:00
SystemNameLoader.coffee Add system names into delta messages 2014-04-18 17:25:25 -04:00
Tracker.coffee Fixed #769. Added some analytics timing tracking. Added replacement for $.browser. 2014-04-13 20:31:23 -07:00
utils.coffee Using the new i18n utility function everywhere. Fixed big bug with spell palette i18n. 2014-03-13 09:02:19 -07:00