From a93dc4e3daa681b4bb8ab71908116fc8616514eb Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 22 Apr 2017 00:23:37 +0200 Subject: [PATCH] * Added a check that continuous PT setting effects are only applied, if the object has still the ability (fixes #3167). I added the effect now only to the layer the bug is caused by. Probably it's correct to check this for every layer. But I don't know how much resources the check addional needs. So if we got other tests that fail for this reason caused by other layers, we could add the check and test if all other tests still work correctly. --- Mage.Sets/src/mage/cards/s/SeekerOfInsight.java | 3 ++- .../java/mage/abilities/effects/ContinuousEffects.java | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SeekerOfInsight.java b/Mage.Sets/src/mage/cards/s/SeekerOfInsight.java index c384bfd14b..289144b798 100644 --- a/Mage.Sets/src/mage/cards/s/SeekerOfInsight.java +++ b/Mage.Sets/src/mage/cards/s/SeekerOfInsight.java @@ -78,6 +78,7 @@ public class SeekerOfInsight extends CardImpl { } class CastNonCreatureSpellCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName()); @@ -97,5 +98,5 @@ class CastNonCreatureSpellCondition implements Condition { @Override public String toString() { return "you've cast a noncreature spell this turn"; + } } -} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index e732999149..ea7067e0d2 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -962,7 +962,9 @@ public class ContinuousEffects implements Serializable { for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { - effect.apply(Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, ability, game); + if (abilityActive(ability, game)) { + effect.apply(Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, ability, game); + } } } for (ContinuousEffect effect : layer) { @@ -1002,6 +1004,11 @@ public class ContinuousEffects implements Serializable { } } + private boolean abilityActive(Ability ability, Game game) { + MageObject object = game.getObject(ability.getSourceId()); + return object != null && object.hasAbility(ability.getId(), game); + } + private void applyLayer(List activeLayerEffects, Layer currentLayer, Game game) { List layer = filterLayeredEffects(activeLayerEffects, currentLayer); if (!layer.isEmpty()) {