Merge pull request #1908 from kleeenexfeu/kleeenexfeu-PartyBattlerShouldAvoidHazardsfix

PartyBattlerShouldAvoidHazards fix
This commit is contained in:
Eduardo Quezada D'Ottone 2021-11-15 19:54:46 -03:00 committed by GitHub
commit bef896c65a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2414,9 +2414,19 @@ static bool32 AnyUsefulStatIsRaised(u8 battler)
return FALSE;
}
struct Pokemon *GetPartyBattlerPartyData(u8 battlerId, u8 switchBattler)
{
struct Pokemon *mon;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
mon = &gPlayerParty[switchBattler];
else
mon = &gEnemyParty[switchBattler];
return mon;
}
static bool32 PartyBattlerShouldAvoidHazards(u8 currBattler, u8 switchBattler)
{
struct Pokemon *mon = GetBattlerPartyData(switchBattler);
struct Pokemon *mon = GetPartyBattlerPartyData(currBattler, switchBattler);
u16 ability = GetMonAbility(mon); // we know our own party data
u16 holdEffect = GetBattlerHoldEffect(GetMonData(mon, MON_DATA_HELD_ITEM), TRUE);
u32 flags = gSideStatuses[GetBattlerSide(currBattler)] & (SIDE_STATUS_SPIKES | SIDE_STATUS_STEALTH_ROCK | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES);