Found & fixed a crash while testing trample. The bug: if the AI's player hand dropped to zero cards. This broke in r2696.
Zeth, please review, I put in a comment where there's something that doesn't make sense- probably an early change that's now obsolete.
This commit is contained in:
@@ -441,15 +441,23 @@ int AIAction::getEfficiency()
|
|||||||
AbilityFactory af;
|
AbilityFactory af;
|
||||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||||
|
|
||||||
|
int efficiencyModifier = (25 * target->DangerRanking());
|
||||||
|
if (p->game->hand->nb_cards > 1)
|
||||||
|
{
|
||||||
|
efficiencyModifier /= p->game->hand->nb_cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Z, please review. If this condition is hit, it's immediately wiped out later at line 464 (the don't give flying twice check),
|
||||||
|
// since both satisfy the check for (target->has(a->abilitygranted)).
|
||||||
|
// Is this if statement section obsolete?
|
||||||
if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && target->has(a->abilitygranted) && p->isAI())
|
if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && target->has(a->abilitygranted) && p->isAI())
|
||||||
{
|
{
|
||||||
efficiency += (25 * target->DangerRanking()) / p->game->hand->nb_cards;
|
efficiency += efficiencyModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN && p == target->controller() && p->isAI())
|
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN && p == target->controller() && p->isAI())
|
||||||
{
|
{
|
||||||
efficiency += (25 * target->DangerRanking()) / p->game->hand->nb_cards;
|
efficiency += efficiencyModifier;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->has(a->abilitygranted))
|
if (target->has(a->abilitygranted))
|
||||||
|
|||||||
Reference in New Issue
Block a user