From cf759e044324e8e3e7ea8fc93033589e26417ce2 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 22 Jan 2020 12:33:03 +0400 Subject: [PATCH] * War's Toll - fixed that is applies restriction attack effect from any zone (from command, hand, etc); --- Mage.Sets/src/mage/cards/a/ArlinnsWolf.java | 4 +-- .../src/mage/cards/d/DuskmantleOperative.java | 4 +-- .../src/mage/cards/e/EnragedCeratok.java | 4 +-- .../src/mage/cards/g/GarenbrigPaladin.java | 4 +-- Mage.Sets/src/mage/cards/r/RavenousSlime.java | 26 +++++-------------- Mage.Sets/src/mage/cards/r/RiverDarter.java | 8 +++--- .../src/mage/cards/r/RubblebeltRunner.java | 4 +-- .../src/mage/cards/s/StromkirkNoble.java | 4 +-- Mage.Sets/src/mage/cards/w/WarsToll.java | 16 +++++------- .../java/mage/abilities/EvasionAbility.java | 3 +-- .../common/SimpleEvasionAbility.java | 3 +-- 11 files changed, 25 insertions(+), 55 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ArlinnsWolf.java b/Mage.Sets/src/mage/cards/a/ArlinnsWolf.java index 78fe947c22..b0d2f95ece 100644 --- a/Mage.Sets/src/mage/cards/a/ArlinnsWolf.java +++ b/Mage.Sets/src/mage/cards/a/ArlinnsWolf.java @@ -34,9 +34,7 @@ public final class ArlinnsWolf extends CardImpl { this.toughness = new MageInt(2); // Arlinn's Wolf can't be blocked by creatures with power 2 or less. - this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect( - filter, Duration.WhileOnBattlefield - ))); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); } private ArlinnsWolf(final ArlinnsWolf card) { diff --git a/Mage.Sets/src/mage/cards/d/DuskmantleOperative.java b/Mage.Sets/src/mage/cards/d/DuskmantleOperative.java index 4f3d69b3d6..10523aca98 100644 --- a/Mage.Sets/src/mage/cards/d/DuskmantleOperative.java +++ b/Mage.Sets/src/mage/cards/d/DuskmantleOperative.java @@ -35,9 +35,7 @@ public final class DuskmantleOperative extends CardImpl { this.toughness = new MageInt(2); // Duskmantle Operative can't be blocked by creatures with power 4 or greater. - this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect( - filter, Duration.WhileOnBattlefield - ))); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); } private DuskmantleOperative(final DuskmantleOperative card) { diff --git a/Mage.Sets/src/mage/cards/e/EnragedCeratok.java b/Mage.Sets/src/mage/cards/e/EnragedCeratok.java index 5098f50a5d..e6316243c7 100644 --- a/Mage.Sets/src/mage/cards/e/EnragedCeratok.java +++ b/Mage.Sets/src/mage/cards/e/EnragedCeratok.java @@ -34,9 +34,7 @@ public final class EnragedCeratok extends CardImpl { this.toughness = new MageInt(4); // Enraged Ceratok can't be blocked by creatures with power 2 or less. - this.addAbility(new SimpleEvasionAbility( - new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield) - )); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); } private EnragedCeratok(final EnragedCeratok card) { diff --git a/Mage.Sets/src/mage/cards/g/GarenbrigPaladin.java b/Mage.Sets/src/mage/cards/g/GarenbrigPaladin.java index 59db660707..18de13a86b 100644 --- a/Mage.Sets/src/mage/cards/g/GarenbrigPaladin.java +++ b/Mage.Sets/src/mage/cards/g/GarenbrigPaladin.java @@ -47,9 +47,7 @@ public final class GarenbrigPaladin extends CardImpl { ), new ManaSpentToCastWatcher()); // Garenbrig Paladin can't be blocked by creatures with power 2 or less. - this.addAbility(new SimpleEvasionAbility( - new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield) - )); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); } private GarenbrigPaladin(final GarenbrigPaladin card) { diff --git a/Mage.Sets/src/mage/cards/r/RavenousSlime.java b/Mage.Sets/src/mage/cards/r/RavenousSlime.java index f68af5571d..56a4df323d 100644 --- a/Mage.Sets/src/mage/cards/r/RavenousSlime.java +++ b/Mage.Sets/src/mage/cards/r/RavenousSlime.java @@ -1,6 +1,5 @@ package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleEvasionAbility; @@ -8,14 +7,9 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.constants.SubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.ComparisonType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; @@ -25,8 +19,9 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class RavenousSlime extends CardImpl { @@ -46,11 +41,7 @@ public final class RavenousSlime extends CardImpl { this.toughness = new MageInt(1); // Ravenous Slime can't be blocked by creatures with power 2 or less. - this.addAbility(new SimpleEvasionAbility( - new CantBeBlockedByCreaturesSourceEffect( - filter, Duration.WhileOnBattlefield - ) - )); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); // If a creature an opponent controls would die, instead exile it and put a number of +1/+1 counters equal to that creature's power on Ravenous Slime. this.addAbility(new SimpleStaticAbility( @@ -130,12 +121,7 @@ class RavenousSlimeEffect extends ReplacementEffectImpl { return false; } if (zEvent.getTarget() != null) { // if it comes from permanent, check if it was a creature on the battlefield - if (zEvent.getTarget().isCreature()) { - return true; - } - } else if (permanent.isCreature()) { - return true; - } - return false; + return zEvent.getTarget().isCreature(); + } else return permanent.isCreature(); } } diff --git a/Mage.Sets/src/mage/cards/r/RiverDarter.java b/Mage.Sets/src/mage/cards/r/RiverDarter.java index 88f3114f26..9a676255da 100644 --- a/Mage.Sets/src/mage/cards/r/RiverDarter.java +++ b/Mage.Sets/src/mage/cards/r/RiverDarter.java @@ -1,7 +1,5 @@ - package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleEvasionAbility; import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; @@ -12,8 +10,9 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.filter.common.FilterCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class RiverDarter extends CardImpl { @@ -27,8 +26,7 @@ public final class RiverDarter extends CardImpl { this.toughness = new MageInt(3); // River Darter can't be blocked by Dinosaurs. - this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect( - new FilterCreaturePermanent(SubType.DINOSAUR, "Dinosaurs"), Duration.WhileOnBattlefield))); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.DINOSAUR, "Dinosaurs"), Duration.WhileOnBattlefield))); } public RiverDarter(final RiverDarter card) { diff --git a/Mage.Sets/src/mage/cards/r/RubblebeltRunner.java b/Mage.Sets/src/mage/cards/r/RubblebeltRunner.java index dacc541e57..00dc85b47a 100644 --- a/Mage.Sets/src/mage/cards/r/RubblebeltRunner.java +++ b/Mage.Sets/src/mage/cards/r/RubblebeltRunner.java @@ -34,9 +34,7 @@ public final class RubblebeltRunner extends CardImpl { this.toughness = new MageInt(3); // Rubblebelt Runner can't be blocked by creature tokens. - this.addAbility(new SimpleEvasionAbility( - new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield) - )); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); } private RubblebeltRunner(final RubblebeltRunner card) { diff --git a/Mage.Sets/src/mage/cards/s/StromkirkNoble.java b/Mage.Sets/src/mage/cards/s/StromkirkNoble.java index 1f75187de2..016bd87afd 100644 --- a/Mage.Sets/src/mage/cards/s/StromkirkNoble.java +++ b/Mage.Sets/src/mage/cards/s/StromkirkNoble.java @@ -29,8 +29,8 @@ public final class StromkirkNoble extends CardImpl { this.toughness = new MageInt(1); // Stromkirk Noble can't be blocked by Humans. - this.addAbility(new SimpleEvasionAbility( - new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.HUMAN, "Humans"), Duration.WhileOnBattlefield))); + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.HUMAN, "Humans"), Duration.WhileOnBattlefield))); + // Whenever Stromkirk Noble deals combat damage to a player, put a +1/+1 counter on it. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); } diff --git a/Mage.Sets/src/mage/cards/w/WarsToll.java b/Mage.Sets/src/mage/cards/w/WarsToll.java index 146ba03236..d83011a423 100644 --- a/Mage.Sets/src/mage/cards/w/WarsToll.java +++ b/Mage.Sets/src/mage/cards/w/WarsToll.java @@ -1,6 +1,5 @@ package mage.cards.w; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleEvasionAbility; import mage.abilities.common.TapForManaAllTriggeredAbility; @@ -8,11 +7,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.RestrictionEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SetTargetPointer; -import mage.constants.TargetController; +import mage.constants.*; import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterLandPermanent; @@ -20,8 +15,9 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class WarsToll extends CardImpl { @@ -42,7 +38,6 @@ public final class WarsToll extends CardImpl { // If a creature an opponent controls attacks, all creatures that opponent controls attack if able. this.addAbility(new SimpleEvasionAbility(new WarsTollAttackRestrictionEffect())); - } public WarsToll(final WarsToll card) { @@ -97,7 +92,10 @@ class WarsTollAttackRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { Player controller = game.getPlayer(permanent.getControllerId()); - return controller != null && controller.hasOpponent(source.getControllerId(), game); + if (controller != null) { + return controller.hasOpponent(source.getControllerId(), game); + } + return false; } @Override diff --git a/Mage/src/main/java/mage/abilities/EvasionAbility.java b/Mage/src/main/java/mage/abilities/EvasionAbility.java index d0e3b62684..d6e09abaed 100644 --- a/Mage/src/main/java/mage/abilities/EvasionAbility.java +++ b/Mage/src/main/java/mage/abilities/EvasionAbility.java @@ -4,13 +4,12 @@ import mage.constants.AbilityType; import mage.constants.Zone; /** - * * @author BetaSteward_at_googlemail.com */ public abstract class EvasionAbility extends StaticAbility { public EvasionAbility() { - this(Zone.ALL); + this(Zone.BATTLEFIELD); } public EvasionAbility(Zone zone) { diff --git a/Mage/src/main/java/mage/abilities/common/SimpleEvasionAbility.java b/Mage/src/main/java/mage/abilities/common/SimpleEvasionAbility.java index d729bbeb58..22961492d7 100644 --- a/Mage/src/main/java/mage/abilities/common/SimpleEvasionAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SimpleEvasionAbility.java @@ -5,13 +5,12 @@ import mage.abilities.effects.Effect; import mage.constants.Zone; /** - * * @author BetaSteward_at_googlemail.com */ public class SimpleEvasionAbility extends EvasionAbility { public SimpleEvasionAbility(Effect effect) { - this(effect, Zone.ALL); + this(effect, Zone.BATTLEFIELD); } public SimpleEvasionAbility(Effect effect, Zone zone) {