Adding check to Flagbearer requirement that only checks for spells that are cast and abilities that are activated -- choosing targets from triggered abilities is exempt.

This commit is contained in:
Clint Herron 2017-03-16 03:26:48 -04:00
parent 4824b96640
commit 3eb9be1b18

View file

@ -9,6 +9,8 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.SpellAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -24,6 +26,11 @@ import mage.target.Target;
* 6/8/2016 If a spell or abilitys targets are changed, or if a copy of a spell * 6/8/2016 If a spell or abilitys targets are changed, or if a copy of a spell
* or ability is put onto the stack and has new targets chosen, it doesnt have * or ability is put onto the stack and has new targets chosen, it doesnt have
* to target a Flagbearer. * 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
* about choosing targets for a copy from 6/8/2016).
* *
* @author LevelX2 * @author LevelX2
*/ */
@ -73,6 +80,12 @@ public class TargetsHaveToTargetPermanentIfAbleEffect extends ContinuousRuleModi
if (stackObject.isCopy()) { if (stackObject.isCopy()) {
return false; return false;
} }
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)) {
return false;
}
Ability ability = (Ability) getValue("targetAbility"); Ability ability = (Ability) getValue("targetAbility");
if (ability != null) { if (ability != null) {
// Get all the allowed permanents on the battlefield in range of the abilities controller // Get all the allowed permanents on the battlefield in range of the abilities controller