Commit graph

22 commits

Author SHA1 Message Date
Nick Winter
09c8a99a9b Merge branch 'patch-5' of git://github.com/gosnat/codecombat into gosnat-patch-5 2014-05-06 07:23:51 -07:00
Nick Winter
acccee33a3 Cleaner conditional init syntax. 2014-05-06 07:22:09 -07:00
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
gosnat
93d117100a Update GoalManager.coffee
For compound goals like GetAllToLocation, you should continue adding to the existing list of thang states.
2014-05-05 13:22:57 -05:00
gosnat
39b21da035 Update GoalManager.coffee
I'd like to temporarily turn on console logging (lines 240 and 245) to take a peek at why numNeeded doesn't seem to be correct if howMany isn't defined.
2014-05-03 21:36:24 -05:00
Nick Winter
3325c55c3f Fixed #759. 2014-04-08 14:58:34 -07:00
Nick Winter
cb27124285 Fixed #135. 2014-03-30 17:24:07 -07:00
Nick Winter
e08265a725 Merge pull request #730 from Darredevil/master
Added setGoalState
2014-03-29 14:04:33 -07:00
Darredevil
e060d4b73d Added setGoalState 2014-03-29 03:52:02 +02:00
Scott Erickson
37a9b7f319 Switching from the slow _.cloneDeep to the fast $.extend 2014-03-18 13:08:26 -07:00
Darredevil
012c25a817 Added GetALLToLocations and KeepALLFromLocations 2014-03-12 01:57:30 +02:00
Darredevil
c9a56048ca Update GoalManager.coffee 2014-03-09 20:35:33 +02:00
Scott Erickson
6b2e0bc364 Changed how the goal manager handles arriving at goals and figuring out the how many requirement. 2014-02-20 11:43:35 -08:00
Scott Erickson
b8051689b3 Fixed the goal manager from polluting the goals in the level with the isPositive property. 2014-02-13 15:50:53 -08:00
Scott Erickson
23964abee9 Set up the goal manager to only use goals from the level.goals property, rather than from scripts. 2014-02-13 09:26:42 -08:00
Scott Erickson
8176e2258f Set up the goal manager to use goals from the new level goals property, rather than from scripts. Backward-compatible for now. 2014-02-12 16:20:25 -08:00
Michael Schmatz
1a2fa68473 Merge branch 'feature/task-queue'
Conflicts:
	app/views/play/level/tome/spell.coffee
2014-02-11 15:58:38 -08:00
Michael Schmatz
b29ab56fe2 Fixed simulation goals 2014-02-11 15:26:57 -08:00
Scott Erickson
47eeda5af4 More memory fixes. 2014-02-11 12:54:08 -08:00
Scott Erickson
7ddb97fa22 More memory fixes. 2014-02-11 12:32:12 -08:00
Nick Winter
6af2d34f59 Fixed a ton of memory leaks, but not all of them. 2014-02-06 14:00:27 -08:00
Nick Winter
6009df26de Ready for action, sir! 2014-01-03 10:32:13 -08:00