From d849c31ee8d46912fe72d96b30f349524a2191b6 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 8 Jun 2021 11:34:23 -0300 Subject: [PATCH] Followed Ghoulslash's suggestion --- include/battle_util.h | 1 - src/battle_util.c | 25 +------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index 2627ed21a..f06a58938 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -138,7 +138,6 @@ 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); diff --git a/src/battle_util.c b/src/battle_util.c index 65fda1907..a5867a8d9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4649,7 +4649,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !(GetBattlerAbility(gBattlerAttacker) == ABILITY_SHEER_FORCE && gBattleMoves[gCurrentMove].flags & FLAG_SHEER_FORCE_BOOST) && (CanBattlerSwitch(battler) || !(gBattleTypeFlags & BATTLE_TYPE_TRAINER)) && !(gBattleTypeFlags & BATTLE_TYPE_ARENA) - && !IsLastAliveMonInParty(battler)) + && CountUsablePartyMons(battler) > 0) { gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_EMERGENCY_EXIT; effect++; @@ -8672,26 +8672,3 @@ 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; -}