From c351a4e8e9619129f25aae95fbaa932cd8b042f1 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 12 Jun 2023 16:01:18 +0400 Subject: [PATCH] refactor: removed direct counter names usage (part 2) --- Mage.Sets/src/mage/cards/a/AAT1.java | 3 ++- Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java | 3 ++- Mage.Sets/src/mage/cards/o/OrcishMine.java | 2 +- Mage.Sets/src/mage/cards/p/PrimalVigor.java | 3 ++- Mage.Sets/src/mage/cards/p/ProteanHydra.java | 2 +- Mage.Sets/src/mage/cards/u/UvildaDeanOfPerfection.java | 2 +- Mage/src/main/java/mage/abilities/common/SiegeAbility.java | 2 +- .../java/mage/abilities/keyword/VanishingSacrificeAbility.java | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AAT1.java b/Mage.Sets/src/mage/cards/a/AAT1.java index f1263e5904..7e04d0b6d6 100644 --- a/Mage.Sets/src/mage/cards/a/AAT1.java +++ b/Mage.Sets/src/mage/cards/a/AAT1.java @@ -15,6 +15,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Zone; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.target.TargetPlayer; @@ -78,7 +79,7 @@ public final class AAT1 extends CardImpl { && event.getPlayerId().equals(game.getControllerId(sourceId)) && card.isCreature(game) && game.getState().getZone(card.getId()) == Zone.GRAVEYARD - && event.getData().equals("repair")) { + && event.getData().equals(CounterType.REPAIR.getName())) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java b/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java index e9a13721b0..827c344b7d 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java +++ b/Mage.Sets/src/mage/cards/c/ChandraFireArtisan.java @@ -10,6 +10,7 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect; import mage.cards.*; import mage.constants.*; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; @@ -68,7 +69,7 @@ class ChandraFireArtisanTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getAmount() == 0 || !event.getData().equals("loyalty") + if (event.getAmount() == 0 || !event.getData().equals(CounterType.LOYALTY.getName()) || !event.getTargetId().equals(this.getSourceId())) { return false; } diff --git a/Mage.Sets/src/mage/cards/o/OrcishMine.java b/Mage.Sets/src/mage/cards/o/OrcishMine.java index 71afeecb5d..4e12a7a6f5 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishMine.java +++ b/Mage.Sets/src/mage/cards/o/OrcishMine.java @@ -82,7 +82,7 @@ class OrcishMineAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getData().equals("ore") && event.getTargetId().equals(this.getSourceId())) { + if (event.getData().equals(CounterType.ORE.getName()) && event.getTargetId().equals(this.getSourceId())) { Permanent p = game.getPermanent(this.getSourceId()); if (p != null) { return p.getCounters(game).getCount(CounterType.ORE) == 0; diff --git a/Mage.Sets/src/mage/cards/p/PrimalVigor.java b/Mage.Sets/src/mage/cards/p/PrimalVigor.java index 45c6160af8..d2cb7593f7 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalVigor.java +++ b/Mage.Sets/src/mage/cards/p/PrimalVigor.java @@ -9,6 +9,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.CreateTokenEvent; import mage.game.events.GameEvent; @@ -111,7 +112,7 @@ class PrimalVigorCounterEffect extends ReplacementEffectImpl { permanent = game.getPermanentEntering(event.getTargetId()); } return permanent != null && event.getAmount() > 0 && permanent.isCreature(game) - && event.getData() != null && event.getData().equals("+1/+1"); + && event.getData() != null && event.getData().equals(CounterType.P1P1.getName()); } @Override diff --git a/Mage.Sets/src/mage/cards/p/ProteanHydra.java b/Mage.Sets/src/mage/cards/p/ProteanHydra.java index f0583051b8..10bca27fc2 100644 --- a/Mage.Sets/src/mage/cards/p/ProteanHydra.java +++ b/Mage.Sets/src/mage/cards/p/ProteanHydra.java @@ -75,7 +75,7 @@ public final class ProteanHydra extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getData().equals("+1/+1") && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.P1P1.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/cards/u/UvildaDeanOfPerfection.java b/Mage.Sets/src/mage/cards/u/UvildaDeanOfPerfection.java index f94c5ff529..3f7fc6f97b 100644 --- a/Mage.Sets/src/mage/cards/u/UvildaDeanOfPerfection.java +++ b/Mage.Sets/src/mage/cards/u/UvildaDeanOfPerfection.java @@ -197,7 +197,7 @@ class UvildaDeanOfPerfectionTriggeredAbility extends TriggeredAbilityImpl { && sourceObject instanceof Card && ((Card) sourceObject).getCounters(game).getCount(CounterType.HONE) == 0 && event.getAmount() > 0 - && event.getData().equals("hone"); + && event.getData().equals(CounterType.HONE.getName()); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/SiegeAbility.java b/Mage/src/main/java/mage/abilities/common/SiegeAbility.java index 43a9c6f497..1096895e47 100644 --- a/Mage/src/main/java/mage/abilities/common/SiegeAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SiegeAbility.java @@ -71,7 +71,7 @@ class SiegeDefeatedTriggeredAbility extends TriggeredAbilityImpl { return permanent != null && permanent.getCounters(game).getCount(CounterType.DEFENSE) == 0 && event.getTargetId().equals(this.getSourceId()) - && event.getData().equals("defense") && event.getAmount() > 0; + && event.getData().equals(CounterType.DEFENSE.getName()) && event.getAmount() > 0; } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java index 642c563e21..d6188978f7 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java @@ -25,7 +25,7 @@ public class VanishingSacrificeAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getData().equals("time") && event.getTargetId().equals(this.getSourceId())) { + if (event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId())) { Permanent p = game.getPermanent(this.getSourceId()); if (p != null) { return p.getCounters(game).getCount(CounterType.TIME) == 0;