From 02191a6d6a636eeed4054bb5271968f8524878e3 Mon Sep 17 00:00:00 2001 From: melvin Date: Mon, 14 Oct 2013 10:31:15 +0800 Subject: [PATCH] trigger should have executeEvent --- .../Magarena/scripts/Merrow_Commerce.groovy | 25 +++++++++++-------- src/magic/model/target/MagicTargetFilter.java | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/release/Magarena/scripts/Merrow_Commerce.groovy b/release/Magarena/scripts/Merrow_Commerce.groovy index eaeb39fdcf..5bfeeeb694 100644 --- a/release/Magarena/scripts/Merrow_Commerce.groovy +++ b/release/Magarena/scripts/Merrow_Commerce.groovy @@ -2,17 +2,22 @@ new MagicAtEndOfTurnTrigger() { @Override public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) { - if (permanent.isController(player)) { - final Collection targets= - game.filterPermanents(permanent.getController(),MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL); - for (final MagicPermanent creature : targets) { - if (creature.isTapped() && - creature.hasSubType(MagicSubType.Merfolk)) { - game.doAction(new MagicUntapAction(creature)); - } - } + return permanent.isController(player) ? + new MagicEvent( + permanent, + this, + "Untap all Merfolk PN controls." + ): + MagicEvent.NONE; + } + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + final Collection targets = event.getPlayer().filterPermanents( + MagicTargetFilter.TARGET_MERFOLK_YOU_CONTROL + ); + for (final MagicPermanent creature : targets) { + game.doAction(new MagicUntapAction(creature)); } - return MagicEvent.NONE; } } ] diff --git a/src/magic/model/target/MagicTargetFilter.java b/src/magic/model/target/MagicTargetFilter.java index c88cb95e35..e5a4139d78 100644 --- a/src/magic/model/target/MagicTargetFilter.java +++ b/src/magic/model/target/MagicTargetFilter.java @@ -504,7 +504,7 @@ public interface MagicTargetFilter { MagicPermanentFilterImpl TARGET_FUNGUS_CREATURE = Factory.creature(MagicSubType.Fungus, Control.Any); - MagicPermanentFilterImpl TARGET_MERFOLK_YOU_CONTROL = Factory.creature(MagicSubType.Merfolk, Control.You); + MagicPermanentFilterImpl TARGET_MERFOLK_YOU_CONTROL = Factory.permanent(MagicSubType.Merfolk, Control.You); MagicPermanentFilterImpl TARGET_SAPROLING_YOU_CONTROL = Factory.creature(MagicSubType.Saproling, Control.You);