From 64af4470e4cb892dea999ac6b3eda8d28b8ac183 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Mon, 13 Dec 2010 12:33:35 +0000 Subject: [PATCH] further improved "prevent" training on ai, while polishing off a Ai deck based on cleric i noticed it was using WAY too much prevent on a creature...sometimes 6 points or more then it should have been using...we only ever want to use *just* enough to survive. this way we can spread the love to the other creatures. i hope to have a polished cleric Ai deck for release 14.1 within the next day or so. trying to include a couple decks that take adventage of all this great training. hopefully i can get prevent working as good as equip does...the Ai deck i constructed called "the kor" is almost an unbeatable white weenie deck. --- projects/mtg/src/AIPlayer.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index efc8f9c3a..9b020f076 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -281,18 +281,31 @@ int AIAction::getEfficiency() { if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power) NeedPreventing = true; - } - if (p == target->controller() && NeedPreventing == true && !(target->getNextOpponent()->has(Constants::DEATHTOUCH) + if (p == target->controller() && target->controller()->isAI() && NeedPreventing == true && !(target->getNextOpponent()->has(Constants::DEATHTOUCH) || target->getNextOpponent()->has(Constants::WITHER))) { efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved".. if (target->toughness == 1 && target->getNextOpponent()->power == 1) efficiency += 15; //small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence. - } + } //note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste. //if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result. - //TODO If the card is the target of a damage spell + int calculateAfterDamage = 0; + int damages = 0; + if((target->defenser || target->blockers.size()) && target->controller()->isAI()) + { + damages = target->getNextOpponent()->power; + calculateAfterDamage = int(target->toughness - damages); + if((calculateAfterDamage + target->preventable) > 0) + { + efficiency = 0; + //this is to avoid wasting prevents on creatures that will already survive. + //this should take into account bushido and flanking as this check is run after every trigger. + } + } + } + //TODO If the card is the target of a damage spell break; } case MTGAbility::STANDARD_EQUIP: