fix for a bug in combohint. ai will now rarely want to use a card outside of a combo if it is to be held for a combo

This commit is contained in:
omegablast2002@yahoo.com
2013-03-13 01:11:58 +00:00
parent cd54ad7012
commit a7aeb7efe5
2 changed files with 8 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ bool AIHints::HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card)
//here we disect the different parts of a given combo
part = hints[i]->combos[cPart];
hints[i]->partOfCombo = split(part,'^');
for(unsigned int dPart = 0; dPart < hints[i]->partOfCombo.size(); dPart++)
for(size_t dPart = hints[i]->partOfCombo.size()-1;dPart >= 0;dPart--)
{
vector<string>asTc;
asTc = parseBetween(hints[i]->partOfCombo[dPart],"hold(",")");
@@ -142,7 +142,9 @@ bool AIHints::HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card)
asTc = parseBetween(hints[i]->partOfCombo[dPart],"cast(",")");
if(asTc.size())
{
hints[i]->cardTargets[asTc[1]] = parseBetween(hints[i]->partOfCombo[dPart],"targeting(",")")[1];
vector<string>cht = parseBetween(hints[i]->partOfCombo[dPart],"targeting(",")");
if(cht.size())
hints[i]->cardTargets[asTc[1]] = cht[1];
}
asTc = parseBetween(hints[i]->partOfCombo[dPart],"totalmananeeded(",")");
if(asTc.size())
@@ -150,6 +152,8 @@ bool AIHints::HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card)
hints[i]->manaNeeded = asTc[1];
asTc.clear();
}
if(dPart == 0)
break;
}
}
}//we collect the peices of a combo on first run.

View File

@@ -1736,9 +1736,8 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
}
else
{
int chance = int(getRandomGenerator()->random() % 100);
if(chance > 1)
continue;//1% chance to just continue evaluating the card to cast.
nextCardToPlay = NULL;
continue;
}
}
int currentCost = card->getManaCost()->getConvertedCost();