trigger should have executeEvent

master
melvin 2013-10-14 10:31:15 +08:00
parent 006ed566b1
commit 02191a6d6a
2 changed files with 16 additions and 11 deletions

View File

@ -2,17 +2,22 @@
new MagicAtEndOfTurnTrigger() { new MagicAtEndOfTurnTrigger() {
@Override @Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) { public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) {
if (permanent.isController(player)) { return permanent.isController(player) ?
final Collection<MagicPermanent> targets= new MagicEvent(
game.filterPermanents(permanent.getController(),MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL); permanent,
for (final MagicPermanent creature : targets) { this,
if (creature.isTapped() && "Untap all Merfolk PN controls."
creature.hasSubType(MagicSubType.Merfolk)) { ):
game.doAction(new MagicUntapAction(creature)); MagicEvent.NONE;
} }
} @Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final Collection<MagicPermanent> targets = event.getPlayer().filterPermanents(
MagicTargetFilter.TARGET_MERFOLK_YOU_CONTROL
);
for (final MagicPermanent creature : targets) {
game.doAction(new MagicUntapAction(creature));
} }
return MagicEvent.NONE;
} }
} }
] ]

View File

@ -504,7 +504,7 @@ public interface MagicTargetFilter<T extends MagicTarget> {
MagicPermanentFilterImpl TARGET_FUNGUS_CREATURE = Factory.creature(MagicSubType.Fungus, Control.Any); 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); MagicPermanentFilterImpl TARGET_SAPROLING_YOU_CONTROL = Factory.creature(MagicSubType.Saproling, Control.You);