diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index 10fee4a5847..522281d6884 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -1004,6 +1004,12 @@ public abstract class GameState { private void setupPlayerState(int life, Map cardTexts, final Player p, final int landsPlayed, final int landsPlayedLastTurn) { // Lock check static as we setup player state + // Clear all zones first, this ensures that any lingering cards and effects (e.g. in command zone) get cleared up + // before setting up a new state + for (ZoneType zt : ZONES.keySet()) { + p.getZone(zt).removeAllCards(true); + } + Map playerCards = new EnumMap(ZoneType.class); for (Entry kv : cardTexts.entrySet()) { String value = kv.getValue(); diff --git a/forge-game/src/main/java/forge/game/zone/Zone.java b/forge-game/src/main/java/forge/game/zone/Zone.java index 35f9f785410..229efd04468 100644 --- a/forge-game/src/main/java/forge/game/zone/Zone.java +++ b/forge-game/src/main/java/forge/game/zone/Zone.java @@ -141,6 +141,19 @@ public class Zone implements java.io.Serializable, Iterable { game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.ComplexUpdate, null)); } + public final void removeAllCards(boolean forcedWithoutEvents) { + if (forcedWithoutEvents) { + cardList.clear(); + } else { + for (Card c : cardList) { + if (cardList.remove(c)) { + onChanged(); + game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Removed, c)); + } + } + } + } + public final boolean is(final ZoneType zone) { return zone == zoneType; } diff --git a/forge-gui/res/puzzle/PS_GRN7.pzl b/forge-gui/res/puzzle/PS_GRN7.pzl new file mode 100644 index 00000000000..6c98741ecbc --- /dev/null +++ b/forge-gui/res/puzzle/PS_GRN7.pzl @@ -0,0 +1,18 @@ +[metadata] +Name:Possibility Storm - Guilds of Ravnica #07 +URL:http://www.possibilitystorm.com/wp-content/uploads/2018/11/089.-GRN7.jpg +Goal:Win +Turns:1 +Difficulty:Rare +Description:Win this turn. Remember that your answer must satisfy all possible blocking scenarios. Assume the top three cards of your opponent's library are all basic Forests. Titanic Growth and Prying Blade are exiled with your Thief of Sanity. +[state] +humanlife=20 +ailife=14 +turn=1 +activeplayer=human +activephase=MAIN1 +humanhand=Urza's Ruinous Blast;The Eldest Reborn;Demonic Vigor;Switcheroo +humanbattlefield=Thief of Sanity|Id:1|RememberedCards:2,3|ExecuteScript:DBEffect;Etrata, the Silencer;Steadfast Armasaur;Goring Ceratops;Watery Grave|NoETBTrigs;Watery Grave|NoETBTrigs;Watery Grave|NoETBTrigs;Glacial Fortress;Glacial Fortress;Glacial Fortress;Glacial Fortress +ailibrary=Forest;Forest;Forest +aibattlefield=Kraul Harpooner;Primordial Wurm;Trostani Discordant +aiexile=Titanic Growth|Id:2|ExiledWith:1|FaceDown;Prying Blade|Id:3|ExiledWith:1|FaceDown