Some gActiveBattler Fixes (#3259)

* some gActiveBattler related fixes

* fix IsBattleSEPlaying gActiveBattler->battlerId

---------

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2023-08-29 03:31:11 -04:00 committed by GitHub
parent 4490e9879a
commit 326fb2605a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -528,7 +528,7 @@ bool8 IsBattleSEPlaying(u8 battlerId)
if (IsSEPlaying()) if (IsSEPlaying())
{ {
gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer++; gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer++;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].soundTimer < 30) if (gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer < 30)
return TRUE; return TRUE;
m4aMPlayStop(&gMPlayInfo_SE1); m4aMPlayStop(&gMPlayInfo_SE1);

View File

@ -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) else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].soundMove)
unusableMoves |= gBitTable[i]; unusableMoves |= gBitTable[i];
// Stuff Cheeks // 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]; unusableMoves |= gBitTable[i];
// Gorilla Tactics // 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]) 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 && gBattleResults.catchAttempts[gLastUsedBall - ITEM_ULTRA_BALL] >= 1
&& !gHasFetchedBall) && !gHasFetchedBall)
{ {
gBattleScripting.battler = battler; gBattleScripting.battler = gActiveBattler = battler;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall);
MarkBattlerForControllerExec(battler); MarkBattlerForControllerExec(battler);
gHasFetchedBall = TRUE; gHasFetchedBall = TRUE;
@ -10758,7 +10758,7 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem)
bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes)
{ {
bool32 ret = TRUE; 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)) if (toxicSpikes && holdEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS && !IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON))
{ {
ret = FALSE; ret = FALSE;