From b399d1e8c5529fc311c93c281a4a8eea51ccfd77 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 27 Feb 2023 22:29:23 -0500 Subject: [PATCH] fix ABILITYEFFECT_ON_TERRAIN battler Id settings --- src/battle_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index fc30547e6079..ddc3eaa1a2f1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6230,7 +6230,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITYEFFECT_ON_TERRAIN: // For ability effects that activate when the field terrain changes. - battler = gBattlerAbility = gBattleScripting.battler; gLastUsedAbility = GetBattlerAbility(battler); switch (gLastUsedAbility) { @@ -6239,6 +6238,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { gSpecialStatuses[battler].terrainAbilityDone = TRUE; ChangeTypeBasedOnTerrain(battler); + gBattlerAbility = gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_MimicryActivates_End3); effect++; } @@ -6247,6 +6247,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].terrainAbilityDone && IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN)) { gSpecialStatuses[battler].terrainAbilityDone = TRUE; + gBattlerAbility = gBattleScripting.battler = battler; PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler)); BattleScriptPushCursorAndCallback(BattleScript_QuarkDriveActivates); effect++;