From 8b8e39ff41ea34fe57645f82a05c9e7f24e7148d Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 8 Mar 2020 13:12:28 +0300 Subject: [PATCH] - Added puzzles PS_THB6 and PS_THB7. - Added a way to precast a spell from a specific host by ID. --- .../src/main/java/forge/ai/GameState.java | 19 ++++++++++++++----- forge-gui/res/puzzle/PS_THB6.pzl | 18 ++++++++++++++++++ forge-gui/res/puzzle/PS_THB7.pzl | 17 +++++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 forge-gui/res/puzzle/PS_THB6.pzl create mode 100644 forge-gui/res/puzzle/PS_THB7.pzl diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index 9d71da36c6a..aaec7b260ce 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -981,14 +981,23 @@ public abstract class GameState { spellDef = spellDef.substring(0, spellDef.indexOf("->")).trim(); } - PaperCard pc = StaticData.instance().getCommonCards().getCard(spellDef); + Card c = null; - if (pc == null) { - System.err.println("ERROR: Could not find a card with name " + spellDef + " to precast!"); - return; + if (StringUtils.isNumeric(spellDef)) { + // Precast from a specific host + c = idToCard.get(Integer.parseInt(spellDef)); + } else { + // Precast from a card by name + PaperCard pc = StaticData.instance().getCommonCards().getCard(spellDef); + + if (pc == null) { + System.err.println("ERROR: Could not find a card with name " + spellDef + " to precast!"); + return; + } + + c = Card.fromPaperCard(pc, activator); } - Card c = Card.fromPaperCard(pc, activator); SpellAbility sa = null; if (!scriptID.isEmpty()) { diff --git a/forge-gui/res/puzzle/PS_THB6.pzl b/forge-gui/res/puzzle/PS_THB6.pzl new file mode 100644 index 00000000000..0fb3f36c66e --- /dev/null +++ b/forge-gui/res/puzzle/PS_THB6.pzl @@ -0,0 +1,18 @@ +[metadata] +Name:Possibility Storm - Theros Beyond Death #06 +URL:https://i0.wp.com/www.possibilitystorm.com/wp-content/uploads/2020/02/149.-THB6-1-scaled.jpg +Goal:Win +Turns:1 +Difficulty:Uncommon +Description:Win this turn. Assume any unknown cards drawn by either player are not relevant to solving the puzzle. Your opponent starts with 13 cards in their library. Your opponent has a Pollenbright Druid on top of their library, and twelve other unknown cards in it. +[state] +humanlife=20 +ailife=18 +turn=1 +activeplayer=human +activephase=MAIN1 +humanhand=Assassin's Trophy;Unmoored Ego;Applied Biomancy;Underworld Dreams;Tyrant's Scorn +humanlibrary=Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt +humanbattlefield=Ob Nixilis, the Hate-Twisted|Counters:LOYALTY=2;Nessian Boar;Thief of Sanity;Thief of Sanity;Watery Grave|NoETBTrigs;Watery Grave|NoETBTrigs;Watery Grave|NoETBTrigs;Watery Grave|NoETBTrigs;Breeding Pool|NoETBTrigs;Breeding Pool|NoETBTrigs;Breeding Pool|NoETBTrigs +ailibrary=Pollenbright Druid;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt;Opt +aibattlefield=Silhana Wayfinder;Silhana Wayfinder;Blightbeetle;Wavebreak Hippocamp diff --git a/forge-gui/res/puzzle/PS_THB7.pzl b/forge-gui/res/puzzle/PS_THB7.pzl new file mode 100644 index 00000000000..0f8ed430eb9 --- /dev/null +++ b/forge-gui/res/puzzle/PS_THB7.pzl @@ -0,0 +1,17 @@ +[metadata] +Name:Possibility Storm - Theros Beyond Death #07 +URL:https://i2.wp.com/www.possibilitystorm.com/wp-content/uploads/2020/03/150.-THB7-scaled.jpg +Goal:Win +Turns:100 +Difficulty:Mythic +Description:It's your OPPONENT'S turn (first main phase), and you need to win before you lose. Can you do it? Your opponent has no cards in hand and no available mana (assume they just tapped out to cast Goblin Assault Team). You control your opponent's Dreadhorde Butcher with The Akroan War's first chapter ability. Assume the puzzle starts with no cards in either player's graveyard. +[state] +humanlife=3 +ailife=11 +turn=1 +activeplayer=ai +activephase=MAIN1 +humanhand=Lazotep Plating;Slaying Fire;So Tiny;Shock;Gideon's Triumph;Aspect of Manticore +humanbattlefield=The Akroan War|Counters:LORE=2|Id:2;Blood Aspirant;Flux Channeler;Naiad of Hidden Coves;Temple of Enlightenment|NoETBTrigs;Temple of Enlightenment|NoETBTrigs;Sacred Foundry|NoETBTrigs;Sacred Foundry|NoETBTrigs +aibattlefield=Underworld Dreams;Underworld Dreams;Underworld Dreams;Ferocity of the Wilds;Goblin Assault Team;Temple Thief;Mire Triton;Dreadhorde Butcher|Id:1 +humanprecast=2:DBGainControl->1