From 12f199c641996798c852492230fc1b8c59df5bd3 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:54:50 +0100 Subject: [PATCH] Fixes absorb still draining HP when flinched (#5814) --- src/battle_script_commands.c | 4 +++- test/battle/move_effect/absorb.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 12a2e215bffc..f37a18b2edc2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -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) { diff --git a/test/battle/move_effect/absorb.c b/test/battle/move_effect/absorb.c index d046876b1b25..f06c970585c6 100644 --- a/test/battle/move_effect/absorb.c +++ b/test/battle/move_effect/absorb.c @@ -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");