From ce4ff713718fb047d40214f6147ec016fb6ca45c Mon Sep 17 00:00:00 2001 From: Sloth Date: Thu, 25 Oct 2012 21:05:06 +0000 Subject: [PATCH] - The AI will no longer clone its own legendary creatures. --- res/cardsfolder/c/clone.txt | 2 +- res/cardsfolder/c/copy_artifact.txt | 2 +- res/cardsfolder/c/copy_enchantment.txt | 2 +- res/cardsfolder/j/jwari_shapeshifter.txt | 2 +- res/cardsfolder/p/phyrexian_metamorph.txt | 2 +- res/cardsfolder/q/quicksilver_gargantuan.txt | 2 +- res/cardsfolder/s/sakashimas_student.txt | 2 +- res/cardsfolder/s/sculpting_steel.txt | 2 +- .../card/abilityfactory/AbilityFactoryChoose.java | 14 ++++++++++++-- 9 files changed, 20 insertions(+), 10 deletions(-) diff --git a/res/cardsfolder/c/clone.txt b/res/cardsfolder/c/clone.txt index 90b10b1bb05..440fd91e490 100644 --- a/res/cardsfolder/c/clone.txt +++ b/res/cardsfolder/c/clone.txt @@ -4,7 +4,7 @@ Types:Creature Shapeshifter Text:no text PT:0/0 K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. +SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. SVar:DBCopy:DB$ Clone | Defined$ Remembered SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/clone.jpg diff --git a/res/cardsfolder/c/copy_artifact.txt b/res/cardsfolder/c/copy_artifact.txt index a7e3feebb97..ad7600c7d9c 100644 --- a/res/cardsfolder/c/copy_artifact.txt +++ b/res/cardsfolder/c/copy_artifact.txt @@ -3,7 +3,7 @@ ManaCost:1 U Types:Enchantment Text:no text K:ETBReplacement:Copy:ChooseArtifact:Optional -SVar:ChooseArtifact:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types. +SVar:ChooseArtifact:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types. SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddTypes$ Enchantment SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/copy_artifact.jpg diff --git a/res/cardsfolder/c/copy_enchantment.txt b/res/cardsfolder/c/copy_enchantment.txt index 57ff70b95f0..d71e559cfb4 100644 --- a/res/cardsfolder/c/copy_enchantment.txt +++ b/res/cardsfolder/c/copy_enchantment.txt @@ -3,7 +3,7 @@ ManaCost:2 U Types:Enchantment Text:no text K:ETBReplacement:Copy:ChooseEnchantment:Optional -SVar:ChooseEnchantment:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Enchantment.Other | SubAbility$ DBCopy | RememberChosen$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any enchantment on the battlefield. +SVar:ChooseEnchantment:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Enchantment.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any enchantment on the battlefield. SVar:DBCopy:DB$ Clone | Defined$ Remembered SVar:RemAIDeck:True SVar:Rarity:Rare diff --git a/res/cardsfolder/j/jwari_shapeshifter.txt b/res/cardsfolder/j/jwari_shapeshifter.txt index c5395219913..8f62c193068 100644 --- a/res/cardsfolder/j/jwari_shapeshifter.txt +++ b/res/cardsfolder/j/jwari_shapeshifter.txt @@ -4,7 +4,7 @@ Types:Creature Shapeshifter Ally Text:no text PT:0/0 K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Ally+Other | SubAbility$ DBCopy | RememberChosen$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any Ally creature on the battlefield. +SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Ally+Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any Ally creature on the battlefield. SVar:DBCopy:DB$ Clone | Defined$ Remembered SVar:RemRandomDeck:True SVar:Rarity:Rare diff --git a/res/cardsfolder/p/phyrexian_metamorph.txt b/res/cardsfolder/p/phyrexian_metamorph.txt index eb27ecf02ff..3754a39e56b 100644 --- a/res/cardsfolder/p/phyrexian_metamorph.txt +++ b/res/cardsfolder/p/phyrexian_metamorph.txt @@ -4,7 +4,7 @@ Types:Artifact Creature Shapeshifter Text:no text PT:0/0 K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other,Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ 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:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other,Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ 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:DBCopy:DB$ Clone | Defined$ Remembered | AddTypes$ Artifact 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 21210009882..ea85e77176a 100644 --- a/res/cardsfolder/q/quicksilver_gargantuan.txt +++ b/res/cardsfolder/q/quicksilver_gargantuan.txt @@ -4,7 +4,7 @@ Types:Creature Shapeshifter Text:no text PT:7/7 K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. It's still 7/7. +SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. It's still 7/7. SVar:DBCopy:DB$ Clone | Defined$ Remembered | SetPower$ 7 | SetToughness$ 7 SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/quicksilver_gargantuan.jpg diff --git a/res/cardsfolder/s/sakashimas_student.txt b/res/cardsfolder/s/sakashimas_student.txt index a5bc81b7be3..aabe54d7313 100644 --- a/res/cardsfolder/s/sakashimas_student.txt +++ b/res/cardsfolder/s/sakashimas_student.txt @@ -5,7 +5,7 @@ Text:no text PT:0/0 A:AB$ ChangeZone | Cost$ 1 U Return<1/Creature.attacking+unblocked> | CostDesc$ Ninjutsu 1 U | ActivationZone$ Hand | Origin$ Hand | Ninjutsu$ True | Destination$ Battlefield | Defined$ Self | SpellDescription$ (1 U, Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand tapped and attacking.) K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types. +SVar:ChooseCreature:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types. SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddTypes$ Ninja SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/sakashimas_student.jpg diff --git a/res/cardsfolder/s/sculpting_steel.txt b/res/cardsfolder/s/sculpting_steel.txt index 2aa40ef8a36..559a25684b0 100644 --- a/res/cardsfolder/s/sculpting_steel.txt +++ b/res/cardsfolder/s/sculpting_steel.txt @@ -3,7 +3,7 @@ ManaCost:3 Types:Artifact Text:no text K:ETBReplacement:Copy:ChooseArtifact:Optional -SVar:ChooseArtifact:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any artifact on the battlefield. +SVar:ChooseArtifact:DB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Artifact.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ Clone | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any artifact on the battlefield. SVar:DBCopy:DB$ Clone | Defined$ Remembered SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/sculpting_steel.jpg diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java index abb5206b408..8cc312d426f 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java @@ -1877,13 +1877,18 @@ public final class AbilityFactoryChoose { choices = CardLists.filterControlledBy(choices, ai.getOpponent()); } if (params.get("AILogic").equals("AtLeast1")) { - if (choices.size() < 1) { + if (choices.isEmpty()) { return false; } } else if (params.get("AILogic").equals("AtLeast2") || params.get("AILogic").equals("BestBlocker")) { if (choices.size() < 2) { return false; } + } else if (params.get("AILogic").equals("Clone")) { + choices = CardLists.getValidCards(choices, "Permanent.YouDontCtrl,Permanent.NonLegendary", host.getController(), host); + if (choices.isEmpty()) { + return false; + } } } @@ -1983,10 +1988,15 @@ public final class AbilityFactoryChoose { } } else { // Computer if (params.containsKey("AILogic") && params.get("AILogic").equals("BestBlocker")) { - if (CardLists.filter(choices, Presets.UNTAPPED).isEmpty()) { + if (!CardLists.filter(choices, Presets.UNTAPPED).isEmpty()) { choices = CardLists.filter(choices, Presets.UNTAPPED); } chosen.add(CardFactoryUtil.getBestCreatureAI(choices)); + } else if (params.containsKey("AILogic") && params.get("AILogic").equals("Clone")) { + if (!CardLists.getValidCards(choices, "Permanent.YouDontCtrl,Permanent.NonLegendary", host.getController(), host).isEmpty()) { + choices = CardLists.getValidCards(choices, "Permanent.YouDontCtrl,Permanent.NonLegendary", host.getController(), host); + } + chosen.add(CardFactoryUtil.getBestAI(choices)); } else { chosen.add(CardFactoryUtil.getBestAI(choices)); }