- Kiki-Jiki, Mirror Breaker should work correctly now with Doubling Season.

This commit is contained in:
jendave
2011-08-06 05:58:42 +00:00
parent 83e56398b7
commit 5d72cbccf3

View File

@@ -672,6 +672,15 @@ public class CardFactory_Creatures {
&& getTargetCard().getController().equals(card.getController())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
int multiplier = 1;
int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", card.getController()).size();
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
Card[] crds = new Card[multiplier];
for (int i=0;i<multiplier;i++)
{
Card copy;
if(!getTargetCard().isToken()) {
//CardFactory cf = new CardFactory("cards.txt");
@@ -720,24 +729,31 @@ public class CardFactory_Creatures {
copy.addIntrinsicKeyword("Haste");
}
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(copy);
crds[i] = copy;
}
//have to do this since getTargetCard() might change
//if Kiki-Jiki somehow gets untapped again
final Card[] target = new Card[1];
target[0] = copy;
final Card[] target = new Card[multiplier];
for (int i=0;i<multiplier;i++) {
final int index = i;
target[i] = crds[i];
Command atEOT = new Command() {
private static final long serialVersionUID = 7803915905490565557L;
public void execute() {
//technically your opponent could steal the token
//and the token shouldn't be sacrificed
if(AllZone.GameAction.isCardInPlay(target[0])) AllZone.GameAction.sacrifice(target[0]); //maybe do a setSacrificeAtEOT, but probably not.
if(AllZone.GameAction.isCardInPlay(target[index])) AllZone.GameAction.sacrifice(target[index]); //maybe do a setSacrificeAtEOT, but probably not.
}
};//Command
AllZone.EndOfTurn.addAt(atEOT);
}
}//is card in play?
}//resolve()
};//SpellAbility