codecombat/app/lib/world
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
..
systems Tweaked collision to make missiles not collide with one another. 2014-02-08 12:27:56 -08:00
box2d.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
component.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
errors.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
GoalManager.coffee Update GoalManager.coffee 2014-05-05 14:08:41 -05:00
Grid.coffee No need for wallNameFor any more. 2014-01-06 19:07:13 -08:00
names.coffee Improved admin view of pending candidates. 2014-04-23 10:21:58 -07:00
rand.coffee Fixed naming. 2014-01-29 10:14:12 -08:00
rectangle.coffee Updates for Aether's protectAPI stuff. 2014-01-28 15:24:08 -08:00
script_event_prereqs.coffee More for #133. 2014-02-02 10:42:18 -08:00
system.coffee Ready for action, sir! 2014-01-03 10:32:13 -08:00
thang.coffee Added getThangByID method to Thang. Handled a few error corner cases with the time popup. 2014-04-11 14:03:13 -07:00
thang_state.coffee Fixed serialization of tracked property arrays. 2014-05-01 13:23:14 -07:00
vector.coffee Improved admin view of pending candidates. 2014-04-23 10:21:58 -07:00
world.coffee Added setGoalState 2014-03-29 03:54:16 +02:00
world_frame.coffee 60 FPS and support for independent world/surface frame rates. 2014-02-17 11:53:52 -08:00
world_script_note.coffee Moved Glen from Archmages to About. 2014-03-13 18:27:08 -07:00
world_utils.coffee Fixed serialization of tracked property arrays. 2014-05-01 13:23:14 -07:00