From ff1b2ceb7209f3972fca52caad3fad444eed5bef Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 11 Sep 2013 17:38:09 +0200 Subject: [PATCH] Fixed a bug of SpellCastOpponentTriggeredAbility and changed FilterCard to FilterSpell. --- .../mage/sets/championsofkamigawa/Reciprocate.java | 10 ++++++---- .../src/mage/sets/conflux/GiltspireAvenger.java | 10 ++++++---- Mage.Sets/src/mage/sets/magic2010/MoldAdder.java | 4 ++-- Mage.Sets/src/mage/sets/magic2014/Mindsparker.java | 4 ++-- .../src/mage/sets/timespiral/PardicDragon.java | 4 ++-- .../common/SpellCastOpponentTriggeredAbility.java | 14 +++++++------- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Reciprocate.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Reciprocate.java index f93639f390..c35c223381 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Reciprocate.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Reciprocate.java @@ -107,8 +107,9 @@ class ReciprocateTarget> extends TargetPerm @Override public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { int remainingTargets = this.minNumberOfTargets - targets.size(); - if (remainingTargets == 0) - return true; + if (remainingTargets == 0) { + return true; + } int count = 0; MageObject targetSource = game.getObject(sourceId); PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); @@ -116,8 +117,9 @@ class ReciprocateTarget> extends TargetPerm if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && watcher != null && watcher.damageSources.contains(permanent.getId())) { count++; - if (count >= remainingTargets) - return true; + if (count >= remainingTargets) { + return true; + } } } return false; diff --git a/Mage.Sets/src/mage/sets/conflux/GiltspireAvenger.java b/Mage.Sets/src/mage/sets/conflux/GiltspireAvenger.java index de4265809e..6979300bda 100644 --- a/Mage.Sets/src/mage/sets/conflux/GiltspireAvenger.java +++ b/Mage.Sets/src/mage/sets/conflux/GiltspireAvenger.java @@ -126,8 +126,9 @@ class GiltspireAvengerTarget> extends Targe @Override public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { int remainingTargets = this.minNumberOfTargets - targets.size(); - if (remainingTargets == 0) - return true; + if (remainingTargets == 0) { + return true; + } int count = 0; MageObject targetSource = game.getObject(sourceId); PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); @@ -135,8 +136,9 @@ class GiltspireAvengerTarget> extends Targe if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && watcher != null && watcher.damageSources.contains(permanent.getId())) { count++; - if (count >= remainingTargets) - return true; + if (count >= remainingTargets) { + return true; + } } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2010/MoldAdder.java b/Mage.Sets/src/mage/sets/magic2010/MoldAdder.java index fd0011d7a5..5ceadadd07 100644 --- a/Mage.Sets/src/mage/sets/magic2010/MoldAdder.java +++ b/Mage.Sets/src/mage/sets/magic2010/MoldAdder.java @@ -36,7 +36,7 @@ import mage.abilities.common.SpellCastOpponentTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.counters.CounterType; -import mage.filter.FilterCard; +import mage.filter.FilterSpell; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; @@ -46,7 +46,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class MoldAdder extends CardImpl { - private static final FilterCard filter = new FilterCard("blue or black spell"); + private static final FilterSpell filter = new FilterSpell("blue or black spell"); static { filter.add(Predicates.or( diff --git a/Mage.Sets/src/mage/sets/magic2014/Mindsparker.java b/Mage.Sets/src/mage/sets/magic2014/Mindsparker.java index d45bc02429..8b11e1133b 100644 --- a/Mage.Sets/src/mage/sets/magic2014/Mindsparker.java +++ b/Mage.Sets/src/mage/sets/magic2014/Mindsparker.java @@ -39,7 +39,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.FilterCard; +import mage.filter.FilterSpell; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; @@ -52,7 +52,7 @@ import mage.players.Player; */ public class Mindsparker extends CardImpl { - private static final FilterCard filter = new FilterCard("white or blue instant or sorcery spell"); + private static final FilterSpell filter = new FilterSpell("white or blue instant or sorcery spell"); static { filter.add(Predicates.or( diff --git a/Mage.Sets/src/mage/sets/timespiral/PardicDragon.java b/Mage.Sets/src/mage/sets/timespiral/PardicDragon.java index 75695ebe40..0401c71abb 100644 --- a/Mage.Sets/src/mage/sets/timespiral/PardicDragon.java +++ b/Mage.Sets/src/mage/sets/timespiral/PardicDragon.java @@ -49,7 +49,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.FilterCard; +import mage.filter.FilterSpell; import mage.game.Game; import mage.players.Player; @@ -76,7 +76,7 @@ public class PardicDragon extends CardImpl { this.addAbility(new SuspendAbility(2, new ManaCostsImpl("{R}{R}"), this, true)); // Whenever an opponent casts a spell, if Pardic Dragon is suspended, that player may put a time counter on Pardic Dragon. this.addAbility(new ConditionalTriggeredAbility( - new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterCard(), false, true), + new SpellCastOpponentTriggeredAbility(Zone.EXILED, new PardicDragonEffect(), new FilterSpell(), false, true), SuspendedCondition.getInstance(), "Whenever an opponent casts a spell, if {this} is suspended, that player may put a time counter on Pardic Dragon." )); diff --git a/Mage/src/mage/abilities/common/SpellCastOpponentTriggeredAbility.java b/Mage/src/mage/abilities/common/SpellCastOpponentTriggeredAbility.java index 3952bf2a35..ecc3084195 100644 --- a/Mage/src/mage/abilities/common/SpellCastOpponentTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/SpellCastOpponentTriggeredAbility.java @@ -30,7 +30,7 @@ package mage.abilities.common; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.constants.Zone; -import mage.filter.FilterCard; +import mage.filter.FilterSpell; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.stack.Spell; @@ -42,23 +42,23 @@ import mage.target.targetpointer.FixedTarget; */ public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl { - private static final FilterCard spellCard = new FilterCard("a spell"); - protected FilterCard filter; + private static final FilterSpell spellCard = new FilterSpell("a spell"); + protected FilterSpell filter; protected boolean setTargetPointerPlayer; public SpellCastOpponentTriggeredAbility(Effect effect, boolean optional) { this(effect, spellCard, optional); } - public SpellCastOpponentTriggeredAbility(Effect effect, FilterCard filter, boolean optional) { + public SpellCastOpponentTriggeredAbility(Effect effect, FilterSpell filter, boolean optional) { this(Zone.BATTLEFIELD, effect, filter, optional); } - public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterCard filter, boolean optional) { + public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterSpell filter, boolean optional) { this(zone, effect, filter, optional, false); } - public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterCard filter, boolean optional, boolean setTargetPointerPlayer) { + public SpellCastOpponentTriggeredAbility(Zone zone, Effect effect, FilterSpell filter, boolean optional, boolean setTargetPointerPlayer) { super(zone, effect, optional); this.filter = filter; this.setTargetPointerPlayer = setTargetPointerPlayer; @@ -79,8 +79,8 @@ public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl