Attempt to fix a bug with Ai and how it manages mana, if an ability or effect would add for exsample 3 black to the manapool, the old way this was set up would be either/or but never both, current mana was always just what was in the pool or what it could make.

with this change, currentmana is now what it could make and if anything is in the pool then add whats in the pool as potential mana., if it could potentially make mana then THIS is its currentpool. as getpotentialMana already handles the rest.

i originally added the manapool at the end of potential as my first attempt to stop this behavior, but this either/or if statement really got in the way of producing the result i wanted, which is, if 
Ai has a 3 swamps, and a dark ritual, and it cast darkritual.
in hand Ai has a 5 black drop.

in OLD set up Ai would see it has 3 mana, then it would see it had 2 mana from the untapped swamps. it would pass the phase thinking that it could not cast the creature.

NOW ai looks for how much it has in mana, it see 3 swamps, it cast dark ritual, it now see what it can create on the next call to findcards, it see 2 swamps + 3 mana in pool, it cast the 5 drop creature.


mind you that this does not fix Ai mindlessly casting dark ritual as we have no current system to tell AI "hey dont cast that card now its useless to do so" like the fancy system to tell it what abilities it should use on cards :) *maybe someday*
This commit is contained in:
omegablast2002@yahoo.com
2010-12-04 19:45:39 +00:00
parent 8a49d2af51
commit 7805e52910

View File

@@ -145,7 +145,11 @@ ManaCost * AIPlayer::getPotentialMana(MTGCardInstance * target)
}
}
}
result->add(this->getManaPool());
if(this->getManaPool()->getConvertedCost())
{
//adding the current manapool if any, to the potential mana Ai can use.
result->add(this->getManaPool());
}
return result;
}
@@ -1158,10 +1162,10 @@ int AIPlayerBaka::computeActions()
{
bool potential = false;
ManaCost * currentMana = manaPool;
if (!currentMana->getConvertedCost())
ManaCost * currentMana = getPotentialMana();
if (currentMana->getConvertedCost())
{
currentMana = getPotentialMana();
//if theres mana i can use there then potential is true.
potential = true;
}
nextCardToPlay = FindCardToPlay(currentMana, "land");