From 9b94b27e5456d4efe130ee554da35efbe47cd181 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 22 Jan 2019 19:13:21 -0500 Subject: [PATCH] updated Flagbearer ability to reflect rules change --- Mage.Sets/src/mage/cards/c/CoalitionFlag.java | 19 ++++++-------- .../src/mage/cards/c/CoalitionHonorGuard.java | 7 +++--- .../src/mage/cards/s/StandardBearer.java | 8 +++--- ...getsHaveToTargetPermanentIfAbleEffect.java | 25 ++++++++++++++----- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CoalitionFlag.java b/Mage.Sets/src/mage/cards/c/CoalitionFlag.java index 9ee5821e9d..a0816c88f8 100644 --- a/Mage.Sets/src/mage/cards/c/CoalitionFlag.java +++ b/Mage.Sets/src/mage/cards/c/CoalitionFlag.java @@ -1,8 +1,6 @@ package mage.cards.c; -import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; @@ -11,18 +9,13 @@ import mage.abilities.effects.common.ruleModifying.TargetsHaveToTargetPermanentI import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.FilterPermanent; +import mage.constants.*; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class CoalitionFlag extends CardImpl { @@ -40,10 +33,12 @@ public final class CoalitionFlag extends CardImpl { this.addAbility(ability); // Enchanted creature is a Flagbearer. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardSubtypeAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.AURA, SubType.FLAGBEARER))); + this.addAbility(new SimpleStaticAbility(new SetCardSubtypeAttachedEffect( + Duration.WhileOnBattlefield, AttachmentType.AURA, SubType.FLAGBEARER + ))); // While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TargetsHaveToTargetPermanentIfAbleEffect(new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer")))); + this.addAbility(new SimpleStaticAbility(new TargetsHaveToTargetPermanentIfAbleEffect())); } public CoalitionFlag(final CoalitionFlag card) { diff --git a/Mage.Sets/src/mage/cards/c/CoalitionHonorGuard.java b/Mage.Sets/src/mage/cards/c/CoalitionHonorGuard.java index bae309cbc2..e421744e28 100644 --- a/Mage.Sets/src/mage/cards/c/CoalitionHonorGuard.java +++ b/Mage.Sets/src/mage/cards/c/CoalitionHonorGuard.java @@ -1,7 +1,6 @@ package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.ruleModifying.TargetsHaveToTargetPermanentIfAbleEffect; @@ -9,8 +8,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.FilterPermanent; + +import java.util.UUID; /** * Cardname: Coalition Honor Guard @@ -28,7 +27,7 @@ public final class CoalitionHonorGuard extends CardImpl { this.toughness = new MageInt(4); // While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TargetsHaveToTargetPermanentIfAbleEffect(new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer")))); + this.addAbility(new SimpleStaticAbility(new TargetsHaveToTargetPermanentIfAbleEffect())); } public CoalitionHonorGuard(final CoalitionHonorGuard card) { diff --git a/Mage.Sets/src/mage/cards/s/StandardBearer.java b/Mage.Sets/src/mage/cards/s/StandardBearer.java index ea49dd6852..941d862cb2 100644 --- a/Mage.Sets/src/mage/cards/s/StandardBearer.java +++ b/Mage.Sets/src/mage/cards/s/StandardBearer.java @@ -1,7 +1,6 @@ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.ruleModifying.TargetsHaveToTargetPermanentIfAbleEffect; @@ -9,11 +8,10 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.FilterPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class StandardBearer extends CardImpl { @@ -27,7 +25,7 @@ public final class StandardBearer extends CardImpl { this.toughness = new MageInt(1); // While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TargetsHaveToTargetPermanentIfAbleEffect(new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer")))); + this.addAbility(new SimpleStaticAbility(new TargetsHaveToTargetPermanentIfAbleEffect())); } public StandardBearer(final StandardBearer card) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/TargetsHaveToTargetPermanentIfAbleEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/TargetsHaveToTargetPermanentIfAbleEffect.java index 944262e9ac..e02f7003b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/TargetsHaveToTargetPermanentIfAbleEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/TargetsHaveToTargetPermanentIfAbleEffect.java @@ -5,8 +5,6 @@ */ package mage.abilities.effects.common.ruleModifying; -import java.util.List; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; @@ -14,6 +12,7 @@ import mage.abilities.SpellAbility; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.SubType; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -22,11 +21,14 @@ import mage.game.stack.StackObject; import mage.players.Player; import mage.target.Target; +import java.util.List; +import java.util.UUID; + /** * 6/8/2016 If a spell or ability's targets are changed, or if a copy of a spell * or ability is put onto the stack and has new targets chosen, it doesn't have * to target a Flagbearer. - * + *

* 3/16/2017 A Flagbearer only requires targeting of itself when choosing targets * as a result of casting a spell or activating an ability. Notably, triggered * abilities are exempt from this targeting restriction (in addition to the note @@ -37,15 +39,22 @@ import mage.target.Target; public class TargetsHaveToTargetPermanentIfAbleEffect extends ContinuousRuleModifyingEffectImpl { private final FilterPermanent filter; + private static final FilterPermanent flagbearerFilter = new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer"); + + public TargetsHaveToTargetPermanentIfAbleEffect() { + this(flagbearerFilter); + } public TargetsHaveToTargetPermanentIfAbleEffect(FilterPermanent filter) { super(Duration.WhileOnBattlefield, Outcome.Detriment); this.filter = filter; - staticText = "While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least " + this.filter.getMessage() + " on the battlefield if able"; + staticText = "While an opponent is choosing targets as part of casting a spell they control " + + "or activating an ability they control, that player must choose at least " + + this.filter.getMessage() + " on the battlefield if able"; } - public TargetsHaveToTargetPermanentIfAbleEffect(final TargetsHaveToTargetPermanentIfAbleEffect effect) { + private TargetsHaveToTargetPermanentIfAbleEffect(final TargetsHaveToTargetPermanentIfAbleEffect effect) { super(effect); this.filter = effect.filter; } @@ -83,7 +92,11 @@ public class TargetsHaveToTargetPermanentIfAbleEffect extends ContinuousRuleModi Ability stackAbility = stackObject.getStackAbility(); // Ensure that this ability is activated or a cast spell, because Flag Bearer effects don't require triggered abilities to choose a Standard Bearer if (!(stackAbility instanceof ActivatedAbility) && - !(stackAbility instanceof SpellAbility)) { + !(stackAbility instanceof SpellAbility)) { + return false; + } + // Also check that targeting player controls the ability + if (!stackAbility.isControlledBy(targetingPlayer.getId())) { return false; } Ability ability = (Ability) getValue("targetAbility");