generalize power, toughness, and cmc hasProperty variable counting (Thanks to slowe I believe).

This commit is contained in:
slapshot5
2011-11-05 04:36:55 +00:00
parent 0a6a26f5e2
commit b249450ac3

View File

@@ -6635,29 +6635,26 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
} else if (property.startsWith("power") || // 8/10 } else if (property.startsWith("power") ||
property.startsWith("toughness") || property.startsWith("cmc")) { property.startsWith("toughness") || property.startsWith("cmc")) {
int x = 0; int x = 0;
int y = 0; int y = 0;
int z = 0; String rhs = "";
if (property.startsWith("power")) { if (property.startsWith("power")) {
z = 7; rhs = property.substring(7);
y = getNetAttack(); y = getNetAttack();
} else if (property.startsWith("toughness")) { } else if (property.startsWith("toughness")) {
z = 11; rhs = property.substring(11);
y = getNetDefense(); y = getNetDefense();
} else if (property.startsWith("cmc")) { } else if (property.startsWith("cmc")) {
z = 5; rhs = property.substring(5);
y = getCMC(); y = getCMC();
} }
try {
if (property.substring(z).equals("X")) { x = Integer.parseInt(rhs);
x = CardFactoryUtil.xCount(source, source.getSVar("X")); } catch (NumberFormatException e) {
} else if (property.substring(z).equals("Y")) { x = CardFactoryUtil.xCount(source, source.getSVar(rhs));
x = CardFactoryUtil.xCount(source, source.getSVar("Y"));
} else {
x = Integer.parseInt(property.substring(z));
} }
if (!AllZoneUtil.compare(y, property, x)) { if (!AllZoneUtil.compare(y, property, x)) {