mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
refactor: removed direct counter names usage (part 2)
This commit is contained in:
parent
8f4cc84266
commit
c351a4e8e9
8 changed files with 11 additions and 8 deletions
|
@ -15,6 +15,7 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
@ -78,7 +79,7 @@ public final class AAT1 extends CardImpl {
|
||||||
&& event.getPlayerId().equals(game.getControllerId(sourceId))
|
&& event.getPlayerId().equals(game.getControllerId(sourceId))
|
||||||
&& card.isCreature(game)
|
&& card.isCreature(game)
|
||||||
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD
|
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD
|
||||||
&& event.getData().equals("repair")) {
|
&& event.getData().equals(CounterType.REPAIR.getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||||
import mage.cards.*;
|
import mage.cards.*;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -68,7 +69,7 @@ class ChandraFireArtisanTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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())) {
|
|| !event.getTargetId().equals(this.getSourceId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class OrcishMineAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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());
|
Permanent p = game.getPermanent(this.getSourceId());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
return p.getCounters(game).getCount(CounterType.ORE) == 0;
|
return p.getCounters(game).getCount(CounterType.ORE) == 0;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.CreateTokenEvent;
|
import mage.game.events.CreateTokenEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -111,7 +112,7 @@ class PrimalVigorCounterEffect extends ReplacementEffectImpl {
|
||||||
permanent = game.getPermanentEntering(event.getTargetId());
|
permanent = game.getPermanentEntering(event.getTargetId());
|
||||||
}
|
}
|
||||||
return permanent != null && event.getAmount() > 0 && permanent.isCreature(game)
|
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
|
@Override
|
||||||
|
|
|
@ -75,7 +75,7 @@ public final class ProteanHydra extends CardImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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
|
@Override
|
||||||
|
|
|
@ -197,7 +197,7 @@ class UvildaDeanOfPerfectionTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
&& sourceObject instanceof Card
|
&& sourceObject instanceof Card
|
||||||
&& ((Card) sourceObject).getCounters(game).getCount(CounterType.HONE) == 0
|
&& ((Card) sourceObject).getCounters(game).getCount(CounterType.HONE) == 0
|
||||||
&& event.getAmount() > 0
|
&& event.getAmount() > 0
|
||||||
&& event.getData().equals("hone");
|
&& event.getData().equals(CounterType.HONE.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,7 +71,7 @@ class SiegeDefeatedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return permanent != null
|
return permanent != null
|
||||||
&& permanent.getCounters(game).getCount(CounterType.DEFENSE) == 0
|
&& permanent.getCounters(game).getCount(CounterType.DEFENSE) == 0
|
||||||
&& event.getTargetId().equals(this.getSourceId())
|
&& event.getTargetId().equals(this.getSourceId())
|
||||||
&& event.getData().equals("defense") && event.getAmount() > 0;
|
&& event.getData().equals(CounterType.DEFENSE.getName()) && event.getAmount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class VanishingSacrificeAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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());
|
Permanent p = game.getPermanent(this.getSourceId());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
return p.getCounters(game).getCount(CounterType.TIME) == 0;
|
return p.getCounters(game).getCount(CounterType.TIME) == 0;
|
||||||
|
|
Loading…
Reference in a new issue