diff --git a/projects/mtg/src/AIPlayerBaka.cpp b/projects/mtg/src/AIPlayerBaka.cpp index b96e340bb..646c7ccc8 100644 --- a/projects/mtg/src/AIPlayerBaka.cpp +++ b/projects/mtg/src/AIPlayerBaka.cpp @@ -714,12 +714,11 @@ bool AIPlayerBaka::payTheManaCost(ManaCost * cost, MTGCardInstance * target,vect clickstream.push(clicks[clicking]); return true; } - - //clean up temporary "clicks" structure if its content wasn't used above - for(size_t i = 0; i< clicks.size(); ++i) - SAFE_DELETE(clicks[i]); - clicks.clear(); } + //clean up temporary "clicks" structure if its content wasn't used above + for(size_t i = 0; i< clicks.size(); ++i) + SAFE_DELETE(clicks[i]); + clicks.clear(); SAFE_DELETE(paid); return false; } @@ -1724,6 +1723,8 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty } if(nextCardToPlay) { + if(!pMana->canAfford(nextCardToPlay->getManaCost())) + gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost()); DebugTrace(" AI wants to play card." << endl << "- Next card to play: " << (nextCardToPlay ? nextCardToPlay->name : "None" ) << endl ); } diff --git a/projects/mtg/src/AIPlayerBakaB.cpp b/projects/mtg/src/AIPlayerBakaB.cpp index a4ad3a5d9..ab30f95a3 100644 --- a/projects/mtg/src/AIPlayerBakaB.cpp +++ b/projects/mtg/src/AIPlayerBakaB.cpp @@ -84,12 +84,11 @@ bool AIPlayerBakaB::payTheManaCost(ManaCost * cost, MTGCardInstance * target, ve clickstream.push(clicks[clicking]); return true; } - - //clean up temporary "clicks" structure if its content wasn't used above - for(size_t i = 0; i< clicks.size(); ++i) - SAFE_DELETE(clicks[i]); - clicks.clear(); } + //clean up temporary "clicks" structure if its content wasn't used above + for(size_t i = 0; i< clicks.size(); ++i) + SAFE_DELETE(clicks[i]); + clicks.clear(); SAFE_DELETE(paid); return false; } @@ -1724,6 +1723,8 @@ MTGCardInstance * AIPlayerBakaB::FindCardToPlay(ManaCost * pMana, const char * t } if(nextCardToPlay) { + if(!pMana->canAfford(nextCardToPlay->getManaCost())) + gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost()); DebugTrace(" AI wants to play card." << endl << "- Next card to play: " << (nextCardToPlay ? nextCardToPlay->name : "None" ) << endl ); }