From 8c7edaaca4c78e79fa91efbf6af9f40cc69ab012 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sat, 5 Aug 2017 09:54:27 +0000 Subject: [PATCH] - Added support for "Destroy Permanents"/"Kill Creatures" goal in puzzle mode. - Added puzzle PC_042815 implemented by Xitax. --- .gitattributes | 1 + forge-gui/res/puzzle/PC_042815.pzl | 22 +++++++++++++++++++ .../src/main/java/forge/puzzle/Puzzle.java | 18 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 forge-gui/res/puzzle/PC_042815.pzl diff --git a/.gitattributes b/.gitattributes index e21e83b343d..5cd3ecffce3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19427,6 +19427,7 @@ forge-gui/res/music/menus/The[!!-~]Pyre.mp3 -text forge-gui/res/puzzle/PC_033115.pzl -text forge-gui/res/puzzle/PC_040715.pzl -text forge-gui/res/puzzle/PC_041415.pzl -text +forge-gui/res/puzzle/PC_042815.pzl -text forge-gui/res/puzzle/PC_050515.pzl -text forge-gui/res/puzzle/PC_051215.pzl -text forge-gui/res/puzzle/PC_051915.pzl -text diff --git a/forge-gui/res/puzzle/PC_042815.pzl b/forge-gui/res/puzzle/PC_042815.pzl new file mode 100644 index 00000000000..fac2c66a0c3 --- /dev/null +++ b/forge-gui/res/puzzle/PC_042815.pzl @@ -0,0 +1,22 @@ +[metadata] +Name:Perplexing Chimera (GatheringMagic.com) 042815 - Dracophobia +URL:http://www.gatheringmagic.com/seanuy-042815-perplexing-chimera-5-dracophobia/ +Goal:Kill Opposing Creatures +Targets:Creature.Dragon+OppCtrl +Turns:1 +Difficulty:Hard +Description:Destroy all opponent's Dragons. Windstorm is on top of your library. +[state] +ActivePlayer=human +ActivePhase=Main1 +HumanLife=5 +AILife=17 +humanhand=Sidisi's Faithful|Set:DTK; Sudden Reclamation|Set:FRF; Trap Essence|Set:KTK; Mystic of the Hidden Way|Set:KTK +humangraveyard=Servant of the Scale|Set:DTK; Naturalize|Set:DTK; Savage Punch|Set:KTK; Sultai Skullkeeper|Set:FRF; Bathe in Dragonfire|Set:FRF; Write into Being|Set:FRF +humanlibrary=Windstorm|Set:KTK +humanbattlefield=Island|Set:DTK; Island|Set:DTK; Island|Set:DTK; Mountain|Set:DTK; Mountain|Set:DTK; Forest|Set:DTK; Forest|Set:DTK; Rugged Highlands|Set:FRF; Whisperer of the Wilds|Set:FRF; Heir of the Wilds|Set:KTK; Roar of Challenge|Set:KTK|FaceDown; Den Protector|Set:DTK|FaceDown; Herdchaser Dragon|Set:DTK; Briber's Purse|Set:KTK +aibattlefield=t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:420; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:421; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:422; t:Dragon,P:4,T:4,Cost:no cost,Types:Creature-Dragon,Keywords:Flying,Image:r_4_4_dragon_dtk|Id:423; Sultai Runemark|Attaching:424|Set:FRF; Herdchaser Dragon|Set:DTK|Counters:P1P1=1|Id:424; Plains|Set:DTK|Tapped; Island|Set:DTK|Tapped; Swamp|Set:DTK|Tapped; Mountain|Set:DTK|Tapped; Mountain|Set:DTK|Tapped; Forest|Set:DTK|Tapped; Forest|Set:DTK|Tapped; Scoured Barrens|Set:KTK|Tapped; Swiftwater Cliffs|Set:FRF|Tapped; Thornwood Falls|Set:FRF|Tapped +aihand= +aigraveyard= +ailibrary= +aiexile= diff --git a/forge-gui/src/main/java/forge/puzzle/Puzzle.java b/forge-gui/src/main/java/forge/puzzle/Puzzle.java index 5add56906d4..9ab44b17907 100644 --- a/forge-gui/src/main/java/forge/puzzle/Puzzle.java +++ b/forge-gui/src/main/java/forge/puzzle/Puzzle.java @@ -21,6 +21,7 @@ public class Puzzle extends GameState implements InventoryItem, Comparable { String url; String difficulty; String description; + String targets; int turns; public Puzzle(Map> puzzleLines) { @@ -44,6 +45,8 @@ public class Puzzle extends GameState implements InventoryItem, Comparable { this.difficulty = split[1]; } else if ("Description".equalsIgnoreCase(split[0])) { this.description = split[1]; + } else if ("Targets".equalsIgnoreCase(split[0])) { + this.targets = split[1]; } } } @@ -116,6 +119,21 @@ public class Puzzle extends GameState implements InventoryItem, Comparable { "TurnCount$ " + (turns + 1) + " | TriggerDescription$ At the beginning of your upkeep step, you win the game."; eff = "DB$ WinsGame | Defined$ You"; break; + case "destroy specified permanents": + case "destroy specified creatures": + case "kill opposing creatures": + if (targets == null) { + targets = "Creature.OppCtrl"; // by default, kill all opponent's creatures + } + String trigKill = "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCards$ Creature.OppCtrl | " + + "Static$ True | TriggerDescription$ When the last creature opponent controls dies, you win the game."; + String effKill = "DB$ WinsGame | Defined$ You | ConditionCheckSVar$ CreatureCount | ConditionSVarCompare$ EQ0"; + final Trigger triggerKill = TriggerHandler.parseTrigger(trigKill, goalCard, true); + triggerKill.setOverridingAbility(AbilityFactory.getAbility(effKill, goalCard)); + goalCard.addTrigger(triggerKill); + + String countVar = "Count$Valid " + targets; + goalCard.setSVar("CreatureCount", countVar); default: break; }