changed BasicManaAbility to only be used for basic mana abilities

This commit is contained in:
Evan Kranzler 2020-04-24 20:39:08 -04:00
parent 505c434fb5
commit 5af57d29e8
4 changed files with 33 additions and 52 deletions

View file

@ -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,7 +82,9 @@ public final class KyrenToy extends CardImpl {
return mana;
}
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (player == null) {
return mana;
}
int numberOfMana = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
@ -107,8 +93,6 @@ public final class KyrenToy extends CardImpl {
}
return new Mana(Mana.ColorlessMana(numberOfMana + 1));
}
return mana;
}
@Override
public KyrenToyManaEffect copy() {

View file

@ -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());

View file

@ -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());

View file

@ -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);
}
}