- Fixing X Mana bug when paying from the Mana Pool

This commit is contained in:
Sol
2011-10-28 16:33:29 +00:00
parent 5383eb98f1
commit 3e73d6b770
2 changed files with 17 additions and 8 deletions

View File

@@ -355,7 +355,10 @@ public class Cost {
CostMana costMana = (CostMana) part;
String mana = getTotalMana();
costMana.setAdjustedMana(AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(mana)).toString());
ManaCost changedCost = AllZone.getGameAction().getSpellCostChange(sa, new ManaCost(mana));
costMana.setAdjustedMana(changedCost.toString(false));
}
}
}

View File

@@ -478,21 +478,21 @@ public class ManaCost {
}
}
/** {@inheritDoc} */
@Override
public final String toString() {
public final String toString(boolean addX){
// Boolean addX used to add Xs into the returned value
StringBuilder sb = new StringBuilder();
ArrayList<Object> list = new ArrayList<Object>(manaPart);
// need to reverse everything since the colored mana is stored first
Collections.reverse(list);
if (addX) {
for (int i = 0; i < getXcounter(); i++) {
sb.append(" ").append("X");
sb.append("X").append(" ");
}
}
for (int i = 0; i < list.size(); i++) {
sb.append(" ");
sb.append(list.get(i).toString());
sb.append(list.get(i).toString()).append(" ");
}
String str = sb.toString().trim();
@@ -504,6 +504,12 @@ public class ManaCost {
return str;
}
/** {@inheritDoc} */
@Override
public final String toString() {
return toString(true);
}
/**
* <p>
* getConvertedManaCost.