magarena/release/Magarena/scripts/Scrib_Nibblers.groovy

62 lines
2.2 KiB
Groovy

[
new MagicLandfallTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent played) {
return new MagicEvent(
permanent,
new MagicSimpleMayChoice(
MagicSimpleMayChoice.UNTAP,
1,
MagicSimpleMayChoice.DEFAULT_YES
),
this,
"PN may\$ untap SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
game.doAction(new MagicUntapAction(event.getPermanent()));
}
}
},
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.MustAttack),
"Attacks"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.NEG_TARGET_PLAYER,
this,
"Exile the top card of target player's\$ library. " +
"If it's a land card, PN gains 1 life."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer player) {
final MagicCard card = player.getLibrary().getCardAtTop();
if (card != MagicCard.NONE) {
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.OwnersLibrary));
game.doAction(new MagicMoveCardAction(card,MagicLocationType.OwnersLibrary,MagicLocationType.Exile));
if (card.hasType(MagicType.Land)) {
game.doAction(new MagicChangeLifeAction(event.getPlayer(),1));
}
}
}
});
}
}
]