From a40c279520335cbd91074afba976c3b02afc1047 Mon Sep 17 00:00:00 2001 From: Patrick Quinn Date: Mon, 16 Jan 2012 12:29:53 -0500 Subject: [PATCH] Move Tactician active/inactive state into its card definition See #21 --- cards.coffee | 9 ++++++--- gameState.coffee | 3 --- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cards.coffee b/cards.coffee index 0e88335..e5a8232 100644 --- a/cards.coffee +++ b/cards.coffee @@ -690,12 +690,15 @@ makeCard 'Tactician', duration, { durationCards: +5 playEffect: (state) -> + # If this is the first time we've played Tactician this turn, reset our count + @activeTacticians = 0 if state.current.countInPlay('Tactician') == 1 + cardsInHand = state.current.hand.length # If any cards can be discarded... if cardsInHand > 0 # Discard the hand and activate the tactician. state.log("...discarding the whole hand.") - state.current.tacticians++ + @activeTacticians++ discards = state.current.hand state.current.discard = state.current.discard.concat(discards) state.current.hand = [] @@ -704,8 +707,8 @@ makeCard 'Tactician', duration, { # The cleanupEffect of a dead Tactician is to discard it instead of putting it in the # duration area. It's not a duration card in this case. cleanupEffect: (state) -> - if state.current.tacticians > 0 - state.current.tacticians-- + if @activeTacticians > 0 + @activeTacticians-- else state.log("#{state.current.ai} discards an inactive Tactician.") transferCard(c.Tactician, state.current.duration, state.current.discard) diff --git a/gameState.coffee b/gameState.coffee index 3803625..d49da9c 100644 --- a/gameState.coffee +++ b/gameState.coffee @@ -43,7 +43,6 @@ class PlayerState @duration = [] @setAside = [] @gainedThisTurn = [] - @tacticians = 0 # number of Tacticians that will go to the duration area @mayReturnTreasury = yes @turnsTaken = 0 @@ -401,7 +400,6 @@ class PlayerState other.gainLocation = @gainLocation other.actionStack = @actionStack.slice(0) other.actionsPlayed = @actionsPlayed - other.tacticians = @tacticians other.ai = @ai other.logFunc = @logFunc other.turnsTaken = @turnsTaken @@ -908,7 +906,6 @@ class State @current.buys = 1 @current.coins = 0 @current.potions = 0 - @current.tacticians = 0 @current.actionsPlayed = 0 @current.mayReturnTreasury = yes @copperValue = 1