From b2a7c7da71aff2b44bc9b0b6a16e65c8baebcb10 Mon Sep 17 00:00:00 2001 From: ArsenalNut Date: Sat, 30 Jun 2012 21:00:32 +0000 Subject: [PATCH] changed targeting for Clone AF --- res/cardsfolder/c/clone.txt | 2 +- res/cardsfolder/e/evil_twin.txt | 2 +- res/cardsfolder/j/jwari_shapeshifter.txt | 2 +- res/cardsfolder/p/phantasmal_image.txt | 2 +- res/cardsfolder/p/phyrexian_metamorph.txt | 2 +- res/cardsfolder/q/quicksilver_gargantuan.txt | 2 +- res/cardsfolder/s/sakashima_the_impostor.txt | 2 +- .../abilityfactory/AbilityFactoryClone.java | 31 ++++++++++--------- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/res/cardsfolder/c/clone.txt b/res/cardsfolder/c/clone.txt index b9bdc335961..85a4b0e0493 100644 --- a/res/cardsfolder/c/clone.txt +++ b/res/cardsfolder/c/clone.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/clone.jpg diff --git a/res/cardsfolder/e/evil_twin.txt b/res/cardsfolder/e/evil_twin.txt index fd7d3477b1f..3bbd4e9ffad 100644 --- a/res/cardsfolder/e/evil_twin.txt +++ b/res/cardsfolder/e/evil_twin.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield except it gains "U B, T: Destroy target creature with the same name as this creature." SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | AddAbilities$ EvilTwin | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddAbilities$ EvilTwin | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:EvilTwin:AB$Destroy | Cost$ U B T | ValidTgts$ Creature.sameName | TgtPrompt$ Select target creature with the same name. | SpellDescription$ Destroy target creature with the same name as this creature. SVar:Rarity:Rare diff --git a/res/cardsfolder/j/jwari_shapeshifter.txt b/res/cardsfolder/j/jwari_shapeshifter.txt index 33c57f5c9b3..52208ab115b 100644 --- a/res/cardsfolder/j/jwari_shapeshifter.txt +++ b/res/cardsfolder/j/jwari_shapeshifter.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any Ally creature on the battlefield. SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Ally+Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:RemRandomDeck:True SVar:Rarity:Rare diff --git a/res/cardsfolder/p/phantasmal_image.txt b/res/cardsfolder/p/phantasmal_image.txt index 55f78eece9c..eae1f393d03 100644 --- a/res/cardsfolder/p/phantasmal_image.txt +++ b/res/cardsfolder/p/phantasmal_image.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it." SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | AddTypes$ Illusion | AddTriggers$ TgtTrig | AddSVars$ TrigSac | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddTypes$ Illusion | AddTriggers$ TgtTrig | AddSVars$ TrigSac | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:TgtTrig:Mode$ BecomesTarget | ValidTarget$ Card.Self | Execute$ TrigSac | TriggerDescription$ When this creature becomes the target of a spell or ability, sacrifice it. SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ Self diff --git a/res/cardsfolder/p/phyrexian_metamorph.txt b/res/cardsfolder/p/phyrexian_metamorph.txt index 4c54c3364bc..9406b294c0f 100644 --- a/res/cardsfolder/p/phyrexian_metamorph.txt +++ b/res/cardsfolder/p/phyrexian_metamorph.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types. SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other,Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | AddTypes$ Artifact | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddTypes$ Artifact | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/phyrexian_metamorph.jpg diff --git a/res/cardsfolder/q/quicksilver_gargantuan.txt b/res/cardsfolder/q/quicksilver_gargantuan.txt index e9d8d3904d0..835742d522c 100644 --- a/res/cardsfolder/q/quicksilver_gargantuan.txt +++ b/res/cardsfolder/q/quicksilver_gargantuan.txt @@ -5,7 +5,7 @@ Text:no text PT:7/7 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. It's still 7/7. SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | SetPower$ 7 | SetToughness$ 7 | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | SetPower$ 7 | SetToughness$ 7 | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/quicksilver_gargantuan.jpg diff --git a/res/cardsfolder/s/sakashima_the_impostor.txt b/res/cardsfolder/s/sakashima_the_impostor.txt index fa704106e37..bd467bb5a87 100644 --- a/res/cardsfolder/s/sakashima_the_impostor.txt +++ b/res/cardsfolder/s/sakashima_the_impostor.txt @@ -5,7 +5,7 @@ Text:no text PT:3/1 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseCreature | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except its name is still CARDNAME, it's legendary in addition to its other types, and it gains "2 U U: Return CARDNAME to its owner's hand at the beginning of the next end step." SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True -SVar:DBCopy:DB$ Clone | Defined$ Self | CloneSource$ Remembered | KeepName$ True | AddTypes$ Legendary | AddAbilities$ ReturnSakashima | AddSVars$ TrigReturnSak | SubAbility$ DBCleanup +SVar:DBCopy:DB$ Clone | Defined$ Remembered | KeepName$ True | AddTypes$ Legendary | AddAbilities$ ReturnSakashima | AddSVars$ TrigReturnSak | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:ReturnSakashima:AB$ DelayedTrigger | Cost$ 2 U U | Mode$ Phase | Phase$ End of Turn | Execute$ TrigReturnSak | SpellDescription$ Return CARDNAME to it's owners hand at the beginning of the next end step. SVar:TrigReturnSak:AB$ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Battlefield | Destination$ Hand diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java index 906eb98fb2d..7ee5dd6d0c0 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java @@ -522,31 +522,34 @@ public final class AbilityFactoryClone { Map origSVars = host.getSVars(); - // find target of cloning + // find cloning source i.e. thing to be copied + Card cardToCopy = null; final Target tgt = sa.getTarget(); if (tgt != null) { - tgtCard = tgt.getTargetCards().get(0); + cardToCopy = tgt.getTargetCards().get(0); } else if (params.containsKey("Defined")) { - tgtCard = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa).get(0); + ArrayList cloneSources = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa); + if (!cloneSources.isEmpty()) { + cardToCopy = cloneSources.get(0); + } + } + if (cardToCopy == null) { + return; + } + + // find target of cloning i.e. card becoming a clone + ArrayList cloneTargets = AbilityFactory.getDefinedCards(host, params.get("CloneTarget"), sa); + if (!cloneTargets.isEmpty()) { + tgtCard = cloneTargets.get(0); } else { tgtCard = host; } - // find cloning source i.e. thing to be copied - ArrayList cloneSources = AbilityFactory.getDefinedCards(host, params.get("CloneSource"), sa); - Card cardToCopy; - if (!cloneSources.isEmpty()) { - cardToCopy = cloneSources.get(0); - } - else { - return; - } - String imageFileName = host.getImageFilename(); - Card cloned; + //Card cloned; boolean keepName = params.containsKey("KeepName"); String originalName = tgtCard.getName();