couple more changes in Ai, and a fix for a crash which happened with phaseaction when the target was removed before the effect resolved.

This commit is contained in:
omegablast2002@yahoo.com
2011-04-19 19:54:47 +00:00
parent 40958170fa
commit c29e231e45
2 changed files with 4 additions and 10 deletions
+1 -4
View File
@@ -485,6 +485,7 @@ int AIAction::getEfficiency()
} }
case MTGAbility::FOREACH: case MTGAbility::FOREACH:
case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use.
{ {
MTGCardInstance * _target = (MTGCardInstance *) (a->target); MTGCardInstance * _target = (MTGCardInstance *) (a->target);
MTGAbility * a = AbilityFactory::getCoreAbility(ability); MTGAbility * a = AbilityFactory::getCoreAbility(ability);
@@ -662,10 +663,6 @@ int AIAction::getEfficiency()
} }
break; break;
} }
case MTGAbility::MANA_PRODUCER:
efficiency = 0;
break;
default: default:
if (target) if (target)
{ {
+3 -6
View File
@@ -2929,6 +2929,7 @@ MTGAbility(_id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestro
else else
psMenuText = sAbility.c_str(); psMenuText = sAbility.c_str();
delete (ability); delete (ability);
} }
void APhaseAction::Update(float dt) void APhaseAction::Update(float dt)
@@ -2944,12 +2945,7 @@ void APhaseAction::Update(float dt)
MTGCardInstance * _target = NULL; MTGCardInstance * _target = NULL;
if(target) if(target)
_target = (MTGCardInstance *) target; _target = (MTGCardInstance *) target;
if (_target) if(!sAbility.size() || (!target||!_target->currentZone))
{
while (_target->next)
_target = _target->next;
}
if(!sAbility.size() || !target || !_target->isInPlay())
{ {
//im aware that adding the isinplay check restricts this ability to having targets //im aware that adding the isinplay check restricts this ability to having targets
//which are in play..however after reviewing all the coded cards which use this //which are in play..however after reviewing all the coded cards which use this
@@ -2982,6 +2978,7 @@ void APhaseAction::Update(float dt)
int APhaseAction::resolve() int APhaseAction::resolve()
{ {
return 0; return 0;
} }