SpellManaCost renamed to ManaCost and moved to forge.card.mana

CostMana renamed to CostPartMana to avoid mixing them up
This commit is contained in:
Maxmtg
2013-02-19 06:30:37 +00:00
parent bb1896cc08
commit e661489893
46 changed files with 232 additions and 226 deletions

4
.gitattributes vendored
View File

@@ -13642,7 +13642,6 @@ src/main/java/forge/card/FormatCollection.java -text
src/main/java/forge/card/MagicColor.java -text
src/main/java/forge/card/MetaSet.java -text
src/main/java/forge/card/MtgDataParser.java -text
src/main/java/forge/card/SpellManaCost.java -text
src/main/java/forge/card/TriggerReplacementBase.java -text
src/main/java/forge/card/UnOpenedMeta.java -text
src/main/java/forge/card/UnOpenedProduct.java -text
@@ -13870,9 +13869,9 @@ src/main/java/forge/card/cost/CostDamage.java -text
src/main/java/forge/card/cost/CostDiscard.java -text
src/main/java/forge/card/cost/CostExile.java -text
src/main/java/forge/card/cost/CostGainLife.java -text
src/main/java/forge/card/cost/CostMana.java -text
src/main/java/forge/card/cost/CostMill.java -text
src/main/java/forge/card/cost/CostPart.java -text
src/main/java/forge/card/cost/CostPartMana.java -text
src/main/java/forge/card/cost/CostPartWithList.java -text
src/main/java/forge/card/cost/CostPayLife.java -text
src/main/java/forge/card/cost/CostPayment.java svneol=native#text/plain
@@ -13889,6 +13888,7 @@ src/main/java/forge/card/cost/CostUtil.java -text
src/main/java/forge/card/cost/package-info.java svneol=native#text/plain
src/main/java/forge/card/mana/IParserManaCost.java -text
src/main/java/forge/card/mana/Mana.java svneol=native#text/plain
src/main/java/forge/card/mana/ManaCost.java -text
src/main/java/forge/card/mana/ManaCostBeingPaid.java svneol=native#text/plain
src/main/java/forge/card/mana/ManaCostParser.java -text
src/main/java/forge/card/mana/ManaCostShard.java -text

View File

@@ -36,13 +36,13 @@ import com.google.common.collect.Iterables;
import forge.CardPredicates.Presets;
import forge.card.CardCharacteristics;
import forge.card.SpellManaCost;
import forge.card.EditionInfo;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplaceMoved;
import forge.card.replacement.ReplacementEffect;
import forge.card.replacement.ReplacementResult;
@@ -1611,7 +1611,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @param s
* a {@link java.lang.String} object.
*/
public final void setManaCost(final SpellManaCost s) {
public final void setManaCost(final ManaCost s) {
this.getCharacteristics().setManaCost(s);
}
@@ -1622,7 +1622,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*
* @return a {@link java.lang.String} object.
*/
public final SpellManaCost getManaCost() {
public final ManaCost getManaCost() {
return this.getCharacteristics().getManaCost();
}

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.TreeMap;
import forge.CardColor;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementEffect;
import forge.card.spellability.SpellAbility;
import forge.card.staticability.StaticAbility;
@@ -35,7 +36,7 @@ import forge.card.trigger.Trigger;
public class CardCharacteristics {
private String name = "";
private ArrayList<String> type = new ArrayList<String>();
private SpellManaCost manaCost = SpellManaCost.NO_COST;
private ManaCost manaCost = ManaCost.NO_COST;
private ArrayList<CardColor> cardColor = new ArrayList<CardColor>();
private boolean cardColorsOverridden = false;
private int baseAttack = 0;
@@ -97,7 +98,7 @@ public class CardCharacteristics {
*
* @return the manaCost
*/
public final SpellManaCost getManaCost() {
public final ManaCost getManaCost() {
return this.manaCost;
}
@@ -107,7 +108,7 @@ public class CardCharacteristics {
* @param manaCost0
* the manaCost to set
*/
public final void setManaCost(final SpellManaCost manaCost0) {
public final void setManaCost(final ManaCost manaCost0) {
this.manaCost = manaCost0;
}

View File

@@ -22,6 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import forge.card.mana.ManaCost;
/**
* TODO: Write javadoc for this type.
*
@@ -29,7 +31,7 @@ import java.util.TreeMap;
public class CardRuleCharacteristics {
private String cardName = null;
private CardType cardType = null;
private SpellManaCost manaCost = SpellManaCost.NO_COST;
private ManaCost manaCost = ManaCost.NO_COST;
private ColorSet color = null;
private String ptLine = null;
private String oracleText = null;
@@ -82,7 +84,7 @@ public class CardRuleCharacteristics {
*
* @return the manaCost
*/
public final SpellManaCost getManaCost() {
public final ManaCost getManaCost() {
return this.manaCost;
}
@@ -92,7 +94,7 @@ public class CardRuleCharacteristics {
* @param manaCost0
* the manaCost to set
*/
public final void setManaCost(final SpellManaCost manaCost0) {
public final void setManaCost(final ManaCost manaCost0) {
this.manaCost = manaCost0;
this.color = ColorSet.fromManaCost(this.manaCost);
}

View File

@@ -25,6 +25,8 @@ import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import forge.card.mana.ManaCost;
@@ -86,7 +88,7 @@ public final class CardRules {
*
* @return the mana cost
*/
public SpellManaCost getManaCost() {
public ManaCost getManaCost() {
return this.characteristics.getManaCost();
}

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import forge.card.mana.ManaCostShard;
import forge.card.mana.IParserManaCost;
import forge.card.mana.ManaCost;
/**
@@ -135,8 +136,8 @@ public class CardRulesReader {
case 'M':
if (line.startsWith("ManaCost:")) {
final String sCost = CardRulesReader.getValueAfterKey(line, "ManaCost:");
this.characteristics[this.curCharacteristics].setManaCost("no cost".equals(sCost) ? SpellManaCost.NO_COST
: new SpellManaCost(new ParserCardnameTxtManaCost(sCost)));
this.characteristics[this.curCharacteristics].setManaCost("no cost".equals(sCost) ? ManaCost.NO_COST
: new ManaCost(new ParserCardnameTxtManaCost(sCost)));
}
case 'N':

View File

@@ -18,6 +18,7 @@
package forge.card;
import forge.Constant;
import forge.card.mana.ManaCost;
import forge.util.BinaryUtil;
/**
@@ -73,7 +74,7 @@ public final class ColorSet implements Comparable<ColorSet> {
return fromMask(mask);
}
public static ColorSet fromManaCost(final SpellManaCost mana) {
public static ColorSet fromManaCost(final ManaCost mana) {
return fromMask(mana.getColorProfile());
}

View File

@@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import forge.card.mana.ManaCostShard;
import forge.card.mana.IParserManaCost;
import forge.card.mana.ManaCost;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.util.FileUtil;
@@ -168,10 +169,10 @@ public final class MtgDataParser implements Iterator<CardRules> {
}
String manaCost = this.it.next();
ret.setManaCost(SpellManaCost.NO_COST);
ret.setManaCost(ManaCost.NO_COST);
CardType type = null;
if (manaCost.startsWith("{")) {
ret.setManaCost(new SpellManaCost(new ManaParserMtgData(manaCost)));
ret.setManaCost(new ManaCost(new ManaParserMtgData(manaCost)));
if (!this.it.hasNext()) {
this.weHaveNext = false;
return null;

View File

@@ -8,9 +8,9 @@ import forge.Card;
import forge.Command;
import forge.GameEntity;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.SpellAbilityEffect;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
@@ -203,7 +203,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
@Override
public void execute() {
final Ability ability = new Ability(hostCard, SpellManaCost.ZERO) {
final Ability ability = new Ability(hostCard, ManaCost.ZERO) {
@Override
public void resolve() {

View File

@@ -10,10 +10,10 @@ import forge.Card;
import forge.CardCharacteristicName;
import forge.Command;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.SpellAbilityEffect;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
@@ -154,7 +154,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
final int index = i;
target[index] = crds[index];
final SpellAbility sac = new Ability(target[index], SpellManaCost.ZERO) {
final SpellAbility sac = new Ability(target[index], ManaCost.ZERO) {
@Override
public void resolve() {
// technically your opponent could steal the token

View File

@@ -11,13 +11,13 @@ import forge.Card;
import forge.CardCharacteristicName;
import forge.CardLists;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.SpellAbilityEffect;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.cost.CostMana;
import forge.card.cost.CostPartMana;
import forge.card.cost.CostPart;
import forge.card.mana.ManaCost;
import forge.card.spellability.Spell;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellAbilityRestriction;
@@ -212,13 +212,13 @@ public class PlayEffect extends SpellAbilityEffect {
final Cost cost = new Cost(tgtCard, "", false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(newSA.getDescription() + " (without paying its mana cost)");
game.getActionPlay().playSpellAbility(newSA, activator);
if (remember) {

View File

@@ -34,9 +34,9 @@ import forge.CardPredicates.Presets;
import forge.Command;
import forge.CounterType;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityFactory;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementEffect;
import forge.card.replacement.ReplacementHandler;
import forge.card.replacement.ReplacementLayer;
@@ -69,7 +69,7 @@ import forge.util.Aggregates;
public class CardFactoryCreatures {
private static void getCard_Stangg(final Card card) {
final Ability ability = new Ability(card, SpellManaCost.ZERO) {
final Ability ability = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
final List<Card> cl = CardFactoryUtil.makeToken("Stangg Twin", "RG 3 4 Stangg Twin",
@@ -119,7 +119,7 @@ public class CardFactoryCreatures {
}
private static void getCard_SphinxJwar(final Card card) {
final SpellAbility ability1 = new AbilityStatic(card, SpellManaCost.ZERO) {
final SpellAbility ability1 = new AbilityStatic(card, ManaCost.ZERO) {
@Override
public void resolve() {
final Player player = card.getController();
@@ -329,7 +329,7 @@ public class CardFactoryCreatures {
}
private static void getCard_KinsbaileBorderguard(final Card card) {
final SpellAbility ability = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility ability = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
card.addCounter(CounterType.P1P1, this.countKithkin(), true);
@@ -363,7 +363,7 @@ public class CardFactoryCreatures {
}
};
final SpellAbility ability2 = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility ability2 = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
for (int i = 0; i < card.sumAllCounters(); i++) {
@@ -519,7 +519,7 @@ public class CardFactoryCreatures {
}
}; // Input
final Ability sacOrSac = new Ability(card, SpellManaCost.NO_COST) {
final Ability sacOrSac = new Ability(card, ManaCost.NO_COST) {
@Override
public void resolve() {
if (player.isHuman()) {
@@ -682,7 +682,7 @@ public class CardFactoryCreatures {
* @param sourceCard
* @param manaCost
*/
public EOTWReplacement(Card sourceCard, SpellManaCost manaCost) {
public EOTWReplacement(Card sourceCard, ManaCost manaCost) {
super(sourceCard, manaCost);
}
@@ -705,7 +705,7 @@ public class CardFactoryCreatures {
}
SpellAbility repAb = new EOTWReplacement(card, SpellManaCost.ZERO);
SpellAbility repAb = new EOTWReplacement(card, ManaCost.ZERO);
CardFactoryUtil.setupETBReplacementAbility(repAb);
ReplacementEffect re = ReplacementHandler.parseReplacement("Event$ Moved | ValidCard$ Creature.Other+YouCtrl | Destination$ Battlefield | ActiveZones$ Battlefield | Description$ Creatures you control enter the battlefield as copies of CARDNAME.", card);

View File

@@ -47,13 +47,13 @@ import forge.Singletons;
import forge.card.CardCharacteristics;
import forge.card.CardType;
import forge.card.MagicColor;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityFactory;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.cost.Cost;
import forge.card.mana.ManaCostParser;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementEffect;
import forge.card.replacement.ReplacementHandler;
import forge.card.replacement.ReplacementLayer;
@@ -880,7 +880,7 @@ public class CardFactoryUtil {
}
};
morphDown.setManaCost(new SpellManaCost(new ManaCostParser("3")));
morphDown.setManaCost(new ManaCost(new ManaCostParser("3")));
morphDown.setDescription("(You may cast this face down as a 2/2 creature for 3.)");
morphDown.setStackDescription("Morph - Creature 2/2");
morphDown.setCastFaceDown(true);
@@ -3387,7 +3387,7 @@ public class CardFactoryUtil {
final String s = parse[1];
final int magnitude = Integer.parseInt(s);
final Ability ability = new Ability(c, SpellManaCost.ZERO) {
final Ability ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final Command untilEOT = new Command() {
@@ -3524,7 +3524,7 @@ public class CardFactoryUtil {
if (extraLand) {
final List<Card> fastbonds = player.getCardsIn(ZoneType.Battlefield, "Fastbond");
for (final Card f : fastbonds) {
final SpellAbility ability = new Ability(f, SpellManaCost.ZERO) {
final SpellAbility ability = new Ability(f, ManaCost.ZERO) {
@Override
public void resolve() {
f.getController().addDamage(1, f);
@@ -3721,7 +3721,7 @@ public class CardFactoryUtil {
final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsMultiKicker(true);
sa.setMultiKickerManaCost(new SpellManaCost( new ManaCostParser(k[1])));
sa.setMultiKickerManaCost(new ManaCost( new ManaCostParser(k[1])));
}
}
@@ -3733,7 +3733,7 @@ public class CardFactoryUtil {
final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsReplicate(true);
sa.setReplicateManaCost(new SpellManaCost(new ManaCostParser(k[1])));
sa.setReplicateManaCost(new ManaCost(new ManaCostParser(k[1])));
}
}
@@ -3762,7 +3762,7 @@ public class CardFactoryUtil {
final String[] k = parse.split(":");
final String evokedCost = k[1];
evokedSpell.setManaCost(new SpellManaCost(new ManaCostParser(evokedCost)));
evokedSpell.setManaCost(new ManaCost(new ManaCostParser(evokedCost)));
final StringBuilder desc = new StringBuilder();
desc.append("Evoke ").append(evokedCost);
@@ -4037,7 +4037,7 @@ public class CardFactoryUtil {
final Trigger haunterDies = forge.card.trigger.TriggerHandler
.parseTrigger(sbHaunter.toString(), card, true);
final Ability haunterDiesWork = new Ability(card, SpellManaCost.ZERO) {
final Ability haunterDiesWork = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
this.getTargetCard().addHauntedBy(card);
@@ -4072,7 +4072,7 @@ public class CardFactoryUtil {
}
};
final Ability haunterDiesSetup = new Ability(card, SpellManaCost.ZERO) {
final Ability haunterDiesSetup = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
final List<Card> creats = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
@@ -4133,7 +4133,7 @@ public class CardFactoryUtil {
final Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger(sbUnExiled.toString(), card,
true);
final Ability haunterUnExiledWork = new Ability(card, SpellManaCost.ZERO) {
final Ability haunterUnExiledWork = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
if (card.getHaunting() != null) {
@@ -4255,7 +4255,7 @@ public class CardFactoryUtil {
newSA.setDescription(origSA.getDescription());
origSA.setPayCosts(null);
origSA.setManaCost(SpellManaCost.ZERO);
origSA.setManaCost(ManaCost.ZERO);
card.clearSpellAbility();
card.addSpellAbility(newSA);
@@ -4762,7 +4762,7 @@ public class CardFactoryUtil {
card.addIntrinsicKeyword("etbCounter:P1P1:" + m + ":no Condition:"
+ "Modular " + m + " (This enters the battlefield with " + m + " +1/+1 counters on it. When it's put into a graveyard, you may put its +1/+1 counters on target artifact creature.)");
final SpellAbility ability = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility ability = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
final Card card2 = this.getTargetCard();

View File

@@ -39,11 +39,11 @@ import forge.Card;
import forge.CardCharacteristicName;
import forge.CardColor;
import forge.CardUtil;
import forge.card.SpellManaCost;
import forge.card.CardRules;
import forge.card.CardRulesReader;
import forge.card.EditionInfo;
import forge.card.mana.ManaCostParser;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementHandler;
import forge.card.trigger.TriggerHandler;
import forge.error.ErrorViewer;
@@ -377,7 +377,7 @@ public class CardReader {
final String value = line.substring(9);
// System.out.println(s);
if (!"no cost".equals(value)) {
card.setManaCost(new SpellManaCost(new ManaCostParser(value)));
card.setManaCost(new ManaCost(new ManaCostParser(value)));
}
}
break;

View File

@@ -24,9 +24,9 @@ import java.util.regex.Pattern;
import forge.Card;
import forge.CounterType;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCostParser;
import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.TextUtil;
@@ -78,7 +78,7 @@ public class Cost {
* @return a boolean.
*/
public final boolean hasNoManaCost() {
return this.getTotalMana() == SpellManaCost.ZERO;
return this.getTotalMana() == ManaCost.ZERO;
}
/**
@@ -91,7 +91,7 @@ public class Cost {
public final boolean isOnlyManaCost() {
// Only used by Morph and Equip... why do we need this?
for (final CostPart part : this.costParts) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
return false;
}
}
@@ -106,21 +106,21 @@ public class Cost {
*
* @return a {@link java.lang.String} object.
*/
public final SpellManaCost getTotalMana() {
public final ManaCost getTotalMana() {
for (final CostPart part : this.costParts) {
if (part instanceof CostMana) {
return new SpellManaCost(new ManaCostParser(part.toString()));
if (part instanceof CostPartMana) {
return new ManaCost(new ManaCostParser(part.toString()));
}
}
return SpellManaCost.ZERO;
return ManaCost.ZERO;
}
private final String name;
// Parsing Strings
public Cost(final Card card, SpellManaCost cost, final boolean bAbility) {
public Cost(final Card card, ManaCost cost, final boolean bAbility) {
this(card, cost.toString(), bAbility);
}
@@ -161,7 +161,7 @@ public class Cost {
}
if ((amountX > 0) || manaParts.length() > 0) {
this.costParts.add(0, new CostMana(manaParts.toString(), amountX, xCantBe0));
this.costParts.add(0, new CostPartMana(manaParts.toString(), amountX, xCantBe0));
}
@@ -350,26 +350,26 @@ public class Cost {
boolean costChanged = false;
// TODO: Change where ChangeCost happens
for (final CostPart part : this.costParts) {
if (part instanceof CostMana) {
final SpellManaCost mana = new SpellManaCost(new ManaCostParser(part.toString()));
if (part instanceof CostPartMana) {
final ManaCost mana = new ManaCost(new ManaCostParser(part.toString()));
final ManaCostBeingPaid changedCost = Singletons.getModel().getGame().getActionPlay().getSpellCostChange(sa, new ManaCostBeingPaid(mana));
((CostMana)part).setAdjustedMana(changedCost.toString(false));
((CostPartMana)part).setAdjustedMana(changedCost.toString(false));
costChanged = true;
}
}
if (!costChanged) {
// Spells with a cost of 0 should be affected too
final ManaCostBeingPaid changedCost = Singletons.getModel().getGame().getActionPlay().getSpellCostChange(sa, new ManaCostBeingPaid("0"));
this.costParts.add(new CostMana(changedCost.toString(), 0, false));
this.costParts.add(new CostPartMana(changedCost.toString(), 0, false));
}
}
public final CostMana getCostMana() {
public final CostPartMana getCostMana() {
// TODO: Change where ChangeCost happens
for (final CostPart part : this.costParts) {
if (part instanceof CostMana) {
return (CostMana) part;
if (part instanceof CostPartMana) {
return (CostPartMana) part;
}
}
return null;
@@ -500,7 +500,7 @@ public class Cost {
}
for (final CostPart part : this.costParts) {
if (part instanceof CostMana) {
if (part instanceof CostPartMana) {
continue;
}
if (!first) {
@@ -535,7 +535,7 @@ public class Cost {
for (final CostPart part : this.costParts) {
boolean append = true;
if (!first) {
if (part instanceof CostMana) {
if (part instanceof CostPartMana) {
cost.insert(0, ", ").insert(0, part.toString());
append = false;
} else {

View File

@@ -32,9 +32,9 @@ import forge.game.player.AIPlayer;
import forge.game.player.Player;
/**
* The Class CostMana.
* The mana component of any spell or ability cost
*/
public class CostMana extends CostPart {
public class CostPartMana extends CostPart {
// "Leftover"
private String mana = "";
private int amountX = 0;
@@ -151,7 +151,7 @@ public class CostMana extends CostPart {
* the amount
* @param xCantBe0 TODO
*/
public CostMana(final String mana, final int amount, boolean xCantBe0) {
public CostPartMana(final String mana, final int amount, boolean xCantBe0) {
this.mana = mana.trim();
this.amountX = amount;
this.setxCantBe0(xCantBe0);

View File

@@ -296,7 +296,7 @@ public class CostPayment {
final List<CostPart> parts = this.cost.getCostParts();
if (this.getCost().getCostMana() == null) {
parts.add(new CostMana("0", 0, false));
parts.add(new CostPartMana("0", 0, false));
}
// Set all of the decisions before attempting to pay anything

View File

@@ -139,10 +139,10 @@ public class CostUtil {
}
for (final CostPart part : cost1.getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost2.getCostParts().add(part);
} else {
CostMana newCostMana = cost2.getCostMana();
CostPartMana newCostMana = cost2.getCostMana();
if (newCostMana != null) {
ManaCostBeingPaid oldManaCost = new ManaCostBeingPaid(part.toString());
newCostMana.setXMana(oldManaCost.getXcounter() + newCostMana.getXMana());

View File

@@ -15,14 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.card;
package forge.card.mana;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import forge.card.mana.ManaCostShard;
import forge.card.mana.IParserManaCost;
import forge.card.ColorSet;
/**
* <p>
@@ -33,7 +32,7 @@ import forge.card.mana.IParserManaCost;
* @version $Id: CardManaCost.java 9708 2011-08-09 19:34:12Z jendave $
*/
public final class SpellManaCost implements Comparable<SpellManaCost> {
public final class ManaCost implements Comparable<ManaCost> {
private final List<ManaCostShard> shards;
private final int genericCost;
private final boolean hasNoCost; // lands cost
@@ -42,12 +41,12 @@ public final class SpellManaCost implements Comparable<SpellManaCost> {
private Float compareWeight = null;
/** The Constant empty. */
public static final SpellManaCost NO_COST = new SpellManaCost(-1);
public static final SpellManaCost ZERO = new SpellManaCost(0);
public static final SpellManaCost ONE = new SpellManaCost(1);
public static final ManaCost NO_COST = new ManaCost(-1);
public static final ManaCost ZERO = new ManaCost(0);
public static final ManaCost ONE = new ManaCost(1);
// pass mana cost parser here
private SpellManaCost(int cmc) {
private ManaCost(int cmc) {
this.hasNoCost = cmc < 0;
this.genericCost = cmc < 0 ? 0 : cmc;
this.shards = Collections.unmodifiableList(new ArrayList<ManaCostShard>());
@@ -61,7 +60,7 @@ public final class SpellManaCost implements Comparable<SpellManaCost> {
* @param parser
* the parser
*/
public SpellManaCost(final IParserManaCost parser) {
public ManaCost(final IParserManaCost parser) {
if (!parser.hasNext()) {
throw new RuntimeException("Empty manacost passed to parser (this should have been handled before)");
}
@@ -187,7 +186,7 @@ public final class SpellManaCost implements Comparable<SpellManaCost> {
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(final SpellManaCost o) {
public int compareTo(final ManaCost o) {
return this.getCompareWeight().compareTo(o.getCompareWeight());
}

View File

@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map.Entry;
import forge.Constant;
import forge.card.MagicColor;
import forge.card.SpellManaCost;
/**
* <p>
@@ -55,10 +54,10 @@ public class ManaCostBeingPaid {
* a {@link java.lang.String} object.
*/
public ManaCostBeingPaid(String sCost) {
this("0".equals(sCost) || "C".equals(sCost) || sCost.isEmpty() ? null : new SpellManaCost(new ManaCostParser(sCost)));
this("0".equals(sCost) || "C".equals(sCost) || sCost.isEmpty() ? null : new ManaCost(new ManaCostParser(sCost)));
}
public ManaCostBeingPaid(SpellManaCost manaCost) {
public ManaCostBeingPaid(ManaCost manaCost) {
if ( null == manaCost )
return;
@@ -521,7 +520,7 @@ public class ManaCostBeingPaid {
* a {@link java.lang.String} object.
*/
public final void combineManaCost(final String extra) {
final SpellManaCost manaCost = new SpellManaCost(new ManaCostParser(extra));
final ManaCost manaCost = new ManaCost(new ManaCostParser(extra));
for (ManaCostShard shard : manaCost.getShards()) {
if (shard == ManaCostShard.X) {
cntX++;

View File

@@ -21,7 +21,7 @@ import com.esotericsoftware.minlog.Log;
import forge.Card;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCost;
/**
* <p>
@@ -43,7 +43,7 @@ public abstract class Ability extends SpellAbility {
* @param manaCost
* a {@link java.lang.String} object.
*/
public Ability(final Card sourceCard, final SpellManaCost manaCost) {
public Ability(final Card sourceCard, final ManaCost manaCost) {
super(sourceCard);
this.setManaCost(manaCost);
}
@@ -60,7 +60,7 @@ public abstract class Ability extends SpellAbility {
* @param stackDescription
* a {@link java.lang.String} object.
*/
public Ability(final Card sourceCard, final SpellManaCost manaCost, final String stackDescription) {
public Ability(final Card sourceCard, final ManaCost manaCost, final String stackDescription) {
this(sourceCard, manaCost);
this.setStackDescription(stackDescription);
Log.debug("an ability is being played from" + sourceCard.getName());

View File

@@ -18,8 +18,8 @@
package forge.card.spellability;
import forge.Card;
import forge.card.SpellManaCost;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
/**
* <p>
@@ -40,7 +40,7 @@ public abstract class AbilityStatic extends Ability {
* @param manaCost
* a {@link java.lang.String} object.
*/
public AbilityStatic(final Card sourceCard, final SpellManaCost manaCost) {
public AbilityStatic(final Card sourceCard, final ManaCost manaCost) {
super(sourceCard, manaCost);
}

View File

@@ -23,7 +23,7 @@ import forge.Card;
import forge.CardCharacteristicName;
import forge.Command;
import forge.card.CardCharacteristics;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCost;
import forge.card.trigger.ZCTrigger;
/**
@@ -82,7 +82,7 @@ public class AbilityTriggered extends Ability implements Command {
* a {@link forge.card.trigger.ZCTrigger} object.
*/
public AbilityTriggered(final Card sourceCard, final Command sourceCommand, final ZCTrigger situation) {
super(sourceCard, SpellManaCost.ZERO);
super(sourceCard, ManaCost.ZERO);
this.todo = sourceCommand;
this.trigger = situation;
if (this.todo instanceof AbilityTriggered) {

View File

@@ -28,11 +28,11 @@ import org.apache.commons.lang.StringUtils;
import forge.Card;
import forge.GameEntity;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.cost.Cost;
import forge.card.mana.Mana;
import forge.card.mana.ManaCost;
import forge.control.input.Input;
import forge.game.player.AIPlayer;
import forge.game.player.Player;
@@ -53,9 +53,9 @@ public abstract class SpellAbility implements ISpellAbility {
private String description = "";
private Player targetPlayer = null;
private String stackDescription = "";
private SpellManaCost manaCost = null;
private SpellManaCost multiKickerManaCost = null;
private SpellManaCost replicateManaCost = null;
private ManaCost manaCost = null;
private ManaCost multiKickerManaCost = null;
private ManaCost replicateManaCost = null;
private int xManaCost = 0;
private Player activatingPlayer = null;
@@ -231,7 +231,7 @@ public abstract class SpellAbility implements ISpellAbility {
*
* @return a {@link java.lang.String} object.
*/
public SpellManaCost getManaCost() {
public ManaCost getManaCost() {
return this.manaCost;
}
@@ -243,7 +243,7 @@ public abstract class SpellAbility implements ISpellAbility {
* @param cost
* a {@link java.lang.String} object.
*/
public void setManaCost(final SpellManaCost cost) {
public void setManaCost(final ManaCost cost) {
this.manaCost = cost;
}
@@ -254,7 +254,7 @@ public abstract class SpellAbility implements ISpellAbility {
*
* @return a {@link java.lang.String} object.
*/
public SpellManaCost getMultiKickerManaCost() {
public ManaCost getMultiKickerManaCost() {
return this.multiKickerManaCost;
}
@@ -266,7 +266,7 @@ public abstract class SpellAbility implements ISpellAbility {
* @param cost
* a {@link java.lang.String} object.
*/
public void setMultiKickerManaCost(final SpellManaCost cost) {
public void setMultiKickerManaCost(final ManaCost cost) {
this.multiKickerManaCost = cost;
}
@@ -277,7 +277,7 @@ public abstract class SpellAbility implements ISpellAbility {
*
* @return a {@link java.lang.String} object.
*/
public SpellManaCost getReplicateManaCost() {
public ManaCost getReplicateManaCost() {
return this.replicateManaCost;
}
@@ -289,7 +289,7 @@ public abstract class SpellAbility implements ISpellAbility {
* @param spellManaCost
* a {@link java.lang.String} object.
*/
public final void setReplicateManaCost(final SpellManaCost spellManaCost) {
public final void setReplicateManaCost(final ManaCost spellManaCost) {
this.replicateManaCost = spellManaCost;
}

View File

@@ -30,11 +30,11 @@ import forge.CardLists;
import forge.CardPredicates;
import forge.Command;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityFactory;
import forge.card.ability.ApiType;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplaceMoved;
import forge.card.replacement.ReplacementEffect;
import forge.card.trigger.Trigger;
@@ -92,7 +92,7 @@ public class SpellPermanent extends Spell {
}; // CommandReturn
/** The champion ability comes. */
private final SpellAbility championAbilityComes = new Ability(this.getSourceCard(), SpellManaCost.ZERO) {
private final SpellAbility championAbilityComes = new Ability(this.getSourceCard(), ManaCost.ZERO) {
@Override
public void resolve() {
@@ -153,7 +153,7 @@ public class SpellPermanent extends Spell {
@Override
public void execute() {
final SpellAbility ability = new Ability(SpellPermanent.this.getSourceCard(), SpellManaCost.ZERO) {
final SpellAbility ability = new Ability(SpellPermanent.this.getSourceCard(), ManaCost.ZERO) {
@Override
public void resolve() {
final Card c = this.getSourceCard().getChampionedCard();
@@ -282,7 +282,7 @@ public class SpellPermanent extends Spell {
public boolean canPlayAI() {
final Card card = this.getSourceCard();
SpellManaCost mana = this.getPayCosts().getTotalMana();
ManaCost mana = this.getPayCosts().getTotalMana();
Player ai = getActivatingPlayer();
if (mana.countX() > 0) {
// Set PayX here to maximum value.
@@ -329,7 +329,7 @@ public class SpellPermanent extends Spell {
}
final AIPlayer ai = (AIPlayer) getActivatingPlayer();
final Card card = this.getSourceCard();
SpellManaCost mana = this.getPayCosts().getTotalMana();
ManaCost mana = this.getPayCosts().getTotalMana();
final Cost cost = this.getPayCosts();
if (cost != null) {

View File

@@ -27,11 +27,11 @@ import forge.Card;
import forge.CardLists;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityFactory;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.ability.effects.CharmEffect;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
@@ -488,7 +488,7 @@ public class TriggerHandler {
sa = regtrig.getOverridingAbility();
if (sa == null) {
if (!triggerParams.containsKey("Execute")) {
sa = new Ability(regtrig.getHostCard(), SpellManaCost.ZERO) {
sa = new Ability(regtrig.getHostCard(), ManaCost.ZERO) {
@Override
public void resolve() {
}

View File

@@ -7,9 +7,9 @@ import java.util.Map;
import forge.Card;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.ApiType;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilitySub;
import forge.card.spellability.ISpellAbility;
@@ -38,7 +38,7 @@ public class WrappedAbility extends Ability implements ISpellAbility {
boolean mandatory = false;
public WrappedAbility(final Trigger regTrig, final SpellAbility sa0, final Player decider0) {
super(regTrig.getHostCard(), SpellManaCost.ZERO);
super(regTrig.getHostCard(), ManaCost.ZERO);
regtrig = regTrig;
sa = sa0;
decider = decider0;
@@ -165,12 +165,12 @@ public class WrappedAbility extends Ability implements ISpellAbility {
}
@Override
public SpellManaCost getMultiKickerManaCost() {
public ManaCost getMultiKickerManaCost() {
return sa.getMultiKickerManaCost();
}
@Override
public SpellManaCost getReplicateManaCost() {
public ManaCost getReplicateManaCost() {
return sa.getReplicateManaCost();
}
@@ -301,7 +301,7 @@ public class WrappedAbility extends Ability implements ISpellAbility {
}
@Override
public void setMultiKickerManaCost(final SpellManaCost cost) {
public void setMultiKickerManaCost(final ManaCost cost) {
sa.setMultiKickerManaCost(cost);
}

View File

@@ -2,7 +2,7 @@ package forge.control.input;
import forge.Card;
import forge.Singletons;
import forge.card.cost.CostMana;
import forge.card.cost.CostPartMana;
import forge.card.cost.CostPayment;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.spellability.SpellAbility;
@@ -14,7 +14,7 @@ import forge.view.ButtonUtil;
public class InputPayManaOfCostPayment extends InputPayManaBase {
private final CostMana costMana;
private final CostPartMana costMana;
// I would kill the one who made 2 classes like above
private final String originalManaCost;
@@ -22,7 +22,7 @@ public class InputPayManaOfCostPayment extends InputPayManaBase {
private final int manaToAdd;
private final CostPayment payment;
public InputPayManaOfCostPayment(final GameState game, CostMana costMana, SpellAbility spellAbility, final CostPayment payment, int toAdd) {
public InputPayManaOfCostPayment(final GameState game, CostPartMana costMana, SpellAbility spellAbility, final CostPayment payment, int toAdd) {
super(game);
manaCost = new ManaCostBeingPaid(costMana.getManaToPay());
manaCost.increaseColorlessMana(toAdd);

View File

@@ -2,7 +2,7 @@ package forge.control.input;
import forge.Card;
import forge.Singletons;
import forge.card.cost.CostMana;
import forge.card.cost.CostPartMana;
import forge.card.cost.CostPayment;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.spellability.SpellAbility;
@@ -17,12 +17,12 @@ public class InputPayManaX extends InputPayManaBase {
private final String colorX;
private final String strX;
private String colorsPaid;
private final CostMana costMana;
private final CostPartMana costMana;
private final CostPayment payment;
private final SpellAbility sa;
public InputPayManaX(final GameState game, final SpellAbility sa0, final CostPayment payment0, final CostMana costMana0)
public InputPayManaX(final GameState game, final SpellAbility sa0, final CostPayment payment0, final CostPartMana costMana0)
{
super(game);
sa = sa0;

View File

@@ -27,8 +27,8 @@ import com.google.common.base.Predicate;
import forge.card.MagicColor;
import forge.card.ColorSet;
import forge.card.SpellManaCost;
import forge.card.CardRules;
import forge.card.mana.ManaCost;
/**
* <p>
@@ -57,7 +57,7 @@ public class GenerateDeckUtil {
public static final Predicate<CardRules> COLORLESS_CARDS = new Predicate<CardRules>() {
@Override
public boolean apply(CardRules c) {
SpellManaCost mc = c.getManaCost();
ManaCost mc = c.getManaCost();
return mc.getColorProfile() == 0 && !mc.isNoCost();
}
};
@@ -71,7 +71,7 @@ public class GenerateDeckUtil {
@Override
public boolean apply(CardRules subject) {
SpellManaCost mc = subject.getManaCost();
ManaCost mc = subject.getManaCost();
return !mc.isPureGeneric() && mc.canBePaidWithAvaliable(allowedColor);
// return allowedColor.containsAllColorsFrom(mc.getColorProfile());
}
@@ -88,7 +88,7 @@ public class GenerateDeckUtil {
@Override
public boolean apply(CardRules c) {
SpellManaCost mc = c.getManaCost();
ManaCost mc = c.getManaCost();
int cmc = mc.getCMC();
return cmc >= min && cmc <= max && !mc.isNoCost();
}

View File

@@ -34,9 +34,9 @@ import forge.Command;
import forge.CounterType;
import forge.GameEntity;
import forge.card.CardType;
import forge.card.SpellManaCost;
import forge.card.ability.effects.AttachEffect;
import forge.card.cost.Cost;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementEffect;
import forge.card.replacement.ReplacementResult;
import forge.card.spellability.Ability;
@@ -524,7 +524,7 @@ public class GameAction {
final StringBuilder sb = new StringBuilder();
sb.append("Recover ").append(recoverable).append("\n");
final Ability recoverAbility = new Ability(recoverable, SpellManaCost.ZERO) {
final Ability recoverAbility = new Ability(recoverable, ManaCost.ZERO) {
@Override
public void resolve() {
Player p = recoverable.getController();
@@ -778,7 +778,7 @@ public class GameAction {
madness.setStackDescription(sb.toString());
// TODO Convert this to a Trigger
final Ability activate = new Ability(card, SpellManaCost.ZERO) {
final Ability activate = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
// pay madness cost here.
@@ -1250,7 +1250,7 @@ public class GameAction {
}
final Card card = c;
final AbilityStatic ability = new AbilityStatic(crd, SpellManaCost.ZERO) {
final AbilityStatic ability = new AbilityStatic(crd, ManaCost.ZERO) {
@Override
public void resolve() {
GameAction.this.destroy(crd);
@@ -1356,7 +1356,7 @@ public class GameAction {
if (persist) {
final Card persistCard = newCard;
final Ability persistAb = new Ability(persistCard, SpellManaCost.ZERO) {
final Ability persistAb = new Ability(persistCard, ManaCost.ZERO) {
@Override
public void resolve() {
@@ -1376,7 +1376,7 @@ public class GameAction {
if (undying) {
final Card undyingCard = newCard;
final Ability undyingAb = new Ability(undyingCard, SpellManaCost.ZERO) {
final Ability undyingAb = new Ability(undyingCard, ManaCost.ZERO) {
@Override
public void resolve() {

View File

@@ -10,7 +10,6 @@ import forge.CardLists;
import forge.CardPredicates;
import forge.CardUtil;
import forge.card.MagicColor;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.ability.effects.CharmEffect;
@@ -19,6 +18,7 @@ import forge.card.cost.Cost;
import forge.card.cost.CostPayment;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellAbilityRequirements;
import forge.card.spellability.Target;
@@ -92,7 +92,7 @@ public class GameActionPlay {
game.getStack().add(sa, x);
} else {
sa.setManaCost(SpellManaCost.ZERO); // Beached As
sa.setManaCost(ManaCost.ZERO); // Beached As
matchInput.setInput(sa.getBeforePayMana());
}
}

View File

@@ -33,7 +33,6 @@ import forge.Constant;
import forge.CounterType;
import forge.Singletons;
import forge.CardPredicates.Presets;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityFactory;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
@@ -44,12 +43,13 @@ import forge.card.cost.CostDiscard;
import forge.card.cost.CostExile;
import forge.card.cost.CostPart;
import forge.card.cost.CostPayLife;
import forge.card.cost.CostMana;
import forge.card.cost.CostPartMana;
import forge.card.cost.CostPutCounter;
import forge.card.cost.CostRemoveCounter;
import forge.card.cost.CostReturn;
import forge.card.cost.CostSacrifice;
import forge.card.cost.CostUtil;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilityManaPart;
import forge.card.spellability.AbilitySub;
@@ -92,7 +92,7 @@ public final class GameActionUtil {
private final boolean canRegenerate;
public AbilityDestroy(Card sourceCard, Card affected, boolean canRegenerate) {
super(sourceCard, SpellManaCost.ZERO);
super(sourceCard, ManaCost.ZERO);
this.affected = affected;
this.canRegenerate = canRegenerate;
}
@@ -118,7 +118,7 @@ public final class GameActionUtil {
* @param controller
* @param cascCard
*/
private CascadeAbility(Card sourceCard, SpellManaCost manaCost, Player controller, Card cascCard) {
private CascadeAbility(Card sourceCard, ManaCost manaCost, Player controller, Card cascCard) {
super(sourceCard, manaCost);
this.controller = controller;
this.cascCard = cascCard;
@@ -204,7 +204,7 @@ public final class GameActionUtil {
void doCascade(final Card c, final Player controller) {
final Card cascCard = c;
final Ability ability = new CascadeAbility(c, SpellManaCost.ZERO, controller, cascCard);
final Ability ability = new CascadeAbility(c, ManaCost.ZERO, controller, cascCard);
final StringBuilder sb = new StringBuilder();
sb.append(c).append(" - Cascade.");
ability.setStackDescription(sb.toString());
@@ -232,7 +232,7 @@ public final class GameActionUtil {
* @param rippleCount
* @param rippleCard
*/
private RippleAbility(Card sourceCard, SpellManaCost manaCost, Player controller, int rippleCount,
private RippleAbility(Card sourceCard, ManaCost manaCost, Player controller, int rippleCount,
Card rippleCard) {
super(sourceCard, manaCost);
this.controller = controller;
@@ -348,7 +348,7 @@ public final class GameActionUtil {
if (controller.isComputer() || GuiDialog.confirm(c, "Activate Ripple for " + c + "?")) {
final Ability ability = new RippleAbility(c, SpellManaCost.ZERO, controller, rippleCount, rippleCard);
final Ability ability = new RippleAbility(c, ManaCost.ZERO, controller, rippleCount, rippleCard);
final StringBuilder sb = new StringBuilder();
sb.append(c).append(" - Ripple.");
ability.setStackDescription(sb.toString());
@@ -397,7 +397,7 @@ public final class GameActionUtil {
* @param unpaid
* a {@link forge.Command} object.
*/
public static void payManaDuringAbilityResolve(final String message, final SpellManaCost spellManaCost, final Command paid,
public static void payManaDuringAbilityResolve(final String message, final ManaCost spellManaCost, final Command paid,
final Command unpaid) {
// temporarily disable the Resolve flag, so the user can payMana for the
// resolving Ability
@@ -588,7 +588,7 @@ public final class GameActionUtil {
remainingParts.remove(part);
}
else if (part instanceof CostMana && ((CostMana) part).getManaToPay().equals("0")) {
else if (part instanceof CostPartMana && ((CostPartMana) part).getManaToPay().equals("0")) {
remainingParts.remove(part);
}
}
@@ -620,7 +620,7 @@ public final class GameActionUtil {
else if (costPart instanceof CostDiscard) {
toSet = new InputPayDiscardCost((CostDiscard) costPart, ability, paid, unpaid);
}
else if (costPart instanceof CostMana) {
else if (costPart instanceof CostPartMana) {
toSet = new InputPayManaExecuteCommands(game, source + "\r\n", ability.getManaCost().toString(), paid, unpaid);
}
@@ -723,7 +723,7 @@ public final class GameActionUtil {
+ "this turn is put into a graveyard, put")) {
final Card thisCard = c;
final String kw = a.get(i).toString();
final Ability ability2 = new Ability(c, SpellManaCost.ZERO) {
final Ability ability2 = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
CounterType counter = CounterType.P1P1;
@@ -801,7 +801,7 @@ public final class GameActionUtil {
final int poison = Integer.parseInt(k[1]);
final Card crd = c;
final Ability ability = new Ability(c, SpellManaCost.ZERO) {
final Ability ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final Player player = crd.getController();
@@ -858,7 +858,7 @@ public final class GameActionUtil {
final ArrayList<Card> auras = enchanted.getEnchantedBy();
for (final Card aura : auras) {
if (aura.getName().equals("Celestial Mantle")) {
final Ability doubleLife = new Ability(aura, SpellManaCost.ZERO) {
final Ability doubleLife = new Ability(aura, ManaCost.ZERO) {
@Override
public void resolve() {
final int life = enchanted.getController().getLife();
@@ -887,7 +887,7 @@ public final class GameActionUtil {
final Player opponent = player.getOpponent();
if (c.getNetAttack() > 0) {
final Ability ability = new Ability(c, SpellManaCost.ZERO) {
final Ability ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
@@ -1225,14 +1225,14 @@ public final class GameActionUtil {
final Cost cost = new Cost(source, "", false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setBasicSpell(false);
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
alternatives.add(newSA);
}
@@ -1246,14 +1246,14 @@ public final class GameActionUtil {
final Cost cost = new Cost(source, "", false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setBasicSpell(false);
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
alternatives.add(newSA);
}
@@ -1266,14 +1266,14 @@ public final class GameActionUtil {
final Cost cost = new Cost(source, "", false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setBasicSpell(false);
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(sa.getDescription() + " (without paying its mana cost and as though it has flash)");
alternatives.add(newSA);
}
@@ -1282,14 +1282,14 @@ public final class GameActionUtil {
final Cost cost = new Cost(source, keyword.substring(17), false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setBasicSpell(false);
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
String costString = cost.toSimpleString();
if (costString.equals("")) {
costString = "0";
@@ -1344,7 +1344,7 @@ public final class GameActionUtil {
final SpellAbility newSA = s.copy();
newSA.setBasicSpell(false);
newSA.setPayCosts(combineCosts(newSA, keyword.substring(19)));
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(s.getDescription() + " (Splicing " + c + " onto it)");
newSA.addSplicedCards(c);
SpellAbility child = newSA;
@@ -1390,7 +1390,7 @@ public final class GameActionUtil {
final SpellAbility newSA = sa.copy();
newSA.setBasicSpell(false);
newSA.setPayCosts(GameActionUtil.combineCosts(newSA, keyword.substring(8)));
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(sa.getDescription() + " (with Buyback)");
ArrayList<String> newoacs = new ArrayList<String>();
newoacs.addAll(sa.getOptionalAdditionalCosts());
@@ -1407,7 +1407,7 @@ public final class GameActionUtil {
final SpellAbility newSA = sa.copy();
newSA.setBasicSpell(false);
newSA.setPayCosts(GameActionUtil.combineCosts(newSA, keyword.substring(7)));
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
final Cost cost = new Cost(source, keyword.substring(7), false);
newSA.setDescription(sa.getDescription() + " (Kicker " + cost.toSimpleString() + ")");
ArrayList<String> newoacs = new ArrayList<String>();
@@ -1427,7 +1427,7 @@ public final class GameActionUtil {
final SpellAbility newSA = sa.copy();
newSA.setBasicSpell(false);
newSA.setPayCosts(GameActionUtil.combineCosts(newSA, costString1));
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
final Cost cost1 = new Cost(source, costString1, false);
newSA.setDescription(sa.getDescription() + " (Additional cost " + cost1.toSimpleString() + ")");
ArrayList<String> newoacs = new ArrayList<String>();
@@ -1440,7 +1440,7 @@ public final class GameActionUtil {
final SpellAbility newSA2 = sa.copy();
newSA2.setBasicSpell(false);
newSA2.setPayCosts(GameActionUtil.combineCosts(newSA2, costString2));
newSA2.setManaCost(SpellManaCost.NO_COST);
newSA2.setManaCost(ManaCost.NO_COST);
final Cost cost2 = new Cost(source, costString2, false);
newSA2.setDescription(sa.getDescription() + " (Additional cost " + cost2.toSimpleString() + ")");
ArrayList<String> newoacs2 = new ArrayList<String>();
@@ -1460,7 +1460,7 @@ public final class GameActionUtil {
final String conspireCost = "tapXType<2/Creature.SharesColorWith/untapped creature you control"
+ " that shares a color with " + source.getName() + ">";
newSA.setPayCosts(GameActionUtil.combineCosts(newSA, conspireCost));
newSA.setManaCost(SpellManaCost.NO_COST);
newSA.setManaCost(ManaCost.NO_COST);
newSA.setDescription(sa.getDescription() + " (Conspire)");
ArrayList<String> newoacs = new ArrayList<String>();
newoacs.addAll(sa.getOptionalAdditionalCosts());

View File

@@ -31,16 +31,16 @@ import forge.CardPredicates;
import forge.CardPredicates.Presets;
import forge.CardUtil;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.ability.effects.CharmEffect;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.cost.CostMana;
import forge.card.cost.CostPartMana;
import forge.card.cost.CostPart;
import forge.card.cost.CostPayment;
import forge.card.cost.CostUtil;
import forge.card.mana.ManaCost;
import forge.card.spellability.AbilityStatic;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
@@ -257,13 +257,13 @@ public class ComputerUtil {
final Cost cost = new Cost(sa.getSourceCard(), "", false);
if (newSA.getPayCosts() != null) {
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) {
if (!(part instanceof CostPartMana)) {
cost.getCostParts().add(part);
}
}
}
newSA.setPayCosts(cost);
newSA.setManaCost(SpellManaCost.ZERO);
newSA.setManaCost(ManaCost.ZERO);
final StringBuilder sb = new StringBuilder();
sb.append(sa.getDescription()).append(" (without paying its mana cost)");
newSA.setDescription(sb.toString());

View File

@@ -15,7 +15,6 @@ import forge.CardUtil;
import forge.Constant;
import forge.Singletons;
import forge.card.MagicColor;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType;
import forge.card.cardfactory.CardFactoryUtil;
@@ -24,6 +23,7 @@ import forge.card.cost.CostPayment;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaPool;
import forge.card.mana.ManaCost;
import forge.card.spellability.AbilityManaPart;
import forge.card.spellability.AbilitySub;
import forge.card.spellability.SpellAbility;
@@ -399,7 +399,7 @@ public class ComputerUtilMana {
* @return ManaCost
*/
private static ManaCostBeingPaid calculateManaCost(final SpellAbility sa, final boolean test, final int extraMana) {
final SpellManaCost mana = sa.getPayCosts() != null ? sa.getPayCosts().getTotalMana() : sa.getManaCost();
final ManaCost mana = sa.getPayCosts() != null ? sa.getPayCosts().getTotalMana() : sa.getManaCost();
ManaCostBeingPaid cost = new ManaCostBeingPaid(mana);

View File

@@ -17,9 +17,9 @@
*/
package forge.game.limited;
import forge.card.SpellManaCost;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.card.mana.ManaCost;
import forge.item.CardPrinted;
/**
@@ -45,7 +45,7 @@ class DeckColors {
*/
public void addColorsOf(CardPrinted pickedCard) {
SpellManaCost colorsInCard = pickedCard.getRules().getManaCost();
ManaCost colorsInCard = pickedCard.getRules().getManaCost();
int colorsCanAdd = MagicColor.ALL_COLORS & ~getChosenColors().getColor();
int colorsWantAdd = colorsInCard.getColorProfile() & colorsCanAdd;

View File

@@ -20,11 +20,11 @@ import com.google.common.collect.Lists;
import forge.Constant.Preferences;
import forge.card.MagicColor;
import forge.card.ColorSet;
import forge.card.SpellManaCost;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
import forge.card.DeckHints;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
import forge.deck.CardPool;
import forge.deck.Deck;
import forge.deck.DeckSection;
@@ -363,7 +363,7 @@ public class LimitedDeck {
// count each card color using mana costs
for (int i = 0; i < deckList.size(); i++) {
final SpellManaCost mc = deckList.get(i).getRules().getManaCost();
final ManaCost mc = deckList.get(i).getRules().getManaCost();
// count each mana symbol in the mana cost
for (ManaCostShard shard : mc.getShards()) {

View File

@@ -36,10 +36,10 @@ import forge.Command;
import forge.Constant;
import forge.GameEntity;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.cost.CostUtil;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilityStatic;
import forge.card.staticability.StaticAbility;
@@ -1251,7 +1251,7 @@ public class CombatUtil {
final String[] k = key.split(" ", 2);
final int a = Integer.valueOf(k[1]);
final Ability ability = new Ability(c, SpellManaCost.ZERO) {
final Ability ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final Player opponent = Singletons.getModel().getGame().getCombat().getDefendingPlayerRelatedTo(c);
@@ -1288,7 +1288,7 @@ public class CombatUtil {
else if (c.getName().equals("Witch-Maw Nephilim") && !c.getDamageHistory().getCreatureAttackedThisCombat()
&& (c.getNetAttack() >= 10)) {
final Card charger = c;
final Ability ability2 = new Ability(c, SpellManaCost.ZERO) {
final Ability ability2 = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
@@ -1445,7 +1445,7 @@ public class CombatUtil {
}
final int mag = flankingMagnitude;
final Card blocker = b;
final Ability ability2 = new Ability(b, SpellManaCost.ZERO) {
final Ability ability2 = new Ability(b, ManaCost.ZERO) {
@Override
public void resolve() {
@@ -1503,7 +1503,7 @@ public class CombatUtil {
Ability ability;
for (int i = 0; i < magnitude; i++) {
ability = new Ability(c, SpellManaCost.ZERO) {
ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final Command untilEOT = new Command() {
@@ -1542,7 +1542,7 @@ public class CombatUtil {
if (phasingPlayer.getCardsIn(ZoneType.Battlefield, "Sovereigns of Lost Alara").size() > 0) {
for (int i = 0; i < phasingPlayer.getCardsIn(ZoneType.Battlefield, "Sovereigns of Lost Alara").size(); i++) {
final Card attacker = c;
final Ability ability4 = new Ability(c, SpellManaCost.ZERO) {
final Ability ability4 = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
List<Card> enchantments =
@@ -1612,7 +1612,7 @@ public class CombatUtil {
// numBlockers -1 since it is for every creature beyond the first
for (int i = 0; i < (numBlockers - 1); i++) {
ability = new Ability(c, SpellManaCost.ZERO) {
ability = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final Command untilEOT = new Command() {

View File

@@ -20,7 +20,7 @@ package forge.game.phase;
import forge.Card;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.game.GameLossReason;
@@ -57,7 +57,7 @@ public class EndOfTurn extends Phase {
for (final Card c : game.getCardsIn(ZoneType.Battlefield)) {
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.")) {
final Card card = c;
final SpellAbility sac = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility sac = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
if (card.isInPlay()) {
@@ -75,7 +75,7 @@ public class EndOfTurn extends Phase {
}
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, exile CARDNAME.")) {
final Card card = c;
final SpellAbility exile = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility exile = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
if (card.isInPlay()) {
@@ -93,7 +93,7 @@ public class EndOfTurn extends Phase {
}
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, destroy CARDNAME.")) {
final Card card = c;
final SpellAbility destroy = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility destroy = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
if (card.isInPlay()) {
@@ -113,7 +113,7 @@ public class EndOfTurn extends Phase {
if (c.hasKeyword("At the beginning of the next end step, destroy CARDNAME if it attacked this turn.")) {
if (c.getDamageHistory().getCreatureAttackedThisTurn()) {
final Card card = c;
final SpellAbility sac = new Ability(card, SpellManaCost.ZERO) {
final SpellAbility sac = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
if (card.isInPlay()) {
@@ -137,7 +137,7 @@ public class EndOfTurn extends Phase {
if (c.hasKeyword("At the beginning of your end step, return CARDNAME to its owner's hand.")
&& game.getPhaseHandler().isPlayerTurn(c.getController())) {
final Card source = c;
final SpellAbility change = new Ability(source, SpellManaCost.ZERO) {
final SpellAbility change = new Ability(source, ManaCost.ZERO) {
@Override
public void resolve() {
if (source.isInPlay()) {
@@ -158,7 +158,7 @@ public class EndOfTurn extends Phase {
Player activePlayer = game.getPhaseHandler().getPlayerTurn();
if (activePlayer.hasKeyword("At the beginning of this turn's end step, you lose the game.")) {
final Card source = new Card();
final SpellAbility change = new Ability(source, SpellManaCost.ZERO) {
final SpellAbility change = new Ability(source, ManaCost.ZERO) {
@Override
public void resolve() {
this.getActivatingPlayer().loseConditionMet(GameLossReason.SpellEffect, "");

View File

@@ -31,10 +31,10 @@ import forge.CardPredicates.Presets;
import forge.Command;
import forge.CounterType;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaCostParser;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilityManaPart;
import forge.card.spellability.AbilityStatic;
@@ -126,7 +126,7 @@ public class Upkeep extends Phase {
final StringBuilder sb = new StringBuilder();
sb.append("Cumulative Upkeep for ").append(c).append("\n");
final Ability upkeepAbility = new Ability(c, SpellManaCost.ZERO) {
final Ability upkeepAbility = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
c.addCounter(CounterType.AGE, 1, true);
@@ -188,7 +188,7 @@ public class Upkeep extends Phase {
final StringBuilder sb = new StringBuilder();
sb.append("Echo for ").append(c).append("\n");
final Ability sacAbility = new Ability(c, SpellManaCost.ZERO) {
final Ability sacAbility = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
@@ -240,7 +240,7 @@ public class Upkeep extends Phase {
// otherwise another slowtrip gets added
card.removeIntrinsicKeyword("Draw a card at the beginning of the next turn's upkeep.");
final Ability slowtrip = new Ability(card, SpellManaCost.ZERO) {
final Ability slowtrip = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
player.drawCard();
@@ -274,7 +274,7 @@ public class Upkeep extends Phase {
// destroy
if (ability.startsWith("At the beginning of your upkeep, destroy CARDNAME")) {
final String[] k = ability.split(" pay ");
final SpellManaCost upkeepCost = new SpellManaCost(new ManaCostParser(k[1]));
final ManaCost upkeepCost = new ManaCost(new ManaCostParser(k[1]));
final Command unpaidCommand = new Command() {
private static final long serialVersionUID = 8942537892273123542L;
@@ -294,7 +294,7 @@ public class Upkeep extends Phase {
final StringBuilder sb = new StringBuilder();
sb.append("Upkeep for ").append(c).append("\n");
final Ability upkeepAbility = new Ability(c, SpellManaCost.ZERO) {
final Ability upkeepAbility = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
if (controller.isHuman()) {
@@ -352,7 +352,7 @@ public class Upkeep extends Phase {
final Ability blankAbility = Upkeep.BlankAbility(c, upkeepCost);
final Ability upkeepAbility = new Ability(c, SpellManaCost.ZERO) {
final Ability upkeepAbility = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
if (controller.isHuman()) {
@@ -380,7 +380,7 @@ public class Upkeep extends Phase {
final String s1 = k[1].substring(0, 2);
final int upkeepDamage = Integer.parseInt(s1.trim());
final String[] l = k[1].split(" pay ");
final SpellManaCost upkeepCost = new SpellManaCost(new ManaCostParser(l[1]));
final ManaCost upkeepCost = new ManaCost(new ManaCostParser(l[1]));
final Command unpaidCommand = new Command() {
private static final long serialVersionUID = 1238166187561501928L;
@@ -397,7 +397,7 @@ public class Upkeep extends Phase {
final StringBuilder sb = new StringBuilder();
sb.append("Damage upkeep for ").append(c).append("\n");
final Ability upkeepAbility = new Ability(c, SpellManaCost.ZERO) {
final Ability upkeepAbility = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
if (controller.isHuman()) {
@@ -470,7 +470,7 @@ public class Upkeep extends Phase {
final List<Card> abyssGetTargets = CardLists.filter(player.getCreaturesInPlay(), Presets.NON_ARTIFACTS);
final Ability sacrificeCreature = new Ability(abyss, SpellManaCost.NO_COST) {
final Ability sacrificeCreature = new Ability(abyss, ManaCost.NO_COST) {
@Override
public void resolve() {
final List<Card> targets = CardLists.getTargetableCards(abyssGetTargets, this);
@@ -538,7 +538,7 @@ public class Upkeep extends Phase {
for (int i = 0; i < cards.size(); i++) {
final Card c = cards.get(i);
final Ability ability = new Ability(c, SpellManaCost.NO_COST) {
final Ability ability = new Ability(c, ManaCost.NO_COST) {
@Override
public void resolve() {
final List<Card> creatures = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
@@ -613,13 +613,13 @@ public class Upkeep extends Phase {
final Card c = cards.get(i);
final Ability cost = new Ability(c, new SpellManaCost(new ManaCostParser("B B B"))) {
final Ability cost = new Ability(c, new ManaCost(new ManaCostParser("B B B"))) {
@Override
public void resolve() {
}
}; // end cost ability
final Ability noPay = new Ability(c, SpellManaCost.ZERO) {
final Ability noPay = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
final List<Card> playerLand = player.getLandsInPlay();
@@ -642,7 +642,7 @@ public class Upkeep extends Phase {
if (cp.isHuman()) {
final String question = "Pay Demonic Hordes upkeep cost?";
if (GuiDialog.confirm(c, question)) {
final Ability pay = new Ability(c, SpellManaCost.ZERO) {
final Ability pay = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
if (game.getZoneOf(c).is(ZoneType.Battlefield)) {
@@ -671,7 +671,7 @@ public class Upkeep extends Phase {
else { // computer
noPay.setActivatingPlayer(cp);
if (ComputerUtilCost.canPayCost(cost, (AIPlayer) cp)) {
final Ability computerPay = new Ability(c, SpellManaCost.ZERO) {
final Ability computerPay = new Ability(c, ManaCost.ZERO) {
@Override
public void resolve() {
ComputerUtilMana.payManaCost(cp, cost);
@@ -738,7 +738,7 @@ public class Upkeep extends Phase {
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
final Card card = list.get(i);
final Ability ability = new Ability(card, SpellManaCost.ZERO) {
final Ability ability = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
card.subtractCounter(CounterType.TIME, 1);
@@ -776,7 +776,7 @@ public class Upkeep extends Phase {
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
final Card card = list.get(i);
final Ability ability = new Ability(card, SpellManaCost.ZERO) {
final Ability ability = new Ability(card, ManaCost.ZERO) {
@Override
public void resolve() {
final int fadeCounters = card.getCounters(CounterType.FADE);
@@ -818,7 +818,7 @@ public class Upkeep extends Phase {
if (GameState.compareTypeAmountInPlay(player, "Creature") < 0) {
for (int i = 0; i < oathList.size(); i++) {
final Card oath = oathList.get(i);
final Ability ability = new Ability(oath, SpellManaCost.ZERO) {
final Ability ability = new Ability(oath, ManaCost.ZERO) {
@Override
public void resolve() {
final List<Card> libraryList = new ArrayList<Card>(player.getCardsIn(ZoneType.Library));
@@ -898,7 +898,7 @@ public class Upkeep extends Phase {
if (GameState.compareTypeAmountInGraveyard(player, "Creature") > 0) {
for (int i = 0; i < oathList.size(); i++) {
final Ability ability = new Ability(oathList.get(0), SpellManaCost.ZERO) {
final Ability ability = new Ability(oathList.get(0), ManaCost.ZERO) {
@Override
public void resolve() {
final List<Card> graveyardCreatures = CardLists.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
@@ -947,7 +947,7 @@ public class Upkeep extends Phase {
// battlefield have each of them deal damage.
if (0 < karmas.size()) {
for (final Card karma : karmas) {
final Ability ability = new Ability(karma, SpellManaCost.ZERO) {
final Ability ability = new Ability(karma, ManaCost.ZERO) {
@Override
public void resolve() {
if (damage > 0) {
@@ -986,7 +986,7 @@ public class Upkeep extends Phase {
for (final Card surge : list) {
final Card source = surge;
final Ability ability = new Ability(source, SpellManaCost.ZERO) {
final Ability ability = new Ability(source, ManaCost.ZERO) {
@Override
public void resolve() {
player.addDamage(damage, source);
@@ -1014,7 +1014,7 @@ public class Upkeep extends Phase {
final List<Card> wires = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tangle Wire"));
for (final Card source : wires) {
final SpellAbility ability = new Ability(source, SpellManaCost.ZERO) {
final SpellAbility ability = new Ability(source, ManaCost.ZERO) {
@Override
public void resolve() {
final int num = source.getCounters(CounterType.FADE);
@@ -1108,7 +1108,7 @@ public class Upkeep extends Phase {
for (int i = 0; i < blaze.size(); i++) {
final Card source = blaze.get(i);
final Ability ability = new Ability(blaze.get(i),SpellManaCost.ZERO) {
final Ability ability = new Ability(blaze.get(i),ManaCost.ZERO) {
@Override
public void resolve() {
player.addDamage(1, source);

View File

@@ -43,10 +43,10 @@ import forge.Constant.Preferences;
import forge.CounterType;
import forge.GameEntity;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.mana.ManaPool;
import forge.card.mana.ManaCost;
import forge.card.replacement.ReplacementResult;
import forge.card.spellability.Ability;
import forge.card.spellability.Spell;
@@ -3225,7 +3225,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
playForMiracleCost.setStackDescription(card.getName() + " - Cast via Miracle");
// TODO Convert this to a Trigger
final Ability miracleTrigger = new MiracleTrigger(card, SpellManaCost.ZERO, card, playForMiracleCost);
final Ability miracleTrigger = new MiracleTrigger(card, ManaCost.ZERO, card, playForMiracleCost);
miracleTrigger.setStackDescription(card.getName() + " - Miracle.");
miracleTrigger.setActivatingPlayer(card.getOwner());
miracleTrigger.setTrigger(true);
@@ -3248,7 +3248,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* @param card
* @param miracle
*/
private MiracleTrigger(Card sourceCard, SpellManaCost manaCost, Card card, SpellAbility miracle) {
private MiracleTrigger(Card sourceCard, ManaCost manaCost, Card card, SpellAbility miracle) {
super(sourceCard, manaCost);
this.card = card;
this.miracle = miracle;

View File

@@ -32,11 +32,11 @@ import forge.CardPredicates;
import forge.CardPredicates.Presets;
import forge.Command;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.ability.AbilityUtils;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.mana.ManaCostBeingPaid;
import forge.card.mana.ManaCostParser;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.AbilityStatic;
import forge.card.spellability.AbilityTriggered;
@@ -477,7 +477,7 @@ public class MagicStack extends MyObservable {
} else if (sp.isXCost()) {
// TODO: convert any X costs to use abCost so it happens earlier
final SpellAbility sa = sp;
final SpellManaCost mc = new SpellManaCost( new ManaCostParser(Integer.toString(sa.getXManaCost())));
final ManaCost mc = new ManaCost( new ManaCostParser(Integer.toString(sa.getXManaCost())));
final Ability ability = new Ability(sp.getSourceCard(), mc) {
@Override
public void resolve() {
@@ -734,7 +734,7 @@ public class MagicStack extends MyObservable {
// be
// 1...
for (final Card bazaar : bazaars) {
final SpellAbility counter = new Ability(bazaar, SpellManaCost.ZERO) {
final SpellAbility counter = new Ability(bazaar, ManaCost.ZERO) {
@Override
public void resolve() {
if (game.getStack().size() > 0) {
@@ -854,7 +854,7 @@ public class MagicStack extends MyObservable {
if (source.hasStartOfKeyword("Haunt") && !source.isCreature()
&& game.getZoneOf(source).is(ZoneType.Graveyard)) {
final List<Card> creats = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final Ability haunterDiesWork = new Ability(source, SpellManaCost.ZERO) {
final Ability haunterDiesWork = new Ability(source, ManaCost.ZERO) {
@Override
public void resolve() {
game.getAction().exile(source);

View File

@@ -31,7 +31,7 @@ import forge.CardPredicates;
import forge.CardPredicates.Presets;
import forge.Command;
import forge.Singletons;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCost;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.staticability.StaticAbility;
@@ -127,7 +127,7 @@ public class PlayerZoneBattlefield extends PlayerZone {
final Card tisLand = c;
for (final Card ti : tis) {
final Card source = ti;
final SpellAbility ability = new Ability(source, SpellManaCost.NO_COST) {
final SpellAbility ability = new Ability(source, ManaCost.NO_COST) {
@Override
public void resolve() {
List<Card> lands = CardLists.filter(tisLand.getController().getCardsIn(ZoneType.Battlefield), Presets.LANDS);
@@ -148,7 +148,7 @@ public class PlayerZoneBattlefield extends PlayerZone {
final Card lesLand = c;
if (les.size() > 0) {
final Card source = les.get(0);
final SpellAbility ability = new Ability(source, SpellManaCost.NO_COST) {
final SpellAbility ability = new Ability(source, ManaCost.NO_COST) {
@Override
public void resolve() {
final List<Card> lands = lesLand.getOwner().getLandsInPlay();

View File

@@ -24,8 +24,8 @@ import java.util.List;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
import forge.gui.toolbox.CardFaceSymbols;
/**
@@ -34,7 +34,7 @@ import forge.gui.toolbox.CardFaceSymbols;
public class ManaCostRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1770527102334163549L;
private SpellManaCost value;
private ManaCost value;
/*
* (non-Javadoc)
@@ -46,7 +46,7 @@ public class ManaCostRenderer extends DefaultTableCellRenderer {
@Override
public final Component getTableCellRendererComponent(final JTable table, final Object value,
final boolean isSelected, final boolean hasFocus, final int row, final int column) {
this.value = (SpellManaCost) value;
this.value = (ManaCost) value;
this.setToolTipText(this.value.toString());
return super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column);
}

View File

@@ -32,8 +32,8 @@ import com.google.common.base.Function;
import forge.Singletons;
import forge.card.ColorSet;
import forge.card.CardEdition;
import forge.card.SpellManaCost;
import forge.card.CardRarity;
import forge.card.mana.ManaCost;
import forge.deck.DeckBase;
import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.SEditorIO;
@@ -306,8 +306,8 @@ public final class SColumnUtil {
private static final Pattern AE_FINDER = Pattern.compile("AE", Pattern.LITERAL);
private static SpellManaCost toManaCost(final InventoryItem i) {
return i instanceof CardPrinted ? ((CardPrinted) i).getRules().getManaCost() : SpellManaCost.NO_COST;
private static ManaCost toManaCost(final InventoryItem i) {
return i instanceof CardPrinted ? ((CardPrinted) i).getRules().getManaCost() : ManaCost.NO_COST;
}
private static ColorSet toColor(final InventoryItem i) {

View File

@@ -27,8 +27,8 @@ import java.util.StringTokenizer;
import com.esotericsoftware.minlog.Log;
import forge.card.SpellManaCost;
import forge.card.mana.ManaCostShard;
import forge.card.mana.ManaCost;
import forge.view.arcane.util.UI;
/**
@@ -134,7 +134,7 @@ public class CardFaceSymbols {
* @param y
* a int.
*/
public static void draw(Graphics g, SpellManaCost manaCost, int x, int y) {
public static void draw(Graphics g, ManaCost manaCost, int x, int y) {
if (manaCost.isNoCost()) {
return;
}
@@ -232,7 +232,7 @@ public class CardFaceSymbols {
* a {@link java.lang.String} object.
* @return a int.
*/
public static int getWidth(final SpellManaCost manaCost) {
public static int getWidth(final ManaCost manaCost) {
int width = manaCost.getShards().size();
if (manaCost.getGenericCost() > 0 || (manaCost.getGenericCost() == 0 && width == 0)) {
width++;