2013-05-30 06:38:14 -07:00
|
|
|
[
|
2013-06-23 18:29:26 -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 permanent.isController(upkeepPlayer) ?
|
|
|
|
new MagicEvent(
|
|
|
|
permanent,
|
|
|
|
this,
|
|
|
|
"Return an instant or sorcery card at random " +
|
|
|
|
"from your graveyard to your hand."
|
|
|
|
) :
|
|
|
|
MagicEvent.NONE;
|
|
|
|
}
|
|
|
|
@Override
|
2013-05-30 06:38:14 -07:00
|
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
2013-04-12 19:32:25 -07:00
|
|
|
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 magic.MersenneTwisterFast rng = new magic.MersenneTwisterFast(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));
|
|
|
|
}
|
|
|
|
}
|
2013-05-30 06:38:14 -07:00
|
|
|
},
|
|
|
|
new MagicWhenOtherSpellIsCastTrigger() {
|
2013-04-12 19:32:25 -07:00
|
|
|
@Override
|
|
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack cardOnStack) {
|
2013-06-05 22:57:29 -07:00
|
|
|
return (permanent.isFriend(cardOnStack) &&
|
2013-08-17 19:52:13 -07:00
|
|
|
cardOnStack.isInstantOrSorcery()) ?
|
2013-04-12 19:32:25 -07:00
|
|
|
new MagicEvent(
|
|
|
|
permanent,
|
|
|
|
this,
|
2013-05-30 06:38:14 -07:00
|
|
|
"SN gets +4/+0 until end of turn."
|
|
|
|
):
|
2013-04-12 19:32:25 -07:00
|
|
|
MagicEvent.NONE;
|
|
|
|
}
|
|
|
|
@Override
|
2013-05-30 06:38:14 -07:00
|
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
2013-04-12 19:32:25 -07:00
|
|
|
game.doAction(new MagicChangeTurnPTAction(event.getPermanent(),4,0));
|
|
|
|
}
|
2013-05-30 06:38:14 -07:00
|
|
|
}
|
|
|
|
]
|