From ca1af753ebd4564d981ba538a19394e554ae3e45 Mon Sep 17 00:00:00 2001 From: North Date: Sat, 31 May 2014 18:43:05 +0300 Subject: [PATCH] [refactor] removed BoostCounter implementations --- .../src/mage/sets/alliances/Contagion.java | 20 +------ .../src/mage/sets/odyssey/SavageFirecat.java | 6 +- .../src/mage/sets/odyssey/Soulcatcher.java | 4 +- .../mage/sets/planechase/IvyElemental.java | 4 +- .../mage/sets/timeshifted/WallOfRoots.java | 18 +----- .../sets/zendikar/BladeOfTheBloodchief.java | 6 +- .../src/mage/sets/zendikar/MarkOfMutiny.java | 4 +- .../AddPlusOneCountersAttachedEffect.java | 4 +- Mage/src/mage/counters/BoostCounter.java | 12 +++- Mage/src/mage/counters/CounterType.java | 11 ++-- .../mage/counters/common/MinusOneCounter.java | 56 ------------------- .../mage/counters/common/PlusOneCounter.java | 56 ------------------- 12 files changed, 31 insertions(+), 170 deletions(-) delete mode 100644 Mage/src/mage/counters/common/MinusOneCounter.java delete mode 100644 Mage/src/mage/counters/common/PlusOneCounter.java diff --git a/Mage.Sets/src/mage/sets/alliances/Contagion.java b/Mage.Sets/src/mage/sets/alliances/Contagion.java index 99d9ed6cfa..40ef05f348 100644 --- a/Mage.Sets/src/mage/sets/alliances/Contagion.java +++ b/Mage.Sets/src/mage/sets/alliances/Contagion.java @@ -86,23 +86,6 @@ public class Contagion extends CardImpl { } } -class ContagionCounter extends BoostCounter { - - public ContagionCounter(int count) { - super(-2, -1); - this.count = count; - } - - public ContagionCounter(final ContagionCounter counter) { - super(counter); - } - - @Override - public ContagionCounter copy() { - return new ContagionCounter(this); - } -} - class DistributeCountersEffect extends OneShotEffect { @@ -126,7 +109,8 @@ class DistributeCountersEffect extends OneShotEffect { for (UUID target: multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.addCounters(new ContagionCounter(multiTarget.getTargetAmount(target)), game); + int amount = multiTarget.getTargetAmount(target); + permanent.addCounters(new BoostCounter(-2, -1, amount), game); } } } diff --git a/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java b/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java index 45873c31fb..7c12a16b5b 100644 --- a/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java +++ b/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java @@ -39,7 +39,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.counters.common.PlusOneCounter; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -63,9 +63,9 @@ public class SavageFirecat extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); // Savage Firecat enters the battlefield with seven +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new PlusOneCounter(7)))); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(7)))); // Whenever you tap a land for mana, remove a +1/+1 counter from Savage Firecat. - this.addAbility(new SavageFirecatTriggeredAbility(new RemoveCounterSourceEffect(new PlusOneCounter(1)))); + this.addAbility(new SavageFirecatTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()))); } diff --git a/Mage.Sets/src/mage/sets/odyssey/Soulcatcher.java b/Mage.Sets/src/mage/sets/odyssey/Soulcatcher.java index 59c120f8f6..3f11622edc 100644 --- a/Mage.Sets/src/mage/sets/odyssey/Soulcatcher.java +++ b/Mage.Sets/src/mage/sets/odyssey/Soulcatcher.java @@ -35,7 +35,7 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.counters.common.PlusOneCounter; +import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; @@ -64,7 +64,7 @@ public class Soulcatcher extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // Whenever a creature with flying dies, put a +1/+1 counter on Soulcatcher. - this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(new PlusOneCounter()), false, filter)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, filter)); } public Soulcatcher(final Soulcatcher card) { diff --git a/Mage.Sets/src/mage/sets/planechase/IvyElemental.java b/Mage.Sets/src/mage/sets/planechase/IvyElemental.java index 9febd90937..ea527e2a14 100644 --- a/Mage.Sets/src/mage/sets/planechase/IvyElemental.java +++ b/Mage.Sets/src/mage/sets/planechase/IvyElemental.java @@ -35,7 +35,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.counters.common.PlusOneCounter; +import mage.counters.CounterType; /** * @@ -53,7 +53,7 @@ public class IvyElemental extends CardImpl { this.toughness = new MageInt(0); // Ivy Elemental enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new PlusOneCounter(), new ManacostVariableValue(), true), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), new ManacostVariableValue(), true), "with X +1/+1 counters on it")); } public IvyElemental(final IvyElemental card) { diff --git a/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java b/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java index d538ac588c..ed79e1e197 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java +++ b/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java @@ -95,7 +95,7 @@ class WallOfRootsCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - permanent.addCounters(new WallOfRootsCounter(), game); + permanent.addCounters(new BoostCounter(0, -1), game); this.paid = true; } return paid; @@ -106,19 +106,3 @@ class WallOfRootsCost extends CostImpl { return new WallOfRootsCost(this); } } - -class WallOfRootsCounter extends BoostCounter { - - public WallOfRootsCounter() { - super(0, -1); - } - - public WallOfRootsCounter(final WallOfRootsCounter counter) { - super(counter); - } - - @Override - public WallOfRootsCounter copy() { - return new WallOfRootsCounter(this); - } -} diff --git a/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java b/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java index 3439310233..fa16b812a1 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java +++ b/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java @@ -39,7 +39,7 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; -import mage.counters.common.PlusOneCounter; +import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -129,10 +129,10 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect { this.color.setRed(true); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn)); - this.getSpellAbility().addEffect(new AddCountersTargetEffect(new PlusOneCounter())); + this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new UntapTargetEffect()); } diff --git a/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java index 0ce047ace2..317ebcc4fd 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java @@ -32,7 +32,7 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.counters.common.PlusOneCounter; +import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; import mage.util.CardUtil; @@ -70,7 +70,7 @@ public class AddPlusOneCountersAttachedEffect extends OneShotEffect