From 8d81f603134a5030f47cd28633f5737e76112bf0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 25 Jun 2025 08:01:31 -0400 Subject: [PATCH] Fix tests failing with `B_FRIENDSHIP_BOOST` being `TRUE` (#7194) Co-authored-by: hedara90 <90hedara@gmail.com> --- test/pokemon.c | 13 +++++++++++-- test/test_runner_battle.c | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/pokemon.c b/test/pokemon.c index 4e8a1da7fa..ac57314f9c 100644 --- a/test/pokemon.c +++ b/test/pokemon.c @@ -82,10 +82,14 @@ TEST("Shininess independent from PID and OTID") TEST("Hyper Training increases stats without affecting IVs") { - u32 data, hp, atk, def, speed, spatk, spdef; + u32 data, hp, atk, def, speed, spatk, spdef, friendship = 0; struct Pokemon mon; CreateMon(&mon, SPECIES_WOBBUFFET, 100, 3, TRUE, 0, OT_ID_PRESET, 0); + // Consider B_FRIENDSHIP_BOOST. + SetMonData(&mon, MON_DATA_FRIENDSHIP, &friendship); + CalculateMonStats(&mon); + hp = GetMonData(&mon, MON_DATA_HP); atk = GetMonData(&mon, MON_DATA_ATK); def = GetMonData(&mon, MON_DATA_DEF); @@ -142,8 +146,13 @@ TEST("Status1 round-trips through BoxPokemon") TEST("canhypertrain/hypertrain affect MON_DATA_HYPER_TRAINED_* and recalculate stats") { - u32 atk; + u32 atk, friendship = 0; CreateMon(&gPlayerParty[0], SPECIES_WOBBUFFET, 100, 0, FALSE, 0, OT_ID_PRESET, 0); + + // Consider B_FRIENDSHIP_BOOST. + SetMonData(&gPlayerParty[0], MON_DATA_FRIENDSHIP, &friendship); + CalculateMonStats(&gPlayerParty[0]); + atk = GetMonData(&gPlayerParty[0], MON_DATA_ATK); RUN_OVERWORLD_SCRIPT( diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 7884993a1c..20271a588d 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -1563,6 +1563,13 @@ void OpenPokemon(u32 sourceLine, u32 side, u32 species) data = MOVE_NONE; for (i = 0; i < MAX_MON_MOVES; i++) SetMonData(DATA.currentMon, MON_DATA_MOVE1 + i, &data); + data = 0; + if (B_FRIENDSHIP_BOOST) + { + // This way, we avoid the boost affecting tests unless explicitly stated. + SetMonData(DATA.currentMon, MON_DATA_FRIENDSHIP, &data); + CalculateMonStats(DATA.currentMon); + } } // (sNaturePersonalities[i] % NUM_NATURES) == i