magarena/release/Magarena/scripts/Unhallowed_Pact.groovy

30 lines
980 B
Groovy

[
new MagicWhenOtherDiesTrigger() {
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicPermanent died) {
final MagicPermanent enchanted = permanent.getEnchantedCreature();
return (enchanted == died) ?
new MagicEvent(
permanent,
enchanted.getCard(),
this,
"Return RN to the battlefield under your control."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicCard card = event.getRefCard();
if (card.isInGraveyard()) {
game.doAction(new MagicReanimateAction(
card,
event.getPlayer()
));
}
}
}
]