replicate trigger goes on stack, gets kicker count from MagicCardOnStack.getChoiceResults

master
melvin 2012-08-19 16:03:48 +08:00
parent adbbc91544
commit f4746edff9
1 changed files with 10 additions and 13 deletions

View File

@ -21,14 +21,16 @@ public class MagicReplicateTrigger extends MagicWhenSpellIsCastTrigger {
public MagicEvent executeTrigger( public MagicEvent executeTrigger(
final MagicGame game, final MagicGame game,
final MagicPermanent permanent, final MagicPermanent permanent,
final MagicCardOnStack data) { final MagicCardOnStack cardOnStack) {
return new MagicEvent( int kickerCount = (Integer)cardOnStack.getChoiceResults()[1];
data.getSource(), return (kickerCount > 0) ?
data.getController(), new MagicEvent(
new MagicKickerChoice(data.getCardDefinition().getCost(),true,true), cardOnStack.getSource(),
new Object[]{data}, cardOnStack.getController(),
new Object[]{cardOnStack},
this, this,
""); "Copy " + cardOnStack.getSource() + " for each time its replicate cost was paid.") :
MagicEvent.NONE;
} }
@Override @Override
@ -37,17 +39,12 @@ public class MagicReplicateTrigger extends MagicWhenSpellIsCastTrigger {
final MagicEvent event, final MagicEvent event,
final Object data[], final Object data[],
final Object[] choiceResults) { final Object[] choiceResults) {
int kickerCount = (Integer)choiceResults[1];
final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0]; final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0];
int kickerCount = (Integer)cardOnStack.getChoiceResults()[1];
for (;kickerCount>0;kickerCount--) { for (;kickerCount>0;kickerCount--) {
game.doAction(new MagicCopyCardOnStackAction( game.doAction(new MagicCopyCardOnStackAction(
cardOnStack.getController(), cardOnStack.getController(),
cardOnStack)); cardOnStack));
} }
} }
@Override
public boolean usesStack() {
return false;
}
} }