From e9b47944e39277d07bbc46a8074763deef011b80 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Sat, 12 Feb 2011 02:27:30 +0000 Subject: [PATCH] reverted a 2nd atempted fix at the infinate loop with ai using inkmoth nexus... it was making ai tap itself out. i think im about 99% sure i know where the issue is now, hopefully. --- projects/mtg/src/AIPlayer.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index f0e317a5e..9f1d66bb7 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -106,25 +106,28 @@ bool AIPlayer::tapLandsForMana(ManaCost * cost, MTGCardInstance * target) //Make sure we can use the ability MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]); AManaProducer * amp = dynamic_cast (a); - if (amp && canHandleCost(amp)) + if (amp && canHandleCost(amp) && (!amp->tap ||(amp->tap && !amp->source->isTapped()))) { MTGCardInstance * card = amp->source; if (card == target) - used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76 - if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() >= 1) { used[card] = true; - int doTap = 1; + } //http://code.google.com/p/wagic/issues/detail?id=76 + if (used[card] == false && amp->isReactingToClick(card) && amp->output->getConvertedCost() >= 1) + { + used[card] = true; + int doUse = 1; for (int i = Constants::MTG_NB_COLORS - 1; i >= 0; i--) { if (diff->getCost(i) && amp->output->getCost(i)) { diff->remove(i, 1); - doTap = 0; + doUse = 0; + used[card] = false; break; } } - if (doTap || amp->tap) + if (doUse || (amp->tap && used[card] == true)) { AIAction * action = NEW AIAction(amp, card); clickstream.push(action); @@ -1316,7 +1319,7 @@ int AIPlayerBaka::computeActions() {//is already looking kick me out of this function! return 0; } - if (p != this && (Player*)g->isInterrupting == this && g->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 1) + if (p != this && interruptIfICan()&& g->isInterrupting == this && g->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 1) { findingCard = true; CardDescriptor cd;