Removed mutable public static mana

This commit is contained in:
poixen 2015-11-29 20:12:39 +01:00
parent e678577720
commit 409e66a2e9
115 changed files with 186 additions and 192 deletions

View file

@ -56,13 +56,6 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
protected int any;
protected boolean flag;
//TODO These are unsafe and mutable
public static final Mana RedMana = RedMana(1);
public static final Mana GreenMana = GreenMana(1);
public static final Mana BlueMana = BlueMana(1);
public static final Mana WhiteMana = WhiteMana(1);
public static final Mana BlackMana = BlackMana(1);
public static final Mana ColorlessMana = ColorlessMana(1);
/**

View file

@ -242,19 +242,19 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
protected void addColoredOption(ColoredManaSymbol symbol) {
switch (symbol) {
case B:
this.options.add(Mana.BlackMana);
this.options.add(Mana.BlackMana(1));
break;
case U:
this.options.add(Mana.BlueMana);
this.options.add(Mana.BlueMana(1));
break;
case W:
this.options.add(Mana.WhiteMana);
this.options.add(Mana.WhiteMana(1));
break;
case R:
this.options.add(Mana.RedMana);
this.options.add(Mana.RedMana(1));
break;
case G:
this.options.add(Mana.GreenMana);
this.options.add(Mana.GreenMana(1));
break;
}
}

View file

@ -222,32 +222,32 @@ class ConvokeEffect extends OneShotEffect {
chooseManaType.setChoice(chooseManaType.getChoices().iterator().next());
}
if (chooseManaType.getChoice().equals("Black")) {
manaPool.addMana(Mana.BlackMana, game, source);
manaPool.addMana(Mana.BlackMana(1), game, source);
manaPool.unlockManaType(ManaType.BLACK);
}
if (chooseManaType.getChoice().equals("Blue")) {
manaPool.addMana(Mana.BlueMana, game, source);
manaPool.addMana(Mana.BlueMana(1), game, source);
manaPool.unlockManaType(ManaType.BLUE);
}
if (chooseManaType.getChoice().equals("Green")) {
manaPool.addMana(Mana.GreenMana, game, source);
manaPool.addMana(Mana.GreenMana(1), game, source);
manaPool.unlockManaType(ManaType.GREEN);
}
if (chooseManaType.getChoice().equals("White")) {
manaPool.addMana(Mana.WhiteMana, game, source);
manaPool.addMana(Mana.WhiteMana(1), game, source);
manaPool.unlockManaType(ManaType.WHITE);
}
if (chooseManaType.getChoice().equals("Red")) {
manaPool.addMana(Mana.RedMana, game, source);
manaPool.addMana(Mana.RedMana(1), game, source);
manaPool.unlockManaType(ManaType.RED);
}
if (chooseManaType.getChoice().equals("Colorless")) {
manaPool.addMana(Mana.ColorlessMana, game, source);
manaPool.addMana(Mana.ColorlessMana(1), game, source);
manaPool.unlockManaType(ManaType.COLORLESS);
}
manaName = chooseManaType.getChoice().toLowerCase();
} else {
manaPool.addMana(Mana.ColorlessMana, game, source);
manaPool.addMana(Mana.ColorlessMana(1), game, source);
manaPool.unlockManaType(ManaType.COLORLESS);
manaName = "colorless";
}

View file

@ -39,7 +39,7 @@ import mage.constants.ColoredManaSymbol;
public class BlackManaAbility extends BasicManaAbility {
public BlackManaAbility() {
super(new BasicManaEffect(Mana.BlackMana));
super(new BasicManaEffect(Mana.BlackMana(1)));
this.netMana.add(new Mana(ColoredManaSymbol.B));
}

View file

@ -39,7 +39,7 @@ import mage.constants.ColoredManaSymbol;
public class BlueManaAbility extends BasicManaAbility {
public BlueManaAbility() {
super(new BasicManaEffect(Mana.BlueMana));
super(new BasicManaEffect(Mana.BlueMana(1)));
this.netMana.add(new Mana(ColoredManaSymbol.U));
}

View file

@ -38,7 +38,7 @@ import mage.abilities.effects.common.BasicManaEffect;
public class ColorlessManaAbility extends BasicManaAbility {
public ColorlessManaAbility() {
super(new BasicManaEffect(Mana.ColorlessMana));
super(new BasicManaEffect(Mana.ColorlessMana(1)));
this.netMana.add(new Mana(0,0,0,0,0,1,0));
}

View file

@ -39,7 +39,7 @@ import mage.constants.ColoredManaSymbol;
public class GreenManaAbility extends BasicManaAbility {
public GreenManaAbility() {
super(new BasicManaEffect(Mana.GreenMana));
super(new BasicManaEffect(Mana.GreenMana(1)));
this.netMana.add(new Mana(ColoredManaSymbol.G));
}

View file

@ -296,25 +296,25 @@ public class ManaOptions extends ArrayList<Mana> {
for (Mana existingMana : existingManas) {
Mana manaToPay = manaAvailable.copy();
manaToPay.subtract(existingMana);
if (manaToPay.getBlack() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.BlackMana.toString())) {
manaToPay.subtract(Mana.BlackMana);
addManaCombination(Mana.BlackMana, existingMana, payCombinations, payCombinationsStrings);
if (manaToPay.getBlack() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.BlackMana(1).toString())) {
manaToPay.subtract(Mana.BlackMana(1));
addManaCombination(Mana.BlackMana(1), existingMana, payCombinations, payCombinationsStrings);
}
if (manaToPay.getBlue() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.BlueMana.toString())) {
manaToPay.subtract(Mana.BlueMana);
addManaCombination(Mana.BlueMana, existingMana, payCombinations, payCombinationsStrings);
if (manaToPay.getBlue() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.BlueMana(1).toString())) {
manaToPay.subtract(Mana.BlueMana(1));
addManaCombination(Mana.BlueMana(1), existingMana, payCombinations, payCombinationsStrings);
}
if (manaToPay.getGreen() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.GreenMana.toString())) {
manaToPay.subtract(Mana.GreenMana);
addManaCombination(Mana.GreenMana, existingMana, payCombinations, payCombinationsStrings);
if (manaToPay.getGreen() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.GreenMana(1).toString())) {
manaToPay.subtract(Mana.GreenMana(1));
addManaCombination(Mana.GreenMana(1), existingMana, payCombinations, payCombinationsStrings);
}
if (manaToPay.getRed() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.RedMana.toString())) {
manaToPay.subtract(Mana.RedMana);
addManaCombination(Mana.RedMana, existingMana, payCombinations, payCombinationsStrings);
if (manaToPay.getRed() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.RedMana(1).toString())) {
manaToPay.subtract(Mana.RedMana(1));
addManaCombination(Mana.RedMana(1), existingMana, payCombinations, payCombinationsStrings);
}
if (manaToPay.getWhite() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.WhiteMana.toString())) {
manaToPay.subtract(Mana.WhiteMana);
addManaCombination(Mana.WhiteMana, existingMana, payCombinations, payCombinationsStrings);
if (manaToPay.getWhite() > 0 && !payCombinationsStrings.contains(existingMana.toString() + Mana.WhiteMana(1).toString())) {
manaToPay.subtract(Mana.WhiteMana(1));
addManaCombination(Mana.WhiteMana(1), existingMana, payCombinations, payCombinationsStrings);
}
}
}

View file

@ -39,7 +39,7 @@ import mage.constants.ColoredManaSymbol;
public class RedManaAbility extends BasicManaAbility {
public RedManaAbility() {
super(new BasicManaEffect(Mana.RedMana));
super(new BasicManaEffect(Mana.RedMana(1)));
this.netMana.add(new Mana(ColoredManaSymbol.R));
}

View file

@ -39,7 +39,7 @@ import mage.constants.ColoredManaSymbol;
public class WhiteManaAbility extends BasicManaAbility {
public WhiteManaAbility() {
super(new BasicManaEffect(Mana.WhiteMana));
super(new BasicManaEffect(Mana.WhiteMana(1)));
this.netMana.add(new Mana(ColoredManaSymbol.W));
}

View file

@ -48,7 +48,7 @@ public class EldraziScionToken extends Token {
subtype.add("Scion");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana, new SacrificeSourceCost()));
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost()));
setOriginalExpansionSetCode("BFZ");
}

View file

@ -58,7 +58,7 @@ public class EldraziSpawnToken extends Token {
subtype.add("Spawn");
power = new MageInt(0);
toughness = new MageInt(1);
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana, new SacrificeSourceCost()));
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost()));
availableImageSetCodes = tokenImageSets;
// Get one of the three possible token images

View file

@ -351,23 +351,23 @@ public class ManaUtil {
int countColorless = 0;
ManaAbility chosenManaAbility = null;
for (ManaAbility ability : useableAbilities.values()) {
if (ability instanceof RedManaAbility && mana.contains(Mana.RedMana)) {
if (ability instanceof RedManaAbility && mana.contains(Mana.RedMana(1))) {
chosenManaAbility = ability;
countColorfull++;
}
if (ability instanceof BlackManaAbility && mana.contains(Mana.BlackMana)) {
if (ability instanceof BlackManaAbility && mana.contains(Mana.BlackMana(1))) {
chosenManaAbility = ability;
countColorfull++;
}
if (ability instanceof BlueManaAbility && mana.contains(Mana.BlueMana)) {
if (ability instanceof BlueManaAbility && mana.contains(Mana.BlueMana(1))) {
chosenManaAbility = ability;
countColorfull++;
}
if (ability instanceof WhiteManaAbility && mana.contains(Mana.WhiteMana)) {
if (ability instanceof WhiteManaAbility && mana.contains(Mana.WhiteMana(1))) {
chosenManaAbility = ability;
countColorfull++;
}
if (ability instanceof GreenManaAbility && mana.contains(Mana.GreenMana)) {
if (ability instanceof GreenManaAbility && mana.contains(Mana.GreenMana(1))) {
chosenManaAbility = ability;
countColorfull++;
}