From 0c118fb707d8f3ddbbf3f30f6d2e386eb2f3daf4 Mon Sep 17 00:00:00 2001 From: Sloth Date: Wed, 22 Feb 2012 17:12:09 +0000 Subject: [PATCH] - Added Auriok Survivors. --- .gitattributes | 1 + res/cardsfolder/a/auriok_survivors.txt | 13 +++++++++++++ .../abilityfactory/AbilityFactoryAttach.java | 17 +++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/a/auriok_survivors.txt diff --git a/.gitattributes b/.gitattributes index b9b77df3dba..dc184ecb3a3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -503,6 +503,7 @@ res/cardsfolder/a/auriok_edgewright.txt svneol=native#text/plain res/cardsfolder/a/auriok_glaivemaster.txt svneol=native#text/plain res/cardsfolder/a/auriok_salvagers.txt svneol=native#text/plain res/cardsfolder/a/auriok_sunchaser.txt svneol=native#text/plain +res/cardsfolder/a/auriok_survivors.txt -text res/cardsfolder/a/auriok_transfixer.txt svneol=native#text/plain res/cardsfolder/a/aurochs.txt svneol=native#text/plain res/cardsfolder/a/aurochs_herd.txt svneol=native#text/plain diff --git a/res/cardsfolder/a/auriok_survivors.txt b/res/cardsfolder/a/auriok_survivors.txt new file mode 100644 index 00000000000..5c759d9a313 --- /dev/null +++ b/res/cardsfolder/a/auriok_survivors.txt @@ -0,0 +1,13 @@ +Name:Auriok Survivors +ManaCost:5 W +Types:Creature Human Soldier +Text:no text +PT:4/6 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may return target Equipment card from your graveyard to the battlefield. If you do, you may attach it to CARDNAME. +SVar:TrigChangeZone:AB$ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Equipment.YouCtrl | SubAbility$ DBAttach +SVar:DBAttach:DB$ Attach | Object$ Targeted | Defined$ Self | Optional$ True +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/auriok_survivors.jpg +SetInfo:NPH|Uncommon|http://magiccards.info/scans/en/nph/3.jpg +Oracle:When Auriok Survivors enters the battlefield, you may return target Equipment card from your graveyard to the battlefield. If you do, you may attach it to Auriok Survivors. +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java index 93b33420f83..12f347fb1d8 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java @@ -33,6 +33,7 @@ import forge.CombatUtil; import forge.Command; import forge.ComputerUtil; import forge.Constant; +import forge.GameActionUtil; import forge.Constant.Zone; import forge.GameEntity; import forge.Player; @@ -994,17 +995,29 @@ public class AbilityFactoryAttach { */ public static void attachResolve(final AbilityFactory af, final SpellAbility sa) { final Map params = af.getMapParams(); - final Card card = sa.getSourceCard(); + Card source = sa.getSourceCard(); + Card card = sa.getSourceCard(); ArrayList targets; + if (params.containsKey("Object")) { + card = AbilityFactory.getDefinedCards(source, params.get("Object"), sa).get(0); + } + final Target tgt = sa.getTarget(); if (tgt != null) { targets = tgt.getTargets(); // TODO Remove invalid targets (although more likely this will just // fizzle earlier) } else { - targets = AbilityFactory.getDefinedObjects(sa.getSourceCard(), params.get("Defined"), sa); + targets = AbilityFactory.getDefinedObjects(source, params.get("Defined"), sa); + } + + final StringBuilder sb = new StringBuilder(); + sb.append("Do you want to attach " + card + " to " + targets + "?"); + if (sa.getActivatingPlayer().isHuman() && params.containsKey("Optional") + && !GameActionUtil.showYesNoDialog(source, sb.toString())) { + return; } // If Cast Targets will be checked on the Stack