From b8412d46488649bf976f91df3bc792acdfb0a004 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 4 Sep 2011 11:02:59 +0000 Subject: [PATCH] - The AI will no longer try to use mana abilities which have a mana cost (it will miscalculate). --- src/main/java/forge/Card.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 1fb05894fc9..8030ec7ecec 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -14,6 +14,7 @@ import java.util.TreeMap; import com.esotericsoftware.minlog.Log; import forge.card.cardFactory.CardFactoryUtil; +import forge.card.cost.Cost; import forge.card.mana.ManaCost; import forge.card.spellability.Ability_Mana; import forge.card.spellability.Ability_Triggered; @@ -1799,12 +1800,19 @@ public class Card extends GameEntity implements Comparable { */ public ArrayList getAIPlayableMana() { ArrayList res = new ArrayList(); - for (Ability_Mana am : getManaAbility()) + for (Ability_Mana am : getManaAbility()) { + + //if a mana ability has a mana cost the AI will miscalculate + Cost cost = am.getPayCosts(); + if(!cost.hasNoManaCost()) + continue; + if (am.isBasic() && !res.contains(am)) { res.add(am); } else if (am.isReflectedMana() && !res.contains(am)) { res.add(am); } + } return res; @@ -3115,7 +3123,7 @@ public class Card extends GameEntity implements Comparable { */ public ArrayList getType() { - // see if type chages are in effect + // see if type changes are in effect if (!changedCardTypes.isEmpty()) { ArrayList newType = new ArrayList(type);