From 013cd0a9a8e2ffef454cb82a7e56938a527da23b Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 4 Dec 2017 05:30:59 +0000 Subject: [PATCH] - Added puzzle PC_122915 by Xitax (has some start-of-the-game quirks, documented in the description for now, may be addressed later). --- .gitattributes | 1 + .../src/main/java/forge/ai/GameState.java | 33 ++++++++++--------- forge-gui/res/puzzle/PC_122915.pzl | 22 +++++++++++++ 3 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 forge-gui/res/puzzle/PC_122915.pzl diff --git a/.gitattributes b/.gitattributes index 0d44c5f0cf3..d8666c050b9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19786,6 +19786,7 @@ forge-gui/res/puzzle/PC_112415.pzl -text forge-gui/res/puzzle/PC_120815.pzl -text forge-gui/res/puzzle/PC_121515.pzl -text forge-gui/res/puzzle/PC_122215.pzl -text +forge-gui/res/puzzle/PC_122915.pzl -text forge-gui/res/puzzle/PC_13.pzl -text forge-gui/res/puzzle/PC_18.pzl -text forge-gui/res/puzzle/PC_19.pzl -text diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java index 8016894d533..5e9cb100702 100644 --- a/forge-ai/src/main/java/forge/ai/GameState.java +++ b/forge-ai/src/main/java/forge/ai/GameState.java @@ -1,23 +1,9 @@ package forge.ai; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; - import forge.StaticData; import forge.card.CardStateName; import forge.game.Game; @@ -27,7 +13,6 @@ import forge.game.ability.effects.DetachedCardEffect; import forge.game.card.Card; import forge.game.card.CardCollection; import forge.game.card.CardCollectionView; -import forge.game.card.CardFactory; import forge.game.card.CounterType; import forge.game.card.token.TokenInfo; import forge.game.combat.Combat; @@ -46,6 +31,12 @@ import forge.util.TextUtil; import forge.util.collect.FCollectionView; import org.apache.commons.lang3.StringUtils; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.*; +import java.util.Map.Entry; + public abstract class GameState { private static final Map ZONES = new HashMap(); static { @@ -74,6 +65,7 @@ public abstract class GameState { private final Map cardToChosenType = new HashMap<>(); private final Map> cardToRememberedId = new HashMap<>(); private final Map> cardToImprintedId = new HashMap<>(); + private final Map cardToNamedCard = new HashMap<>(); private final Map cardToExiledWithId = new HashMap<>(); private final Map cardAttackMap = new HashMap<>(); @@ -281,6 +273,9 @@ public abstract class GameState { if (!c.getChosenType().isEmpty()) { newText.append("|ChosenType:").append(c.getChosenType()); } + if (!c.getNamedCard().isEmpty()) { + newText.append("|NamedCard:").append(c.getNamedCard()); + } List rememberedCardIds = Lists.newArrayList(); for (Object obj : c.getRemembered()) { @@ -828,6 +823,12 @@ public abstract class GameState { Card c = entry.getKey(); c.setChosenType(entry.getValue()); } + + // Named card + for (Entry entry : cardToNamedCard.entrySet()) { + Card c = entry.getKey(); + c.setNamedCard(entry.getValue()); + } } private void handleCardAttachments() { @@ -1008,6 +1009,8 @@ public abstract class GameState { cardToChosenClrs.put(c, Arrays.asList(info.substring(info.indexOf(':') + 1).split(","))); } else if (info.startsWith("ChosenType:")) { cardToChosenType.put(c, info.substring(info.indexOf(':') + 1)); + } else if (info.startsWith("NamedCard:")) { + cardToNamedCard.put(c, info.substring(info.indexOf(':') + 1)); } else if (info.startsWith("ExecuteScript:")) { cardToScript.put(c, info.substring(info.indexOf(':') + 1)); } else if (info.startsWith("RememberedCards:")) { diff --git a/forge-gui/res/puzzle/PC_122915.pzl b/forge-gui/res/puzzle/PC_122915.pzl new file mode 100644 index 00000000000..3466c123686 --- /dev/null +++ b/forge-gui/res/puzzle/PC_122915.pzl @@ -0,0 +1,22 @@ +[metadata] +Name:Perplexing Chimera (GatheringMagic.com) 122915 - Burn, Baby, Burn +URL:http://www.gatheringmagic.com/seanuy-122915-burn-baby-burn/ +Goal:Win +Turns:1 +Difficulty:Hard +Description: Win this turn. AI has these cards in hand - Lightning Bolt, Guerrilla Tactics, Skullcrack, Pyrotechnics.\n\nIMPORTANT - Once the puzzle starts, you will be prompted to apply the replacement effect of the card Clone. You need to choose "No" in order for this puzzle to work correctly. Also, a notification box will pop up to name a card. It does not matter what you choose, the card "Lightning Bolt" will be automatically chosen after the game begins [These quirks will be resolved at a later date]. +[state] +ActivePlayer=human +ActivePhase=main1 +HumanLife=2 +AILife=10 +humanhand=Valorous Stance; Parallax Wave +humangraveyard= +humanlibrary= +humanprecast= +humanbattlefield=Plains|Set:ZEN; Plains|Set:ZEN; Plains|Set:ZEN; Island|Set:ZEN; Island|Set:ZEN; Island|Set:ZEN; Aven Riftwatcher|Counters:TIME=1; Brago, King Eternal; Heavy Infantry|Id:422; Runed Halo|NamedCard:Lightning Bolt; Angelic Shield; Clone|ExecuteScript:DBCopy->420 +aibattlefield=Swamp|Tapped|Set:ZEN; Swamp|Tapped|Set:ZEN; Swamp|Tapped|Set:ZEN; Mountain|Set:ZEN; Mountain|Tapped|Set:ZEN; Mountain|Tapped|Set:ZEN; Volcanic Dragon|Id:420; Typhoid Rats; Skulking Fugitive; Vulshok Refugee; Mindslicer|Id:424; Accorder's Shield|Attaching:424; Torment|Attaching:422; +aihand=Lightning Bolt; Guerrilla Tactics; Skullcrack; Pyrotechnics +aigraveyard= +ailibrary= +aiexile=