fix ITEM_NONE being considered a form change item by DoesSpeciesUseHoldItemToChangeForm (#8915)

This commit is contained in:
Phexi 2026-01-14 18:41:00 +01:00 committed by GitHub
parent 1e19c5921a
commit 955617381f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -9027,6 +9027,9 @@ bool32 DoesSpeciesUseHoldItemToChangeForm(u16 species, u16 heldItemId)
u32 i;
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
if (heldItemId == ITEM_NONE)
return FALSE;
for (i = 0; formChanges != NULL && formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
{
enum FormChanges method = formChanges[i].method;

View File

@ -183,3 +183,15 @@ SINGLE_BATTLE_TEST("Trick fails if the target is behind a Substitute")
EXPECT(opponent->item == ITEM_LUM_BERRY);
}
}
SINGLE_BATTLE_TEST("Trick can be used against targets with an active form change that doesn't require items")
{
GIVEN {
PLAYER(SPECIES_XERNEAS);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ORAN_BERRY); }
} WHEN {
TURN { MOVE(opponent, MOVE_TRICK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK, opponent);
}
}