mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 23:23:43 +01:00
Fixed AI not considering Hidden Abilities in its team during switching logic (#2908)
This commit is contained in:
commit
48fba7a35c
@ -198,9 +198,8 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
|||||||
|
|
||||||
if (GetMonData(&party[i], MON_DATA_HP) == 0)
|
if (GetMonData(&party[i], MON_DATA_HP) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_NONE)
|
species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
|
||||||
continue;
|
if (species == SPECIES_NONE || species == SPECIES_EGG)
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG)
|
|
||||||
continue;
|
continue;
|
||||||
if (i == gBattlerPartyIndexes[battlerIn1])
|
if (i == gBattlerPartyIndexes[battlerIn1])
|
||||||
continue;
|
continue;
|
||||||
@ -213,12 +212,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
|||||||
if (IsAceMon(gActiveBattler, i))
|
if (IsAceMon(gActiveBattler, i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
monAbility = GetMonAbility(&party[i]);
|
||||||
species = GetMonData(&party[i], MON_DATA_SPECIES);
|
|
||||||
if (GetMonData(&party[i], MON_DATA_ABILITY_NUM) != 0)
|
|
||||||
monAbility = gSpeciesInfo[species].abilities[1];
|
|
||||||
else
|
|
||||||
monAbility = gSpeciesInfo[species].abilities[0];
|
|
||||||
|
|
||||||
if (absorbingTypeAbility == monAbility && Random() & 1)
|
if (absorbingTypeAbility == monAbility && Random() & 1)
|
||||||
{
|
{
|
||||||
@ -570,9 +564,8 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent)
|
|||||||
|
|
||||||
if (GetMonData(&party[i], MON_DATA_HP) == 0)
|
if (GetMonData(&party[i], MON_DATA_HP) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_NONE)
|
species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
|
||||||
continue;
|
if (species == SPECIES_NONE || species == SPECIES_EGG)
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG)
|
|
||||||
continue;
|
continue;
|
||||||
if (i == gBattlerPartyIndexes[battlerIn1])
|
if (i == gBattlerPartyIndexes[battlerIn1])
|
||||||
continue;
|
continue;
|
||||||
@ -585,12 +578,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent)
|
|||||||
if (IsAceMon(gActiveBattler, i))
|
if (IsAceMon(gActiveBattler, i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
monAbility = GetMonAbility(&party[i]);
|
||||||
species = GetMonData(&party[i], MON_DATA_SPECIES);
|
|
||||||
if (GetMonData(&party[i], MON_DATA_ABILITY_NUM) != 0)
|
|
||||||
monAbility = gSpeciesInfo[species].abilities[1];
|
|
||||||
else
|
|
||||||
monAbility = gSpeciesInfo[species].abilities[0];
|
|
||||||
|
|
||||||
CalcPartyMonTypeEffectivenessMultiplier(gLastLandedMoves[gActiveBattler], species, monAbility);
|
CalcPartyMonTypeEffectivenessMultiplier(gLastLandedMoves[gActiveBattler], species, monAbility);
|
||||||
if (gMoveResultFlags & flags)
|
if (gMoveResultFlags & flags)
|
||||||
@ -964,7 +952,9 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
|||||||
// Get invalid slots ids.
|
// Get invalid slots ids.
|
||||||
for (i = firstId; i < lastId; i++)
|
for (i = firstId; i < lastId; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
u16 species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
|
||||||
|
if (species == SPECIES_NONE
|
||||||
|
|| species == SPECIES_EGG
|
||||||
|| GetMonData(&party[i], MON_DATA_HP) == 0
|
|| GetMonData(&party[i], MON_DATA_HP) == 0
|
||||||
|| gBattlerPartyIndexes[battlerIn1] == i
|
|| gBattlerPartyIndexes[battlerIn1] == i
|
||||||
|| gBattlerPartyIndexes[battlerIn2] == i
|
|| gBattlerPartyIndexes[battlerIn2] == i
|
||||||
|
Loading…
x
Reference in New Issue
Block a user