diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index c009219e26..a116dd0b52 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -444,7 +444,7 @@ u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights) if (sum == 0) Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomWeightedArray called with zero sum"); - if (gCurrentTurnActionNumber < gBattlersCount) + if (gCurrentTurnActionNumber < gBattlersCount || tag == RNG_SHELL_SIDE_ARM) { u32 battlerId = gBattlerByTurnOrder[gCurrentTurnActionNumber]; turn = &DATA.battleRecordTurns[gBattleResults.battleTurnCounter][battlerId]; @@ -2216,6 +2216,17 @@ void Move(u32 sourceLine, struct BattlePokemon *battler, struct MoveContext ctx) DATA.battleRecordTurns[DATA.turns][battlerId].secondaryEffect = 1 + ctx.secondaryEffect; if (ctx.explicitRNG) DATA.battleRecordTurns[DATA.turns][battlerId].rng = ctx.rng; + + u32 shellSideArmCount = 0; + for (u32 i = 0; i < STATE->battlersCount; i++) + { + if (DATA.battleRecordTurns[DATA.turns][i].rng.tag == RNG_SHELL_SIDE_ARM) + { + shellSideArmCount++; + if (shellSideArmCount > 1) + Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":L Tried to use fixed RNG for multiple Shell Side Arm moves in the same turn"); + } + } if (!(DATA.actionBattlers & (1 << battlerId))) {