From 0742741dd3668dd2e38d8bb445b4f1cf23d75f81 Mon Sep 17 00:00:00 2001 From: spindrift64 <102487911+spindrift64@users.noreply.github.com> Date: Sun, 4 May 2025 22:26:12 +0200 Subject: [PATCH] Fix Life Orb inflicting self damage when using status moves (#6767) (#6773) --- src/battle_util.c | 1 + test/battle/hold_effect/life_orb.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index a9a976fb42..9bf82b0670 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8202,6 +8202,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn) break; case HOLD_EFFECT_LIFE_ORB: if (IsBattlerAlive(gBattlerAttacker) + && !IsBattleMoveStatus(gCurrentMove) && (IsBattlerTurnDamaged(gBattlerTarget) || !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)) // Needs the second check in case of Substitute && !(TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove)) && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD diff --git a/test/battle/hold_effect/life_orb.c b/test/battle/hold_effect/life_orb.c index 61acd60660..f27ce29d03 100644 --- a/test/battle/hold_effect/life_orb.c +++ b/test/battle/hold_effect/life_orb.c @@ -15,3 +15,19 @@ SINGLE_BATTLE_TEST("Life Orb activates if it hits a Substitute") MESSAGE("Wobbuffet was hurt by the Life Orb!"); } } + +SINGLE_BATTLE_TEST("Life Orb does not activate if using a status move") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIFE_ORB); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_GROWL); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_GROWL, player); + NONE_OF { + HP_BAR(player); + MESSAGE("Wobbuffet was hurt by the Life Orb!"); + } + } +}