fixed a division by zero error when AI has equipment on field but no creatures to equip them to.
fixed formatting of getEfficiency code block
This commit is contained in:
@@ -278,7 +278,7 @@ int AIAction::getEfficiency()
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
//this is a specail case for all(this) targetting workaround.
|
||||
//this is a special case for all(this) targetting workaround.
|
||||
//adding a direct method for targetting the source is planned for
|
||||
//the coming releases, all(this) workaround prevents eff from being returned
|
||||
//as its not targetted the same as abilities
|
||||
@@ -329,12 +329,13 @@ int AIAction::getEfficiency()
|
||||
|
||||
int equips = p->game->battlefield->countByType("Equipment");
|
||||
int myArmy = p->game->battlefield->countByType("Creature");
|
||||
int equilized = abs(equips / myArmy);
|
||||
// when can this ever be negative?
|
||||
int equilized = myArmy ? abs(equips / myArmy) : 0;
|
||||
|
||||
if (p == target->controller() && target->equipment <= 1 && !a->source->target)
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());
|
||||
if (target->hasColor(5))
|
||||
if (target->hasColor(Constants::MTG_COLOR_WHITE))
|
||||
efficiency += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking.
|
||||
if (target->power == 1 && target->toughness == 1 && target->isToken == 0)
|
||||
efficiency += 10; //small bonus to encourage equipping nontoken 1/1 creatures.
|
||||
|
||||
Reference in New Issue
Block a user