1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-11 01:01:05 -09:00

refactor: removed direct counter names usage in some places

This commit is contained in:
Oleg Agafonov 2023-06-12 13:53:15 +04:00
parent 70fa98f492
commit 8f4cc84266
51 changed files with 72 additions and 67 deletions

View file

@ -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. // {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 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()); ability.addTarget(new TargetAttackingOrBlockingCreature());
this.addAbility(ability); this.addAbility(ability);

View file

@ -46,7 +46,7 @@ public final class ArceeSharpshooter extends CardImpl {
.setText("it deals that much damage to target creature"), .setText("it deals that much damage to target creature"),
new GenericManaCost(1) 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.addEffect(new TransformSourceEffect().setText("convert {this}"));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);

View file

@ -152,7 +152,7 @@ class AsForetoldAddAltCostEffect extends ContinuousEffectImpl {
+ sourcePermanent.getTurnsOnBattlefield()); + sourcePermanent.getTurnsOnBattlefield());
// If we haven't used it yet this turn, give the option of using the zero alternative cost // If we haven't used it yet this turn, give the option of using the zero alternative cost
if (wasItUsed == null) { if (wasItUsed == null) {
int timeCounters = sourcePermanent.getCounters(game).getCount("time"); int timeCounters = sourcePermanent.getCounters(game).getCount(CounterType.TIME);
AsForetoldAlternativeCost alternateCostAbility = new AsForetoldAlternativeCost(timeCounters); AsForetoldAlternativeCost alternateCostAbility = new AsForetoldAlternativeCost(timeCounters);
alternateCostAbility.setSourceId(source.getSourceId()); alternateCostAbility.setSourceId(source.getSourceId());
controller.getAlternativeSourceCosts().add(alternateCostAbility); controller.getAlternativeSourceCosts().add(alternateCostAbility);

View file

@ -11,6 +11,7 @@ import mage.constants.Outcome;
import mage.constants.RollDieType; import mage.constants.RollDieType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DieRolledEvent; import mage.game.events.DieRolledEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -105,9 +106,9 @@ class AsLuckWouldHaveItEffect extends OneShotEffect {
if (controller != null && permanent != null) { if (controller != null && permanent != null) {
if (getValue("rolled") != null) { if (getValue("rolled") != null) {
int amount = (Integer) getValue("rolled"); 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()); Player player = game.getPlayer(permanent.getControllerId());
if (player != null) { if (player != null) {
player.won(game); player.won(game);

View file

@ -74,7 +74,7 @@ class AstralCornucopiaManaEffect extends ManaEffect {
return netMana; return netMana;
} }
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE);
if (counters > 0) { if (counters > 0) {
netMana.add(Mana.WhiteMana(counters)); netMana.add(Mana.WhiteMana(counters));
netMana.add(Mana.BlueMana(counters)); netMana.add(Mana.BlueMana(counters));
@ -95,7 +95,7 @@ class AstralCornucopiaManaEffect extends ManaEffect {
if (sourcePermanent == null || controller == null) { if (sourcePermanent == null || controller == null) {
return null; return null;
} }
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE);
if (counters == 0) { if (counters == 0) {
return null; return null;
} }

View file

@ -50,7 +50,7 @@ public final class AuntieBlyteBadInfluence extends CardImpl {
new DamageTargetEffect(GetXValue.instance, "it"), new ManaCostsImpl<>("{1}{R}") new DamageTargetEffect(GetXValue.instance, "it"), new ManaCostsImpl<>("{1}{R}")
); );
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1));
ability.addTarget(new TargetAnyTarget()); ability.addTarget(new TargetAnyTarget());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -42,7 +42,7 @@ public final class BlackManaBattery extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {B}, then add {B} for each charge counter removed this way", "Add {B}, then add {B} for each charge counter removed this way",
true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); 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}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -43,7 +43,7 @@ public final class BlademaneBaku extends CardImpl {
Effect effect = new BoostSourceEffect(xValue, StaticValue.get(0), Duration.EndOfTurn); Effect effect = new BoostSourceEffect(xValue, StaticValue.get(0), Duration.EndOfTurn);
effect.setText("for each counter removed, {this} gets +2/+0 until end of turn"); effect.setText("for each counter removed, {this} gets +2/+0 until end of turn");
Ability ability = new SimpleActivatedAbility(effect, new GenericManaCost(1)); Ability ability = new SimpleActivatedAbility(effect, new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -41,7 +41,7 @@ public final class BlueManaBattery extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {U}, then add {U} for each charge counter removed this way", "Add {U}, then add {U} for each charge counter removed this way",
true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); 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}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -48,7 +48,7 @@ public final class BottomlessVault extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {B} for each storage counter removed this way", "Add {B} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -46,7 +46,7 @@ public final class BrainInAJar extends CardImpl {
// {3}, {T}, Remove X charge counters from Brain in a Jar: Scry X. // {3}, {T}, Remove X charge counters from Brain in a Jar: Scry X.
ability = new SimpleActivatedAbility(new BrainInAJarScryEffect(), new GenericManaCost(3)); ability = new SimpleActivatedAbility(new BrainInAJarScryEffect(), new GenericManaCost(3));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -39,7 +39,7 @@ public final class CalciformPools extends CardImpl {
new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance,
new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.W, ColoredManaSymbol.U), new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.W, ColoredManaSymbol.U),
new GenericManaCost(1)); new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -49,7 +49,7 @@ public final class CrucibleOfTheSpiritDragon extends CardImpl {
new CrucibleOfTheSpiritDragonManaBuilder(), new CrucibleOfTheSpiritDragonManaBuilder(),
false false
); );
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -48,7 +48,7 @@ public final class CruelSadist extends CardImpl {
new DamageTargetEffect(RemovedCountersForCostValue.instance, "it"), new ManaCostsImpl<>("{2}{B}") new DamageTargetEffect(RemovedCountersForCostValue.instance, "it"), new ManaCostsImpl<>("{2}{B}")
); );
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -39,7 +39,7 @@ public final class DreadshipReef extends CardImpl {
new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance,
new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.U, ColoredManaSymbol.B), new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.U, ColoredManaSymbol.B),
new GenericManaCost(1)); new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -48,7 +48,7 @@ public final class DwarvenHold extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {R} for each storage counter removed this way", "Add {R} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class FountainOfCho extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {W} for each storage counter removed this way", "Add {W} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -41,7 +41,7 @@ public final class FungalReaches extends CardImpl {
new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance,
new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.R, ColoredManaSymbol.G), new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.R, ColoredManaSymbol.G),
new GenericManaCost(1)); new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class GeistflameReservoir extends CardImpl {
.setText("it deals that much damage to any target"), new ManaCostsImpl<>("{1}{R}")); .setText("it deals that much damage to any target"), new ManaCostsImpl<>("{1}{R}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost( 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()); ability.addTarget(new TargetAnyTarget());
this.addAbility(ability); this.addAbility(ability);

View file

@ -41,7 +41,7 @@ public final class GreenManaBattery extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {G}, then add {G} for each charge counter removed this way", "Add {G}, then add {G} for each charge counter removed this way",
true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); 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}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -52,7 +52,7 @@ public final class Haruspex extends CardImpl {
Mana.AnyMana(1), RemovedCountersForCostValue.instance, new TapSourceCost(), Mana.AnyMana(1), RemovedCountersForCostValue.instance, new TapSourceCost(),
"Add X mana of any one color", true, xValue "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")); this.addAbility(ability.withFlavorWord("Devouring Monster"));
} }

View file

@ -14,6 +14,7 @@ import mage.constants.CardType;
import mage.constants.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
@ -95,7 +96,7 @@ class HibernationsEndEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && player != null) { 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); FilterCard filter = new FilterCard("creature card with mana value " + newConvertedCost);
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, newConvertedCost)); filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(CardType.CREATURE.getPredicate()); filter.add(CardType.CREATURE.getPredicate());

View file

@ -48,7 +48,7 @@ public final class HollowTrees extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {G} for each storage counter removed this way", "Add {G} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -48,7 +48,7 @@ public final class IcatianStore extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {W} for each storage counter removed this way", "Add {W} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -32,7 +32,7 @@ public final class InfusedArrows extends CardImpl {
this.addAbility(new SunburstAbility(this)); this.addAbility(new SunburstAbility(this));
// {tap}, Remove X charge counters from Infused Arrows: Target creature gets -X/-X until end of turn. // {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 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()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -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}. // {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 = 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); this.addAbility(ability);
} }

View file

@ -43,7 +43,7 @@ public final class MageRingNetwork extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {C} for each storage counter removed this way", "Add {C} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -15,6 +15,7 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
@ -72,8 +73,8 @@ class RemoveCounterMaintenanceHangarEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
for (Card card : controller.getGraveyard().getCards(game)) { for (Card card : controller.getGraveyard().getCards(game)) {
if (card.getCounters(game).getCount("repair") > 0) { if (card.getCounters(game).getCount(CounterType.REPAIR) > 0) {
card.removeCounters("repair", 1, source, game); card.removeCounters(CounterType.REPAIR.getName(), 1, source, game);
} }
} }
return true; return true;

View file

@ -38,7 +38,7 @@ public final class MercadianBazaar extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {R} for each storage counter removed this way", "Add {R} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -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. // {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()); 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); this.addAbility(ability2);
} }

View file

@ -39,7 +39,7 @@ public final class MoltenSlagheap extends CardImpl {
new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance,
new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.B, ColoredManaSymbol.R), new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.B, ColoredManaSymbol.R),
new GenericManaCost(1)); new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -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. // {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 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); this.addAbility(ability);
} }

View file

@ -40,7 +40,7 @@ public final class PetalmaneBaku extends CardImpl {
new GenericManaCost(1), new GenericManaCost(1),
"Add X mana of any one color", "Add X mana of any one color",
true, new CountersSourceCount(CounterType.KI)); true, new CountersSourceCount(CounterType.KI));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -73,7 +73,7 @@ public final class PhylacteryLich extends CardImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) {
if (perm.getCounters(game).getCount("phylactery") > 0) { if (perm.getCounters(game).getCount(CounterType.PHYLACTERY) > 0) {
return false; return false;
} }
} }

View file

@ -85,7 +85,7 @@ class PrimalAmuletEffect extends OneShotEffect {
permanent.addCounters(CounterType.CHARGE.createInstance(), source.getControllerId(), source, game); permanent.addCounters(CounterType.CHARGE.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.CHARGE); int counters = permanent.getCounters(game).getCount(CounterType.CHARGE);
if (counters > 3 && player.chooseUse(Outcome.Benefit, "Transform this?", source, game)) { 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); new TransformSourceEffect().apply(game, source);
} }
return true; return true;

View file

@ -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. // {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 ability = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI));
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(filter));
ability.setTargetAdjuster(QuillmaneBakuAdjuster.instance); ability.setTargetAdjuster(QuillmaneBakuAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);

View file

@ -56,7 +56,7 @@ public final class RasputinTheOneiromancer extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add that much {C}", "Add that much {C}",
true, new CountersSourceCount(CounterType.DREAM)); 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}")); "Remove one or more dream counters from {this}"));
this.addAbility(ability2); this.addAbility(ability2);

View file

@ -41,7 +41,7 @@ public final class RedManaBattery extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {R}, then add {R} for each charge counter removed this way", "Add {R}, then add {R} for each charge counter removed this way",
true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); 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}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class RushwoodGrove extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {G} for each storage counter removed this way", "Add {G} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -39,7 +39,7 @@ public final class SaltcrustedSteppe extends CardImpl {
new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance, new AddManaInAnyCombinationEffect(RemovedCountersForCostValue.instance,
new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.G, ColoredManaSymbol.W), new CountersSourceCount(CounterType.STORAGE), ColoredManaSymbol.G, ColoredManaSymbol.W),
new GenericManaCost(1)); new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -48,7 +48,7 @@ public final class SandSilos extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {U} for each storage counter removed this way", "Add {U} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class SaprazzanCove extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {U} for each storage counter removed this way", "Add {U} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -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. // {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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.Custom, true), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter)); 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); ability.setTargetAdjuster(SimicManipulatorAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -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. // {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 ability = new SimpleActivatedAbility(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance())); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class SubterraneanHangar extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {B} for each storage counter removed this way", "Add {B} for each storage counter removed this way",
true, new CountersSourceCount(CounterType.STORAGE)); 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}")); "Remove any number of storage counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -77,7 +77,7 @@ class TreasureMapEffect extends OneShotEffect {
permanent.addCounters(CounterType.LANDMARK.createInstance(), source.getControllerId(), source, game); permanent.addCounters(CounterType.LANDMARK.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK); int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK);
if (counters > 2) { if (counters > 2) {
permanent.removeCounters("landmark", counters, source, game); permanent.removeCounters(CounterType.LANDMARK.getName(), counters, source, game);
new TransformSourceEffect().apply(game, source); new TransformSourceEffect().apply(game, source);
new CreateTokenEffect(new TreasureToken(), 3).apply(game, source); new CreateTokenEffect(new TreasureToken(), 3).apply(game, source);
} }

View file

@ -38,7 +38,7 @@ public final class WaxmaneBaku extends CardImpl {
// {1}, Remove X ki counters from Waxmane Baku: Tap X target creatures. // {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 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); ability.setTargetAdjuster(WaxmaneBakuAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -41,7 +41,7 @@ public final class WhiteManaBattery extends CardImpl {
new TapSourceCost(), new TapSourceCost(),
"Add {W}, then add {W} for each charge counter removed this way", "Add {W}, then add {W} for each charge counter removed this way",
true, new IntPlusDynamicValue(1, new CountersSourceCount(CounterType.CHARGE))); 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}")); "Remove any number of charge counters from {this}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.copy;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -70,7 +71,7 @@ public class VesuvaTest extends CardTestPlayerBase {
Permanent darkDepth = getPermanent("Dark Depths", playerA); Permanent darkDepth = getPermanent("Dark Depths", playerA);
if (darkDepth != null) { 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); assertTappedCount("Dark Depths", true, 1);
} }

View file

@ -57,7 +57,7 @@ public class PayVariableLoyaltyCost extends VariableCostImpl {
return 0; return 0;
} }
int maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY.getName()); int maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY);
// apply cost modification // apply cost modification
if (source instanceof LoyaltyAbility) { if (source instanceof LoyaltyAbility) {

View file

@ -5,6 +5,7 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.VariableCostImpl; import mage.abilities.costs.VariableCostImpl;
import mage.abilities.costs.VariableCostType; import mage.abilities.costs.VariableCostType;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -14,26 +15,26 @@ import mage.game.permanent.Permanent;
public class RemoveVariableCountersSourceCost extends VariableCostImpl { public class RemoveVariableCountersSourceCost extends VariableCostImpl {
protected int minimalCountersToPay = 0; protected int minimalCountersToPay = 0;
private final String counterName; private final CounterType counterType;
public RemoveVariableCountersSourceCost(Counter counter) { public RemoveVariableCountersSourceCost(CounterType counterType) {
this(counter, 0); this(counterType, 0);
} }
public RemoveVariableCountersSourceCost(Counter counter, String text) { public RemoveVariableCountersSourceCost(CounterType counterType, String text) {
this(counter, 0, text); this(counterType, 0, text);
} }
public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay) { public RemoveVariableCountersSourceCost(CounterType counterType, int minimalCountersToPay) {
this(counter, minimalCountersToPay, ""); this(counterType, minimalCountersToPay, "");
} }
public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay, String text) { public RemoveVariableCountersSourceCost(CounterType counterType, int minimalCountersToPay, String text) {
super(VariableCostType.NORMAL, counter.getName() + " counters to remove"); super(VariableCostType.NORMAL, counterType.getName() + " counters to remove");
this.minimalCountersToPay = minimalCountersToPay; this.minimalCountersToPay = minimalCountersToPay;
this.counterName = counter.getName(); this.counterType = counterType;
if (text == null || text.isEmpty()) { if (text == null || text.isEmpty()) {
this.text = "Remove X " + counterName + " counters from {this}"; this.text = "Remove X " + counterType.getName() + " counters from {this}";
} else { } else {
this.text = text; this.text = text;
} }
@ -42,7 +43,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl {
public RemoveVariableCountersSourceCost(final RemoveVariableCountersSourceCost cost) { public RemoveVariableCountersSourceCost(final RemoveVariableCountersSourceCost cost) {
super(cost); super(cost);
this.minimalCountersToPay = cost.minimalCountersToPay; this.minimalCountersToPay = cost.minimalCountersToPay;
this.counterName = cost.counterName; this.counterType = cost.counterType;
} }
@Override @Override
@ -52,7 +53,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl {
@Override @Override
public Cost getFixedCostsFromAnnouncedValue(int xValue) { public Cost getFixedCostsFromAnnouncedValue(int xValue) {
return new RemoveCountersSourceCost(new Counter(counterName, xValue)); return new RemoveCountersSourceCost(new Counter(this.counterType.getName(), xValue));
} }
@Override @Override
@ -63,6 +64,6 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl {
@Override @Override
public int getMaxValue(Ability source, Game game) { public int getMaxValue(Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId()); 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;
} }
} }