Fixing CostChange issue where required mana is reduced to 0.

This commit is contained in:
Sol
2011-09-13 03:13:06 +00:00
parent de59f0d4ce
commit 3a45c6ad23
3 changed files with 15 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ import forge.card.spellability.SpellAbility;
*/ */
public class Cost { public class Cost {
private boolean isAbility = true; private boolean isAbility = true;
ArrayList<CostPart> costParts = new ArrayList<CostPart>(); private ArrayList<CostPart> costParts = new ArrayList<CostPart>();
public ArrayList<CostPart> getCostParts(){ return costParts; } public ArrayList<CostPart> getCostParts(){ return costParts; }

View File

@@ -103,10 +103,15 @@ public class CostMana extends CostPart {
manaToAdd = AbilityFactory.calculateAmount(source, "X", ability) * getXMana(); manaToAdd = AbilityFactory.calculateAmount(source, "X", ability) * getXMana();
} }
} }
if (!getManaToPay().equals("0") || manaToAdd > 0) if (!getManaToPay().equals("0") || manaToAdd > 0){
CostUtil.setInput(CostMana.input_payMana(ability, payment, this, manaToAdd)); CostUtil.setInput(CostMana.input_payMana(ability, payment, this, manaToAdd));
else if (getXMana() > 0) }
else if (getXMana() > 0){
CostUtil.setInput(CostMana.input_payXMana(ability, payment, this, getXMana())); CostUtil.setInput(CostMana.input_payXMana(ability, payment, this, getXMana()));
}
else{
payment.paidCost(this);
}
// We return false here because the Inputs set above should recall payment.payCosts() // We return false here because the Inputs set above should recall payment.payCosts()
return false; return false;

View File

@@ -352,7 +352,13 @@ public class ManaCost {
sb.append(list.get(i).toString()); sb.append(list.get(i).toString());
} }
return sb.toString().trim(); String str = sb.toString().trim();
if (str.equals("")){
return "0";
}
return str;
} }
/** /**