From 1e0cfd7a4281c8cd7e464c2436cc625e9347da94 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 14:23:58 +0000 Subject: [PATCH] Fixing Clone to work with AI --- src/forge/CardFactory_Creatures.java | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index cf7ff14abfd..6a2da762e2e 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -13293,6 +13293,27 @@ public class CardFactory_Creatures { @Override public void resolve() { + + if (card.getController().equals(AllZone.ComputerPlayer)) { + + CardList AICreatures = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); + CardList PlayerCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + if (!AICreatures.isEmpty()) { + + copyTarget[0] = AICreatures.iterator().next(); + + } + + else if (!PlayerCreatures.isEmpty()) { + + copyTarget[0] = PlayerCreatures.iterator().next(); + + } + + } + + if (copyTarget[0] != null) { + cloned[0] = cfact.getCard(copyTarget[0].getName(), card.getController()); cloned[0].setCloneOrigin(card.getName()); cloned[0].addLeavesPlayCommand(leaves); @@ -13300,6 +13321,9 @@ public class CardFactory_Creatures { cloned[0].setImageFilename(copyTarget[0].getImageFilename()); PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); play.add(cloned[0]); + + } + } };//SpellAbility @@ -13360,6 +13384,27 @@ public class CardFactory_Creatures { @Override public void resolve() { + + if (card.getController().equals(AllZone.ComputerPlayer)) { + + CardList AICreatures = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); + CardList PlayerCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + if (!AICreatures.isEmpty()) { + + copyTarget[0] = AICreatures.iterator().next(); + + } + + else if (!PlayerCreatures.isEmpty()) { + + copyTarget[0] = PlayerCreatures.iterator().next(); + + } + + } + + if (copyTarget[0] != null) { + cloned[0] = cfact.getCard(copyTarget[0].getName(), card.getController()); cloned[0].setCloneOrigin(card.getName()); cloned[0].addLeavesPlayCommand(leaves); @@ -13367,6 +13412,9 @@ public class CardFactory_Creatures { cloned[0].setBaseAttack(7); PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); play.add(cloned[0]); + + } + } };//SpellAbility