Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing cleanup effects, because the relevant cards are still in play now

  • Loading branch information...
commit 769e5bc341f37a644cac4562c0bed59e2235e544 1 parent fa8bea5
@rspeer authored
Showing with 11 additions and 6 deletions.
  1. +3 −3 cards.coffee
  2. +8 −3 gameState.coffee
View
6 cards.coffee
@@ -735,7 +735,7 @@ makeCard 'Tactician', duration, {
state.cardState[this].activeTacticians--
else
state.log("#{state.current.ai} discards an inactive Tactician.")
- transferCard(c.Tactician, state.current.duration, state.current.discard)
+ transferCard(c.Tactician, state.current.inPlay, state.current.discard)
state.handleDiscards(state.current, [c.Tactician])
}
@@ -1393,7 +1393,7 @@ makeCard 'Alchemist', action, {
cleanupEffect:
(state) ->
if c.Potion in state.current.inPlay
- transferCardToTop(c.Alchemist, state.current.discard, state.current.draw)
+ transferCardToTop(c.Alchemist, state.current.inPlay, state.current.draw)
}
makeCard 'Apothecary', action, {
@@ -2533,7 +2533,7 @@ makeCard 'Treasury', c.Market, {
cleanupEffect: (state) ->
if state.cardState[this].mayReturnTreasury
- transferCardToTop(c.Treasury, state.current.discard, state.current.draw)
+ transferCardToTop(c.Treasury, state.current.inPlay, state.current.draw)
state.log("#{state.current.ai} returns a Treasury to the top of the deck.")
}
View
11 gameState.coffee
@@ -495,7 +495,10 @@ class State
# left undefined.
# - `log
setUpWithOptions: (ais, options) ->
- tableau = options.require ? []
+ tableau = []
+ if options.require?
+ for card in options.require
+ tableau.push(c[card])
for ai in ais
if ai.requires?
for card in ai.requires
@@ -896,8 +899,10 @@ class State
# Handle effects of cleaning up the card, which may involve moving it
# somewhere else. We do this before removing cards from play because
# cards such as Scheme and Herbalist need to consider cards in play.
- cardsToCleanup = @current.inPlay.concat()
- card.onCleanup(this) for card in cardsToCleanup
+ cardsToCleanup = @current.inPlay.concat().reverse()
+ for i in [cardsToCleanup.length-1...-1]
+ card = cardsToCleanup[i]
+ card.onCleanup(this)
# Clean up cards in play.
while @current.inPlay.length > 0
Please sign in to comment.
Something went wrong with that request. Please try again.