fixed a crash witnessed when ai was trying to get the efficiency return of aamover the ai had a target, but the ability did not have a target, when "destinationZone()" was run, the game would crash due to a null pointer.
increase the "random" chance to use unknown, the old method almost always returned 0.
This commit is contained in:
@@ -698,7 +698,7 @@ int AIAction::getEfficiency()
|
||||
if (target)
|
||||
{
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY,NULL,target);
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
||||
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller()))
|
||||
{
|
||||
@@ -706,12 +706,13 @@ int AIAction::getEfficiency()
|
||||
}
|
||||
else
|
||||
{
|
||||
efficiency = WRand() % 5; //Small percentage of chance for unknown abilities
|
||||
//without a base to start with Wrand % 5 almost always returns 0.
|
||||
efficiency = 10 + WRand() % 5; //Small percentage of chance for unknown abilities
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
efficiency = WRand() % 10;
|
||||
efficiency = 10 + WRand() % 10;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user