From 56f5714af2ed73cec8e318265b18ec8e2ccbec02 Mon Sep 17 00:00:00 2001 From: Sloth Date: Mon, 29 Apr 2013 16:11:05 +0000 Subject: [PATCH] - AI will no longer copy its own legendary permanents. --- .../java/forge/card/ability/ai/CopyPermanentAi.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/card/ability/ai/CopyPermanentAi.java b/src/main/java/forge/card/ability/ai/CopyPermanentAi.java index 570ca6d3719..0f0cd1ecdbd 100644 --- a/src/main/java/forge/card/ability/ai/CopyPermanentAi.java +++ b/src/main/java/forge/card/ability/ai/CopyPermanentAi.java @@ -46,7 +46,7 @@ public class CopyPermanentAi extends SpellAbilityAi { } @Override - protected boolean doTriggerAINoCost(AIPlayer aiPlayer, SpellAbility sa, boolean mandatory) { + protected boolean doTriggerAINoCost(final AIPlayer aiPlayer, SpellAbility sa, boolean mandatory) { final Card source = sa.getSourceCard(); // //// @@ -68,7 +68,7 @@ public class CopyPermanentAi extends SpellAbilityAi { abTgt.resetTargets(); // target loop while (abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)) { - if (list.size() == 0) { + if (list.isEmpty()) { if ((abTgt.getNumTargeted() < abTgt.getMinTargets(sa.getSourceCard(), sa)) || (abTgt.getNumTargeted() == 0)) { abTgt.resetTargets(); @@ -79,6 +79,12 @@ public class CopyPermanentAi extends SpellAbilityAi { } } + list = CardLists.filter(list, new Predicate() { + @Override + public boolean apply(final Card c) { + return !c.isType("Legendary") || c.getController().isOpponentOf(aiPlayer); + } + }); Card choice; if (!CardLists.filter(list, Presets.CREATURES).isEmpty()) { choice = ComputerUtilCard.getBestCreatureAI(list);