2 changes,

comparing counters to p instead of isAi(), and hope to close off an edge case where ai would get stuck cycling through setting the target of a may ability. caught it stuck 2 times while watching demo. i watched demo for close to an hour without seeing any adverse effect, and without getting stuck, tho this is so hard to debug, since there is no call stack loaded for this case when it happens.
This commit is contained in:
omegablast2002@yahoo.com
2011-04-26 14:10:57 +00:00
parent 2e25d24f20
commit ef942d46b5

View File

@@ -431,12 +431,12 @@ int AIAction::getEfficiency()
{
if(cc && _target)
{
if(_target && _target->controller()->isAI() && cc->toughness>=0)
if(_target && _target->controller() == p && cc->toughness>=0)
{
efficiency = 90;
}
if(_target && !_target->controller()->isAI() && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0)))
if(_target && _target->controller() != p && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0)))
{
efficiency = 90;
@@ -968,8 +968,14 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCardInst
{
case TARGET_CARD:
{
MTGCardInstance * card = ((MTGCardInstance *) potentialTargets[i]);
clickstream.push(NEW AIAction(card));
if(!Choosencard)
{
MTGCardInstance * card = ((MTGCardInstance *) potentialTargets[i]);
clickstream.push(NEW AIAction(card));
Choosencard = card;
}
//can't be 100% positive that this wont have an adverse side-effect
//hoping this fills a edge case where ai will keep trying to choose a target for a card which it already has a target for.
return 1;
break;
}