From f060d0185f2da05378f51c577baadbf3fb131cef Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 2 Feb 2023 21:59:40 -0500 Subject: [PATCH] fix wind power, electromorphosis stomping on gbattlerattacker --- data/battle_scripts_1.s | 33 +++------------------------------ src/battle_script_commands.c | 9 +++++---- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e526f6e96..0dada5566 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2951,12 +2951,9 @@ BattleScript_TryTailwindAbilitiesLoop_WindRider: BattleScript_TryTailwindAbilitiesLoop_WindPower: call BattleScript_AbilityPopUp - copybyte sSAVED_BATTLER, gBattlerAttacker - copybyte gBattlerAttacker, gBattlerTarget - setcharge + setcharge BS_TARGET printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER waitmessage B_WAIT_TIME_LONG - copybyte gBattlerAttacker, sSAVED_BATTLER goto BattleScript_TryTailwindAbilitiesLoop_Increment BattleScript_EffectMircleEye: @@ -5675,7 +5672,7 @@ BattleScript_EffectCharge:: attackcanceler attackstring ppreduce - setcharge + setcharge BS_ATTACKER attackanimation waitanimation .if B_CHARGE_SPDEF_RAISE >= GEN_5 @@ -6738,27 +6735,6 @@ BattleScript_TailwindEnds:: waitmessage B_WAIT_TIME_LONG end2 -BattleScript_WindPowerActivatesEnd2:: - setbyte gBattlerAttacker, 0 -BattleScript_WindPowerLoop: - printstring STRINGID_EMPTYSTRING3 - jumpifability BS_ATTACKER, ABILITY_WIND_POWER, BattleScript_WindPowerLoop_Cont - goto BattleScript_WindPowerIncrement -BattleScript_WindPowerLoop_Cont: - jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerIncrement - goto BattleScript_WindPower_Activate -BattleScript_WindPower_Activate: - call BattleScript_AbilityPopUp - setcharge - printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER - waitmessage B_WAIT_TIME_LONG -BattleScript_WindPowerIncrement: - addbyte gBattlerAttacker, 1 - jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_WindPowerLoop -BattleScript_WindPowerEnd: - destroyabilitypopup - end2 - BattleScript_TrickRoomEnds:: printstring STRINGID_TRICKROOMENDS waitmessage B_WAIT_TIME_LONG @@ -7233,11 +7209,8 @@ BattleScript_AngerShellRet: return BattleScript_WindPowerActivates:: -.if B_CHECK_IF_CHARGED_UP == TRUE - jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerActivates_Ret -.endif call BattleScript_AbilityPopUp - setcharge + setcharge BS_TARGET printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER waitmessage B_WAIT_TIME_LONG BattleScript_WindPowerActivates_Ret: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ccec3f6a6..87cb185b4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -13198,10 +13198,11 @@ static void Cmd_setforcedtarget(void) static void Cmd_setcharge(void) { - gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP; - gDisableStructs[gBattlerAttacker].chargeTimer = 2; - gDisableStructs[gBattlerAttacker].chargeTimerStartValue = 2; - gBattlescriptCurrInstr++; + u8 battler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); + gStatuses3[battler] |= STATUS3_CHARGED_UP; + gDisableStructs[battler].chargeTimer = 2; + gDisableStructs[battler].chargeTimerStartValue = 2; + gBattlescriptCurrInstr += 2; } // Nature Power