From 71362ce82b054f7ad0e1677b8be3b2e725c7676c Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 8 May 2023 15:12:33 +0300 Subject: [PATCH 1/2] Update support for Meld in GameState/Puzzle Mode. (#3078) * - Simplify MeldedWith support in GameState (as a parameter for Meld). * - Maintain support for old-style "|Meld" game states just in case. --- .../src/main/java/forge/ai/GameState.java | 23 ++++++++++--------- forge-gui/res/puzzle/PS_ONE3.pzl | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index 0dce859f59b..31b5c7bb18c 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -304,7 +304,7 @@ public abstract class GameState { } else if (c.getCurrentStateName().equals(CardStateName.Meld)) { newText.append("|Meld"); if (c.getMeldedWith() != null) { - newText.append("|MeldedWith:"); + newText.append(":"); newText.append(c.getMeldedWith().getName()); } } else if (c.getCurrentStateName().equals(CardStateName.Modal)) { @@ -1249,17 +1249,18 @@ public abstract class GameState { c.setBackSide(true); } else if (info.startsWith("Flipped")) { c.setState(CardStateName.Flipped, true); - } else if (info.startsWith("MeldedWith")) { - String meldCardName = info.substring(info.indexOf(':') + 1).replace("^", ","); - Card meldTarget; - PaperCard pc = StaticData.instance().getCommonCards().getCard(meldCardName); - if (pc == null) { - System.err.println("ERROR: Tried to create a non-existent card named " + meldCardName + " (as a MeldedWith card) when loading game state!"); - continue; - } - meldTarget = Card.fromPaperCard(pc, c.getOwner()); - c.setMeldedWith(meldTarget); } else if (info.startsWith("Meld")) { + if (info.indexOf(':') > 0) { + String meldCardName = info.substring(info.indexOf(':') + 1).replace("^", ","); + Card meldTarget; + PaperCard pc = StaticData.instance().getCommonCards().getCard(meldCardName); + if (pc == null) { + System.err.println("ERROR: Tried to create a non-existent card named " + meldCardName + " (as a MeldedWith card) when loading game state!"); + continue; + } + meldTarget = Card.fromPaperCard(pc, c.getOwner()); + c.setMeldedWith(meldTarget); + } c.setState(CardStateName.Meld, true); c.setBackSide(true); } else if (info.startsWith("Modal")) { diff --git a/forge-gui/res/puzzle/PS_ONE3.pzl b/forge-gui/res/puzzle/PS_ONE3.pzl index b6ab6b43248..26123fa3bcb 100644 --- a/forge-gui/res/puzzle/PS_ONE3.pzl +++ b/forge-gui/res/puzzle/PS_ONE3.pzl @@ -13,7 +13,7 @@ p0life=20 p0landsplayed=0 p0landsplayedlastturn=0 p0hand=Cement Shoes;Prophetic Prism -p0battlefield=Kaito, Dancing Shadow|Counters:LOYALTY=3;Tezzeret, Betrayer of Flesh|Counters:LOYALTY=2;Urza, Planeswalker|Meld|MeldedWith:The Mightstone and Weakstone|Counters:LOYALTY=7;Levitating Statue;Ichormoon Gauntlet +p0battlefield=Kaito, Dancing Shadow|Counters:LOYALTY=3;Tezzeret, Betrayer of Flesh|Counters:LOYALTY=2;Urza, Planeswalker|Meld:The Mightstone and Weakstone|Counters:LOYALTY=7;Levitating Statue;Ichormoon Gauntlet p0library=Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt p1life=21 p1landsplayed=0 From 87d934acef739fc35c6d608cbd9468eb9ea94914 Mon Sep 17 00:00:00 2001 From: tool4ever Date: Mon, 8 May 2023 15:58:32 +0200 Subject: [PATCH 2/2] Update vraska_betrayals_sting.txt --- forge-gui/res/cardsfolder/v/vraska_betrayals_sting.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-gui/res/cardsfolder/v/vraska_betrayals_sting.txt b/forge-gui/res/cardsfolder/v/vraska_betrayals_sting.txt index 22520029d71..e490b838303 100644 --- a/forge-gui/res/cardsfolder/v/vraska_betrayals_sting.txt +++ b/forge-gui/res/cardsfolder/v/vraska_betrayals_sting.txt @@ -6,7 +6,7 @@ K:Compleated A:AB$ Draw | Cost$ AddCounter<0/LOYALTY> | Planeswalker$ True | SubAbility$ DBLoseLife | SpellDescription$ You draw a card and you lose 1 life. Proliferate. SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ 1 | SubAbility$ DBProliferate SVar:DBProliferate:DB$ Proliferate -A:AB$ Animate | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Creature | RemoveAllAbilities$ True | Colors$ Green | Types$ Artifact,Treasure | Abilities$ TreasureSac | RemoveCardTypes$ True | Duration$ Permanent | StackDescription$ {c:Targeted} becomes a Treasure artifact with "{T}, Sacrifice this artifact: Add one mana of any color" and loses all other card types and abilities. | SpellDescription$ Target creature becomes a Treasure artifact with "{T}, Sacrifice this artifact: Add one mana of any color" and loses all other card types and abilities. +A:AB$ Animate | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Creature | RemoveAllAbilities$ True | Types$ Artifact,Treasure | Abilities$ TreasureSac | RemoveCardTypes$ True | Duration$ Permanent | StackDescription$ {c:Targeted} becomes a Treasure artifact with "{T}, Sacrifice this artifact: Add one mana of any color" and loses all other card types and abilities. | SpellDescription$ Target creature becomes a Treasure artifact with "{T}, Sacrifice this artifact: Add one mana of any color" and loses all other card types and abilities. SVar:TreasureSac:AB$ Mana | Cost$ T Sac<1/CARDNAME/this artifact> | Produced$ Any | SpellDescription$ Add one mana of any color. A:AB$ Poison | Cost$ SubCounter<9/LOYALTY> | Planeswalker$ True | Ultimate$ True | ValidTgts$ Player | ConditionCheckSVar$ X | ConditionSVarCompare$ LT9 | Num$ Difference | StackDescription$ If {p:Targeted} has fewer than nine poison counters, they get a number of poison counters equal to the difference. | SpellDescription$ If target player has fewer than nine poison counters, they get a number of poison counters equal to the difference. SVar:X:TargetedPlayer$PoisonCounters