add MovesWithPP macro to allow for setting pps in tests

This commit is contained in:
CallmeEchoo 2023-04-25 19:45:35 +02:00
parent 60e048b83e
commit 7fad0a2dbc
2 changed files with 20 additions and 0 deletions

View File

@ -713,6 +713,9 @@ void Randomly(u32 sourceLine, u32 passes, u32 trials, struct RandomlyContext);
/* Given */
#define MOVE_ARGS(...) {__VA_ARGS__}
#define PP_ARGS(...) {__VA_ARGS__}
#define GIVEN for (; gBattleTestRunnerState->runGiven; gBattleTestRunnerState->runGiven = FALSE)
#define RNGSeed(seed) RNGSeed_(__LINE__, seed)
@ -733,6 +736,7 @@ void Randomly(u32 sourceLine, u32 passes, u32 trials, struct RandomlyContext);
#define Speed(speed) Speed_(__LINE__, speed)
#define Item(item) Item_(__LINE__, item)
#define Moves(move1, ...) Moves_(__LINE__, (const u16 [MAX_MON_MOVES]) { move1, __VA_ARGS__ })
#define MovesWithPP(moves, pp) MovesWithPP_(__LINE__, (const u16 [MAX_MON_MOVES]) MOVE_ARGS moves, (const u8 [MAX_MON_MOVES]) PP_ARGS pp)
#define Friendship(friendship) Friendship_(__LINE__, friendship)
#define Status1(status1) Status1_(__LINE__, status1)
@ -753,6 +757,7 @@ void SpDefense_(u32 sourceLine, u32 spDefense);
void Speed_(u32 sourceLine, u32 speed);
void Item_(u32 sourceLine, u32 item);
void Moves_(u32 sourceLine, const u16 moves[MAX_MON_MOVES]);
void MovesWithPP_(u32 sourceLine, const u16 moves[MAX_MON_MOVES], const u8 pp[MAX_MON_MOVES]);
void Friendship_(u32 sourceLine, u32 friendship);
void Status1_(u32 sourceLine, u32 status1);

View File

@ -1161,6 +1161,21 @@ void Moves_(u32 sourceLine, const u16 moves[MAX_MON_MOVES])
DATA.explicitMoves[DATA.currentSide] |= 1 << DATA.currentPartyIndex;
}
void MovesWithPP_(u32 sourceLine, const u16 moves[MAX_MON_MOVES], const u8 pp[MAX_MON_MOVES])
{
s32 i;
INVALID_IF(!DATA.currentMon, "Moves outside of PLAYER/OPPONENT");
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (moves[i] == MOVE_NONE)
break;
INVALID_IF(moves[i] >= MOVES_COUNT, "Illegal move: %d", moves[i]);
SetMonData(DATA.currentMon, MON_DATA_MOVE1 + i, &moves[i]);
SetMonData(DATA.currentMon, MON_DATA_PP1 + i, &pp[i]);
}
DATA.explicitMoves[DATA.currentSide] |= 1 << DATA.currentPartyIndex;
}
void Friendship_(u32 sourceLine, u32 friendship)
{
INVALID_IF(!DATA.currentMon, "Friendship outside of PLAYER/OPPONENT");