updated Flagbearer ability to reflect rules change

This commit is contained in:
Evan Kranzler 2019-01-22 19:13:21 -05:00
parent 1431e69b43
commit 9b94b27e54
4 changed files with 32 additions and 27 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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.
*
* <p>
* 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");