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("Class") || keyword.startsWith("Blitz")
|| keyword.startsWith("Specialize") || keyword.equals("Ravenous") || keyword.startsWith("Specialize") || keyword.equals("Ravenous")
|| keyword.equals("For Mirrodin") || keyword.startsWith("Craft") || keyword.equals("For Mirrodin") || keyword.startsWith("Craft")
|| keyword.startsWith("Landwalk") || keyword.startsWith("Landwalk")) {
|| keyword.startsWith("Alternative Cost")) {
// keyword parsing takes care of adding a proper description // keyword parsing takes care of adding a proper description
} else if (keyword.equals("Read ahead")) { } else if (keyword.equals("Read ahead")) {
sb.append(Localizer.getInstance().getMessage("lblReadAhead")).append(" (").append(Localizer.getInstance().getMessage("lblReadAheadDesc")); 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) { public static void addSpellAbility(final KeywordInterface inst, final CardState card, final boolean intrinsic) {
String keyword = inst.getOriginal(); String keyword = inst.getOriginal();
Card host = card.getCard(); Card host = card.getCard();
if (keyword.startsWith("Alternative Cost") && !host.isLand()) { if (keyword.startsWith("Adapt")) {
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")) {
final String[] k = keyword.split(":"); final String[] k = keyword.split(":");
final String magnitude = k[1]; final String magnitude = k[1];
final String manacost = k[2]; 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) { public static List<SpellAbility> alternativeCosts(final SpellAbility sa, final Card source, final Player pl) {
List<SpellAbility> result = Lists.newArrayList(); List<SpellAbility> result = Lists.newArrayList();
CardCollection list = new CardCollection(source.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)); // add source first in case it's LKI (alternate host)
list.add(source); CardCollection list = new CardCollection(source);
list.addAll(source.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
for (final Card ca : list) { for (final Card ca : list) {
for (final StaticAbility stAb : ca.getStaticAbilities()) { for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.checkConditions(MODE)) { if (!stAb.checkConditions(MODE)) {
@@ -36,18 +37,23 @@ public class StaticAbilityAlternativeCost {
newSA.setActivatingPlayer(pl); newSA.setActivatingPlayer(pl);
newSA.setBasicSpell(false); newSA.setBasicSpell(false);
// CostDesc only for ManaCost? if (cost.hasXInAnyCostPart()) {
if (sa.isAbility()) { newSA.setSVar("X", stAb.getSVar("X"));
newSA.putParam("CostDesc", stAb.hasParam("CostDesc") ? ManaCostParser.parse(stAb.getParam("CostDesc")) : cost.toSimpleString());
} }
// makes new SpellDescription // makes new SpellDescription
final StringBuilder sb = new StringBuilder(); 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 // skip reminder text for now, Keywords might be too complicated
//sb.append("(").append(newKi.getReminderText()).append(")"); //sb.append("(").append(newKi.getReminderText()).append(")");
if (sa.isSpell()) { 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()); newSA.setDescription(sb.toString());

View File

@@ -3,5 +3,6 @@ ManaCost:1 W
Types:Legendary Creature Human Samurai Types:Legendary Creature Human Samurai
PT:2/1 PT:2/1
K:Bushido:1 K:Bushido:1
S:Mode$ Continuous | Affected$ Card.Samurai+YouCtrl | AddKeyword$ Alternative Cost:ConvertedManaCost | AffectedZone$ Hand,Graveyard,Exile,Library,Command | Description$ You may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's mana value. S:Mode$ AlternativeCost | ValidSA$ Spell.Samurai | ValidPlayer$ You | Cost$ X | Description$ You may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's mana value.
SVar:X:Count$CardManaCost
Oracle:Bushido 1 (Whenever this creature blocks or becomes blocked, it gets +1/+1 until end of turn.)\nYou may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's mana value. Oracle:Bushido 1 (Whenever this creature blocks or becomes blocked, it gets +1/+1 until end of turn.)\nYou may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's mana value.

View File

@@ -3,8 +3,9 @@ ManaCost:4 B
Types:Creature Vampire Warlock Types:Creature Vampire Warlock
PT:3/5 PT:3/5
K:Flying K:Flying
A:AB$ Effect | Cost$ 1 B T | StaticAbilities$ ReduceCost | Triggers$ TrigCastSpell A:AB$ Effect | Cost$ 1 B T | StaticAbilities$ ReduceCost | Triggers$ TrigCastSpell | SpellDescription$ Rather than pay the mana cost of the next spell you cast this turn, you may pay life equal to that spell's mana value.
SVar:ReduceCost:Mode$ Continuous | Affected$ Card.nonLand+YouCtrl | AddKeyword$ Alternative Cost:PayLife<ConvertedManaCost> | AffectedZone$ Hand,Graveyard,Exile,Library,Command | EffectZone$ Command | Description$ Rather than pay the mana cost of the next spell you cast this turn, you may pay life equal to that spell's mana value. SVar:ReduceCost:Mode$ AlternativeCost | ValidSA$ Spell | ValidPlayer$ You | Cost$ PayLife<X> | Description$ Rather than pay the mana cost of the next spell you cast this turn, you may pay life equal to that spell's mana value.
SVar:TrigCastSpell:Mode$ SpellCast | ValidActivatingPlayer$ You | TriggerZones$ Command | Execute$ RemoveEffect | Static$ True SVar:TrigCastSpell:Mode$ SpellCast | ValidActivatingPlayer$ You | TriggerZones$ Command | Execute$ RemoveEffect | Static$ True
SVar:RemoveEffect:DB$ ChangeZone | Origin$ Command | Destination$ Exile SVar:RemoveEffect:DB$ ChangeZone | Origin$ Command | Destination$ Exile
SVar:X:Count$CardManaCost
Oracle:Flying\n{1}{B}, {T}: Rather than pay the mana cost of the next spell you cast this turn, you may pay life equal to that spell's mana value. Oracle:Flying\n{1}{B}, {T}: Rather than pay the mana cost of the next spell you cast this turn, you may pay life equal to that spell's mana value.

View File

@@ -264,7 +264,10 @@ public class HumanPlaySpellAbility {
if (needX) { if (needX) {
if (cost.hasXInAnyCostPart()) { if (cost.hasXInAnyCostPart()) {
final String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way final String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
if ("Count$xPaid".equals(sVar) || sVar.isEmpty()) { // check if X != 0 is even allowed or the X shard got removed
boolean replacedXshard = ability.isSpell() && ability.getHostCard().getManaCost().countX() > 0 &&
(cost.hasNoManaCost() || cost.getCostMana().getAmountOfX() == 0);
if (("Count$xPaid".equals(sVar) && !replacedXshard) || sVar.isEmpty()) {
final Integer value = controller.announceRequirements(ability, "X"); final Integer value = controller.announceRequirements(ability, "X");
if (value == null) { if (value == null) {
return false; return false;