From 57c6a338d8eb2633ffdae068100e806bcd7bd317 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Mon, 20 Feb 2023 14:39:29 +0100 Subject: [PATCH 1/5] Fix color word usage --- .../game/ability/effects/ProtectEffect.java | 34 +++++-------------- .../game/ability/effects/UntapEffect.java | 15 +++----- forge-gui/res/cardsfolder/o/opal_titan.txt | 10 ++---- 3 files changed, 15 insertions(+), 44 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ProtectEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ProtectEffect.java index 0a31d1eef25..a4e09a5b5f4 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ProtectEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ProtectEffect.java @@ -10,6 +10,7 @@ import com.google.common.collect.Lists; import forge.GameCommand; import forge.card.MagicColor; import forge.game.Game; +import forge.game.ability.AbilityUtils; import forge.game.ability.SpellAbilityEffect; import forge.game.card.Card; import forge.game.card.CardCollection; @@ -50,7 +51,7 @@ public class ProtectEffect extends SpellAbilityEffect { } } - if (sa.hasParam("Radiance") && (sa.usesTargeting())) { + if (sa.hasParam("Radiance") && sa.usesTargeting()) { sb.append(" and each other ").append(sa.getParam("ValidTgts")) .append(" that shares a color with "); if (tgtCards.size() > 1) { @@ -117,6 +118,11 @@ public class ProtectEffect extends SpellAbilityEffect { for (final String color : host.getChosenColors()) { gains.add(color.toLowerCase()); } + } else if (sa.getParam("Gains").startsWith("Defined")) { + CardCollection def = AbilityUtils.getDefinedCards(host, sa.getParam("Gains").substring(8), sa); + for (final Byte color : def.get(0).getColor()) { + gains.add(MagicColor.toLongString(color)); + } } else { gains.addAll(choices); } @@ -127,7 +133,7 @@ public class ProtectEffect extends SpellAbilityEffect { gainsKWList.add(TextUtil.concatWithSpace("Protection from", color)); } - final CardCollection untargetedCards = CardUtil.getRadiance(sa); + tgtCards.addAll(CardUtil.getRadiance(sa)); final long timestamp = game.getNextTimestamp(); @@ -157,30 +163,6 @@ public class ProtectEffect extends SpellAbilityEffect { addUntilCommand(sa, untilEOT); } } - - for (final Card unTgtC : untargetedCards) { - // only pump things in play - if (!unTgtC.isInPlay()) { - continue; - } - - unTgtC.addChangedCardKeywords(gainsKWList, null, false, timestamp, 0, true); - - if (!"Permanent".equals(sa.getParam("Duration"))) { - // If not Permanent, remove protection at EOT - final GameCommand untilEOT = new GameCommand() { - private static final long serialVersionUID = 7682700789217703789L; - - @Override - public void run() { - if (unTgtC.isInPlay()) { - unTgtC.removeChangedCardKeywords(timestamp, 0, true); - } - } - }; - addUntilCommand(sa, untilEOT); - } - } } public static List getProtectionList(final SpellAbility sa) { diff --git a/forge-game/src/main/java/forge/game/ability/effects/UntapEffect.java b/forge-game/src/main/java/forge/game/ability/effects/UntapEffect.java index 77d9d229c03..f7752512864 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/UntapEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/UntapEffect.java @@ -43,8 +43,10 @@ public class UntapEffect extends SpellAbilityEffect { } else if (sa.hasParam("UntapExactly")) { untapChoose(sa, true); } else { - final CardCollection untargetedCards = CardUtil.getRadiance(sa); - for (final Card tgtC : getTargetCards(sa)) { + final CardCollection affectedCards = getTargetCards(sa); + affectedCards.addAll(CardUtil.getRadiance(sa)); + + for (final Card tgtC : affectedCards) { if (tgtC.isPhasedOut()) { continue; } @@ -56,15 +58,6 @@ public class UntapEffect extends SpellAbilityEffect { tgtC.setTapped(false); } } - for (final Card tgtC : untargetedCards) { - if (tgtC.isInPlay()) { - tgtC.untap(true); - } - if (sa.hasParam("ETB")) { - // do not fire triggers - tgtC.setTapped(false); - } - } } } diff --git a/forge-gui/res/cardsfolder/o/opal_titan.txt b/forge-gui/res/cardsfolder/o/opal_titan.txt index cc79d79f580..ed19650d075 100644 --- a/forge-gui/res/cardsfolder/o/opal_titan.txt +++ b/forge-gui/res/cardsfolder/o/opal_titan.txt @@ -1,11 +1,7 @@ Name:Opal Titan ManaCost:2 W W Types:Enchantment -T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ Opponent | Execute$ TrigOpalTitanAnimate | IsPresent$ Card.Self+Enchantment | TriggerZones$ Battlefield | TriggerDescription$ When an opponent casts a creature spell, if CARDNAME is an enchantment, CARDNAME becomes a 4/4 Giant creature with protection from each of that spell's colors. -SVar:TrigOpalTitanAnimate:DB$ Animate | Defined$ Self | Types$ Creature,Giant | Power$ 4 | Toughness$ 4 | RemoveCardTypes$ True | Duration$ Permanent | SubAbility$ DBOpalTitanProtectionWhite | Duration$ Permanent -SVar:DBOpalTitanProtectionWhite:DB$ Protection | Gains$ white | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.White | ConditionCompare$ GE1 | SubAbility$ DBOpalTitanProtectionBlue | Duration$ Permanent -SVar:DBOpalTitanProtectionBlue:DB$ Protection | Gains$ blue | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Blue | ConditionCompare$ GE1 | SubAbility$ DBOpalTitanProtectionBlack | Duration$ Permanent -SVar:DBOpalTitanProtectionBlack:DB$ Protection | Gains$ black | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Black | ConditionCompare$ GE1 | SubAbility$ DBOpalTitanProtectionGreen | Duration$ Permanent -SVar:DBOpalTitanProtectionGreen:DB$ Protection | Gains$ green | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Green | ConditionCompare$ GE1 | SubAbility$ DBOpalTitanProtectionRed | Duration$ Permanent -SVar:DBOpalTitanProtectionRed:DB$ Protection | Gains$ red | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Red | ConditionCompare$ GE1 | Duration$ Permanent +T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ Opponent | Execute$ TrigAnimate | IsPresent$ Card.Self+Enchantment | TriggerZones$ Battlefield | TriggerDescription$ When an opponent casts a creature spell, if CARDNAME is an enchantment, CARDNAME becomes a 4/4 Giant creature with protection from each of that spell's colors. +SVar:TrigAnimate:DB$ Animate | Defined$ Self | Types$ Creature,Giant | Power$ 4 | Toughness$ 4 | RemoveCardTypes$ True | Duration$ Permanent | SubAbility$ DBProtection | Duration$ Permanent +SVar:DBProtection:DB$ Protection | Gains$ Defined TriggeredCard | Duration$ Permanent Oracle:When an opponent casts a creature spell, if Opal Titan is an enchantment, Opal Titan becomes a 4/4 Giant creature with protection from each of that spell's colors. From 6c5436a69e60e6cc8ad24e3929c015b4247e66d5 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Mon, 20 Feb 2023 15:59:53 +0100 Subject: [PATCH 2/5] XColor fixes --- .../main/java/forge/ai/ComputerUtilMana.java | 5 ++++- .../java/forge/ai/ability/DamageDealAi.java | 3 ++- .../forge/game/spellability/SpellAbility.java | 18 ++++++++++++++++++ .../res/cardsfolder/a/atalya_samite_master.txt | 2 +- forge-gui/res/cardsfolder/c/consume_spirit.txt | 2 +- .../res/cardsfolder/c/crimson_hellkite.txt | 2 +- forge-gui/res/cardsfolder/c/crypt_rats.txt | 2 +- forge-gui/res/cardsfolder/d/drain_life.txt | 2 +- .../res/cardsfolder/p/primitive_justice.txt | 4 ++-- forge-gui/res/cardsfolder/s/soul_burn.txt | 6 +++--- .../src/main/java/forge/player/HumanPlay.java | 2 +- 11 files changed, 35 insertions(+), 13 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java index 05414e0dcfa..29fcfe0873f 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java @@ -1354,7 +1354,10 @@ public class ComputerUtilMana { manaToAdd = 1; } - String xColor = sa.getParamOrDefault("XColor", "1"); + String xColor = sa.getXColor(); + if (xColor == null) { + xColor = "1"; + } if (card.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) { xColor = "WUBRGX"; } diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java index 72a10b7f736..eabc0ce7fca 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -23,6 +23,7 @@ import forge.ai.ComputerUtilMana; import forge.ai.PlayerControllerAi; import forge.ai.SpecialCardAi; import forge.ai.SpellAbilityAi; +import forge.card.MagicColor; import forge.card.mana.ManaCost; import forge.game.Game; import forge.game.GameEntity; @@ -1011,7 +1012,7 @@ public class DamageDealAi extends DamageAiBase { Player opponent = ai.getWeakestOpponent(); // TODO: somehow account for the possible cost reduction? - int dmg = ComputerUtilMana.determineLeftoverMana(sa, ai, saTgt.getParam("XColor"), false); + int dmg = ComputerUtilMana.determineLeftoverMana(sa, ai, MagicColor.toShortString(saTgt.getParam("XColor")), false); while (!ComputerUtilMana.canPayManaCost(sa, ai, dmg, false) && dmg > 0) { // TODO: ideally should never get here, currently put here as a precaution for complex mana base cases where the miscalculation might occur. Will remove later if it proves to never trigger. diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java index a7b9356d611..10332f5429f 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java @@ -28,6 +28,7 @@ import com.google.common.collect.*; import forge.GameCommand; import forge.card.CardStateName; import forge.card.ColorSet; +import forge.card.MagicColor; import forge.card.mana.ManaCost; import forge.game.CardTraitBase; import forge.game.ForgeScript; @@ -2417,6 +2418,23 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit xManaCostPaid = n; } + public String getXColor() { + if (!hasParam("XColor")) { + return null; + } + + StringBuilder sb = new StringBuilder(); + String parts[] = getParam("XColor").split(","); + for (String col : parts) { + // color word used + if (col.length() > 2) { + col = MagicColor.toShortString(col); + } + sb.append(col); + } + return sb.toString(); + } + public boolean canCastTiming(Player activator) { return canCastTiming(getHostCard(), activator); } diff --git a/forge-gui/res/cardsfolder/a/atalya_samite_master.txt b/forge-gui/res/cardsfolder/a/atalya_samite_master.txt index fcf2351abc8..8fd6e287531 100644 --- a/forge-gui/res/cardsfolder/a/atalya_samite_master.txt +++ b/forge-gui/res/cardsfolder/a/atalya_samite_master.txt @@ -2,7 +2,7 @@ Name:Atalya, Samite Master ManaCost:3 W W Types:Legendary Creature Human Cleric PT:2/3 -A:AB$ Charm | Cost$ X T | XColor$ W | Choices$ PreventDamage,GainLife | CharmNum$ 1 +A:AB$ Charm | Cost$ X T | XColor$ White | Choices$ PreventDamage,GainLife | CharmNum$ 1 SVar:PreventDamage:DB$ PreventDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature | Amount$ X | SpellDescription$ Prevent the next X damage that would be dealt to target creature this turn. SVar:GainLife:DB$ GainLife | LifeAmount$ X | Defined$ You | SpellDescription$ You gain X life. SVar:X:Count$xPaid diff --git a/forge-gui/res/cardsfolder/c/consume_spirit.txt b/forge-gui/res/cardsfolder/c/consume_spirit.txt index 5bae59327a1..9091beba75b 100644 --- a/forge-gui/res/cardsfolder/c/consume_spirit.txt +++ b/forge-gui/res/cardsfolder/c/consume_spirit.txt @@ -1,7 +1,7 @@ Name:Consume Spirit ManaCost:X 1 B Types:Sorcery -A:SP$ DealDamage | Cost$ X 1 B | XColor$ B | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ X | SubAbility$ DBGainLife | SpellDescription$ Spend only black mana on X. Consume Spirit deals X damage to any target and you gain X life. +A:SP$ DealDamage | Cost$ X 1 B | XColor$ Black | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ X | SubAbility$ DBGainLife | SpellDescription$ Spend only black mana on X. Consume Spirit deals X damage to any target and you gain X life. SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ X SVar:X:Count$xPaid Oracle:Spend only black mana on X.\nConsume Spirit deals X damage to any target and you gain X life. diff --git a/forge-gui/res/cardsfolder/c/crimson_hellkite.txt b/forge-gui/res/cardsfolder/c/crimson_hellkite.txt index 33237e11b7e..45a62dfb859 100644 --- a/forge-gui/res/cardsfolder/c/crimson_hellkite.txt +++ b/forge-gui/res/cardsfolder/c/crimson_hellkite.txt @@ -2,7 +2,7 @@ Name:Crimson Hellkite ManaCost:6 R R R Types:Creature Dragon PT:6/6 -A:AB$ DealDamage | Cost$ T X | XColor$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ X | SpellDescription$ Crimson Hellkite deals X damage to target creature. Spend only red mana on X. +A:AB$ DealDamage | Cost$ T X | XColor$ Red | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ X | SpellDescription$ Crimson Hellkite deals X damage to target creature. Spend only red mana on X. K:Flying SVar:X:Count$xPaid Oracle:Flying\n{X}, {T}: Crimson Hellkite deals X damage to target creature. Spend only red mana on X. diff --git a/forge-gui/res/cardsfolder/c/crypt_rats.txt b/forge-gui/res/cardsfolder/c/crypt_rats.txt index 99e37ae47a8..2e58d738eaa 100644 --- a/forge-gui/res/cardsfolder/c/crypt_rats.txt +++ b/forge-gui/res/cardsfolder/c/crypt_rats.txt @@ -2,6 +2,6 @@ Name:Crypt Rats ManaCost:2 B Types:Creature Rat PT:1/1 -A:AB$ DamageAll | Cost$ X | XColor$ B | NumDmg$ X | ValidCards$ Creature | ValidPlayers$ Player | ValidDescription$ each creature and each player. | SpellDescription$ Crypt Rats deals X damage to each creature and each player. Spend only black mana on X. +A:AB$ DamageAll | Cost$ X | XColor$ Black | NumDmg$ X | ValidCards$ Creature | ValidPlayers$ Player | ValidDescription$ each creature and each player. | SpellDescription$ Crypt Rats deals X damage to each creature and each player. Spend only black mana on X. SVar:X:Count$xPaid Oracle:{X}: Crypt Rats deals X damage to each creature and each player. Spend only black mana on X. diff --git a/forge-gui/res/cardsfolder/d/drain_life.txt b/forge-gui/res/cardsfolder/d/drain_life.txt index d1a46e4affa..90d62e26553 100644 --- a/forge-gui/res/cardsfolder/d/drain_life.txt +++ b/forge-gui/res/cardsfolder/d/drain_life.txt @@ -1,7 +1,7 @@ Name:Drain Life ManaCost:X 1 B Types:Sorcery -A:SP$ StoreSVar | Cost$ X 1 B | XColor$ B | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black mana on X. CARDNAME deals X damage to any target. You gain life equal to the damage dealt, but not more life than the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness. +A:SP$ StoreSVar | Cost$ X 1 B | XColor$ Black | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black mana on X. CARDNAME deals X damage to any target. You gain life equal to the damage dealt, but not more life than the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness. SVar:StoreTgtPW:DB$ StoreSVar | SVar$ Limit | Type$ Targeted | Expression$ CardCounters.LOYALTY | SubAbility$ StoreTgtP | ConditionDefined$ Targeted | ConditionPresent$ Card.Planeswalker | ConditionCheckSVar$ Loyalty | ConditionSVarCompare$ LTLimit SVar:StoreTgtP:DB$ StoreSVar | SVar$ Limit | Type$ Count | Expression$ TargetedLifeTotal | SubAbility$ DBDamage | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature,Card.Planeswalker | ConditionCompare$ EQ0 SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | SubAbility$ DBGainLife | AILogic$ XLifeDrain diff --git a/forge-gui/res/cardsfolder/p/primitive_justice.txt b/forge-gui/res/cardsfolder/p/primitive_justice.txt index c5090d6c04c..d1177288c82 100644 --- a/forge-gui/res/cardsfolder/p/primitive_justice.txt +++ b/forge-gui/res/cardsfolder/p/primitive_justice.txt @@ -3,10 +3,10 @@ ManaCost:1 R Types:Sorcery A:SP$ Destroy | Cost$ X 1 R | XColor$ RG | AnnounceTitle$ how many times to pay the additional cost | Announce$ AdditionalCostPayTimes | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | TargetMin$ TargetNum | TargetMax$ TargetNum | SubAbility$ DBGainLife | SpellDescription$ Destroy target artifact. For each additional {1}{R} you paid, destroy another target artifact. For each additional {1}{G} you paid, destroy another target artifact, and you gain 1 life. S:Mode$ RaiseCost | ValidCard$ Card.Self | Type$ Spell | Amount$ IncreaseCost | EffectZone$ All | Description$ As an additional cost to cast this spell, you may pay {1}{R} and/or {1}{G} any number of times. -SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ GreenManaPaid +SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ GManaPaid SVar:AdditionalCostPayTimes:Number$0 SVar:TargetNum:SVar$AdditionalCostPayTimes/Plus.1 SVar:IncreaseCost:SVar$AdditionalCostPayTimes SVar:X:SVar$AdditionalCostPayTimes -SVar:GreenManaPaid:Count$xColorPaid G +SVar:GManaPaid:Count$xColorPaid G Oracle:As an additional cost to cast this spell, you may pay {1}{R} and/or {1}{G} any number of times.\nDestroy target artifact. For each additional {1}{R} you paid, destroy another target artifact. For each additional {1}{G} you paid, destroy another target artifact, and you gain 1 life. diff --git a/forge-gui/res/cardsfolder/s/soul_burn.txt b/forge-gui/res/cardsfolder/s/soul_burn.txt index e8ed5834ce2..ee544149bfa 100644 --- a/forge-gui/res/cardsfolder/s/soul_burn.txt +++ b/forge-gui/res/cardsfolder/s/soul_burn.txt @@ -1,15 +1,15 @@ Name:Soul Burn ManaCost:X 2 B Types:Sorcery -A:SP$ StoreSVar | Cost$ X 2 B | XColor$ BR | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black and/or red mana on X. CARDNAME deals X damage to target creature or player. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness. +A:SP$ StoreSVar | Cost$ X 2 B | XColor$ Black,Red | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black and/or red mana on X. CARDNAME deals X damage to target creature or player. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness. SVar:StoreTgtPW:DB$ StoreSVar | SVar$ Limit | Type$ Targeted | Expression$ CardCounters.LOYALTY | SubAbility$ StoreTgtP | ConditionDefined$ Targeted | ConditionPresent$ Card.Planeswalker | ConditionCheckSVar$ Loyalty | ConditionSVarCompare$ LTLimit SVar:StoreTgtP:DB$ StoreSVar | SVar$ Limit | Type$ Count | Expression$ TargetedLifeTotal | SubAbility$ DBDamage | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature,Card.Planeswalker | ConditionCompare$ EQ0 SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | SubAbility$ DBGainLife | AILogic$ XLifeDrain SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ DrainedLifeCard SVar:X:Count$xPaid -SVar:DrainedLifeCard:SVar$BlackManaPaid/LimitMax.Limit +SVar:DrainedLifeCard:SVar$BManaPaid/LimitMax.Limit SVar:Limit:Count$xPaid SVar:Loyalty:Targeted$CardCounters.LOYALTY -SVar:BlackManaPaid:Count$xColorPaid B +SVar:BManaPaid:Count$xColorPaid B DeckHints:Color$Red Oracle:Spend only black and/or red mana on X.\nSoul Burn deals X damage to any target. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness. diff --git a/forge-gui/src/main/java/forge/player/HumanPlay.java b/forge-gui/src/main/java/forge/player/HumanPlay.java index f92473ef39d..bf7fc5da0e7 100644 --- a/forge-gui/src/main/java/forge/player/HumanPlay.java +++ b/forge-gui/src/main/java/forge/player/HumanPlay.java @@ -634,7 +634,7 @@ public class HumanPlay { ManaCostBeingPaid toPay = new ManaCostBeingPaid(realCost, mc.getRestriction()); String xInCard = source.getSVar("X"); - String xColor = ability.getParam("XColor"); + String xColor = ability.getXColor(); if (source.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) { xColor = "WUBRGX"; } From 07bf3a18c96af5214073009200d7476e336693c5 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Mon, 20 Feb 2023 19:15:32 +0100 Subject: [PATCH 3/5] Fix changedText not applied to SA --- forge-gui/res/cardsfolder/a/atalya_samite_master.txt | 4 ++-- .../src/main/java/forge/player/HumanPlaySpellAbility.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/forge-gui/res/cardsfolder/a/atalya_samite_master.txt b/forge-gui/res/cardsfolder/a/atalya_samite_master.txt index 8fd6e287531..24a5110ddfd 100644 --- a/forge-gui/res/cardsfolder/a/atalya_samite_master.txt +++ b/forge-gui/res/cardsfolder/a/atalya_samite_master.txt @@ -3,8 +3,8 @@ ManaCost:3 W W Types:Legendary Creature Human Cleric PT:2/3 A:AB$ Charm | Cost$ X T | XColor$ White | Choices$ PreventDamage,GainLife | CharmNum$ 1 -SVar:PreventDamage:DB$ PreventDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature | Amount$ X | SpellDescription$ Prevent the next X damage that would be dealt to target creature this turn. -SVar:GainLife:DB$ GainLife | LifeAmount$ X | Defined$ You | SpellDescription$ You gain X life. +SVar:PreventDamage:DB$ PreventDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature | Amount$ X | SpellDescription$ Prevent the next X damage that would be dealt to target creature this turn. Spend only white mana on X. +SVar:GainLife:DB$ GainLife | LifeAmount$ X | Defined$ You | SpellDescription$ You gain X life. Spend only white mana on X. SVar:X:Count$xPaid AI:RemoveDeck:All Oracle:{X}, {T}: Choose one —\n• Prevent the next X damage that would be dealt to target creature this turn. Spend only white mana on X.\n• You gain X life. Spend only white mana on X. diff --git a/forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java b/forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java index 69d53309c7e..bbe5cf80488 100644 --- a/forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java +++ b/forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java @@ -90,6 +90,7 @@ public class HumanPlaySpellAbility { zonePosition = fromZone.getCards().indexOf(c); } ability.setHostCard(game.getAction().moveToStack(c, ability)); + ability.changeText(); } if (!ability.isCopied()) { From 55009a21a9cbe399f27208275b7273e9b4c14cb9 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Mon, 20 Feb 2023 20:19:04 +0100 Subject: [PATCH 4/5] Clean up --- forge-game/src/main/java/forge/game/ability/AbilityUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index 699a408e48c..341846b8dea 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -534,9 +534,7 @@ public class AbilityUtils { } else if (hType.startsWith("Property")) { String defined = hType.split("Property")[1]; for (Player p : game.getPlayersInTurnOrder()) { - if (ability instanceof SpellAbility && p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), ability)) { - players.add(p); - } else if (!(ability instanceof SpellAbility) && p.hasProperty(defined, player, ability.getHostCard(), ability)) { + if (p.hasProperty(defined, player, ability.getHostCard(), ability)) { players.add(p); } } From 0a8a96c312e5e0f54b6428c66d821e63fddcb8a9 Mon Sep 17 00:00:00 2001 From: TRT <> Date: Mon, 20 Feb 2023 22:36:14 +0100 Subject: [PATCH 5/5] Conversion: use color words --- forge-core/src/main/java/forge/card/mana/ManaAtom.java | 10 ++++++++-- .../forge/game/ability/effects/ReplaceManaEffect.java | 3 +++ forge-gui/res/cardsfolder/c/celestial_dawn.txt | 2 +- forge-gui/res/cardsfolder/f/false_dawn.txt | 4 ++-- forge-gui/res/cardsfolder/g/grell_philosopher.txt | 2 +- forge-gui/res/cardsfolder/q/quicksilver_elemental.txt | 2 +- forge-gui/res/cardsfolder/s/sunglasses_of_urza.txt | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/forge-core/src/main/java/forge/card/mana/ManaAtom.java b/forge-core/src/main/java/forge/card/mana/ManaAtom.java index f65ad3a1a91..83b298116a9 100644 --- a/forge-core/src/main/java/forge/card/mana/ManaAtom.java +++ b/forge-core/src/main/java/forge/card/mana/ManaAtom.java @@ -65,8 +65,14 @@ public abstract class ManaAtom { case "AnyType": return ALL_MANA_TYPES; } byte b = 0; - for (char c : s.toCharArray()) { - b |= fromName(c); + if (s.length() > 2) { + // check for color word + b = fromName(s); + } + if (b == 0) { + for (char c : s.toCharArray()) { + b |= fromName(c); + } } return b; } diff --git a/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java index f96a864c2bf..439e0bb294a 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java @@ -57,6 +57,9 @@ public class ReplaceManaEffect extends SpellAbilityEffect { if (card.hasChosenColor()) { color = MagicColor.toShortString(card.getChosenColor()); } + } else { + // convert in case Color Word used + color = MagicColor.toShortString(color); } if (sa.hasParam("ReplaceOnly")) { replaced = replaced.replace(sa.getParam("ReplaceOnly"), color); diff --git a/forge-gui/res/cardsfolder/c/celestial_dawn.txt b/forge-gui/res/cardsfolder/c/celestial_dawn.txt index beb7c498d4f..4637286ae39 100644 --- a/forge-gui/res/cardsfolder/c/celestial_dawn.txt +++ b/forge-gui/res/cardsfolder/c/celestial_dawn.txt @@ -4,7 +4,7 @@ Types:Enchantment S:Mode$ Continuous | Affected$ Land.YouCtrl | AddType$ Plains | RemoveLandTypes$ True | Description$ Lands you control are Plains. S:Mode$ Continuous | Affected$ Card.YouOwn+nonLand | SetColor$ White | AffectedZone$ Hand,Library,Graveyard,Exile,Command | Description$ Nonland permanents you control are white. The same is true for spells you control and nonland cards you own that aren't on the battlefield. S:Mode$ Continuous | Affected$ Card.YouCtrl+nonLand | SetColor$ White | AffectedZone$ Battlefield,Stack -S:Mode$ Continuous | Affected$ You | ManaConversion$ W->AnyColor | Description$ You may spend white mana as though it were mana of any color. +S:Mode$ Continuous | Affected$ You | ManaConversion$ White->AnyColor | Description$ You may spend white mana as though it were mana of any color. S:Mode$ Continuous | Affected$ You | ManaConversion$ UBRG<-C | Description$ You may spend other mana only as though it were colorless mana. SVar:NonStackingEffect:True AI:RemoveDeck:Random diff --git a/forge-gui/res/cardsfolder/f/false_dawn.txt b/forge-gui/res/cardsfolder/f/false_dawn.txt index f97cf6bd1a3..fe597a81703 100644 --- a/forge-gui/res/cardsfolder/f/false_dawn.txt +++ b/forge-gui/res/cardsfolder/f/false_dawn.txt @@ -4,7 +4,7 @@ Types:Sorcery A:SP$ Effect | Cost$ 1 W | ReplacementEffects$ FDRep | StaticAbilities$ FDManaConvertion | SubAbility$ DBDraw | SpellDescription$ Until end of turn, spells and abilities you control that would add colored mana instead add that much white mana. Until end of turn, you may spend white mana as though it were mana of any color. Draw a card. SVar:DBDraw:DB$ Draw | NumCards$ 1 SVar:FDRep:Event$ ProduceMana | ActiveZones$ Command | ValidSA$ SpellAbility.YouCtrl | ReplaceWith$ ProduceW | Description$ Spells and abilities you control that would add colored mana add that much white mana instead. -SVar:ProduceW:DB$ ReplaceMana | ReplaceColor$ W -SVar:FDManaConvertion:Mode$ Continuous | EffectZone$ Command | Affected$ You | ManaConversion$ W->AnyColor | Description$ You may spend white mana as though it were mana of any color. +SVar:ProduceW:DB$ ReplaceMana | ReplaceColor$ White +SVar:FDManaConvertion:Mode$ Continuous | EffectZone$ Command | Affected$ You | ManaConversion$ White->AnyColor | Description$ You may spend white mana as though it were mana of any color. AI:RemoveDeck:All Oracle:Until end of turn, spells and abilities you control that would add colored mana instead add that much white mana. Until end of turn, you may spend white mana as though it were mana of any color.\nDraw a card. diff --git a/forge-gui/res/cardsfolder/g/grell_philosopher.txt b/forge-gui/res/cardsfolder/g/grell_philosopher.txt index faae3e8fef4..c86941de95b 100644 --- a/forge-gui/res/cardsfolder/g/grell_philosopher.txt +++ b/forge-gui/res/cardsfolder/g/grell_philosopher.txt @@ -5,7 +5,7 @@ PT:1/4 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigEffect | TriggerDescription$ Aberrant Tinkering — When CARDNAME enters the battlefield and at the beginning of your upkeep, each Horror you control gains all activated abilities of target artifact an opponent controls until end of turn. You may spend blue mana as though it were mana of any color to pay the activation costs of CARDNAME's abilities. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigEffect | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ Aberrant Tinkering — When CARDNAME enters the battlefield and at the beginning of your upkeep, each Horror you control gains all activated abilities of target artifact an opponent controls until end of turn. You may spend blue mana as though it were mana of any color to pay the activation costs of CARDNAME's abilities. SVar:TrigEffect:DB$ Effect | ValidTgts$ Card.Artifact+OppCtrl | TgtZone$ Battlefield | TgtPrompt$ Select target artifact an opponent controls | StaticAbilities$ STSteal | ImprintCards$ Targeted | RememberObjects$ Valid Creature.Horror+YouCtrl | ForgetOnMoved$ Battlefield -SVar:STSteal:Mode$ Continuous | Affected$ Card.IsRemembered | EffectZone$ Command | GainsAbilitiesOfDefined$ ImprintedLKI | GainsAbilitiesActivateIgnoreColor$ U->AnyColor +SVar:STSteal:Mode$ Continuous | Affected$ Card.IsRemembered | EffectZone$ Command | GainsAbilitiesOfDefined$ ImprintedLKI | GainsAbilitiesActivateIgnoreColor$ Blue->AnyColor AI:RemoveDeck:All DeckHints:Type$Horror Oracle:Aberrant Tinkering — When Grell Philosopher enters the battlefield and at the beginning of your upkeep, each Horror you control gains all activated abilities of target artifact an opponent controls until end of turn. You may spend blue mana as though it were mana of any color to activate those abilities. diff --git a/forge-gui/res/cardsfolder/q/quicksilver_elemental.txt b/forge-gui/res/cardsfolder/q/quicksilver_elemental.txt index 3f881f62afd..73a4a2a90c1 100644 --- a/forge-gui/res/cardsfolder/q/quicksilver_elemental.txt +++ b/forge-gui/res/cardsfolder/q/quicksilver_elemental.txt @@ -2,7 +2,7 @@ Name:Quicksilver Elemental ManaCost:3 U U Types:Creature Elemental PT:3/4 -K:ManaConvert:U->AnyColor:You may spend blue mana as though it were mana of any color to pay the activation costs of CARDNAME's abilities. +K:ManaConvert:Blue->AnyColor:You may spend blue mana as though it were mana of any color to pay the activation costs of CARDNAME's abilities. A:AB$ Effect | Cost$ U | ValidTgts$ Creature | TgtZone$ Battlefield | TgtPrompt$ Select target creature card | StaticAbilities$ STSteal | RememberObjects$ Targeted | Duration$ UntilHostLeavesPlayOrEOT | SpellDescription$ CARDNAME gains all activated abilities of target creature until end of turn. SVar:STSteal:Mode$ Continuous | Affected$ Card.EffectSource | EffectZone$ Command | GainsAbilitiesOfDefined$ RememberedLKI | Description$ Quicksilver Elemental gains all activated abilities of that card until end of turn. AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/s/sunglasses_of_urza.txt b/forge-gui/res/cardsfolder/s/sunglasses_of_urza.txt index 5487397ca7a..56f1d8a8204 100644 --- a/forge-gui/res/cardsfolder/s/sunglasses_of_urza.txt +++ b/forge-gui/res/cardsfolder/s/sunglasses_of_urza.txt @@ -1,7 +1,7 @@ Name:Sunglasses of Urza ManaCost:3 Types:Artifact -S:Mode$ Continuous | Affected$ You | ManaConversion$ W->R | Description$ You may spend white mana as though it were red mana. +S:Mode$ Continuous | Affected$ You | ManaConversion$ White->Red | Description$ You may spend white mana as though it were red mana. AI:RemoveDeck:All DeckNeeds:Color$Red Oracle:You may spend white mana as though it were red mana.