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.
This commit is contained in:
Agetian
2023-05-08 15:12:33 +03:00
committed by GitHub
parent 80cf74d26c
commit 71362ce82b
2 changed files with 13 additions and 12 deletions

View File

@@ -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")) {

View File

@@ -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