magarena/release/Magarena/scripts/Mistbind_Clique.groovy

65 lines
2.9 KiB
Groovy

[
new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
final MagicTargetFilter<MagicPermanent> targetFilter =
new MagicOtherPermanentTargetFilter(
MagicTargetFilter.TARGET_FAERIE_YOU_CONTROL,permanent);
final MagicTargetChoice targetChoice =
new MagicTargetChoice(
targetFilter,false,MagicTargetHint.None,"another Faerie to exile");
final MagicChoice championChoice =
new MagicMayChoice(targetChoice);
return new MagicEvent(
permanent,
championChoice,
MagicExileTargetPicker.create(),
this,
"PN may\$ exile another Faerie you control\$. " +
"If you don't, sacrifice SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPermanent permanent = event.getPermanent();
if (event.isYes()) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicExileUntilThisLeavesPlayAction(permanent,creature));
final Collection<MagicPermanent> targets = game.filterPermanents(
event.getPlayer().getOpponent(),
MagicTargetFilter.TARGET_LAND_YOU_CONTROL);
for (final MagicPermanent land : targets) {
game.doAction(new MagicTapAction(land,true));
}
}
});
} else {
game.doAction(new MagicSacrificeAction(permanent));
}
}
},
new MagicWhenLeavesPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent left) {
if (permanent == left &&
!permanent.getExiledCards().isEmpty()) {
final MagicCard exiledCard = permanent.getExiledCards().get(0);
return new MagicEvent(
permanent,
exiledCard,
this,
"Return RN to the battlefield"
);
}
return MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicCard exiledCard = event.getRefCard();
game.doAction(new MagicRemoveCardAction(exiledCard,MagicLocationType.Exile));
game.doAction(new MagicPlayCardAction(exiledCard,exiledCard.getOwner(),MagicPlayCardAction.NONE));
}
}
]