fix crash damage implementation and incorrect memento generation (#8804)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
amiosi 2026-01-05 18:18:46 -05:00 committed by GitHub
parent 0bed4761a1
commit 126100c027
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 11 deletions

View File

@ -94,8 +94,8 @@
// Other move settings
#define B_INCINERATE_GEMS GEN_LATEST // In Gen6+, Incinerate can destroy Gems.
#define B_CAN_SPITE_FAIL GEN_LATEST // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP.
#define B_CRASH_IF_TARGET_IMMUNE GEN_LATEST // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
#define B_MEMENTO_FAIL GEN_LATEST // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6.
#define B_CRASH_IF_TARGET_IMMUNE GEN_LATEST // In Gen4+, moves with crash damage will crash if the user attacks a target that is immune due to their typing.
#define B_MEMENTO_FAIL GEN_LATEST // In Gen4+, Memento no longer fails if the target already has -6 Attack and Special Attack. Additionally, in Gen5+, it fails if there is no target, or if the target is protected or behind a Substitute.
#define B_GLARE_GHOST GEN_LATEST // In Gen4+, Glare can hit Ghost-type Pokémon normally.
#define B_SKILL_SWAP GEN_LATEST // In Gen4+, Skill Swap triggers switch-in abilities after use.
#define B_BRICK_BREAK GEN_LATEST // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune.

View File

@ -5907,16 +5907,29 @@ static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
&& !gBattleStruct->noTargetPresent)
{
s32 recoil = 0;
if (B_RECOIL_IF_MISS_DMG >= GEN_5 || (B_CRASH_IF_TARGET_IMMUNE == GEN_4 && gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_DOESNT_AFFECT_FOE))
if (B_CRASH_IF_TARGET_IMMUNE == GEN_4 && gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_DOESNT_AFFECT_FOE)
{
recoil = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
}
if (B_RECOIL_IF_MISS_DMG >= GEN_5)
{
recoil = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
else if (B_RECOIL_IF_MISS_DMG == GEN_4 && (GetNonDynamaxMaxHP(gBattlerTarget) / 2) < gBattleStruct->moveDamage[gBattlerTarget])
recoil = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
else if (B_RECOIL_IF_MISS_DMG == GEN_3)
recoil = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
}
else if (B_RECOIL_IF_MISS_DMG >= GEN_3)
{
if ((GetNonDynamaxMaxHP(gBattlerTarget) / 2) < gBattleStruct->moveDamage[gBattlerTarget])
recoil = gBattleStruct->moveDamage[gBattlerTarget];
else
recoil = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
}
else if (B_RECOIL_IF_MISS_DMG == GEN_2)
recoil = GetNonDynamaxMaxHP(gBattlerTarget) / 8;
{
recoil = gBattleStruct->moveDamage[gBattlerTarget] / 8;
}
else
{
recoil = 1;
}
SetPassiveDamageAmount(gBattlerAttacker, recoil);
BattleScriptCall(BattleScript_RecoilIfMiss);
effect = TRUE;
@ -12499,7 +12512,7 @@ static void Cmd_trymemento(void)
{
CMD_ARGS(const u8 *failInstr);
if (B_MEMENTO_FAIL >= GEN_4
if (B_MEMENTO_FAIL >= GEN_5
&& (gBattleCommunication[MISS_TYPE] == B_MSG_PROTECTED
|| IsSemiInvulnerable(gBattlerTarget, CHECK_ALL)
|| IsBattlerProtected(gBattlerAttacker, gBattlerTarget, gCurrentMove)

View File

@ -442,7 +442,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
#if B_UPDATED_MOVE_DATA == GEN_3
.description = COMPOUND_STRING(
"A 2-turn move that strikes\n"
"the foe on the 2nd turn.");
"the foe on the 2nd turn."),
#else
.description = COMPOUND_STRING(
"A 2-turn move with a high\n"
@ -4367,7 +4367,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
#else
.description = COMPOUND_STRING(
"A triangular field of energy\n"
"is created and launched.");
"is created and launched."),
#endif
.effect = EFFECT_HIT,
.power = 80,