Page 1 of 1

Teaching the AI to use mana abilities

PostPosted: 12 Oct 2009, 01:43
by zerker2000
I remember receiving an AI mana pool idea, can someone who knows how the AI works tell me where a mana counting method should be put?

Re: Teaching the AI to use mana abilities

PostPosted: 12 Oct 2009, 03:08
by DennisBergkamp
Ah, this is very funky code, it can be found in ComputerUtil.canPayCost() and also check out ComputerUtil.getAvailableMana().

Re: Teaching the AI to use mana abilities

PostPosted: 12 Oct 2009, 03:30
by zerker2000
Well, all the mana code I've found so far is quite funky, if it was up to me I'd just store mana costs as strings in oracle format and have manaCost.addMana subtract colored, then split, then colorless mana from the string in that order(and for an AI that uses only basic land abilities, I'd first subtract all colorless mana I can, then all n choice mana in increasing order). Also, I just looked at the code and found a mistype I planted when going through it: ComputerUtil.getAvailableMana should use getBasicMana instead of getManaAbility, and CardUtil.isMana should be exiled(removed from source) along with all auras("if (!CardUtil.isMana(c)) return false;") attached to it.

Re: Teaching the AI to use mana abilities

PostPosted: 12 Oct 2009, 06:06
by DennisBergkamp
Ok cool, I've just made these changes.