From 53f0544da8415fe6ae5a027a86b0489630ea259e Mon Sep 17 00:00:00 2001 From: Agetian Date: Fri, 28 Jul 2017 13:45:14 +0000 Subject: [PATCH] - 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). --- .../java/forge/game/card/CardFactoryUtil.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index a606bea4090..b11467cef18 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -3563,27 +3563,25 @@ public class CardFactoryUtil { final boolean intrinsic = kws == null; 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); + String costStr = kw[1]; + 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