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:
parent
fda783b394
commit
89b179e4c4
5
src/battle_script_commands.c
Normal file → Executable file
5
src/battle_script_commands.c
Normal file → Executable 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)
|
||||
|
||||
@ -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!");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user