From 8087a07a9c4fc2a9b0e32b6733a6a41efbc689f3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 26 May 2014 16:57:36 +0200 Subject: [PATCH] * AI Player - Fixed a bug that AI did not care about existing filter criterias for choosing cards from own hand. --- .../src/main/java/mage/player/ai/ComputerPlayer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 41c445b310..a665ab16a0 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -224,7 +224,12 @@ public class ComputerPlayer> extends PlayerImpl i } if (target instanceof TargetCardInHand) { List cards = new ArrayList<>(); - cards.addAll(this.hand.getCards(game)); + for (UUID cardId: ((TargetCardInHand)target).possibleTargets(this.getId(), hand, game)) { + Card card = game.getCard(cardId); + if (card != null) { + cards.add(card); + } + } while(!target.isChosen() && !cards.isEmpty()) { Card pick = pickTarget(cards, outcome, target, null, game); if (pick != null) {