From d68ee9c50773b11ef4b191cafbd6efa59d0c5770 Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 12 Jun 2018 08:58:32 +0300 Subject: [PATCH 1/2] - Added puzzle PS_DOM7. --- forge-gui/res/puzzle/PS_DOM7.pzl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 forge-gui/res/puzzle/PS_DOM7.pzl diff --git a/forge-gui/res/puzzle/PS_DOM7.pzl b/forge-gui/res/puzzle/PS_DOM7.pzl new file mode 100644 index 00000000000..7a9d2cfb013 --- /dev/null +++ b/forge-gui/res/puzzle/PS_DOM7.pzl @@ -0,0 +1,17 @@ +[metadata] +Name:Possibility Storm - Dominaria #07 +URL:http://www.possibilitystorm.com/wp-content/uploads/2018/06/066.-DOM7.jpg +Goal:Win +Turns:1 +Difficulty:Uncommon +Description:Win this turn.\nIMPORTANT: According to the rules of this puzzle, you have to start at the beginning of your main phase, and you just put Lore counters on your Sagas and need to put their abilities on the stack and choose targets before doing anything else. Due to the current limitations of Forge, you will start in your draw step so that this can be properly simulated. Please pass priority as soon as the puzzle starts to put the abilities on stack and progress to your Main phase. +[state] +humanlife=20 +ailife=4 +turn=1 +activeplayer=human +activephase=DRAW +humanhand=Shivan Fire;Kazarov, Sengir Pureblood;Dreamcaller Siren;Soul Salvage +humangraveyard=Thran Temporal Gateway;Neheb, the Worthy;Rona, Disciple of Gix +humanbattlefield=The Eldest Reborn|Counters:LORE=2;The First Eruption|Counters:LORE=1;Keldon Warcaller;Minotaur Sureshot;Frontline Devastator;Canyon Slough;Canyon Slough;Canyon Slough;Drowned Catacomb;Drowned Catacomb +aibattlefield=Cataclysmic Gearhulk|Set:KLD;Verdurous Gearhulk|Set:KLD|Counters:P1P1=2;Noxious Gearhulk|Set:KLD|Counters:P1P1=2 From 07d2b0aaf382e977064a810e874e57f0d3bca497 Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 12 Jun 2018 09:30:41 +0300 Subject: [PATCH 2/2] - PS_DOM7: better implementation. --- forge-ai/src/main/java/forge/ai/GameState.java | 16 +++++++++++++--- forge-gui/res/puzzle/PS_DOM7.pzl | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index c71ba439fdf..0d1617017f4 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -85,6 +85,8 @@ public abstract class GameState { private String tChangePlayer = "NONE"; private String tChangePhase = "NONE"; + private String tAdvancePhase = "NONE"; + private String precastHuman = null; private String precastAI = null; @@ -409,8 +411,10 @@ public abstract class GameState { if (categoryName.startsWith("active")) { if (categoryName.endsWith("player")) tChangePlayer = categoryValue.trim().toLowerCase(); - if (categoryName.endsWith("phase")) + else if (categoryName.endsWith("phase")) tChangePhase = categoryValue.trim().toUpperCase(); + else if (categoryName.endsWith("phaseadvance")) + tAdvancePhase = categoryValue.trim().toUpperCase(); return; } @@ -523,8 +527,9 @@ public abstract class GameState { cardToScript.clear(); cardAttackMap.clear(); - Player newPlayerTurn = tChangePlayer.equals("human") ? human : tChangePlayer.equals("ai") ? ai : null; - PhaseType newPhase = tChangePhase.equals("none") ? null : PhaseType.smartValueOf(tChangePhase); + Player newPlayerTurn = tChangePlayer.equalsIgnoreCase("human") ? human : tChangePlayer.equalsIgnoreCase("ai") ? ai : null; + PhaseType newPhase = tChangePhase.equalsIgnoreCase("none") ? null : PhaseType.smartValueOf(tChangePhase); + PhaseType advPhase = tAdvancePhase.equalsIgnoreCase("none") ? null : PhaseType.smartValueOf(tAdvancePhase); // Set stack to resolving so things won't trigger/effects be checked right away game.getStack().setResolving(true); @@ -564,6 +569,11 @@ public abstract class GameState { game.getStack().setResolving(false); + // Advance to a certain phase, activating all triggered abilities + if (advPhase != null) { + game.getPhaseHandler().devAdvanceToPhase(advPhase); + } + game.getAction().checkStateEffects(true); //ensure state based effects and triggers are updated } diff --git a/forge-gui/res/puzzle/PS_DOM7.pzl b/forge-gui/res/puzzle/PS_DOM7.pzl index 7a9d2cfb013..89f2edc8138 100644 --- a/forge-gui/res/puzzle/PS_DOM7.pzl +++ b/forge-gui/res/puzzle/PS_DOM7.pzl @@ -4,13 +4,14 @@ URL:http://www.possibilitystorm.com/wp-content/uploads/2018/06/066.-DOM7.jpg Goal:Win Turns:1 Difficulty:Uncommon -Description:Win this turn.\nIMPORTANT: According to the rules of this puzzle, you have to start at the beginning of your main phase, and you just put Lore counters on your Sagas and need to put their abilities on the stack and choose targets before doing anything else. Due to the current limitations of Forge, you will start in your draw step so that this can be properly simulated. Please pass priority as soon as the puzzle starts to put the abilities on stack and progress to your Main phase. +Description:Win this turn. You just put Lore counters on your Sagas. Put their abilities on the stack and choose targets before doing anything else. [state] humanlife=20 ailife=4 turn=1 activeplayer=human activephase=DRAW +activephaseadvance=MAIN1 humanhand=Shivan Fire;Kazarov, Sengir Pureblood;Dreamcaller Siren;Soul Salvage humangraveyard=Thran Temporal Gateway;Neheb, the Worthy;Rona, Disciple of Gix humanbattlefield=The Eldest Reborn|Counters:LORE=2;The First Eruption|Counters:LORE=1;Keldon Warcaller;Minotaur Sureshot;Frontline Devastator;Canyon Slough;Canyon Slough;Canyon Slough;Drowned Catacomb;Drowned Catacomb