mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
CardFactoryUtil & GameActionUtil: make "Alternative Cost" a better keyword to create SpellAbilities
that does make it work better with MayPlay
This commit is contained in:
@@ -231,19 +231,6 @@ public final class GameActionUtil {
|
||||
}
|
||||
alternatives.add(flashback);
|
||||
}
|
||||
if (sa.isSpell() && keyword.startsWith("Alternative Cost")) {
|
||||
final SpellAbility newSA = sa.copy();
|
||||
newSA.setBasicSpell(false);
|
||||
String kw = keyword;
|
||||
if (keyword.contains("ConvertedManaCost")) {
|
||||
final String cmc = Integer.toString(sa.getHostCard().getCMC());
|
||||
kw = keyword.replace("ConvertedManaCost", cmc);
|
||||
}
|
||||
final Cost cost = new Cost(kw.substring(17), false).add(newSA.getPayCosts().copyWithNoMana());
|
||||
newSA.setPayCosts(cost);
|
||||
newSA.setDescription(sa.getDescription() + " (by paying " + cost.toSimpleString() + " instead of its mana cost)");
|
||||
alternatives.add(newSA);
|
||||
}
|
||||
if (sa.isSpell() && keyword.equals("You may cast CARDNAME as though it had flash if you pay 2 more to cast it.")) {
|
||||
final SpellAbility newSA = sa.copy();
|
||||
newSA.setBasicSpell(false);
|
||||
|
||||
@@ -1667,7 +1667,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
for (final SpellAbility sa : state.getSpellAbilities()) {
|
||||
// only add abilities not Spell portions of cards
|
||||
if (sa == null || !state.getType().isPermanent()) {
|
||||
if (sa == null || sa.isSecondary() || !state.getType().isPermanent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -3173,7 +3173,27 @@ public class CardFactoryUtil {
|
||||
|
||||
public static void addSpellAbility(final String keyword, final Card card, final KeywordsChange kws) {
|
||||
final boolean intrinsic = kws == null;
|
||||
if (keyword.startsWith("Bestow")) {
|
||||
if (keyword.startsWith("Alternative Cost")) {
|
||||
final String[] kw = keyword.split(":");
|
||||
String costStr = kw[1];
|
||||
final SpellAbility sa = card.getFirstSpellAbility();
|
||||
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)");
|
||||
|
||||
if (!intrinsic) {
|
||||
newSA.setTemporary(true);
|
||||
newSA.setIntrinsic(false);
|
||||
kws.addSpellAbility(newSA);
|
||||
}
|
||||
card.addSpellAbility(newSA);
|
||||
} else if (keyword.startsWith("Bestow")) {
|
||||
final String[] params = keyword.split(":");
|
||||
final String cost = params[1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user