magarena/release/Magarena/scripts/Seance.groovy

56 lines
2.3 KiB
Groovy
Raw Normal View History

2013-05-30 21:55:42 -07:00
def Spirit = new MagicStatic(MagicLayer.Type) {
@Override
public void modSubTypeFlags(final MagicPermanent permanent,final Set<MagicSubType> flags) {
flags.add(MagicSubType.Spirit);
}
};
2013-06-23 18:29:26 -07:00
[
2013-05-30 21:55:42 -07:00
new MagicAtUpkeepTrigger() {
2013-04-12 19:32:25 -07:00
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicPlayer upkeepPlayer) {
return new MagicEvent(
permanent,
new MagicMayChoice(
MagicTargetChoice.TARGET_CREATURE_CARD_FROM_GRAVEYARD
),
new MagicGraveyardTargetPicker(true),
this,
2013-05-30 21:55:42 -07:00
"PN may\$ exile target creature card\$ from his or her graveyard. " +
2013-04-12 19:32:25 -07:00
"If he or she does, put a token onto the battlefield that's a copy " +
"of that card except it's a Spirit in addition to its other types. " +
2013-05-30 21:55:42 -07:00
"Exile it at the beginning of the next end step."
);
2013-04-12 19:32:25 -07:00
}
2013-06-23 18:29:26 -07:00
2013-04-12 19:32:25 -07:00
@Override
2013-05-30 21:55:42 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
if (event.isYes()) {
2013-05-31 00:57:12 -07:00
event.processTargetCard(game,{
final MagicCard card ->
final MagicPlayer player=event.getPlayer();
game.doAction(new MagicRemoveCardAction(
card,
MagicLocationType.Graveyard));
game.doAction(new MagicMoveCardAction(
card,
MagicLocationType.Graveyard,
MagicLocationType.Exile));
final MagicPutIntoPlayAction action = new MagicPlayTokenAction(
player,
card.getCardDefinition());
game.doAction(action);
final MagicPermanent permanent = action.getPermanent();
game.doAction(MagicChangeStateAction.Set(
permanent,
MagicPermanentState.SacrificeAtEndOfTurn
));
2013-05-31 00:57:12 -07:00
game.doAction(new MagicAddStaticAction(permanent,Spirit));
} as MagicCardAction);
2013-04-12 19:32:25 -07:00
}
}
2013-05-30 21:55:42 -07:00
}
]