Remove Alternative Cost KW (#5050)

This commit is contained in:
tool4ever
2024-04-16 16:00:16 +02:00
committed by GitHub
parent 4ccbc9baa6
commit bcaadd0765
6 changed files with 24 additions and 30 deletions

View File

@@ -2495,8 +2495,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| keyword.startsWith("Class") || keyword.startsWith("Blitz")
|| keyword.startsWith("Specialize") || keyword.equals("Ravenous")
|| keyword.equals("For Mirrodin") || keyword.startsWith("Craft")
|| keyword.startsWith("Landwalk")
|| keyword.startsWith("Alternative Cost")) {
|| keyword.startsWith("Landwalk")) {
// keyword parsing takes care of adding a proper description
} else if (keyword.equals("Read ahead")) {
sb.append(Localizer.getInstance().getMessage("lblReadAhead")).append(" (").append(Localizer.getInstance().getMessage("lblReadAheadDesc"));

View File

@@ -2607,23 +2607,7 @@ public class CardFactoryUtil {
public static void addSpellAbility(final KeywordInterface inst, final CardState card, final boolean intrinsic) {
String keyword = inst.getOriginal();
Card host = card.getCard();
if (keyword.startsWith("Alternative Cost") && !host.isLand()) {
final String[] kw = keyword.split(":");
String costStr = kw[1];
for (SpellAbility sa : host.getBasicSpells()) {
if (costStr.equals("ConvertedManaCost")) {
costStr = Integer.toString(host.getCMC());
}
final Cost cost = new Cost(costStr, false).add(sa.getPayCosts().copyWithNoMana());
final SpellAbility newSA = sa.copyWithDefinedCost(cost);
newSA.setBasicSpell(false);
newSA.putParam("Secondary", "True");
newSA.setDescription(sa.getDescription() + " (by paying " + cost.toSimpleString() + " instead of its mana cost)");
newSA.setIntrinsic(intrinsic);
inst.addSpellAbility(newSA);
}
} else if (keyword.startsWith("Adapt")) {
if (keyword.startsWith("Adapt")) {
final String[] k = keyword.split(":");
final String magnitude = k[1];
final String manacost = k[2];

View File

@@ -18,8 +18,9 @@ public class StaticAbilityAlternativeCost {
public static List<SpellAbility> alternativeCosts(final SpellAbility sa, final Card source, final Player pl) {
List<SpellAbility> result = Lists.newArrayList();
CardCollection list = new CardCollection(source.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
list.add(source);
// add source first in case it's LKI (alternate host)
CardCollection list = new CardCollection(source);
list.addAll(source.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
for (final Card ca : list) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.checkConditions(MODE)) {
@@ -36,18 +37,23 @@ public class StaticAbilityAlternativeCost {
newSA.setActivatingPlayer(pl);
newSA.setBasicSpell(false);
// CostDesc only for ManaCost?
if (sa.isAbility()) {
newSA.putParam("CostDesc", stAb.hasParam("CostDesc") ? ManaCostParser.parse(stAb.getParam("CostDesc")) : cost.toSimpleString());
if (cost.hasXInAnyCostPart()) {
newSA.setSVar("X", stAb.getSVar("X"));
}
// makes new SpellDescription
final StringBuilder sb = new StringBuilder();
sb.append(newSA.getCostDescription());
// CostDesc only for ManaCost?
if (sa.isAbility()) {
newSA.putParam("CostDesc", stAb.hasParam("CostDesc") ? ManaCostParser.parse(stAb.getParam("CostDesc")) : cost.toSimpleString());
sb.append(newSA.getCostDescription());
}
// skip reminder text for now, Keywords might be too complicated
//sb.append("(").append(newKi.getReminderText()).append(")");
if (sa.isSpell()) {
sb.append(" ").append(sa.getDescription()).append(" (by paying " + cost.toSimpleString() + " instead of its mana cost)");
sb.append(sa.getDescription()).append(" (by paying " + cost.toSimpleString() + " instead of its mana cost)");
}
newSA.setDescription(sb.toString());