From 443ee670cd6830948395269a12c58cc8183955b8 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sat, 30 Jul 2016 18:58:37 +0000 Subject: [PATCH] ComputerUtilCost: checkDiscardCost: remove from hand what is already selected for discard --- forge-ai/src/main/java/forge/ai/ComputerUtilCost.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java index e616bd553d2..507772b849b 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java @@ -100,6 +100,9 @@ public class ComputerUtilCost { if (cost == null) { return true; } + + CardCollection hand = new CardCollection(ai.getCardsIn(ZoneType.Hand)); + for (final CostPart part : cost.getCostParts()) { if (part instanceof CostDiscard) { final CostDiscard disc = (CostDiscard) part; @@ -108,7 +111,7 @@ public class ComputerUtilCost { if (type.equals("CARDNAME") && source.getAbilityText().contains("Bloodrush")) { continue; } - final CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Hand), type.split(","), source.getController(), source, null); + final CardCollection typeList = CardLists.getValidCards(hand, type.split(","), source.getController(), source, null); if (typeList.size() > ai.getMaxHandSize()) { continue; } @@ -119,6 +122,7 @@ public class ComputerUtilCost { return false; } else { typeList.remove(pref); + hand.remove(pref); } } }