From 1e2aa18ffe13e655227739dd09f60f668b6b307a Mon Sep 17 00:00:00 2001 From: wiz1989 <80073265+wiz1989@users.noreply.github.com> Date: Mon, 17 Mar 2025 19:16:43 +0100 Subject: [PATCH] Added Dynamax/Gigantamax battle messages (#6440) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> --- asm/macros/battle_script.inc | 6 ++++++ data/battle_scripts_1.s | 17 +++++++++++++++++ include/config/battle.h | 1 + include/constants/battle_string_ids.h | 6 +++++- src/battle_message.c | 4 ++++ src/battle_script_commands.c | 12 ++++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index e50cbcbe43..3804e64240 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1817,6 +1817,12 @@ .4byte \failInstr .endm + .macro jumpifcangigantamax battler:req, jumpInstr:req + callnative BS_JumpIfCanGigantamax + .byte \battler + .4byte \jumpInstr + .endm + @ various command changed to more readable macros .macro cancelmultiturnmoves battler:req various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 7d94e9727b..aeb3f610d7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -10006,6 +10006,14 @@ BattleScript_EffectSteelsurge:: BattleScript_DynamaxBegins:: flushtextbox trytrainerslidedynamaxmsg + jumpifcangigantamax BS_ATTACKER, BattleScript_DynamaxBegins_GigantamaxString_01 + printstring STRINGID_TIMETODYNAMAX + waitmessage B_WAIT_TIME_MED + goto BattleScript_DynamaxBegins_SwitchIn +BattleScript_DynamaxBegins_GigantamaxString_01: + printstring STRINGID_TIMETOGIGANTAMAX + waitmessage B_WAIT_TIME_MED +BattleScript_DynamaxBegins_SwitchIn: returnatktoball pause B_WAIT_TIME_SHORT returntoball BS_SCRIPTING, TRUE @@ -10013,6 +10021,15 @@ BattleScript_DynamaxBegins:: updatedynamax playanimation BS_SCRIPTING, B_ANIM_DYNAMAX_GROWTH waitanimation + jumpifbyteequal B_SHOW_DYNAMAX_MESSAGE, FALSE, BattleScript_DynamaxBegins_End3 + jumpifcangigantamax BS_ATTACKER, BattleScript_DynamaxBegins_GigantamaxString_02 + printstring STRINGID_PKMNDYNAMAXED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_DynamaxBegins_End3 +BattleScript_DynamaxBegins_GigantamaxString_02: + printstring STRINGID_PKMNGIGANTAMAXED + waitmessage B_WAIT_TIME_LONG +BattleScript_DynamaxBegins_End3: end3 BattleScript_DynamaxEnds:: diff --git a/include/config/battle.h b/include/config/battle.h index 33451ca4db..cffa3701b3 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -255,6 +255,7 @@ #define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option #define B_MOVE_DESCRIPTION_BUTTON L_BUTTON // If set to a button other than B_LAST_USED_BALL_BUTTON, pressing this button will open the move description menu #define B_SHOW_USELESS_Z_MOVE_INFO FALSE // If set to TRUE, Z-moves without additional effects like newer gen status moves will say "no additional effect" +#define B_SHOW_DYNAMAX_MESSAGE FALSE // If set to TRUE, an additional battle message is shown after completing Dynamaxing/Gigantamaxing. // Catching settings #define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 3ba637c690..16d41f3977 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -729,8 +729,12 @@ #define STRINGID_ITDOESNTAFFECTTWOFOES 727 #define STRINGID_SENDCAUGHTMONPARTYORBOX 728 #define STRINGID_PKMNSENTTOPCAFTERCATCH 729 +#define STRINGID_PKMNDYNAMAXED 730 +#define STRINGID_PKMNGIGANTAMAXED 731 +#define STRINGID_TIMETODYNAMAX 732 +#define STRINGID_TIMETOGIGANTAMAX 733 -#define BATTLESTRINGS_COUNT 730 +#define BATTLESTRINGS_COUNT 734 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index c463474d40..e91cf957df 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -893,6 +893,10 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_ITDOESNTAFFECTTWOFOES] = COMPOUND_STRING("It doesn't affect {B_DEF_NAME_WITH_PREFIX2} and {B_DEF_PARTNER_NAME}…"), [STRINGID_SENDCAUGHTMONPARTYORBOX] = COMPOUND_STRING("Add {B_DEF_NAME} to your party?"), [STRINGID_PKMNSENTTOPCAFTERCATCH] = gText_PkmnSentToPCAfterCatch, + [STRINGID_PKMNDYNAMAXED] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} grew huge\ninto its Dynamax form!"), + [STRINGID_PKMNGIGANTAMAXED] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} grew huge\ninto its Gigantamax form!"), + [STRINGID_TIMETODYNAMAX] = COMPOUND_STRING("Time to Dynamax!"), + [STRINGID_TIMETOGIGANTAMAX] = COMPOUND_STRING("Time to Gigantamax!"), }; const u16 gTrainerUsedItemStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8e71ba08f5..455dcff789 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -18659,3 +18659,15 @@ void BS_RestoreSavedMove(void) gBattlescriptCurrInstr = cmd->nextInstr; } + +void BS_JumpIfCanGigantamax(void) +{ + NATIVE_ARGS(u8 battler, const u8 *jumpInstr); + u32 battler = GetBattlerForBattleScript(cmd->battler); + + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_GIGANTAMAX_FACTOR) + && GetGMaxTargetSpecies(gBattleMons[battler].species) != SPECIES_NONE) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +}