rspeer/dominiate

Throne Room and King's Court don't nest correctly

Closed this issue · 1 comments

Example:

ChapelPoorHouseThroneRoom draws 5 cards: [Poor House, Throne Room, Throne Room, Poor House, Chapel].

...


== ChapelPoorHouseThroneRoom's turn 11 ==
ChapelPoorHouseThroneRoom plays Throne Room.
...playing Throne Room (1 of 2).
...playing Poor House (1 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
...playing Poor House (2 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
...playing Poor House (2 of 2).
ChapelPoorHouseThroneRoom reveals the hand ([Poor House, Chapel]).
Coins: 12, Potions: 0, Buys: 1
ChapelPoorHouseThroneRoom buys Province.
(ChapelPoorHouseThroneRoom shuffles.)
ChapelPoorHouseThroneRoom draws 5 cards: [Province, Poor House, Province, Chapel, Throne Room].

When the Throne Room is played on the Throne Room, the second play of the nested TR becomes a play of Poor House instead. The root of this issue is the line action = state.current.ai.choose('multiplied', state, choices) in the King's Court implementation. It is interpreted as an assignment to a global variable.

Thanks! I had let CoffeeScript's scope rules lull me into complacency.