diff --git a/res/cardsfolder/c/clone.txt b/res/cardsfolder/c/clone.txt index a7c7d659a52..b9bdc335961 100644 --- a/res/cardsfolder/c/clone.txt +++ b/res/cardsfolder/c/clone.txt @@ -1,8 +1,12 @@ Name:Clone ManaCost:3 U Types:Creature Shapeshifter -Text:You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. +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:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/clone.jpg SetInfo:LEA|Uncommon|http://magiccards.info/scans/en/al/52.jpg diff --git a/res/cardsfolder/e/evil_twin.txt b/res/cardsfolder/e/evil_twin.txt index 4a1d6e43490..fd7d3477b1f 100644 --- a/res/cardsfolder/e/evil_twin.txt +++ b/res/cardsfolder/e/evil_twin.txt @@ -1,8 +1,13 @@ Name:Evil Twin ManaCost:2 U B Types:Creature Shapeshifter -Text: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." +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: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 SVar:Picture:http://www.wizards.com/global/images/magic/general/evil_twin.jpg SetInfo:ISD|Rare|http://magiccards.info/scans/en/isd/212.jpg diff --git a/res/cardsfolder/j/jwari_shapeshifter.txt b/res/cardsfolder/j/jwari_shapeshifter.txt index 260cbc93e2d..33c57f5c9b3 100644 --- a/res/cardsfolder/j/jwari_shapeshifter.txt +++ b/res/cardsfolder/j/jwari_shapeshifter.txt @@ -1,8 +1,12 @@ Name:Jwari Shapeshifter ManaCost:1 U Types:Creature Shapeshifter Ally -Text:You may have CARDNAME enter the battlefield as a copy of any Ally creature on the battlefield. +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:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/jwari_shapeshifter.jpg diff --git a/res/cardsfolder/p/phantasmal_image.txt b/res/cardsfolder/p/phantasmal_image.txt index 8841a557185..55f78eece9c 100644 --- a/res/cardsfolder/p/phantasmal_image.txt +++ b/res/cardsfolder/p/phantasmal_image.txt @@ -1,8 +1,14 @@ Name:Phantasmal Image ManaCost:1 U Types:Creature Illusion -Text:You may have Phantasmal Image 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." +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: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 SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/phantasmal_image.jpg SetInfo:M12|Rare|http://magiccards.info/scans/en/m12/72.jpg diff --git a/res/cardsfolder/p/phyrexian_metamorph.txt b/res/cardsfolder/p/phyrexian_metamorph.txt index 6c94f4e3d72..4c54c3364bc 100644 --- a/res/cardsfolder/p/phyrexian_metamorph.txt +++ b/res/cardsfolder/p/phyrexian_metamorph.txt @@ -1,8 +1,12 @@ Name:Phyrexian Metamorph ManaCost:3 PU Types:Artifact Creature Shapeshifter -Text: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. +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:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/phyrexian_metamorph.jpg SetInfo:NPH|Rare|http://magiccards.info/scans/en/nph/42.jpg diff --git a/res/cardsfolder/q/quicksilver_gargantuan.txt b/res/cardsfolder/q/quicksilver_gargantuan.txt index 32b3d082d55..e9d8d3904d0 100644 --- a/res/cardsfolder/q/quicksilver_gargantuan.txt +++ b/res/cardsfolder/q/quicksilver_gargantuan.txt @@ -1,8 +1,12 @@ Name:Quicksilver Gargantuan ManaCost:5 U U Types:Creature Shapeshifter -Text:You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. It's still 7/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:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/quicksilver_gargantuan.jpg SetInfo:SOM|Mythic|http://magiccards.info/scans/en/som/39.jpg diff --git a/src/main/java/forge/card/CardCharacteristics.java b/src/main/java/forge/card/CardCharacteristics.java index a84fa7e5dbd..509cc439d63 100644 --- a/src/main/java/forge/card/CardCharacteristics.java +++ b/src/main/java/forge/card/CardCharacteristics.java @@ -391,7 +391,7 @@ public class CardCharacteristics { public void setReplacementEffects(ArrayList replacementEffects0) { this.replacementEffects = replacementEffects0; } - + /** *

* getSVar. diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java index 08019a8e960..47f49240c30 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryClone.java @@ -34,6 +34,8 @@ import forge.card.spellability.AbilitySub; import forge.card.spellability.Spell; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; +import forge.card.trigger.Trigger; +import forge.card.trigger.TriggerHandler; import forge.card.trigger.TriggerType; import forge.game.phase.PhaseType; import forge.game.player.ComputerUtil; @@ -484,6 +486,7 @@ public final class AbilityFactoryClone { final HashMap params = af.getMapParams(); Card tgtCard; final Card host = sa.getSourceCard(); + Map origSVars = host.getSVars(); // find target of cloning @@ -499,8 +502,12 @@ public final class AbilityFactoryClone { } // find cloning source i.e. thing to be copied - Card cardToCopy = AbilityFactory.getDefinedCards(host, params.get("CloneSource"), sa).get(0); - if (cardToCopy == null) { + ArrayList cloneSources = AbilityFactory.getDefinedCards(host, params.get("CloneSource"), sa); + Card cardToCopy; + if (!cloneSources.isEmpty()) { + cardToCopy = cloneSources.get(0); + } + else { return; } @@ -508,6 +515,7 @@ public final class AbilityFactoryClone { Card cloned; + //boolean keepName = params.containsKey("KeepName"); AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed); if (cardToCopy.isToken()) { @@ -548,6 +556,7 @@ public final class AbilityFactoryClone { tgtCard.addStaticAbility(tgtCard.getStaticAbilityStrings().get(i)); } + addExtraCharacteristics(tgtCard, params, origSVars); // If target is a flipped card, also copy the flipped // state. if (cardToCopy.isFlip()) { @@ -560,7 +569,7 @@ public final class AbilityFactoryClone { for (int i = 0; i < tgtCard.getStaticAbilityStrings().size(); i++) { tgtCard.addStaticAbility(tgtCard.getStaticAbilityStrings().get(i)); } - + addExtraCharacteristics(tgtCard, params, origSVars); tgtCard.setFlip(true); tgtCard.setState(CardCharactersticName.Original); @@ -574,4 +583,72 @@ public final class AbilityFactoryClone { tgtCard.setImageFilename(imageFileName); } // cloneResolve + private static void addExtraCharacteristics(final Card tgtCard, final HashMap params, final Map origSVars) { + // additional types to clone + if (params.containsKey("AddTypes")) { + for (final String type : Arrays.asList(params.get("AddTypes").split(","))) { + tgtCard.addType(type); + } + } + + // triggers to add to clone + final ArrayList triggers = new ArrayList(); + if (params.containsKey("AddTriggers")) { + triggers.addAll(Arrays.asList(params.get("AddTriggers").split(","))); + for (final String s : triggers) { + if (origSVars.containsKey(s)) { + final String actualTrigger = origSVars.get(s); + final Trigger parsedTrigger = TriggerHandler.parseTrigger(actualTrigger, tgtCard, true); + tgtCard.addTrigger(parsedTrigger); + } + } + } + + // SVars to add to clone + if (params.containsKey("AddSVars")) { + for (final String s : Arrays.asList(params.get("AddSVars").split(","))) { + if (origSVars.containsKey(s)) { + final String actualsVar = origSVars.get(s); + tgtCard.setSVar(s, actualsVar); + } + } + } + + // abilities to add to clone + if (params.containsKey("AddAbilities")) { + for (final String s : Arrays.asList(params.get("AddAbilities").split(","))) { + if (origSVars.containsKey(s)) { + final AbilityFactory newAF = new AbilityFactory(); + final String actualAbility = origSVars.get(s); + final SpellAbility grantedAbility = newAF.getAbility(actualAbility, tgtCard); + tgtCard.addSpellAbility(grantedAbility); + } + } + } + + // set power of clone + if (params.containsKey("SetPower")) { + String rhs = params.get("SetPower"); + int power = -1; + try { + power = Integer.parseInt(rhs); + } catch (final NumberFormatException e) { + power = CardFactoryUtil.xCount(tgtCard, tgtCard.getSVar(rhs)); + } + tgtCard.setBaseAttack(power); + } + + // set toughness of clone + if (params.containsKey("SetToughness")) { + String rhs = params.get("SetToughness"); + int toughness = -1; + try { + toughness = Integer.parseInt(rhs); + } catch (final NumberFormatException e) { + toughness = CardFactoryUtil.xCount(tgtCard, tgtCard.getSVar(rhs)); + } + tgtCard.setBaseDefense(toughness); + } + } + } // end class AbilityFactoryClone diff --git a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java index eae197d1e19..e7d547fbc19 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java @@ -1962,10 +1962,14 @@ public class CardFactoryCreatures { getCard_YoseiTheMorningStar(card, cardName); } else if (cardName.equals("Phyrexian Dreadnought")) { getCard_PhyrexianDreadnought(card, cardName); - } else if (cardName.equals("Clone") || cardName.equals("Vesuvan Doppelganger") - || cardName.equals("Quicksilver Gargantuan") || cardName.equals("Jwari Shapeshifter") - || cardName.equals("Phyrexian Metamorph") || cardName.equals("Phantasmal Image") - || cardName.equals("Body Double") || cardName.equals("Evil Twin") +// } else if (cardName.equals("Clone") || cardName.equals("Vesuvan Doppelganger") +// || cardName.equals("Quicksilver Gargantuan") || cardName.equals("Jwari Shapeshifter") +// || cardName.equals("Phyrexian Metamorph") || cardName.equals("Phantasmal Image") +// || cardName.equals("Body Double") || cardName.equals("Evil Twin") +// || cardName.equals("Sakashima the Impostor")) { + } else if (cardName.equals("Vesuvan Doppelganger") + || cardName.equals("Jwari Shapeshifter") + || cardName.equals("Body Double") || cardName.equals("Sakashima the Impostor")) { getCard_ClonesSeries(card, cardName); } else if (cardName.equals("Nebuchadnezzar")) {