refactor: removed direct counter names usage (part 2)

This commit is contained in:
Oleg Agafonov 2023-06-12 16:01:18 +04:00
parent 8f4cc84266
commit c351a4e8e9
8 changed files with 11 additions and 8 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;