Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Population Bomb / Triple Kick missing message #5747

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,7 @@
2:
.endm

.macro setmultihitcounter value:req
.byte 0x8d
.byte \value
.macro unused_0x8d
.endm

.macro initmultihitstring
Expand Down
2 changes: 1 addition & 1 deletion include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 12 additions & 28 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]];
Expand Down Expand Up @@ -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)
Expand Down