From 326fb2605af9bc2bbf74e7ee7fef2e25edb1de05 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 29 Aug 2023 03:31:11 -0400 Subject: [PATCH] Some gActiveBattler Fixes (#3259) * some gActiveBattler related fixes * fix IsBattleSEPlaying gActiveBattler->battlerId --------- Co-authored-by: ghoulslash --- src/battle_gfx_sfx_util.c | 2 +- src/battle_util.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 9da563057..e39ea54a3 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -528,7 +528,7 @@ bool8 IsBattleSEPlaying(u8 battlerId) if (IsSEPlaying()) { gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer++; - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].soundTimer < 30) + if (gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer < 30) return TRUE; m4aMPlayStop(&gMPlayInfo_SE1); diff --git a/src/battle_util.c b/src/battle_util.c index 2f2a65923..d98d48db4 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1884,7 +1884,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check) else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].soundMove) unusableMoves |= gBitTable[i]; // Stuff Cheeks - else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) + else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battlerId].item) != POCKET_BERRIES) unusableMoves |= gBitTable[i]; // Gorilla Tactics else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) @@ -4879,7 +4879,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && gBattleResults.catchAttempts[gLastUsedBall - ITEM_ULTRA_BALL] >= 1 && !gHasFetchedBall) { - gBattleScripting.battler = battler; + gBattleScripting.battler = gActiveBattler = battler; BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); MarkBattlerForControllerExec(battler); gHasFetchedBall = TRUE; @@ -10758,7 +10758,7 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) { bool32 ret = TRUE; - u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE); + u32 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); if (toxicSpikes && holdEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS && !IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)) { ret = FALSE;