From 0921fa3e67bd71121834e631975bcc8692d0f444 Mon Sep 17 00:00:00 2001 From: Seravy Date: Mon, 19 Feb 2018 16:52:53 +0100 Subject: [PATCH] Proper check of available mana sources --- forge-ai/src/main/java/forge/ai/ComputerUtilCost.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java index 4e1a85c2a30..8b3de9eada1 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java @@ -151,13 +151,12 @@ public class ComputerUtilCost { if (pref == null) { // Dream Halls allows to discard 1 worthless card to cast 1 expensive for free // Do it even if nothing marked for discard in hand, if it's worth doing! - int lands = ai.getCardsIn(ZoneType.Battlefield).size(); + int mana = ComputerUtilMana.getAvailableManaEstimate(ai, false); // Don't do it for abilities on cards in play, we want it to play spells! if ((!source.isInPlay() // We can't pay for this spell even if we play another land, or have wrong colors - // TODO this is ugly, is there a procedure that can determine available mana instead of land count? Otherwise this ignores moxes and other sources! - && ((source.getCMC() > lands + 1) || (!source.determineColor().hasNoColorsExcept(ColorSet.fromNames(getAvailableManaColors(ai, Lists.newArrayList())).getColor()))) + && ((source.getCMC() > mana + 1) || (!source.determineColor().hasNoColorsExcept(ColorSet.fromNames(getAvailableManaColors(ai, Lists.newArrayList())).getColor()))) // Don't discard more than 1 card && (num == 1) )) {