From c29e231e45f81795376afbb8ba69ca04bf3dd4a0 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 19 Apr 2011 19:54:47 +0000 Subject: [PATCH] couple more changes in Ai, and a fix for a crash which happened with phaseaction when the target was removed before the effect resolved. --- projects/mtg/src/AIPlayer.cpp | 5 +---- projects/mtg/src/AllAbilities.cpp | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index 79f4fb8dc..a0bc6e183 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -485,6 +485,7 @@ int AIAction::getEfficiency() } 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); MTGAbility * a = AbilityFactory::getCoreAbility(ability); @@ -662,10 +663,6 @@ int AIAction::getEfficiency() } break; } - case MTGAbility::MANA_PRODUCER: - efficiency = 0; - break; - default: if (target) { diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 8921860f0..de11aa5e4 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2929,6 +2929,7 @@ MTGAbility(_id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestro else psMenuText = sAbility.c_str(); delete (ability); + } void APhaseAction::Update(float dt) @@ -2944,12 +2945,7 @@ void APhaseAction::Update(float dt) MTGCardInstance * _target = NULL; if(target) _target = (MTGCardInstance *) target; - if (_target) - { - while (_target->next) - _target = _target->next; - } - if(!sAbility.size() || !target || !_target->isInPlay()) + if(!sAbility.size() || (!target||!_target->currentZone)) { //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 @@ -2982,6 +2978,7 @@ void APhaseAction::Update(float dt) int APhaseAction::resolve() { + return 0; }