46 lines
2.0 KiB
Groovy
46 lines
2.0 KiB
Groovy
[
|
|
new MagicAtUpkeepTrigger() {
|
|
@Override
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
|
|
return permanent.isController(upkeepPlayer) ?
|
|
new MagicEvent(
|
|
permanent,
|
|
this,
|
|
"Return an instant or sorcery card at random " +
|
|
"from your graveyard to your hand."
|
|
) :
|
|
MagicEvent.NONE;
|
|
}
|
|
@Override
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
final MagicPlayer player = event.getPlayer();
|
|
final List<MagicCard> targets = game.filterCards(player,MagicTargetFilter.TARGET_INSTANT_OR_SORCERY_CARD_FROM_GRAVEYARD);
|
|
if (targets.size() > 0) {
|
|
final MagicPermanent permanent = event.getPermanent();
|
|
final MagicRandom rng = new MagicRandom(player.getGraveyard().getStateId());
|
|
final int index = rng.nextInt(targets.size());
|
|
final MagicCard card = targets.get(index);
|
|
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
|
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersHand));
|
|
}
|
|
}
|
|
},
|
|
new MagicWhenOtherSpellIsCastTrigger() {
|
|
@Override
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack cardOnStack) {
|
|
return (permanent.isFriend(cardOnStack) &&
|
|
cardOnStack.isInstantOrSorcerySpell()) ?
|
|
new MagicEvent(
|
|
permanent,
|
|
this,
|
|
"SN gets +4/+0 until end of turn."
|
|
):
|
|
MagicEvent.NONE;
|
|
}
|
|
@Override
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
game.doAction(new MagicChangeTurnPTAction(event.getPermanent(),4,0));
|
|
}
|
|
}
|
|
]
|