Fix Life Orb inflicting self damage when using status moves (#6767) (#6773)

This commit is contained in:
spindrift64 2025-05-04 22:26:12 +02:00 committed by GitHub
parent 904b399a81
commit 0742741dd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

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

View File

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