* AI Player - Fixed a bug that AI did not care about existing filter criterias for choosing cards from own hand.

This commit is contained in:
LevelX2 2014-05-26 16:57:36 +02:00
parent 588da451e5
commit 8087a07a9c

View file

@ -224,7 +224,12 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
} }
if (target instanceof TargetCardInHand) { if (target instanceof TargetCardInHand) {
List<Card> cards = new ArrayList<>(); List<Card> 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()) { while(!target.isChosen() && !cards.isEmpty()) {
Card pick = pickTarget(cards, outcome, target, null, game); Card pick = pickTarget(cards, outcome, target, null, game);
if (pick != null) { if (pick != null) {