- Fix for cards like Shimmering Grotto being able to pay for itself.

This commit is contained in:
Sol
2011-09-05 00:16:10 +00:00
parent afc4ea7478
commit 1d4b09fdf7

View File

@@ -222,21 +222,25 @@ public class Cost {
costParts.add(new CostReveal(splitStr[0], splitStr[1], description)); costParts.add(new CostReveal(splitStr[0], splitStr[1], description));
} }
int manaLocation = 0;
// These won't show up with multiples // These won't show up with multiples
if (parse.contains("Untap")) { if (parse.contains("Untap")) {
parse = parse.replace("Untap", "").trim(); parse = parse.replace("Untap", "").trim();
costParts.add(0, new CostUntap()); costParts.add(0, new CostUntap());
manaLocation++;
} }
if (parse.contains("Q")) { if (parse.contains("Q")) {
parse = parse.replace("Q", "").trim(); parse = parse.replace("Q", "").trim();
costParts.add(0, new CostUntap()); costParts.add(0, new CostUntap());
manaLocation++;
} }
if (parse.contains("T")) { if (parse.contains("T")) {
tapCost = true; tapCost = true;
parse = parse.replace("T", "").trim(); parse = parse.replace("T", "").trim();
costParts.add(0, new CostTap()); costParts.add(0, new CostTap());
manaLocation++;
} }
String stripXCost = parse.replaceAll("X", ""); String stripXCost = parse.replaceAll("X", "");
@@ -247,8 +251,9 @@ public class Cost {
if (mana.equals("")) if (mana.equals(""))
mana = "0"; mana = "0";
if (amountX > 0 || !mana.equals("0")) if (amountX > 0 || !mana.equals("0")){
costParts.add(0, new CostMana(mana, amountX)); costParts.add(manaLocation, new CostMana(mana, amountX));
}
} }
/** /**
@@ -414,9 +419,19 @@ public class Cost {
boolean first = true; boolean first = true;
for(CostPart part : costParts){ for(CostPart part : costParts){
if (!first) boolean append = true;
cost.append(", "); if (!first){
cost.append(part.toString()); if (part instanceof CostMana){
cost.insert(0, ", ").insert(0, part.toString());
append = false;
}
else{
cost.append(", ");
}
}
if (append){
cost.append(part.toString());
}
first = false; first = false;
} }