Fixes draining moves recovering 1 HP when dealing 0 damage (#7523)

Co-authored-by: root <root@DESKTOP-RVGNQ5E.localdomain>
Co-authored-by: LinathanZel <LinathanZel@github.com>
This commit is contained in:
Linathan 2025-08-09 18:27:47 -04:00 committed by GitHub
parent fda783b394
commit 89b179e4c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

5
src/battle_script_commands.c Normal file → Executable file
View File

@ -6061,10 +6061,13 @@ static void Cmd_moveend(void)
switch (moveEffect)
{
case EFFECT_ABSORB:
if (!(gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK) && IsBattlerAlive(gBattlerAttacker))
if (!(gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK)
&& gBattleStruct->moveDamage[gBattlerTarget] > 0
&& IsBattlerAlive(gBattlerAttacker))
{
gBattleStruct->moveDamage[gBattlerAttacker] = max(1, (gBattleStruct->moveDamage[gBattlerTarget] * GetMoveAbsorbPercentage(gCurrentMove) / 100));
gBattleStruct->moveDamage[gBattlerAttacker] = GetDrainedBigRootHp(gBattlerAttacker, gBattleStruct->moveDamage[gBattlerAttacker]);
gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE;
effect = TRUE;
if (GetBattlerAbility(gBattlerTarget) == ABILITY_LIQUID_OOZE)

View File

@ -104,3 +104,17 @@ SINGLE_BATTLE_TEST("Absorb does not drain any HP if user flinched")
}
TO_DO_BATTLE_TEST("Absorb recovers 50% of the damage dealt to a Substitute");
SINGLE_BATTLE_TEST("Absorb does not drain any HP if user does 0 damage")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
} WHEN {
TURN { MOVE(opponent, MOVE_ENDURE); MOVE(player, MOVE_ABSORB); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_ENDURE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_ABSORB, player);
NOT MESSAGE("The opposing Wobbuffet had its energy drained!");
}
}