Fixed Emergency Exit
The ability was getting triggered even if the user was the only Pokémon alive in the party.
This commit is contained in:
parent
339f297949
commit
2c1237365b
2 changed files with 26 additions and 1 deletions
|
@ -138,6 +138,7 @@ bool32 IsTelekinesisBannedSpecies(u16 species);
|
|||
bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
|
||||
bool32 IsThawingMove(u8 battlerId, u16 move);
|
||||
bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId);
|
||||
bool32 IsLastAliveMonInParty(u8 battlerId);
|
||||
|
||||
// ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
|
||||
|
|
|
@ -4648,7 +4648,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||
&& (gMultiHitCounter == 0 || gMultiHitCounter == 1)
|
||||
&& !(GetBattlerAbility(gBattlerAttacker) == ABILITY_SHEER_FORCE && gBattleMoves[gCurrentMove].flags & FLAG_SHEER_FORCE_BOOST)
|
||||
&& (CanBattlerSwitch(battler) || !(gBattleTypeFlags & BATTLE_TYPE_TRAINER))
|
||||
&& !(gBattleTypeFlags & BATTLE_TYPE_ARENA))
|
||||
&& !(gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
||||
&& !IsLastAliveMonInParty(battler))
|
||||
{
|
||||
gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_EMERGENCY_EXIT;
|
||||
effect++;
|
||||
|
@ -8671,3 +8672,26 @@ bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability)
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsLastAliveMonInParty(u8 battlerId)
|
||||
{
|
||||
struct Pokemon *party;
|
||||
u8 i;
|
||||
u8 count = 0;
|
||||
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
party = gPlayerParty;
|
||||
else
|
||||
party = gEnemyParty;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&party[i], MON_DATA_HP) != 0)
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count > 1)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue