diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index a279ba7569..c449c9421e 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1529,6 +1529,18 @@ .4byte \ptr .endm + .macro trytrainerslidezmovemsg + callnative BS_TryTrainerSlideZMoveMsg + .endm + + .macro trytrainerslidemegaevolutionmsg + callnative BS_TryTrainerSlideMegaEvolutionMsg + .endm + + .macro trytrainerslidedynamaxmsg + callnative BS_TryTrainerSlideDynamaxMsg + .endm + @ various command changed to more readable macros .macro cancelmultiturnmoves battler:req various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES @@ -2188,14 +2200,6 @@ various \battler, VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES .endm - .macro trytrainerslidezmovemsg battler:req - various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE - .endm - - .macro trytrainerslidemegaevolutionmsg battler:req - various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION - .endm - @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2e5494a03a..50d10e81ab 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7826,7 +7826,7 @@ BattleScript_FocusPunchSetUp:: BattleScript_MegaEvolution:: flushtextbox - trytrainerslidemegaevolutionmsg BS_ATTACKER + trytrainerslidemegaevolutionmsg printstring STRINGID_MEGAEVOREACTING BattleScript_MegaEvolutionAfterString: waitmessage B_WAIT_TIME_LONG @@ -7842,7 +7842,7 @@ BattleScript_MegaEvolutionAfterString: BattleScript_WishMegaEvolution:: flushtextbox - trytrainerslidemegaevolutionmsg BS_ATTACKER + trytrainerslidemegaevolutionmsg printstring STRINGID_FERVENTWISHREACHED goto BattleScript_MegaEvolutionAfterString @@ -7870,7 +7870,7 @@ BattleScript_PrimalReversionRet:: BattleScript_UltraBurst:: flushtextbox - trytrainerslidezmovemsg BS_ATTACKER + trytrainerslidezmovemsg printstring STRINGID_ULTRABURSTREACTING waitmessage B_WAIT_TIME_LONG setbyte gIsCriticalHit, 0 @@ -10089,7 +10089,7 @@ BattleScript_JabocaRowapBerryActivate_Dmg: @ z moves / effects BattleScript_ZMoveActivateDamaging:: flushtextbox - trytrainerslidezmovemsg BS_ATTACKER + trytrainerslidezmovemsg printstring STRINGID_ZPOWERSURROUNDS playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL printstring STRINGID_ZMOVEUNLEASHED @@ -10098,7 +10098,7 @@ BattleScript_ZMoveActivateDamaging:: BattleScript_ZMoveActivateStatus:: flushtextbox - trytrainerslidezmovemsg BS_ATTACKER + trytrainerslidezmovemsg savetarget printstring STRINGID_ZPOWERSURROUNDS playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL @@ -10689,6 +10689,7 @@ BattleScript_EffectSteelsurge:: BattleScript_DynamaxBegins:: flushtextbox + trytrainerslidedynamaxmsg returnatktoball pause B_WAIT_TIME_SHORT returntoball BS_SCRIPTING diff --git a/include/battle.h b/include/battle.h index 902295e873..f34db84202 100644 --- a/include/battle.h +++ b/include/battle.h @@ -726,6 +726,7 @@ struct BattleStruct bool8 trainerSlideMegaEvolutionMsgDone; bool8 trainerSlideZMoveMsgDone; bool8 trainerSlideBeforeFirstTurnMsgDone; + bool8 trainerSlideDynamaxMsgDone; u32 aiDelayTimer; // Counts number of frames AI takes to choose an action. u32 aiDelayFrames; // Number of frames it took to choose an action. bool8 transformZeroToHero[PARTY_SIZE][NUM_BATTLE_SIDES]; diff --git a/include/battle_message.h b/include/battle_message.h index e01c916c3c..338712606a 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -238,6 +238,7 @@ enum TRAINER_SLIDE_MEGA_EVOLUTION, TRAINER_SLIDE_Z_MOVE, TRAINER_SLIDE_BEFORE_FIRST_TURN, + TRAINER_SLIDE_DYNAMAX, }; void BufferStringBattle(u16 stringID, u32 battler); diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 9526d549fd..b98396fe57 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -245,8 +245,6 @@ #define VARIOUS_STORE_HEALING_WISH 152 #define VARIOUS_HIT_SWITCH_TARGET_FAILED 153 #define VARIOUS_TRY_REVIVAL_BLESSING 154 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 155 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 156 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_message.c b/src/battle_message.c index 6763fe32ba..fa2df70688 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -4033,6 +4033,7 @@ struct TrainerSlide const u8 *msgMegaEvolution; const u8 *msgZMove; const u8 *msgBeforeFirstTurn; + const u8 *msgDynamax; }; static const struct TrainerSlide sTrainerSlides[] = @@ -4053,6 +4054,7 @@ static const struct TrainerSlide sTrainerSlides[] = .msgMegaEvolution = sText_PowderExplodes, .msgZMove = sText_Electromagnetism, .msgBeforeFirstTurn = sText_GravityIntensified, + .msgDynamax = sText_TargetWokeUp, }, */ }; @@ -4238,6 +4240,14 @@ u32 ShouldDoTrainerSlide(u32 battler, u32 which) return TRUE; } break; + case TRAINER_SLIDE_DYNAMAX: + if (sTrainerSlides[i].msgDynamax != NULL && !gBattleStruct->trainerSlideDynamaxMsgDone) + { + gBattleStruct->trainerSlideDynamaxMsgDone = TRUE; + gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgDynamax; + return TRUE; + } + break; } break; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bf63d0c1b2..8de129f474 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10641,30 +10641,6 @@ static void Cmd_various(void) } return; } - case VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE: - { - VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_Z_MOVE))) - { - gBattleScripting.battler = battler; - BattleScriptPush(cmd->nextInstr); - gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); - return; - } - break; - } - case VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION: - { - VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_MEGA_EVOLUTION))) - { - gBattleScripting.battler = battler; - BattleScriptPush(cmd->nextInstr); - gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); - return; - } - break; - } } // End of switch (cmd->id) gBattlescriptCurrInstr = cmd->nextInstr; @@ -16290,7 +16266,6 @@ void BS_TryRelicSong(void) gBattlescriptCurrInstr = cmd->nextInstr; } - void BS_SetPledge(void) { NATIVE_ARGS(const u8 *jumpInstr); @@ -16401,3 +16376,48 @@ void BS_SetPledgeStatus(void) else gBattlescriptCurrInstr = BattleScript_MoveEnd; } + +void BS_TryTrainerSlideZMoveMsg(void) +{ + NATIVE_ARGS(); + s32 shouldSlide; + + if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_Z_MOVE))) + { + gBattleScripting.battler = gBattlerAttacker; + BattleScriptPush(cmd->nextInstr); + gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); + } + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_TryTrainerSlideMegaEvolutionMsg(void) +{ + NATIVE_ARGS(); + s32 shouldSlide; + + if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_MEGA_EVOLUTION))) + { + gBattleScripting.battler = gBattlerAttacker; + BattleScriptPush(cmd->nextInstr); + gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); + } + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_TryTrainerSlideDynamaxMsg(void) +{ + NATIVE_ARGS(); + s32 shouldSlide; + + if ((shouldSlide = ShouldDoTrainerSlide(gBattlerAttacker, TRAINER_SLIDE_DYNAMAX))) + { + gBattleScripting.battler = gBattlerAttacker; + BattleScriptPush(cmd->nextInstr); + gBattlescriptCurrInstr = (shouldSlide == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); + } + else + gBattlescriptCurrInstr = cmd->nextInstr; +}