added MagicReplicateTrigger. added Gigadrowse

master
beholder 2012-03-21 09:02:20 +01:00
parent 7032df4fa8
commit da069a3269
4 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,12 @@
>Gigadrowse
url=http://magiccards.info/gp/en/26.html
image=http://magiccards.info/scans/en/gp/26.jpg
value=2
rarity=C
type=Instant
color=u
converted=1
cost={U}
ability=replicate
timing=tapping
requires_card_code

View File

@ -0,0 +1,42 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicTapAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicTapTargetPicker;
public class Gigadrowse {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(
final MagicCardOnStack cardOnStack,
final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack.getCard(),
cardOnStack.getController(),
MagicTargetChoice.NEG_TARGET_PERMANENT,
new MagicTapTargetPicker(true,false),
MagicEvent.NO_DATA,
this,
"Tap target permanent$.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object[] data,
final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
game.doAction(new MagicTapAction(permanent,true));
}
});
}
};
}

View File

@ -494,6 +494,11 @@ public enum MagicAbility {
card.add(new MagicAnnihilatorTrigger(n));
}
},
Replicate("replicate", 20) {
public void addAbilityImpl(final MagicCardDefinition card, final String arg) {
card.add(MagicReplicateTrigger.create());
}
},
None("",0);
public static final long PROTECTION_FLAGS=

View File

@ -0,0 +1,53 @@
package magic.model.trigger;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.action.MagicCopyCardOnStackAction;
import magic.model.choice.MagicKickerChoice;
import magic.model.event.MagicEvent;
import magic.model.stack.MagicCardOnStack;
public class MagicReplicateTrigger extends MagicWhenSpellIsCastTrigger {
private static final MagicReplicateTrigger INSTANCE = new MagicReplicateTrigger();
private MagicReplicateTrigger() {}
public static final MagicReplicateTrigger create() {
return INSTANCE;
}
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicCardOnStack data) {
return new MagicEvent(
data.getSource(),
data.getController(),
new MagicKickerChoice(data.getCardDefinition().getCost(),true,true),
new Object[]{data},
this,
"");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
int kickerCount = (Integer)choiceResults[1];
final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0];
for (;kickerCount>0;kickerCount--) {
game.doAction(new MagicCopyCardOnStackAction(
cardOnStack.getController(),
cardOnStack));
}
}
@Override
public boolean usesStack() {
return false;
}
}