Fixes absorb still draining HP when flinched (#5814)

This commit is contained in:
Alex 2024-12-16 10:54:50 +01:00 committed by GitHub
parent 39bc916ca8
commit 12f199c641
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -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)
{

View file

@ -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");