CardFactoryUtil: fixed Eternalize and nonManaCost

This commit is contained in:
Hanmac
2017-07-30 06:07:43 +00:00
parent e00aeb39e5
commit 24e2e29894

View File

@@ -3764,13 +3764,28 @@ public class CardFactoryUtil {
} else if (keyword.startsWith("Eternalize")) { } else if (keyword.startsWith("Eternalize")) {
final String[] kw = keyword.split(":"); final String[] kw = keyword.split(":");
String costStr = kw[1]; String costStr = kw[1];
Cost cost = new Cost(costStr, true);
StringBuilder sb = new StringBuilder();
String effect = "AB$ CopyPermanent | Cost$ " + costStr + " ExileFromGrave<1/CARDNAME> " + sb.append("AB$ CopyPermanent | Cost$ ").append(costStr).append(" ExileFromGrave<1/CARDNAME>")
"| ActivationZone$ Graveyard | SorcerySpeed$ True | Eternalize$ True " + .append(" | Defined$ Self | ActivationZone$ Graveyard | SorcerySpeed$ True | Eternalize$ True");
"| PrecostDesc$ Eternalize | CostDesc$ " + ManaCostParser.parse(costStr) + " | Defined$ Self " +
"| StackDescription$ Eternalize - CARDNAME "+ sb.append(" | PrecostDesc$ Eternalize ");
"| SpellDescription$ (" + Keyword.getInstance(keyword).getReminderText() + ")" ; if (!cost.isOnlyManaCost()) { //Something other than a mana cost
final SpellAbility sa = AbilityFactory.getAbility(effect, card); sb.append("- ");
}
// don't use SimpleString there because it does has "and" between cost i dont want that
costStr = cost.toString();
// but now it has ": " at the end i want to remove
sb.append("| CostDesc$ ").append(costStr.substring(0, costStr.length() - 2));
if (!cost.isOnlyManaCost()) {
sb.append(".");
}
sb.append(" | StackDescription$ Eternalize - CARDNAME ")
.append("| SpellDescription$ (").append(Keyword.getInstance(keyword).getReminderText()).append(")");
final SpellAbility sa = AbilityFactory.getAbility(sb.toString(), card);
sa.setIntrinsic(intrinsic); sa.setIntrinsic(intrinsic);
if (!intrinsic) { if (!intrinsic) {