Fixed Elixirs not being able to be used unless the first move was missing PP

This commit is contained in:
Hedara 2024-05-18 15:44:55 +02:00
parent 982934c4aa
commit 313f2e5526
2 changed files with 27 additions and 2 deletions

View file

@ -1254,11 +1254,11 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon)
cannotUse = TRUE;
break;
case EFFECT_ITEM_RESTORE_PP:
if (ItemId_GetEffect(itemId)[6] == ITEM4_HEAL_PP)
if (ItemId_GetEffect(itemId)[4] == ITEM4_HEAL_PP)
{
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (GetMonData(mon, MON_DATA_PP1 + i) < CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + i), GetMonData(mon, MON_DATA_PP_BONUSES), i));
if (GetMonData(mon, MON_DATA_PP1 + i) < CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + i), GetMonData(mon, MON_DATA_PP_BONUSES), i))
break;
}
if (i == MAX_MON_MOVES)

View file

@ -66,3 +66,28 @@ SINGLE_BATTLE_TEST("Max Elixir restores the PP of all of a battler's moves fully
}
TO_DO_BATTLE_TEST("Ether won't work if the selected move has all its PP")
SINGLE_BATTLE_TEST("Elixir can be used if at least one move is missing PP in any slot") // As it works right now, this test can't test what it's suppossed to, since the relevant check doesn't run in the testing system.
{
u8 move1PP;
u8 move2PP;
u8 move3PP;
u8 move4PP;
PARAMETRIZE { move1PP = 30; move2PP = 30; move3PP = 20; move4PP = 10; }
PARAMETRIZE { move1PP = 40; move2PP = 20; move3PP = 20; move4PP = 10; }
PARAMETRIZE { move1PP = 40; move2PP = 30; move3PP = 10; move4PP = 10; }
PARAMETRIZE { move1PP = 40; move2PP = 30; move3PP = 20; move4PP = 0; }
GIVEN {
ASSUME(gItemsInfo[ITEM_ELIXIR].battleUsage == EFFECT_ITEM_RESTORE_PP);
ASSUME(gItemsInfo[ITEM_ELIXIR].type == ITEM_USE_PARTY_MENU);
PLAYER(SPECIES_WOBBUFFET) { MovesWithPP({MOVE_MEDITATE, move1PP}, {MOVE_AGILITY, move2PP}, {MOVE_PSYBEAM, move3PP}, {MOVE_TRICK, move4PP}); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_ELIXIR, partyIndex: 0); }
} THEN {
EXPECT_EQ(player->pp[0], 40);
EXPECT_EQ(player->pp[1], 30);
EXPECT_EQ(player->pp[2], 20);
EXPECT_EQ(player->pp[3], 10);
}
}