From 193177d9999d56729a687ca3b1a2fc3f3b96d9e2 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 25 Jul 2015 12:41:48 +0200 Subject: [PATCH] Fixed a lot of storage lands to calculate available mana correctly. --- .../betrayersofkamigawa/PetalmaneBaku.java | 35 +++++++++------ .../sets/fallenempires/BottomlessVault.java | 14 ++++-- .../mage/sets/fallenempires/HollowTrees.java | 14 ++++-- .../mage/sets/fallenempires/IcatianStore.java | 14 ++++-- .../mage/sets/fifthedition/DwarvenHold.java | 14 ++++-- .../src/mage/sets/fifthedition/SandSilos.java | 14 ++++-- .../sets/mercadianmasques/FountainOfCho.java | 15 ++++--- .../mercadianmasques/MercadianBazaar.java | 13 ++++-- .../sets/mercadianmasques/RushwoodGrove.java | 17 ++++--- .../sets/mercadianmasques/SaprazzanCove.java | 15 ++++--- .../mercadianmasques/SubterraneanHangar.java | 13 ++++-- .../RemoveVariableCountersSourceCost.java | 45 +++++++++---------- 12 files changed, 141 insertions(+), 82 deletions(-) diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PetalmaneBaku.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PetalmaneBaku.java index 4de0d0d8933..d7ee3a8fd78 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PetalmaneBaku.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PetalmaneBaku.java @@ -25,24 +25,26 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; -import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; +import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.BasicManaAbility; +import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; import mage.filter.common.FilterSpiritOrArcaneCard; import mage.game.Game; @@ -62,14 +64,19 @@ public class PetalmaneBaku extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); - + // Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku. this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true)); // {1}, Remove X ki counters from Petalmane Baku: Add X mana of any one color to your mana pool. - Ability ability = new PetalmaneBakuManaAbility(); - ability.addCost(new GenericManaCost(1)); - ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1))); + Ability ability = new DynamicManaAbility( + new Mana(0, 0, 0, 0, 0, 0, 1), + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add X mana of any one color to your mana pool", + true, new CountersCount(CounterType.KI)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove X ki counters from {this}")); this.addAbility(ability); } @@ -81,8 +88,9 @@ public class PetalmaneBaku extends CardImpl { public PetalmaneBaku copy() { return new PetalmaneBaku(this); } - + private class PetalmaneBakuManaAbility extends BasicManaAbility { + PetalmaneBakuManaAbility() { super(new PetalmaneBakuManaEffect()); this.addChoice(new ChoiceColor()); @@ -96,7 +104,7 @@ public class PetalmaneBaku extends CardImpl { public PetalmaneBakuManaAbility copy() { return new PetalmaneBakuManaAbility(this); } -} + } private class PetalmaneBakuManaEffect extends ManaEffect { @@ -118,9 +126,9 @@ public class PetalmaneBaku extends CardImpl { int numberOfMana = 0; for (Cost cost : source.getCosts()) { if (cost instanceof RemoveVariableCountersSourceCost) { - numberOfMana = ((RemoveVariableCountersSourceCost)cost).getAmount(); + numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount(); } - } + } if (choice.getColor().isBlack()) { player.getManaPool().addMana(new Mana(0, 0, 0, 0, numberOfMana, 0, 0), game, source); return true; @@ -152,5 +160,4 @@ public class PetalmaneBaku extends CardImpl { } } - -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/fallenempires/BottomlessVault.java b/Mage.Sets/src/mage/sets/fallenempires/BottomlessVault.java index 85705452450..277cc93571a 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/BottomlessVault.java +++ b/Mage.Sets/src/mage/sets/fallenempires/BottomlessVault.java @@ -35,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -67,10 +69,14 @@ public class BottomlessVault extends CardImpl { Effect effect = new ConditionalOneShotEffect(addStorageCounter, SourceTappedCondition.getInstance(), "if {this} is tapped, put a storage counter on it"); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false)); // {tap}, Remove any number of storage counters from Bottomless Vault: Add {B} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.BlackMana, new RemovedCountersForCostValue(), - "Add {B} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.BlackMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {B} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/fallenempires/HollowTrees.java b/Mage.Sets/src/mage/sets/fallenempires/HollowTrees.java index f14cdd1f50b..9253c1fc4f3 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/HollowTrees.java +++ b/Mage.Sets/src/mage/sets/fallenempires/HollowTrees.java @@ -35,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -67,10 +69,14 @@ public class HollowTrees extends CardImpl { Effect effect = new ConditionalOneShotEffect(addStorageCounter, SourceTappedCondition.getInstance(), "if {this} is tapped, put a storage counter on it"); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false)); // {tap}, Remove any number of storage counters from Hollow Trees: Add {G} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.BlackMana, new RemovedCountersForCostValue(), - "Add {B} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.GreenMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {G} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/fallenempires/IcatianStore.java b/Mage.Sets/src/mage/sets/fallenempires/IcatianStore.java index ad30635e7ef..0fbec1161d9 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/IcatianStore.java +++ b/Mage.Sets/src/mage/sets/fallenempires/IcatianStore.java @@ -35,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -67,10 +69,14 @@ public class IcatianStore extends CardImpl { Effect effect = new ConditionalOneShotEffect(addStorageCounter, SourceTappedCondition.getInstance(), "if {this} is tapped, put a storage counter on it"); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false)); // {tap}, Remove any number of storage counters from Icatian Store: Add {W} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.WhiteMana, new RemovedCountersForCostValue(), - "Add {W} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.WhiteMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {W} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/fifthedition/DwarvenHold.java b/Mage.Sets/src/mage/sets/fifthedition/DwarvenHold.java index f7e8c8afd0f..ad4bc54a7ab 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/DwarvenHold.java +++ b/Mage.Sets/src/mage/sets/fifthedition/DwarvenHold.java @@ -35,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -67,10 +69,14 @@ public class DwarvenHold extends CardImpl { Effect effect = new ConditionalOneShotEffect(addStorageCounter, SourceTappedCondition.getInstance(), "if {this} is tapped, put a storage counter on it"); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false)); // {tap}, Remove any number of storage counters from Dwarven Hold: Add {R} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.RedMana, new RemovedCountersForCostValue(), - "Add {R} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.RedMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {R} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/fifthedition/SandSilos.java b/Mage.Sets/src/mage/sets/fifthedition/SandSilos.java index 7e8a942094e..bbc58406a2f 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/SandSilos.java +++ b/Mage.Sets/src/mage/sets/fifthedition/SandSilos.java @@ -35,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -67,10 +69,14 @@ public class SandSilos extends CardImpl { Effect effect = new ConditionalOneShotEffect(addStorageCounter, SourceTappedCondition.getInstance(), "if {this} is tapped, put a storage counter on it"); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false)); // {tap}, Remove any number of storage counters from Sand Silos: Add {U} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.BlueMana, new RemovedCountersForCostValue(), - "Add {U} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.BlueMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {U} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/FountainOfCho.java b/Mage.Sets/src/mage/sets/mercadianmasques/FountainOfCho.java index 5074f07c584..d60cf95b01f 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/FountainOfCho.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/FountainOfCho.java @@ -34,6 +34,7 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.DynamicManaAbility; @@ -57,11 +58,15 @@ public class FountainOfCho extends CardImpl { this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}: Put a storage counter on Fountain of Cho. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost())); - // {tap}, Remove any number of storage counters from Fountain of Cho: Add {W} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.WhiteMana, new RemovedCountersForCostValue(), - "Add {W} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + // {T}, Remove any number of storage counters from Fountain of Cho: Add {W} to your mana pool for each storage counter removed this way. + Ability ability = new DynamicManaAbility( + Mana.WhiteMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {W} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/MercadianBazaar.java b/Mage.Sets/src/mage/sets/mercadianmasques/MercadianBazaar.java index b89398ad4a3..f361fba4a78 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/MercadianBazaar.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/MercadianBazaar.java @@ -34,6 +34,7 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.DynamicManaAbility; @@ -58,10 +59,14 @@ public class MercadianBazaar extends CardImpl { // {tap}: Put a storage counter on Mercadian Bazaar. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost())); // {tap}, Remove any number of storage counters from Mercadian Bazaar: Add {R} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.RedMana, new RemovedCountersForCostValue(), - "Add {R} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.RedMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {R} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/RushwoodGrove.java b/Mage.Sets/src/mage/sets/mercadianmasques/RushwoodGrove.java index df971fa382f..7aeef255e35 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/RushwoodGrove.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/RushwoodGrove.java @@ -34,6 +34,7 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.DynamicManaAbility; @@ -55,13 +56,17 @@ public class RushwoodGrove extends CardImpl { // Rushwood Grove enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); - // {tap}: Put a storage counter on Rushwood Grove. + // {T}: Put a storage counter on Rushwood Grove. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost())); - // {tap}, Remove any number of storage counters from Rushwood Grove: Add {G} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.GreenMana, new RemovedCountersForCostValue(), - "Add {G} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + // {T}, Remove any number of storage counters from Rushwood Grove: Add {G} to your mana pool for each storage counter removed this way. + Ability ability = new DynamicManaAbility( + Mana.GreenMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {G} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/SaprazzanCove.java b/Mage.Sets/src/mage/sets/mercadianmasques/SaprazzanCove.java index 7d841973f70..f6fa90c5fab 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/SaprazzanCove.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/SaprazzanCove.java @@ -34,13 +34,12 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; -import mage.abilities.effects.common.AddManaInAnyCombinationEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.ColoredManaSymbol; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; @@ -60,10 +59,14 @@ public class SaprazzanCove extends CardImpl { // {tap}: Put a storage counter on Saprazzan Cove. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost())); // {tap}, Remove any number of storage counters from Saprazzan Cove: Add {U} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.BlueMana, new RemovedCountersForCostValue(), - "Add {U} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.BlueMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {U} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/SubterraneanHangar.java b/Mage.Sets/src/mage/sets/mercadianmasques/SubterraneanHangar.java index 245b09cbd4a..21a9634814b 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/SubterraneanHangar.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/SubterraneanHangar.java @@ -34,6 +34,7 @@ import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersCount; import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.DynamicManaAbility; @@ -58,10 +59,14 @@ public class SubterraneanHangar extends CardImpl { // {tap}: Put a storage counter on Subterranean Hangar. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost())); // {tap}, Remove any number of storage counters from Subterranean Hangar: Add {B} to your mana pool for each storage counter removed this way. - Ability ability = new DynamicManaAbility(Mana.BlackMana, new RemovedCountersForCostValue(), - "Add {B} to your mana pool for each storage counter removed this way"); - ability.addCost(new RemoveVariableCountersSourceCost( - CounterType.STORAGE.createInstance(), "Remove any number of storage counters from {this}")); + Ability ability = new DynamicManaAbility( + Mana.BlackMana, + new RemovedCountersForCostValue(), + new TapSourceCost(), + "Add {B} to your mana pool for each storage counter removed this way", + true, new CountersCount(CounterType.STORAGE)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(), + "Remove any number of storage counters from {this}")); this.addAbility(ability); } diff --git a/Mage/src/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java b/Mage/src/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java index 49020791d4c..7678d644736 100644 --- a/Mage/src/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java +++ b/Mage/src/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java @@ -1,16 +1,16 @@ /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,12 +20,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.costs.common; import mage.abilities.Ability; @@ -39,37 +38,38 @@ import mage.game.permanent.Permanent; * * @author LevelX2 */ -public class RemoveVariableCountersSourceCost extends VariableCostImpl { +public class RemoveVariableCountersSourceCost extends VariableCostImpl { protected int minimalCountersToPay = 0; private String counterName; - public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay) { - super(new StringBuilder(counter.getName()).append(" counters to remove").toString()); - this.minimalCountersToPay = minimalCountersToPay; - this.counterName = counter.getName(); - this.text = new StringBuilder("Remove ").append(xText).append(" ").append(counterName).append(" counters from {this}").toString(); - } - public RemoveVariableCountersSourceCost(Counter counter) { this(counter, 0); } - - public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay, String text) { - this(counter, minimalCountersToPay); - this.text = text; - } public RemoveVariableCountersSourceCost(Counter counter, String text) { - this(counter); - this.text = text; + this(counter, 0, text); + } + + public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay) { + this(counter, minimalCountersToPay, ""); + } + + public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay, String text) { + super(counter.getName() + " counters to remove"); + this.minimalCountersToPay = minimalCountersToPay; + this.counterName = counter.getName(); + if (text == null || text.isEmpty()) { + this.text = "Remove X " + counterName + " counters from {this}"; + } else { + this.text = text; + } } public RemoveVariableCountersSourceCost(final RemoveVariableCountersSourceCost cost) { super(cost); this.minimalCountersToPay = cost.minimalCountersToPay; this.counterName = cost.counterName; - this.text = cost.text; } @Override @@ -98,4 +98,3 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { } } -