tweaks to ai use of cast order, we had instance where "land" would get an over-ride and not cast.

This commit is contained in:
omegablast2002@yahoo.com
2012-07-25 12:10:25 +00:00
parent 23e4002a9a
commit c85d07f890
+7 -1
View File
@@ -1668,6 +1668,7 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
if (card->hasType(Subtypes::TYPE_PLANESWALKER) && card->types.size() > 0 && game->inPlay->hasTypeSpecificInt(Subtypes::TYPE_PLANESWALKER,card->types[1])) if (card->hasType(Subtypes::TYPE_PLANESWALKER) && card->types.size() > 0 && game->inPlay->hasTypeSpecificInt(Subtypes::TYPE_PLANESWALKER,card->types[1]))
continue; continue;
int currentCost = card->getManaCost()->getConvertedCost(); int currentCost = card->getManaCost()->getConvertedCost();
int hasX = card->getManaCost()->hasX(); int hasX = card->getManaCost()->hasX();
gotPayments.clear(); gotPayments.clear();
@@ -1909,12 +1910,16 @@ int AIPlayerBaka::computeActions()
currentMana->add(this->getManaPool()); currentMana->add(this->getManaPool());
nextCardToPlay = FindCardToPlay(currentMana, "land"); nextCardToPlay = FindCardToPlay(currentMana, "land");
//look for the most expensive creature we can afford. If not found, try enchantment, then artifact, etc... if (game->playRestrictions->canPutIntoZone(nextCardToPlay, game->stack) == PlayRestriction::CANT_PLAY)
nextCardToPlay = NULL;//look for a land, did we find one we can play..if not set to null now.
if(hints && hints->mCastOrder().size()) if(hints && hints->mCastOrder().size())
{ {
vector<string>findType = hints->mCastOrder(); vector<string>findType = hints->mCastOrder();
for(unsigned int j = 0;j < findType.size();j++) for(unsigned int j = 0;j < findType.size();j++)
{ {
if(nextCardToPlay)
continue;//if there is a card to play on first run of this, it is most likly a land.
if(clickstream.size()) if(clickstream.size())
{ {
SAFE_DELETE(currentMana); SAFE_DELETE(currentMana);
@@ -1927,6 +1932,7 @@ int AIPlayerBaka::computeActions()
} }
else else
{ {
//look for the most expensive creature we can afford. If not found, try enchantment, then artifact, etc...
const char* types[] = {"planeswalker","creature", "enchantment", "artifact", "sorcery", "instant"}; const char* types[] = {"planeswalker","creature", "enchantment", "artifact", "sorcery", "instant"};
int count = 0; int count = 0;
while (!nextCardToPlay && count < 6) while (!nextCardToPlay && count < 6)