- Alternative Cost for spells should be added to all spells on the card, not only the first spell ability (fixes interaction with split cards, among possibly other things).

This commit is contained in:
Agetian
2017-07-28 13:45:14 +00:00
parent 839ced1b32
commit 53f0544da8

View File

@@ -3564,26 +3564,24 @@ public class CardFactoryUtil {
if (keyword.startsWith("Alternative Cost") && !card.isLand()) {
final String[] kw = keyword.split(":");
String costStr = kw[1];
final SpellAbility sa = card.getFirstSpellAbility();
if (sa == null) {
return;
}
final SpellAbility newSA = sa.copy();
newSA.setBasicSpell(false);
if (costStr.equals("ConvertedManaCost")) {
costStr = Integer.toString(card.getCMC());
}
final Cost cost = new Cost(costStr, false).add(sa.getPayCosts().copyWithNoMana());
newSA.getMapParams().put("Secondary", "True");
newSA.setPayCosts(cost);
newSA.setDescription(sa.getDescription() + " (by paying " + cost.toSimpleString() + " instead of its mana cost)");
newSA.setIntrinsic(intrinsic);
for (SpellAbility sa: card.getBasicSpells()) {
final SpellAbility newSA = sa.copy();
newSA.setBasicSpell(false);
if (costStr.equals("ConvertedManaCost")) {
costStr = Integer.toString(card.getCMC());
}
final Cost cost = new Cost(costStr, false).add(sa.getPayCosts().copyWithNoMana());
newSA.getMapParams().put("Secondary", "True");
newSA.setPayCosts(cost);
newSA.setDescription(sa.getDescription() + " (by paying " + cost.toSimpleString() + " instead of its mana cost)");
newSA.setIntrinsic(intrinsic);
if (!intrinsic) {
newSA.setTemporary(true);
kws.addSpellAbility(newSA);
if (!intrinsic) {
newSA.setTemporary(true);
kws.addSpellAbility(newSA);
}
card.addSpellAbility(newSA);
}
card.addSpellAbility(newSA);
} else if (keyword.equals("Aftermath")) {
// Aftermath does modify existing SA, and does not add new one