mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Proper check of available mana sources
This commit is contained in:
@@ -151,13 +151,12 @@ public class ComputerUtilCost {
|
|||||||
if (pref == null) {
|
if (pref == null) {
|
||||||
// Dream Halls allows to discard 1 worthless card to cast 1 expensive for free
|
// 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!
|
// 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!
|
// Don't do it for abilities on cards in play, we want it to play spells!
|
||||||
if ((!source.isInPlay()
|
if ((!source.isInPlay()
|
||||||
// We can't pay for this spell even if we play another land, or have wrong colors
|
// 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() > mana + 1) || (!source.determineColor().hasNoColorsExcept(ColorSet.fromNames(getAvailableManaColors(ai, Lists.newArrayList())).getColor())))
|
||||||
&& ((source.getCMC() > lands + 1) || (!source.determineColor().hasNoColorsExcept(ColorSet.fromNames(getAvailableManaColors(ai, Lists.newArrayList())).getColor())))
|
|
||||||
// Don't discard more than 1 card
|
// Don't discard more than 1 card
|
||||||
&& (num == 1)
|
&& (num == 1)
|
||||||
)) {
|
)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user