From 4ac61ad15ff1f83d6df589a8c8493741d21edd3f Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 31 Aug 2023 22:24:58 -0400 Subject: [PATCH] handleultraburst, handleprimalreversion, handlemegaevo --- asm/macros/battle_script.inc | 33 ++++++++------- include/constants/battle_script_commands.h | 2 - src/battle_script_commands.c | 48 ++++++++++++---------- 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 25898a7d8..e43929c8d 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1382,6 +1382,24 @@ .4byte \ptr .endm + .macro handlemegaevo battler:req, case:req + callnative BS_HandleMegaEvolution + .byte \battler + .byte \case + .endm + + .macro handleprimalreversion battler:req, case:req + callnative BS_HandlePrimalReversion + .byte \battler + .byte \case + .endm + + .macro handleultraburst battler:req, case:req + callnative BS_HandleUltraBurst + .byte \battler + .byte \case + .endm + @ various command changed to more readable macros .macro cancelmultiturnmoves battler:req various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES @@ -1627,21 +1645,6 @@ .4byte \failInstr .endm - .macro handlemegaevo battler:req, case:req - various \battler, VARIOUS_HANDLE_MEGA_EVO - .byte \case - .endm - - .macro handleprimalreversion battler:req, case:req - various \battler, VARIOUS_HANDLE_PRIMAL_REVERSION - .byte \case - .endm - - .macro handleultraburst battler:req, case:req - various \battler, VARIOUS_HANDLE_ULTRA_BURST - .byte \case - .endm - .macro handleformchange battler:req, case:req various \battler, VARIOUS_HANDLE_FORM_CHANGE .byte \case diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 20e6d7e45..b6ed84561 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -210,7 +210,6 @@ #define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 118 #define VARIOUS_CONSUME_BERRY 119 #define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 120 -#define VARIOUS_HANDLE_PRIMAL_REVERSION 121 #define VARIOUS_APPLY_PLASMA_FISTS 122 #define VARIOUS_JUMP_IF_SPECIES 123 #define VARIOUS_UPDATE_ABILITY_POPUP 124 @@ -257,7 +256,6 @@ #define VARIOUS_TRY_REVIVAL_BLESSING 165 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 166 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 167 -#define VARIOUS_HANDLE_ULTRA_BURST 168 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5627f0d38..45f497201 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9626,27 +9626,6 @@ static void Cmd_various(void) } return; } - case VARIOUS_HANDLE_MEGA_EVO: - { - VARIOUS_ARGS(u8 case_); - HandleScriptMegaPrimalBurst(cmd->case_, gActiveBattler, HANDLE_TYPE_MEGA_EVOLUTION); - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } - case VARIOUS_HANDLE_PRIMAL_REVERSION: - { - VARIOUS_ARGS(u8 case_); - HandleScriptMegaPrimalBurst(cmd->case_, gActiveBattler, HANDLE_TYPE_PRIMAL_REVERSION); - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } - case VARIOUS_HANDLE_ULTRA_BURST: - { - VARIOUS_ARGS(u8 case_); - HandleScriptMegaPrimalBurst(cmd->case_, gActiveBattler, HANDLE_TYPE_ULTRA_BURST); - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } case VARIOUS_HANDLE_FORM_CHANGE: { VARIOUS_ARGS(u8 case_); @@ -16383,3 +16362,30 @@ void BS_SetSnow(void) } gBattlescriptCurrInstr = cmd->nextInstr; } + +void BS_HandleMegaEvolution(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + gActiveBattler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, gActiveBattler, HANDLE_TYPE_MEGA_EVOLUTION); + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_HandlePrimalReversion(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + gActiveBattler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, gActiveBattler, HANDLE_TYPE_PRIMAL_REVERSION); + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_HandleUltraBurst(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + gActiveBattler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, gActiveBattler, HANDLE_TYPE_ULTRA_BURST); + gBattlescriptCurrInstr = cmd->nextInstr; +}