Skip to content

Commit

Permalink
fix absorbign abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine committed Mar 1, 2025
1 parent ea965fb commit 86e3de3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ struct BattleStruct
u8 printedStrongWindsWeakenedAttack:1;
u8 numSpreadTargets:2;
u8 bypassMoldBreakerChecks:1; // for ABILITYEFFECT_IMMUNITY
u8 padding3:1;
u8 noTargetPresent:1;
u8 usedEjectItem;
u8 usedMicleBerry;
struct MessageStatus slideMessageStatus;
Expand Down Expand Up @@ -933,7 +933,6 @@ static inline bool32 IsBattleMoveRecoil(u32 move)
// in include/constants/battle_script_commands.h
struct BattleScripting
{
s32 painSplitHp;
s32 bideDmg;
u8 multihitString[6];
bool8 expOnCatch;
Expand Down
1 change: 0 additions & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ enum TypeSideHazard
#define MOVE_RESULT_FOE_HUNG_ON (1 << 7)
#define MOVE_RESULT_STURDIED (1 << 8)
#define MOVE_RESULT_FOE_ENDURED_AFFECTION (1 << 9)
#define MOVE_RESULT_ABSORBED (1 << 10)
#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)

enum BattleWeather
Expand Down
7 changes: 5 additions & 2 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,8 @@ static void Cmd_attackcanceler(void)
&& (!gBattleMoveEffects[effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)))
|| (IsMoveNotAllowedInSkyBattles(gCurrentMove)))
{
gBattleStruct->noTargetPresent = TRUE;

if (effect == EFFECT_FLING) // Edge case for removing a mon's item when there is no target available after using Fling.
gBattlescriptCurrInstr = BattleScript_FlingFailConsumeItem;
else
Expand Down Expand Up @@ -6363,8 +6365,8 @@ static void Cmd_moveend(void)
break;
}
else if (gMovesInfo[gCurrentMove].effect == EFFECT_RECOIL_IF_MISS
&& gBattleStruct->moveResultFlags[gBattlerTarget] & (MOVE_RESULT_NO_EFFECT | MOVE_RESULT_ABSORBED)
&& !(gAbsentBattlerFlags & (1u << gBattlerTarget))
&& !IsBattlerTurnDamaged(gBattlerTarget)
&& !gBattleStruct->noTargetPresent
&& IsBattlerAlive(gBattlerAttacker))
{
if (B_RECOIL_IF_MISS_DMG >= GEN_5 || (B_CRASH_IF_TARGET_IMMUNE == GEN_4 && gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_DOESNT_AFFECT_FOE))
Expand Down Expand Up @@ -7317,6 +7319,7 @@ static void Cmd_moveend(void)
gBattleStruct->fickleBeamBoosted = FALSE;
gBattleStruct->redCardActivates = FALSE;
gBattleStruct->battlerState[gBattlerAttacker].usedMicleBerry = FALSE;
gBattleStruct->noTargetPresent = FALSE;
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
gBattleStruct->pledgeMove = FALSE;
if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE)
Expand Down
4 changes: 2 additions & 2 deletions test/battle/move_effect/recoil_if_miss.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ SINGLE_BATTLE_TEST("Recoil if miss: Jump Kick's recoil happens after Spiky Shiel
}
}

SINGLE_BATTLE_TEST("Recoil If Miss: Jump Kick recoil happens after Spiky Shield damage")
SINGLE_BATTLE_TEST("Recoil if miss: Jump Kick recoil happens after Spiky Shield damage")
{
GIVEN {
ASSUME(!gMovesInfo[MOVE_JUMP_KICK].ignoresProtect);
Expand All @@ -117,7 +117,7 @@ SINGLE_BATTLE_TEST("Recoil If Miss: Jump Kick recoil happens after Spiky Shield
}
}

SINGLE_BATTLE_TEST("Recoil If Miss: Supercell Slam causes recoil if it is absorbed")
SINGLE_BATTLE_TEST("Recoil if miss: Supercell Slam causes recoil if it is absorbed")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
Expand Down

0 comments on commit 86e3de3

Please sign in to comment.