From 103c060c7961cfa2d36e2f93f8deaa0b97dca029 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Sat, 30 Nov 2024 23:23:24 +0100 Subject: [PATCH] Fixes Population Bomb / Triple Kick missing message --- asm/macros/battle_script.inc | 4 +--- include/config/battle.h | 2 +- src/battle_script_commands.c | 40 +++++++++++------------------------- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 6dbcabe43ec..27488c25d8a 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -798,9 +798,7 @@ 2: .endm - .macro setmultihitcounter value:req - .byte 0x8d - .byte \value + .macro unused_0x8d .endm .macro initmultihitstring diff --git a/include/config/battle.h b/include/config/battle.h index fbc41be6ba7..1b19d0d2c9a 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -6,7 +6,7 @@ #define B_CRIT_MULTIPLIER GEN_LATEST // In Gen6+, critical hits multiply damage by 1.5 instead of 2. #define B_PARALYSIS_SPEED GEN_LATEST // In Gen7+, Speed is decreased by 50% instead of 75%. #define B_CONFUSION_SELF_DMG_CHANCE GEN_LATEST // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. -#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. +#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See SetRandomMultiHitCounter for values. #define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) #define B_LIGHT_BALL_ATTACK_BOOST GEN_LATEST // In Gen4+, Light Ball doubles the power of physical moves in addition to special moves. #define B_SANDSTORM_SPDEF_BOOST GEN_LATEST // In Gen4+, Sandstorm weather multiplies the Sp. Defense of Rock-type Pokémon by x1.5. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2ca3cd52f89..0822a55aa7b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -481,7 +481,7 @@ static void Cmd_statbuffchange(void); static void Cmd_normalisebuffs(void); static void Cmd_setbide(void); static void Cmd_twoturnmoveschargestringandanimation(void); -static void Cmd_setmultihitcounter(void); +static void Cmd_unused_0x8d(void); static void Cmd_initmultihitstring(void); static void Cmd_forcerandomswitch(void); static void Cmd_tryconversiontypechange(void); @@ -740,7 +740,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_normalisebuffs, //0x8A Cmd_setbide, //0x8B Cmd_twoturnmoveschargestringandanimation, //0x8C - Cmd_setmultihitcounter, //0x8D + Cmd_unused_0x8d, //0x8D Cmd_initmultihitstring, //0x8E Cmd_forcerandomswitch, //0x8F Cmd_tryconversiontypechange, //0x90 @@ -2534,6 +2534,15 @@ static void Cmd_resultmessage(void) if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK)) { + if (gMultiHitCounter && gMultiHitCounter < gMovesInfo[gCurrentMove].strikeCount) + { + gMultiHitCounter = 0; + gMoveResultFlags &= ~MOVE_RESULT_MISSED; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings; + return; + } + if (gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK) // Wonder Guard or Levitate - show the ability pop-up CreateAbilityPopUp(gBattlerTarget, gBattleMons[gBattlerTarget].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0); stringId = gMissStringIds[gBattleCommunication[MISS_TYPE]]; @@ -12015,33 +12024,8 @@ static void Cmd_twoturnmoveschargestringandanimation(void) gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_setmultihitcounter(void) +static void Cmd_unused_0x8d(void) { - CMD_ARGS(u8 value); - - if (cmd->value) - { - gMultiHitCounter = cmd->value; - } - else - { - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK) - { - gMultiHitCounter = 5; - } - else - { - // WARNING: These seem to be unused, see SetRandomMultiHitCounter. - if (B_MULTI_HIT_CHANCE >= GEN_5) - // 35%: 2 hits, 35%: 3 hits, 15% 4 hits, 15% 5 hits. - gMultiHitCounter = RandomWeighted(RNG_HITS, 0, 0, 7, 7, 3, 3); - else - // 37.5%: 2 hits, 37.5%: 3 hits, 12.5% 4 hits, 12.5% 5 hits. - gMultiHitCounter = RandomWeighted(RNG_HITS, 0, 0, 3, 3, 1, 1); - } - } - - gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_initmultihitstring(void)