mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-04 17:19:47 -04:00
Extended team-based goal completion to collection and leaving sides goal types.
This commit is contained in:
parent
89aa930803
commit
925588dfc2
1 changed files with 10 additions and 10 deletions
|
@ -169,23 +169,23 @@ module.exports = class GoalManager extends CocoClass
|
|||
|
||||
onThangLeftMap: (e, frameNumber) ->
|
||||
for goal in @goals ? []
|
||||
@checkLeft(goal.id, goal.leaveOffSides.who, goal.leaveOffSides.sides, e.thang.id, e.side, frameNumber) if goal.leaveOffSides?
|
||||
@checkLeft(goal.id, goal.keepFromLeavingOffSides.who, goal.keepFromLeavingOffSides.sides, e.thang.id, e.side, frameNumber) if goal.keepFromLeavingOffSides?
|
||||
@checkLeft(goal.id, goal.leaveOffSides.who, goal.leaveOffSides.sides, e.thang, e.side, frameNumber) if goal.leaveOffSides?
|
||||
@checkLeft(goal.id, goal.keepFromLeavingOffSides.who, goal.keepFromLeavingOffSides.sides, e.thang, e.side, frameNumber) if goal.keepFromLeavingOffSides?
|
||||
|
||||
checkLeft: (goalID, who, sides, thangID, side, frameNumber) ->
|
||||
checkLeft: (goalID, who, sides, thang, side, frameNumber) ->
|
||||
return if sides and side and not (side in sides)
|
||||
return unless thangID in who
|
||||
@updateGoalState(goalID, thangID, 'left', frameNumber)
|
||||
return unless thang.id in who or thang.team in who
|
||||
@updateGoalState(goalID, thang.id, 'left', frameNumber)
|
||||
|
||||
onThangCollectedItem: (e, frameNumber) ->
|
||||
for goal in @goals ? []
|
||||
@checkCollected(goal.id, goal.collectThangs.who, goal.collectThangs.targets, e.actor.id, e.item.id, frameNumber) if goal.collectThangs?
|
||||
@checkCollected(goal.id, goal.keepFromCollectingThangs.who, goal.keepFromCollectingThangs.targets, e.actor.id, e.item.id, frameNumber) if goal.keepFromCollectingThangs?
|
||||
@checkCollected(goal.id, goal.collectThangs.who, goal.collectThangs.targets, e.actor, e.item.id, frameNumber) if goal.collectThangs?
|
||||
@checkCollected(goal.id, goal.keepFromCollectingThangs.who, goal.keepFromCollectingThangs.targets, e.actor, e.item.id, frameNumber) if goal.keepFromCollectingThangs?
|
||||
|
||||
checkCollected: (goalID, who, targets, thangID, itemID, frameNumber) ->
|
||||
checkCollected: (goalID, who, targets, thang, itemID, frameNumber) ->
|
||||
return unless itemID in targets
|
||||
return unless thangID in who
|
||||
@updateGoalState(goalID, thangID, 'collected', frameNumber)
|
||||
return unless thang.id in who or thang.team in who
|
||||
@updateGoalState(goalID, thang.id, 'collected', frameNumber)
|
||||
|
||||
wrapUpGoalStates: (finalFrame) ->
|
||||
for goalID, state of @goalStates
|
||||
|
|
Loading…
Add table
Reference in a new issue