From 8f4cc84266e00424bd45e49e2b92b815e2ccb8b5 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 12 Jun 2023 13:53:15 +0400 Subject: [PATCH] refactor: removed direct counter names usage in some places --- .../src/mage/cards/a/ArcboundJavelineer.java | 2 +- .../src/mage/cards/a/ArceeSharpshooter.java | 2 +- Mage.Sets/src/mage/cards/a/AsForetold.java | 2 +- .../src/mage/cards/a/AsLuckWouldHaveIt.java | 5 ++-- .../src/mage/cards/a/AstralCornucopia.java | 4 +-- .../mage/cards/a/AuntieBlyteBadInfluence.java | 2 +- .../src/mage/cards/b/BlackManaBattery.java | 2 +- Mage.Sets/src/mage/cards/b/BlademaneBaku.java | 2 +- .../src/mage/cards/b/BlueManaBattery.java | 2 +- .../src/mage/cards/b/BottomlessVault.java | 2 +- Mage.Sets/src/mage/cards/b/BrainInAJar.java | 2 +- .../src/mage/cards/c/CalciformPools.java | 2 +- .../cards/c/CrucibleOfTheSpiritDragon.java | 2 +- Mage.Sets/src/mage/cards/c/CruelSadist.java | 2 +- Mage.Sets/src/mage/cards/d/DreadshipReef.java | 2 +- Mage.Sets/src/mage/cards/d/DwarvenHold.java | 2 +- Mage.Sets/src/mage/cards/f/FountainOfCho.java | 2 +- Mage.Sets/src/mage/cards/f/FungalReaches.java | 2 +- .../src/mage/cards/g/GeistflameReservoir.java | 2 +- .../src/mage/cards/g/GreenManaBattery.java | 2 +- Mage.Sets/src/mage/cards/h/Haruspex.java | 2 +- .../src/mage/cards/h/HibernationsEnd.java | 3 +- Mage.Sets/src/mage/cards/h/HollowTrees.java | 2 +- Mage.Sets/src/mage/cards/i/IcatianStore.java | 2 +- Mage.Sets/src/mage/cards/i/InfusedArrows.java | 2 +- Mage.Sets/src/mage/cards/k/KyrenToy.java | 2 +- .../src/mage/cards/m/MageRingNetwork.java | 2 +- .../src/mage/cards/m/MaintenanceHangar.java | 5 ++-- .../src/mage/cards/m/MercadianBazaar.java | 2 +- Mage.Sets/src/mage/cards/m/MercadianLift.java | 2 +- .../src/mage/cards/m/MoltenSlagheap.java | 2 +- Mage.Sets/src/mage/cards/n/NightDealings.java | 2 +- Mage.Sets/src/mage/cards/p/PetalmaneBaku.java | 2 +- .../src/mage/cards/p/PhylacteryLich.java | 2 +- Mage.Sets/src/mage/cards/p/PrimalAmulet.java | 2 +- Mage.Sets/src/mage/cards/q/QuillmaneBaku.java | 2 +- .../mage/cards/r/RasputinTheOneiromancer.java | 2 +- .../src/mage/cards/r/RedManaBattery.java | 2 +- Mage.Sets/src/mage/cards/r/RushwoodGrove.java | 2 +- .../src/mage/cards/s/SaltcrustedSteppe.java | 2 +- Mage.Sets/src/mage/cards/s/SandSilos.java | 2 +- Mage.Sets/src/mage/cards/s/SaprazzanCove.java | 2 +- .../src/mage/cards/s/SimicManipulator.java | 2 +- Mage.Sets/src/mage/cards/s/SkullmaneBaku.java | 2 +- .../src/mage/cards/s/SubterraneanHangar.java | 2 +- Mage.Sets/src/mage/cards/t/TreasureMap.java | 2 +- Mage.Sets/src/mage/cards/w/WaxmaneBaku.java | 2 +- .../src/mage/cards/w/WhiteManaBattery.java | 2 +- .../org/mage/test/cards/copy/VesuvaTest.java | 3 +- .../costs/common/PayVariableLoyaltyCost.java | 2 +- .../RemoveVariableCountersSourceCost.java | 29 ++++++++++--------- 51 files changed, 72 insertions(+), 67 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ArcboundJavelineer.java b/Mage.Sets/src/mage/cards/a/ArcboundJavelineer.java index 9ee1d8e3bb..9daabfa70f 100644 --- a/Mage.Sets/src/mage/cards/a/ArcboundJavelineer.java +++ b/Mage.Sets/src/mage/cards/a/ArcboundJavelineer.java @@ -31,7 +31,7 @@ public final class ArcboundJavelineer extends CardImpl { // {T}, Remove X +1/+1 counters from Arcbound Javelineer: It deals X damage to target attacking or blocking creature. Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(GetXValue.instance, "It"), new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1)); ability.addTarget(new TargetAttackingOrBlockingCreature()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/a/ArceeSharpshooter.java b/Mage.Sets/src/mage/cards/a/ArceeSharpshooter.java index fc9bdd5e47..5376b5b76a 100644 --- a/Mage.Sets/src/mage/cards/a/ArceeSharpshooter.java +++ b/Mage.Sets/src/mage/cards/a/ArceeSharpshooter.java @@ -46,7 +46,7 @@ public final class ArceeSharpshooter extends CardImpl { .setText("it deals that much damage to target creature"), new GenericManaCost(1) ); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance(), 1)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1, 1)); ability.addEffect(new TransformSourceEffect().setText("convert {this}")); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/a/AsForetold.java b/Mage.Sets/src/mage/cards/a/AsForetold.java index 610e9d2989..a117bbdcde 100644 --- a/Mage.Sets/src/mage/cards/a/AsForetold.java +++ b/Mage.Sets/src/mage/cards/a/AsForetold.java @@ -152,7 +152,7 @@ class AsForetoldAddAltCostEffect extends ContinuousEffectImpl { + sourcePermanent.getTurnsOnBattlefield()); // If we haven't used it yet this turn, give the option of using the zero alternative cost if (wasItUsed == null) { - int timeCounters = sourcePermanent.getCounters(game).getCount("time"); + int timeCounters = sourcePermanent.getCounters(game).getCount(CounterType.TIME); AsForetoldAlternativeCost alternateCostAbility = new AsForetoldAlternativeCost(timeCounters); alternateCostAbility.setSourceId(source.getSourceId()); controller.getAlternativeSourceCosts().add(alternateCostAbility); diff --git a/Mage.Sets/src/mage/cards/a/AsLuckWouldHaveIt.java b/Mage.Sets/src/mage/cards/a/AsLuckWouldHaveIt.java index 1d1402717e..22228e8d29 100644 --- a/Mage.Sets/src/mage/cards/a/AsLuckWouldHaveIt.java +++ b/Mage.Sets/src/mage/cards/a/AsLuckWouldHaveIt.java @@ -11,6 +11,7 @@ import mage.constants.Outcome; import mage.constants.RollDieType; import mage.constants.Zone; import mage.counters.Counter; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DieRolledEvent; import mage.game.events.GameEvent; @@ -105,9 +106,9 @@ class AsLuckWouldHaveItEffect extends OneShotEffect { if (controller != null && permanent != null) { if (getValue("rolled") != null) { int amount = (Integer) getValue("rolled"); - permanent.addCounters(new Counter("luck", amount), source.getControllerId(), source, game); + permanent.addCounters(new Counter(CounterType.LUCK.getName(), amount), source.getControllerId(), source, game); - if (permanent.getCounters(game).getCount("luck") >= 100) { + if (permanent.getCounters(game).getCount(CounterType.LUCK) >= 100) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { player.won(game); diff --git a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java index 9560fa3421..ae62ee7eda 100644 --- a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java +++ b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java @@ -74,7 +74,7 @@ class AstralCornucopiaManaEffect extends ManaEffect { return netMana; } - int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (counters > 0) { netMana.add(Mana.WhiteMana(counters)); netMana.add(Mana.BlueMana(counters)); @@ -95,7 +95,7 @@ class AstralCornucopiaManaEffect extends ManaEffect { if (sourcePermanent == null || controller == null) { return null; } - int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (counters == 0) { return null; } diff --git a/Mage.Sets/src/mage/cards/a/AuntieBlyteBadInfluence.java b/Mage.Sets/src/mage/cards/a/AuntieBlyteBadInfluence.java index e9932cae20..53e94b571c 100644 --- a/Mage.Sets/src/mage/cards/a/AuntieBlyteBadInfluence.java +++ b/Mage.Sets/src/mage/cards/a/AuntieBlyteBadInfluence.java @@ -50,7 +50,7 @@ public final class AuntieBlyteBadInfluence extends CardImpl { new DamageTargetEffect(GetXValue.instance, "it"), new ManaCostsImpl<>("{1}{R}") ); ability.addCost(new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1)); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BlackManaBattery.java b/Mage.Sets/src/mage/cards/b/BlackManaBattery.java index f685a6bd3d..741a8976b1 100644 --- a/Mage.Sets/src/mage/cards/b/BlackManaBattery.java +++ b/Mage.Sets/src/mage/cards/b/BlackManaBattery.java @@ -42,7 +42,7 @@ public final class BlackManaBattery extends CardImpl { new TapSourceCost(), "Add {B}, then add {B} for each charge counter removed this way", true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE, "Remove any number of charge counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BlademaneBaku.java b/Mage.Sets/src/mage/cards/b/BlademaneBaku.java index fd9b07f0a4..4bfd4b7e7d 100644 --- a/Mage.Sets/src/mage/cards/b/BlademaneBaku.java +++ b/Mage.Sets/src/mage/cards/b/BlademaneBaku.java @@ -43,7 +43,7 @@ public final class BlademaneBaku extends CardImpl { Effect effect = new BoostSourceEffect(xValue, StaticValue.get(0), Duration.EndOfTurn); effect.setText("for each counter removed, {this} gets +2/+0 until end of turn"); Ability ability = new SimpleActivatedAbility(effect, new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BlueManaBattery.java b/Mage.Sets/src/mage/cards/b/BlueManaBattery.java index 9e69d0a59f..f71987d531 100644 --- a/Mage.Sets/src/mage/cards/b/BlueManaBattery.java +++ b/Mage.Sets/src/mage/cards/b/BlueManaBattery.java @@ -41,7 +41,7 @@ public final class BlueManaBattery extends CardImpl { new TapSourceCost(), "Add {U}, then add {U} for each charge counter removed this way", true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE, "Remove any number of charge counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BottomlessVault.java b/Mage.Sets/src/mage/cards/b/BottomlessVault.java index ac3f4735a1..aa4d3266e7 100644 --- a/Mage.Sets/src/mage/cards/b/BottomlessVault.java +++ b/Mage.Sets/src/mage/cards/b/BottomlessVault.java @@ -48,7 +48,7 @@ public final class BottomlessVault extends CardImpl { new TapSourceCost(), "Add {B} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BrainInAJar.java b/Mage.Sets/src/mage/cards/b/BrainInAJar.java index c383abea1f..ae618360fe 100644 --- a/Mage.Sets/src/mage/cards/b/BrainInAJar.java +++ b/Mage.Sets/src/mage/cards/b/BrainInAJar.java @@ -46,7 +46,7 @@ public final class BrainInAJar extends CardImpl { // {3}, {T}, Remove X charge counters from Brain in a Jar: Scry X. ability = new SimpleActivatedAbility(new BrainInAJarScryEffect(), new GenericManaCost(3)); ability.addCost(new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CalciformPools.java b/Mage.Sets/src/mage/cards/c/CalciformPools.java index 0eae5ea814..9c16e8a472 100644 --- a/Mage.Sets/src/mage/cards/c/CalciformPools.java +++ b/Mage.Sets/src/mage/cards/c/CalciformPools.java @@ -39,7 +39,7 @@ public final class CalciformPools extends CardImpl { new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.W, ColoredManaSymbol.U), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CrucibleOfTheSpiritDragon.java b/Mage.Sets/src/mage/cards/c/CrucibleOfTheSpiritDragon.java index 9d089af626..ccb640a7ce 100644 --- a/Mage.Sets/src/mage/cards/c/CrucibleOfTheSpiritDragon.java +++ b/Mage.Sets/src/mage/cards/c/CrucibleOfTheSpiritDragon.java @@ -49,7 +49,7 @@ public final class CrucibleOfTheSpiritDragon extends CardImpl { new CrucibleOfTheSpiritDragonManaBuilder(), false ); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CruelSadist.java b/Mage.Sets/src/mage/cards/c/CruelSadist.java index 74893c8170..3254c1976c 100644 --- a/Mage.Sets/src/mage/cards/c/CruelSadist.java +++ b/Mage.Sets/src/mage/cards/c/CruelSadist.java @@ -48,7 +48,7 @@ public final class CruelSadist extends CardImpl { new DamageTargetEffect(RemovedCountersForCostValue.instance, "it"), new ManaCostsImpl<>("{2}{B}") ); ability.addCost(new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DreadshipReef.java b/Mage.Sets/src/mage/cards/d/DreadshipReef.java index cd08b166e0..2fb38965a5 100644 --- a/Mage.Sets/src/mage/cards/d/DreadshipReef.java +++ b/Mage.Sets/src/mage/cards/d/DreadshipReef.java @@ -39,7 +39,7 @@ public final class DreadshipReef extends CardImpl { new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.U, ColoredManaSymbol.B), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DwarvenHold.java b/Mage.Sets/src/mage/cards/d/DwarvenHold.java index 822e82d82e..492df645ce 100644 --- a/Mage.Sets/src/mage/cards/d/DwarvenHold.java +++ b/Mage.Sets/src/mage/cards/d/DwarvenHold.java @@ -48,7 +48,7 @@ public final class DwarvenHold extends CardImpl { new TapSourceCost(), "Add {R} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/FountainOfCho.java b/Mage.Sets/src/mage/cards/f/FountainOfCho.java index 215a1fe4d5..4c4b503ece 100644 --- a/Mage.Sets/src/mage/cards/f/FountainOfCho.java +++ b/Mage.Sets/src/mage/cards/f/FountainOfCho.java @@ -38,7 +38,7 @@ public final class FountainOfCho extends CardImpl { new TapSourceCost(), "Add {W} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/FungalReaches.java b/Mage.Sets/src/mage/cards/f/FungalReaches.java index 07dbacec66..88552e7ba8 100644 --- a/Mage.Sets/src/mage/cards/f/FungalReaches.java +++ b/Mage.Sets/src/mage/cards/f/FungalReaches.java @@ -41,7 +41,7 @@ public final class FungalReaches extends CardImpl { new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.R, ColoredManaSymbol.G), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GeistflameReservoir.java b/Mage.Sets/src/mage/cards/g/GeistflameReservoir.java index 1abccdba20..7756d4e28f 100644 --- a/Mage.Sets/src/mage/cards/g/GeistflameReservoir.java +++ b/Mage.Sets/src/mage/cards/g/GeistflameReservoir.java @@ -38,7 +38,7 @@ public final class GeistflameReservoir extends CardImpl { .setText("it deals that much damage to any target"), new ManaCostsImpl<>("{1}{R}")); ability.addCost(new TapSourceCost()); ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.CHARGE.createInstance(), "Remove any number of charge counters from {this}" + CounterType.CHARGE, "Remove any number of charge counters from {this}" )); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/g/GreenManaBattery.java b/Mage.Sets/src/mage/cards/g/GreenManaBattery.java index 3211f88d63..20f442d94d 100644 --- a/Mage.Sets/src/mage/cards/g/GreenManaBattery.java +++ b/Mage.Sets/src/mage/cards/g/GreenManaBattery.java @@ -41,7 +41,7 @@ public final class GreenManaBattery extends CardImpl { new TapSourceCost(), "Add {G}, then add {G} for each charge counter removed this way", true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE, "Remove any number of charge counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/h/Haruspex.java b/Mage.Sets/src/mage/cards/h/Haruspex.java index 013409899b..28686ee711 100644 --- a/Mage.Sets/src/mage/cards/h/Haruspex.java +++ b/Mage.Sets/src/mage/cards/h/Haruspex.java @@ -52,7 +52,7 @@ public final class Haruspex extends CardImpl { Mana.AnyMana(1), RemovedCountersForCostValue.instance, new TapSourceCost(), "Add X mana of any one color", true, xValue ); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1)); this.addAbility(ability.withFlavorWord("Devouring Monster")); } diff --git a/Mage.Sets/src/mage/cards/h/HibernationsEnd.java b/Mage.Sets/src/mage/cards/h/HibernationsEnd.java index 5bd21098c3..827abd1781 100644 --- a/Mage.Sets/src/mage/cards/h/HibernationsEnd.java +++ b/Mage.Sets/src/mage/cards/h/HibernationsEnd.java @@ -14,6 +14,7 @@ import mage.constants.CardType; import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.Zone; +import mage.counters.CounterType; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.game.Game; @@ -95,7 +96,7 @@ class HibernationsEndEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && player != null) { - int newConvertedCost = sourcePermanent.getCounters(game).getCount("age"); + int newConvertedCost = sourcePermanent.getCounters(game).getCount(CounterType.AGE); FilterCard filter = new FilterCard("creature card with mana value " + newConvertedCost); filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, newConvertedCost)); filter.add(CardType.CREATURE.getPredicate()); diff --git a/Mage.Sets/src/mage/cards/h/HollowTrees.java b/Mage.Sets/src/mage/cards/h/HollowTrees.java index 317908a85f..131ceb07bd 100644 --- a/Mage.Sets/src/mage/cards/h/HollowTrees.java +++ b/Mage.Sets/src/mage/cards/h/HollowTrees.java @@ -48,7 +48,7 @@ public final class HollowTrees extends CardImpl { new TapSourceCost(), "Add {G} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/i/IcatianStore.java b/Mage.Sets/src/mage/cards/i/IcatianStore.java index 2c162d5f97..fe051890a7 100644 --- a/Mage.Sets/src/mage/cards/i/IcatianStore.java +++ b/Mage.Sets/src/mage/cards/i/IcatianStore.java @@ -48,7 +48,7 @@ public final class IcatianStore extends CardImpl { new TapSourceCost(), "Add {W} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/i/InfusedArrows.java b/Mage.Sets/src/mage/cards/i/InfusedArrows.java index 79998c242d..df6e1a9655 100644 --- a/Mage.Sets/src/mage/cards/i/InfusedArrows.java +++ b/Mage.Sets/src/mage/cards/i/InfusedArrows.java @@ -32,7 +32,7 @@ public final class InfusedArrows extends CardImpl { this.addAbility(new SunburstAbility(this)); // {tap}, Remove X charge counters from Infused Arrows: Target creature gets -X/-X until end of turn. Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn), new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KyrenToy.java b/Mage.Sets/src/mage/cards/k/KyrenToy.java index 825bbe762a..7a6ca1f14f 100644 --- a/Mage.Sets/src/mage/cards/k/KyrenToy.java +++ b/Mage.Sets/src/mage/cards/k/KyrenToy.java @@ -38,7 +38,7 @@ public final class KyrenToy extends CardImpl { // {T}, Remove X charge counters from Kyren Toy: Add X mana of {C}, and then add {C}. ability = new SimpleManaAbility(Zone.BATTLEFIELD, new KyrenToyManaEffect(), new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(1))); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MageRingNetwork.java b/Mage.Sets/src/mage/cards/m/MageRingNetwork.java index 6502283911..642187e2ef 100644 --- a/Mage.Sets/src/mage/cards/m/MageRingNetwork.java +++ b/Mage.Sets/src/mage/cards/m/MageRingNetwork.java @@ -43,7 +43,7 @@ public final class MageRingNetwork extends CardImpl { new TapSourceCost(), "Add {C} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java b/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java index e1dc49ff9b..458e41fe4c 100644 --- a/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java +++ b/Mage.Sets/src/mage/cards/m/MaintenanceHangar.java @@ -15,6 +15,7 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; +import mage.counters.CounterType; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; @@ -72,8 +73,8 @@ class RemoveCounterMaintenanceHangarEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Card card : controller.getGraveyard().getCards(game)) { - if (card.getCounters(game).getCount("repair") > 0) { - card.removeCounters("repair", 1, source, game); + if (card.getCounters(game).getCount(CounterType.REPAIR) > 0) { + card.removeCounters(CounterType.REPAIR.getName(), 1, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MercadianBazaar.java b/Mage.Sets/src/mage/cards/m/MercadianBazaar.java index 247d06ce7e..a7aee26137 100644 --- a/Mage.Sets/src/mage/cards/m/MercadianBazaar.java +++ b/Mage.Sets/src/mage/cards/m/MercadianBazaar.java @@ -38,7 +38,7 @@ public final class MercadianBazaar extends CardImpl { new TapSourceCost(), "Add {R} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MercadianLift.java b/Mage.Sets/src/mage/cards/m/MercadianLift.java index 9db546bd2c..b9c41d63a5 100644 --- a/Mage.Sets/src/mage/cards/m/MercadianLift.java +++ b/Mage.Sets/src/mage/cards/m/MercadianLift.java @@ -39,7 +39,7 @@ public final class MercadianLift extends CardImpl { // {tap}, Remove X winch counters from Mercadian Lift: You may put a creature card with converted mana cost X from your hand onto the battlefield. Ability ability2 = new SimpleActivatedAbility(new MercadianLiftEffect(), new TapSourceCost()); - ability2.addCost(new RemoveVariableCountersSourceCost(CounterType.WINCH.createInstance(1))); + ability2.addCost(new RemoveVariableCountersSourceCost(CounterType.WINCH)); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/cards/m/MoltenSlagheap.java b/Mage.Sets/src/mage/cards/m/MoltenSlagheap.java index 03a89a1217..c96b964102 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenSlagheap.java +++ b/Mage.Sets/src/mage/cards/m/MoltenSlagheap.java @@ -39,7 +39,7 @@ public final class MoltenSlagheap extends CardImpl { new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.B, ColoredManaSymbol.R), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/n/NightDealings.java b/Mage.Sets/src/mage/cards/n/NightDealings.java index a3de7e52d4..75c9014aa5 100644 --- a/Mage.Sets/src/mage/cards/n/NightDealings.java +++ b/Mage.Sets/src/mage/cards/n/NightDealings.java @@ -40,7 +40,7 @@ public final class NightDealings extends CardImpl { // {2}{B}{B}, Remove X theft counters from Night Dealings: Search your library for a nonland card with converted mana cost X, reveal it, and put it into your hand. Then shuffle your library. Ability ability = new SimpleActivatedAbility(new NightDealingsSearchEffect(), new ManaCostsImpl<>("{2}{B}{B}")); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.THEFT.createInstance(1))); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.THEFT)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PetalmaneBaku.java b/Mage.Sets/src/mage/cards/p/PetalmaneBaku.java index 6bf0e93426..01bc8bc8e0 100644 --- a/Mage.Sets/src/mage/cards/p/PetalmaneBaku.java +++ b/Mage.Sets/src/mage/cards/p/PetalmaneBaku.java @@ -40,7 +40,7 @@ public final class PetalmaneBaku extends CardImpl { new GenericManaCost(1), "Add X mana of any one color", true, new CountersSourceCount(CounterType.KI)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java index 3bfe360119..26f6f255f7 100644 --- a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java +++ b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java @@ -73,7 +73,7 @@ public final class PhylacteryLich extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) { - if (perm.getCounters(game).getCount("phylactery") > 0) { + if (perm.getCounters(game).getCount(CounterType.PHYLACTERY) > 0) { return false; } } diff --git a/Mage.Sets/src/mage/cards/p/PrimalAmulet.java b/Mage.Sets/src/mage/cards/p/PrimalAmulet.java index e61244fbfd..2b4964245d 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalAmulet.java +++ b/Mage.Sets/src/mage/cards/p/PrimalAmulet.java @@ -85,7 +85,7 @@ class PrimalAmuletEffect extends OneShotEffect { permanent.addCounters(CounterType.CHARGE.createInstance(), source.getControllerId(), source, game); int counters = permanent.getCounters(game).getCount(CounterType.CHARGE); if (counters > 3 && player.chooseUse(Outcome.Benefit, "Transform this?", source, game)) { - permanent.removeCounters("charge", counters, source, game); + permanent.removeCounters(CounterType.CHARGE.getName(), counters, source, game); new TransformSourceEffect().apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/q/QuillmaneBaku.java b/Mage.Sets/src/mage/cards/q/QuillmaneBaku.java index 29e17f0200..9cd025ade2 100644 --- a/Mage.Sets/src/mage/cards/q/QuillmaneBaku.java +++ b/Mage.Sets/src/mage/cards/q/QuillmaneBaku.java @@ -44,7 +44,7 @@ public final class QuillmaneBaku extends CardImpl { // {1}, {T}, Remove X ki counters from Quillmane Baku: Return target creature with mana value X or less to its owner's hand. Ability ability = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI)); ability.addTarget(new TargetCreaturePermanent(filter)); ability.setTargetAdjuster(QuillmaneBakuAdjuster.instance); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java b/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java index 7826db7593..cd7f60303f 100644 --- a/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java +++ b/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java @@ -56,7 +56,7 @@ public final class RasputinTheOneiromancer extends CardImpl { new TapSourceCost(), "Add that much {C}", true, new CountersSourceCount(CounterType.DREAM)); - ability2.addCost(new RemoveVariableCountersSourceCost(CounterType.DREAM.createInstance(), 1, + ability2.addCost(new RemoveVariableCountersSourceCost(CounterType.DREAM, 1, "Remove one or more dream counters from {this}")); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/cards/r/RedManaBattery.java b/Mage.Sets/src/mage/cards/r/RedManaBattery.java index 32b20c6813..b9568a6325 100644 --- a/Mage.Sets/src/mage/cards/r/RedManaBattery.java +++ b/Mage.Sets/src/mage/cards/r/RedManaBattery.java @@ -41,7 +41,7 @@ public final class RedManaBattery extends CardImpl { new TapSourceCost(), "Add {R}, then add {R} for each charge counter removed this way", true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE, "Remove any number of charge counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RushwoodGrove.java b/Mage.Sets/src/mage/cards/r/RushwoodGrove.java index 5d6735cea7..68fc8faf5d 100644 --- a/Mage.Sets/src/mage/cards/r/RushwoodGrove.java +++ b/Mage.Sets/src/mage/cards/r/RushwoodGrove.java @@ -38,7 +38,7 @@ public final class RushwoodGrove extends CardImpl { new TapSourceCost(), "Add {G} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SaltcrustedSteppe.java b/Mage.Sets/src/mage/cards/s/SaltcrustedSteppe.java index beaa9c012a..0cf308a55d 100644 --- a/Mage.Sets/src/mage/cards/s/SaltcrustedSteppe.java +++ b/Mage.Sets/src/mage/cards/s/SaltcrustedSteppe.java @@ -39,7 +39,7 @@ public final class SaltcrustedSteppe extends CardImpl { new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.G, ColoredManaSymbol.W), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SandSilos.java b/Mage.Sets/src/mage/cards/s/SandSilos.java index 49090e97bb..dbf63501a0 100644 --- a/Mage.Sets/src/mage/cards/s/SandSilos.java +++ b/Mage.Sets/src/mage/cards/s/SandSilos.java @@ -48,7 +48,7 @@ public final class SandSilos extends CardImpl { new TapSourceCost(), "Add {U} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SaprazzanCove.java b/Mage.Sets/src/mage/cards/s/SaprazzanCove.java index 578275a661..05d48a4971 100644 --- a/Mage.Sets/src/mage/cards/s/SaprazzanCove.java +++ b/Mage.Sets/src/mage/cards/s/SaprazzanCove.java @@ -38,7 +38,7 @@ public final class SaprazzanCove extends CardImpl { new TapSourceCost(), "Add {U} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SimicManipulator.java b/Mage.Sets/src/mage/cards/s/SimicManipulator.java index 287417de36..1d81682973 100644 --- a/Mage.Sets/src/mage/cards/s/SimicManipulator.java +++ b/Mage.Sets/src/mage/cards/s/SimicManipulator.java @@ -54,7 +54,7 @@ public final class SimicManipulator extends CardImpl { // {T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.Custom, true), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance(), 1, "Remove one or more +1/+1 counters from {this}")); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1, 1, "Remove one or more +1/+1 counters from {this}")); ability.setTargetAdjuster(SimicManipulatorAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SkullmaneBaku.java b/Mage.Sets/src/mage/cards/s/SkullmaneBaku.java index 738cc6fbb3..d28b4b4137 100644 --- a/Mage.Sets/src/mage/cards/s/SkullmaneBaku.java +++ b/Mage.Sets/src/mage/cards/s/SkullmaneBaku.java @@ -42,7 +42,7 @@ public final class SkullmaneBaku extends CardImpl { // {1}, {T}, Remove X ki counters from Skullmane Baku: Target creature gets -X/-X until end of turn. Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SubterraneanHangar.java b/Mage.Sets/src/mage/cards/s/SubterraneanHangar.java index 69874e3957..4d31bf2001 100644 --- a/Mage.Sets/src/mage/cards/s/SubterraneanHangar.java +++ b/Mage.Sets/src/mage/cards/s/SubterraneanHangar.java @@ -38,7 +38,7 @@ public final class SubterraneanHangar extends CardImpl { new TapSourceCost(), "Add {B} for each storage counter removed this way", true, new CountersSourceCount(CounterType.STORAGE)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE, "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TreasureMap.java b/Mage.Sets/src/mage/cards/t/TreasureMap.java index 20caca3f76..713a4bbd68 100644 --- a/Mage.Sets/src/mage/cards/t/TreasureMap.java +++ b/Mage.Sets/src/mage/cards/t/TreasureMap.java @@ -77,7 +77,7 @@ class TreasureMapEffect extends OneShotEffect { permanent.addCounters(CounterType.LANDMARK.createInstance(), source.getControllerId(), source, game); int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK); if (counters > 2) { - permanent.removeCounters("landmark", counters, source, game); + permanent.removeCounters(CounterType.LANDMARK.getName(), counters, source, game); new TransformSourceEffect().apply(game, source); new CreateTokenEffect(new TreasureToken(), 3).apply(game, source); } diff --git a/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java b/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java index adc0c45592..1b25a88230 100644 --- a/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java +++ b/Mage.Sets/src/mage/cards/w/WaxmaneBaku.java @@ -38,7 +38,7 @@ public final class WaxmaneBaku extends CardImpl { // {1}, Remove X ki counters from Waxmane Baku: Tap X target creatures. Ability ability = new SimpleActivatedAbility(new TapTargetEffect("tap X target creatures"), new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI)); ability.setTargetAdjuster(WaxmaneBakuAdjuster.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/w/WhiteManaBattery.java b/Mage.Sets/src/mage/cards/w/WhiteManaBattery.java index d39a179feb..9a73e40057 100644 --- a/Mage.Sets/src/mage/cards/w/WhiteManaBattery.java +++ b/Mage.Sets/src/mage/cards/w/WhiteManaBattery.java @@ -41,7 +41,7 @@ public final class WhiteManaBattery extends CardImpl { new TapSourceCost(), "Add {W}, then add {W} for each charge counter removed this way", true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(), + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE, "Remove any number of charge counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java index 1a8e91ae04..ef55d5caa9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java @@ -3,6 +3,7 @@ package org.mage.test.cards.copy; import mage.constants.PhaseStep; import mage.constants.Zone; +import mage.counters.CounterType; import mage.game.permanent.Permanent; import org.junit.Assert; import org.junit.Test; @@ -70,7 +71,7 @@ public class VesuvaTest extends CardTestPlayerBase { Permanent darkDepth = getPermanent("Dark Depths", playerA); if (darkDepth != null) { - Assert.assertEquals(10, darkDepth.getCounters(currentGame).getCount("ice")); + Assert.assertEquals(10, darkDepth.getCounters(currentGame).getCount(CounterType.ICE)); } assertTappedCount("Dark Depths", true, 1); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java index ca1a04dc04..564956f635 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java @@ -57,7 +57,7 @@ public class PayVariableLoyaltyCost extends VariableCostImpl { return 0; } - int maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY.getName()); + int maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY); // apply cost modification if (source instanceof LoyaltyAbility) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java index 6459913ac7..af69bf4068 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java @@ -5,6 +5,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.VariableCostImpl; import mage.abilities.costs.VariableCostType; import mage.counters.Counter; +import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -14,26 +15,26 @@ import mage.game.permanent.Permanent; public class RemoveVariableCountersSourceCost extends VariableCostImpl { protected int minimalCountersToPay = 0; - private final String counterName; + private final CounterType counterType; - public RemoveVariableCountersSourceCost(Counter counter) { - this(counter, 0); + public RemoveVariableCountersSourceCost(CounterType counterType) { + this(counterType, 0); } - public RemoveVariableCountersSourceCost(Counter counter, String text) { - this(counter, 0, text); + public RemoveVariableCountersSourceCost(CounterType counterType, String text) { + this(counterType, 0, text); } - public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay) { - this(counter, minimalCountersToPay, ""); + public RemoveVariableCountersSourceCost(CounterType counterType, int minimalCountersToPay) { + this(counterType, minimalCountersToPay, ""); } - public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay, String text) { - super(VariableCostType.NORMAL, counter.getName() + " counters to remove"); + public RemoveVariableCountersSourceCost(CounterType counterType, int minimalCountersToPay, String text) { + super(VariableCostType.NORMAL, counterType.getName() + " counters to remove"); this.minimalCountersToPay = minimalCountersToPay; - this.counterName = counter.getName(); + this.counterType = counterType; if (text == null || text.isEmpty()) { - this.text = "Remove X " + counterName + " counters from {this}"; + this.text = "Remove X " + counterType.getName() + " counters from {this}"; } else { this.text = text; } @@ -42,7 +43,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { public RemoveVariableCountersSourceCost(final RemoveVariableCountersSourceCost cost) { super(cost); this.minimalCountersToPay = cost.minimalCountersToPay; - this.counterName = cost.counterName; + this.counterType = cost.counterType; } @Override @@ -52,7 +53,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { @Override public Cost getFixedCostsFromAnnouncedValue(int xValue) { - return new RemoveCountersSourceCost(new Counter(counterName, xValue)); + return new RemoveCountersSourceCost(new Counter(this.counterType.getName(), xValue)); } @Override @@ -63,6 +64,6 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { @Override public int getMaxValue(Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); - return permanent != null ? permanent.getCounters(game).getCount(counterName) : 0; + return permanent != null ? permanent.getCounters(game).getCount(this.counterType) : 0; } }