Skip to content

Commit

Permalink
Fixes absorb still draining HP when flinched (#5814)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored Dec 16, 2024
1 parent 39bc916 commit 12f199c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -5674,7 +5674,9 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++;
break;
case MOVEEND_ABSORB:
if (gMovesInfo[gCurrentMove].effect == EFFECT_ABSORB)
if (gMovesInfo[gCurrentMove].effect == EFFECT_ABSORB
&& !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& TARGET_TURN_DAMAGED)
{
if (gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK && gMovesInfo[gCurrentMove].healingMove)
{
Expand Down
16 changes: 16 additions & 0 deletions test/battle/move_effect/absorb.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,20 @@ SINGLE_BATTLE_TEST("Draining Kiss recovers 75% of the damage dealt")
}
}

SINGLE_BATTLE_TEST("Absorb does not drain any HP if user flinched")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_FAKE_OUT); MOVE(player, MOVE_ABSORB); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FAKE_OUT, opponent);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_ABSORB, player);
MESSAGE("The opposing Wobbuffet had its energy drained!");
}
}
}

TO_DO_BATTLE_TEST("Absorb recovers 50% of the damage dealt to a Substitute");

0 comments on commit 12f199c

Please sign in to comment.