diff --git a/include/test/battle.h b/include/test/battle.h index 819d05cbff..d1861e0c7f 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -682,6 +682,7 @@ struct BattleTestData struct RecordedBattleSave recordedBattle; u8 battleRecordTypes[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE]; + u8 battleRecordTurnNumbers[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE]; u8 battleRecordSourceLineOffsets[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE]; u16 recordIndexes[MAX_BATTLERS_COUNT]; struct BattlerTurn battleRecordTurns[MAX_TURNS][MAX_BATTLERS_COUNT]; diff --git a/test/battle/ability/sap_sipper.c b/test/battle/ability/sap_sipper.c index b253bfaa84..9d0ee7eaca 100644 --- a/test/battle/ability/sap_sipper.c +++ b/test/battle/ability/sap_sipper.c @@ -46,7 +46,7 @@ SINGLE_BATTLE_TEST("Sap Sipper does not increase Attack if already maxed") { GIVEN { PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); } - OPPONENT(SPECIES_WOBBUFFET) { Speed(1); } + OPPONENT(SPECIES_WOBBUFFET); } WHEN { TURN { MOVE(player, MOVE_BELLY_DRUM); MOVE(opponent, MOVE_VINE_WHIP); } } SCENE { diff --git a/test/battle/weather/hail.c b/test/battle/weather/hail.c index 4210a22d9e..f5ccf3cc99 100644 --- a/test/battle/weather/hail.c +++ b/test/battle/weather/hail.c @@ -57,7 +57,7 @@ SINGLE_BATTLE_TEST("Hail fails if Desolate Land or Primordial Sea are active") DOUBLE_BATTLE_TEST("Hail deals damage based on turn order") { GIVEN { - PLAYER(SPECIES_GLALIE); + PLAYER(SPECIES_GLALIE) { Speed(4); } PLAYER(SPECIES_WYNAUT) { Speed(1); } OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } OPPONENT(SPECIES_WYNAUT) { Speed(3); } diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c index 1673c26f99..6059d2c224 100644 --- a/test/battle/weather/sandstorm.c +++ b/test/battle/weather/sandstorm.c @@ -69,7 +69,7 @@ SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Ground, Rock, and Steel-type DOUBLE_BATTLE_TEST("Sandstorm deals damage based on turn order") { GIVEN { - PLAYER(SPECIES_PHANPY); + PLAYER(SPECIES_PHANPY) { Speed(4); } PLAYER(SPECIES_WYNAUT) { Speed(1); } OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } OPPONENT(SPECIES_WYNAUT) { Speed(3); } diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index ae86f87ab4..b74e8e6d2e 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -330,8 +330,10 @@ static void BattleTest_Run(void *data) if (DATA.hasExplicitSpeeds) { + // TODO: If a battler is taking the default action maybe it + // should not require an explicit speed? if (DATA.explicitSpeeds[B_SIDE_PLAYER] != (1 << DATA.playerPartySize) - 1 - && DATA.explicitSpeeds[B_SIDE_OPPONENT] != (1 << DATA.opponentPartySize) - 1) + || DATA.explicitSpeeds[B_SIDE_OPPONENT] != (1 << DATA.opponentPartySize) - 1) { Test_ExitWithResult(TEST_RESULT_INVALID, SourceLine(0), ":LSpeed required for all PLAYERs and OPPONENTs"); } @@ -1863,6 +1865,7 @@ static void PushBattlerAction(u32 sourceLine, s32 battlerId, u32 actionType, u32 if (recordIndex >= BATTLER_RECORD_SIZE) Test_ExitWithResult(TEST_RESULT_INVALID, SourceLine(0), ":LToo many actions"); DATA.battleRecordTypes[battlerId][recordIndex] = actionType; + DATA.battleRecordTurnNumbers[battlerId][recordIndex] = DATA.turns; DATA.battleRecordSourceLineOffsets[battlerId][recordIndex] = SourceLineOffset(sourceLine); DATA.recordedBattle.battleRecord[battlerId][recordIndex] = byte; } @@ -1911,6 +1914,17 @@ void TestRunner_Battle_CheckBattleRecordActionType(u32 battlerId, u32 recordInde if (actualMacro) { + if (gBattleResults.battleTurnCounter != DATA.battleRecordTurnNumbers[battlerId][recordIndex]) + { + switch (DATA.battleRecordTypes[battlerId][recordIndex]) + { + case RECORDED_PARTY_INDEX: + Test_ExitWithResult(TEST_RESULT_INVALID, line, ":L%s:%d: %s not required (is the send out random?)", filename, line, actualMacro); + default: + Test_ExitWithResult(TEST_RESULT_INVALID, line, ":L%s:%d: %s not required", filename, line, actualMacro); + } + } + switch (actionType) { case RECORDED_ACTION_TYPE: @@ -2423,7 +2437,7 @@ void SendOut(u32 sourceLine, struct BattlePokemon *battler, u32 partyIndex) s32 i; s32 battlerId = battler - gBattleMons; INVALID_IF(DATA.turnState == TURN_CLOSED, "SEND_OUT outside TURN"); - INVALID_IF(partyIndex >= ((battlerId & BIT_SIDE) == B_SIDE_PLAYER ? DATA.playerPartySize : DATA.opponentPartySize), "SWITCH to invalid party index"); + INVALID_IF(partyIndex >= ((battlerId & BIT_SIDE) == B_SIDE_PLAYER ? DATA.playerPartySize : DATA.opponentPartySize), "SEND_OUT of invalid party index"); INVALID_IF(IsAITest() && (battlerId & BIT_SIDE) == B_SIDE_OPPONENT, "SEND_OUT is not allowed for opponent in AI tests. Use EXPECT_SEND_OUT instead"); for (i = 0; i < STATE->battlersCount; i++) {