- Fix for new Cost object not using CostChange information properly

This commit is contained in:
Sol
2011-09-05 22:46:13 +00:00
parent 8de408cd65
commit d8bde04f98
2 changed files with 12 additions and 4 deletions

View File

@@ -300,8 +300,8 @@ public class Cost {
if (part instanceof CostMana){
CostMana costMana = (CostMana)part;
if (getTotalMana() != "0") { // 11/15/10 use getTotalMana() to account for X reduction
String mana = getTotalMana();
String mana = getTotalMana();
if (mana != "0") { // 11/15/10 use getTotalMana() to account for X reduction
costMana.setAdjustedMana(AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(mana)).toString());
}
}

View File

@@ -50,6 +50,14 @@ public class CostMana extends CostPart {
this.adjustedMana = adjustedMana;
}
public String getManaToPay() {
// Only used for Human to pay for non-X cost first
if (!adjustedMana.equals(""))
return adjustedMana;
return mana;
}
public CostMana(String mana, int amount){
this.mana = mana.trim();
this.amountX = amount;
@@ -95,7 +103,7 @@ public class CostMana extends CostPart {
manaToAdd = AbilityFactory.calculateAmount(source, "X", ability) * getXMana();
}
}
if (!getMana().equals("0") || manaToAdd > 0)
if (!getManaToPay().equals("0") || manaToAdd > 0)
CostUtil.setInput(CostMana.input_payMana(ability, payment, this, manaToAdd));
else if (getXMana() > 0)
CostUtil.setInput(CostMana.input_payXMana(ability, payment, this, getXMana()));
@@ -188,7 +196,7 @@ public class CostMana extends CostPart {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
manaCost = new ManaCost("0");
} else {
String mana = costMana.getMana();
String mana = costMana.getManaToPay();
manaCost = new ManaCost(mana);
manaCost.increaseColorlessMana(manaToAdd);
}