AI_GetAbility supports hidden abilities
This commit is contained in:
parent
201a38f487
commit
9fdd6fffee
1 changed files with 7 additions and 8 deletions
|
@ -1134,17 +1134,16 @@ s32 AI_GetAbility(u32 battlerId)
|
||||||
|| gBattleMons[battlerId].ability == ABILITY_ARENA_TRAP)
|
|| gBattleMons[battlerId].ability == ABILITY_ARENA_TRAP)
|
||||||
return gBattleMons[battlerId].ability;
|
return gBattleMons[battlerId].ability;
|
||||||
|
|
||||||
|
// AI has no knowledge of opponent, so it guesses which ability.
|
||||||
if (gBaseStats[gBattleMons[battlerId].species].abilities[0] != ABILITY_NONE)
|
if (gBaseStats[gBattleMons[battlerId].species].abilities[0] != ABILITY_NONE)
|
||||||
{
|
{
|
||||||
if (gBaseStats[gBattleMons[battlerId].species].abilities[1] != ABILITY_NONE)
|
u16 abilityGuess = ABILITY_NONE;
|
||||||
|
while (abilityGuess == ABILITY_NONE)
|
||||||
{
|
{
|
||||||
// AI has no knowledge of opponent, so it guesses which ability.
|
abilityGuess = gBaseStats[gBattleMons[battlerId].species].abilities[Random() % NUM_ABILITY_SLOTS];
|
||||||
return gBaseStats[gBattleMons[battlerId].species].abilities[Random() & 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return gBaseStats[gBattleMons[battlerId].species].abilities[0]; // It's definitely ability 1.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return abilityGuess;
|
||||||
}
|
}
|
||||||
return ABILITY_NONE; // Unknown.
|
return ABILITY_NONE; // Unknown.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue