From 5af57d29e8bf686c6dae03111e71f6bcbd661c34 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 24 Apr 2020 20:39:08 -0400 Subject: [PATCH] changed BasicManaAbility to only be used for basic mana abilities --- Mage.Sets/src/mage/cards/k/KyrenToy.java | 44 ++++++------------- Mage.Sets/src/mage/cards/m/MyrReservoir.java | 20 ++++----- .../src/mage/cards/r/RosheenMeanderer.java | 15 ++++--- .../mage/abilities/mana/BasicManaAbility.java | 6 +-- 4 files changed, 33 insertions(+), 52 deletions(-) diff --git a/Mage.Sets/src/mage/cards/k/KyrenToy.java b/Mage.Sets/src/mage/cards/k/KyrenToy.java index af6dd7d7dd..25211ebb84 100644 --- a/Mage.Sets/src/mage/cards/k/KyrenToy.java +++ b/Mage.Sets/src/mage/cards/k/KyrenToy.java @@ -9,7 +9,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.abilities.mana.BasicManaAbility; +import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -32,12 +32,12 @@ public final class KyrenToy extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); // {1}, {T}: Put a charge counter on Kyren Toy. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1)), new GenericManaCost(1)); + Ability ability = new SimpleActivatedAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1)), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); // {T}, Remove X charge counters from Kyren Toy: Add X mana of {C}, and then add {C}. - ability = new KyrenToyManaAbility(); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new KyrenToyManaEffect(), new TapSourceCost()); ability.addCost(new RemoveVariableCountersSourceCost(CounterType.CHARGE.createInstance(1))); this.addAbility(ability); } @@ -51,30 +51,14 @@ public final class KyrenToy extends CardImpl { return new KyrenToy(this); } - private class KyrenToyManaAbility extends BasicManaAbility { - - KyrenToyManaAbility() { - super(new KyrenToyManaEffect()); - } - - KyrenToyManaAbility(final KyrenToyManaAbility ability) { - super(ability); - } - - @Override - public KyrenToyManaAbility copy() { - return new KyrenToyManaAbility(this); - } - } - private static class KyrenToyManaEffect extends ManaEffect { - KyrenToyManaEffect() { + private KyrenToyManaEffect() { super(); staticText = "Add an amount of {C} equal to X plus one"; } - KyrenToyManaEffect(final KyrenToyManaEffect effect) { + private KyrenToyManaEffect(final KyrenToyManaEffect effect) { super(effect); } @@ -98,16 +82,16 @@ public final class KyrenToy extends CardImpl { return mana; } Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - int numberOfMana = 0; - for (Cost cost : source.getCosts()) { - if (cost instanceof RemoveVariableCountersSourceCost) { - numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount(); - } - } - return new Mana(Mana.ColorlessMana(numberOfMana + 1)); + if (player == null) { + return mana; } - return mana; + int numberOfMana = 0; + for (Cost cost : source.getCosts()) { + if (cost instanceof RemoveVariableCountersSourceCost) { + numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount(); + } + } + return new Mana(Mana.ColorlessMana(numberOfMana + 1)); } @Override diff --git a/Mage.Sets/src/mage/cards/m/MyrReservoir.java b/Mage.Sets/src/mage/cards/m/MyrReservoir.java index d6d66099a1..86018854a7 100644 --- a/Mage.Sets/src/mage/cards/m/MyrReservoir.java +++ b/Mage.Sets/src/mage/cards/m/MyrReservoir.java @@ -1,7 +1,5 @@ - package mage.cards.m; -import java.util.UUID; import mage.ConditionalMana; import mage.MageObject; import mage.Mana; @@ -10,9 +8,9 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.Condition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; -import mage.abilities.mana.BasicManaAbility; +import mage.abilities.effects.mana.BasicManaEffect; +import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -22,6 +20,8 @@ import mage.filter.FilterCard; import mage.game.Game; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * @author nantuko */ @@ -34,7 +34,7 @@ public final class MyrReservoir extends CardImpl { } public MyrReservoir(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); // {tap}: Add {C}{C}. Spend this mana only to cast Myr spells or activate abilities of Myr. this.addAbility(new MyrReservoirManaAbility()); @@ -46,7 +46,7 @@ public final class MyrReservoir extends CardImpl { this.addAbility(ability); } - public MyrReservoir(final MyrReservoir card) { + private MyrReservoir(final MyrReservoir card) { super(card); } @@ -56,14 +56,14 @@ public final class MyrReservoir extends CardImpl { } } -class MyrReservoirManaAbility extends BasicManaAbility { +class MyrReservoirManaAbility extends ActivatedManaAbilityImpl { MyrReservoirManaAbility() { - super(new BasicManaEffect(new MyrConditionalMana())); + super(Zone.BATTLEFIELD, new BasicManaEffect(new MyrConditionalMana()), new TapSourceCost()); this.netMana.add(Mana.ColorlessMana(2)); } - MyrReservoirManaAbility(MyrReservoirManaAbility ability) { + private MyrReservoirManaAbility(MyrReservoirManaAbility ability) { super(ability); } @@ -75,7 +75,7 @@ class MyrReservoirManaAbility extends BasicManaAbility { class MyrConditionalMana extends ConditionalMana { - public MyrConditionalMana() { + MyrConditionalMana() { super(Mana.ColorlessMana(2)); staticText = "Spend this mana only to cast Myr spells or activate abilities of Myr"; addCondition(new MyrManaCondition()); diff --git a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java index 9186613c39..f4229c6515 100644 --- a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java @@ -5,16 +5,18 @@ import mage.MageInt; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; +import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.effects.mana.BasicManaEffect; -import mage.abilities.mana.BasicManaAbility; +import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.conditional.ManaCondition; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; +import mage.constants.Zone; import mage.game.Game; import java.util.UUID; @@ -34,10 +36,9 @@ public final class RosheenMeanderer extends CardImpl { // {T}: Add {C}{C}{C}{C}. Spend this mana only on costs that contain {X}. this.addAbility(new RosheenMeandererManaAbility()); - } - public RosheenMeanderer(final RosheenMeanderer card) { + private RosheenMeanderer(final RosheenMeanderer card) { super(card); } @@ -47,14 +48,14 @@ public final class RosheenMeanderer extends CardImpl { } } -class RosheenMeandererManaAbility extends BasicManaAbility { +class RosheenMeandererManaAbility extends ActivatedManaAbilityImpl { RosheenMeandererManaAbility() { - super(new BasicManaEffect(new RosheenMeandererConditionalMana())); + super(Zone.BATTLEFIELD, new BasicManaEffect(new RosheenMeandererConditionalMana()), new TapSourceCost()); this.netMana.add(Mana.ColorlessMana(4)); } - RosheenMeandererManaAbility(RosheenMeandererManaAbility ability) { + private RosheenMeandererManaAbility(RosheenMeandererManaAbility ability) { super(ability); } @@ -66,7 +67,7 @@ class RosheenMeandererManaAbility extends BasicManaAbility { class RosheenMeandererConditionalMana extends ConditionalMana { - public RosheenMeandererConditionalMana() { + RosheenMeandererConditionalMana() { super(Mana.ColorlessMana(4)); staticText = "Spend this mana only on costs that contain {X}"; addCondition(new RosheenMeandererManaCondition()); diff --git a/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java b/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java index 7392ba4fad..4f6b2eb2e8 100644 --- a/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java @@ -1,13 +1,10 @@ - - package mage.abilities.mana; -import mage.constants.Zone; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ManaEffect; +import mage.constants.Zone; /** - * * @author BetaSteward_at_googlemail.com */ public abstract class BasicManaAbility extends ActivatedManaAbilityImpl { @@ -19,5 +16,4 @@ public abstract class BasicManaAbility extends ActivatedManaAbilityImpl { public BasicManaAbility(BasicManaAbility ability) { super(ability); } - }