From 54e388a3752e81d6c8137f740097dc68540f5fad Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 22 Feb 2023 00:30:12 -0300 Subject: [PATCH 01/18] More detailed hydra test results --- test/test_runner.c | 4 +++- tools/mgba-rom-test-hydra/main.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/test/test_runner.c b/test/test_runner.c index 0be1634317..c2d3f66d25 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -194,8 +194,10 @@ void CB2_TestRunner(void) default: result = "UNKNOWN"; break; } - if (gTestRunnerState.expectedResult == gTestRunnerState.result) + if (gTestRunnerState.result == TEST_RESULT_PASS) MgbaPrintf_(":P%s%s\e[0m", color, result); + else if (gTestRunnerState.expectedResult == gTestRunnerState.result) + MgbaPrintf_(":K%s%s\e[0m", color, result); else MgbaPrintf_(":F%s%s\e[0m", color, result); } diff --git a/tools/mgba-rom-test-hydra/main.c b/tools/mgba-rom-test-hydra/main.c index 4ce9b09bd0..107ca339be 100644 --- a/tools/mgba-rom-test-hydra/main.c +++ b/tools/mgba-rom-test-hydra/main.c @@ -9,7 +9,11 @@ * COMMANDS * N: Sets the test name to the remainder of the line. * R: Sets the result to the remainder of the line, and flushes any - * output buffered since the previous R. */ + * output buffered since the previous R. + * + * //Missing P, F and K documentation, please tell me what to put here lol + * + */ #include #include #include @@ -39,6 +43,7 @@ struct Runner size_t output_buffer_capacity; char *output_buffer; int passes; + int knownFails; int results; }; @@ -76,8 +81,11 @@ static void handle_read(struct Runner *runner) case 'P': case 'F': + case 'K': if (soc[1] == 'P') runner->passes++; + else if (soc[1] == 'K') + runner->knownFails++; runner->results++; soc += 2; fprintf(stdout, "%s: ", runner->test_name); @@ -411,6 +419,7 @@ int main(int argc, char *argv[]) // Reap test runners and collate exit codes. int exit_code = 0; int passes = 0; + int knownFails = 0; int results = 0; for (int i = 0; i < nrunners; i++) { @@ -425,9 +434,25 @@ int main(int argc, char *argv[]) if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) > exit_code) exit_code = WEXITSTATUS(wstatus); passes += runners[i].passes; + knownFails += runners[i].knownFails; results += runners[i].results; } - fprintf(stdout, "%d/%d \e[32mPASS\e[0med\n", passes, results); + + if (results == 0) + { + fprintf(stdout, "\nNo tests found.\n"); + } + else + { + fprintf(stdout, "\n- Tests TOTAL: %d\n", results); + fprintf(stdout, "- Tests \e[32mPASSED: \e[0m %d\n", passes); + if (knownFails > 0) + fprintf(stdout, "- Tests \e[33mKNOWN_FAILING:\e[0m %d\n", knownFails); + if (passes + knownFails < results) + fprintf(stdout, "- Tests \e[31mFAILED: \e[0m %d\n", results - passes - knownFails); + } + fprintf(stdout, "\n"); + fflush(stdout); return exit_code; } From 5808e82434ab03d10396485028398f618858eac6 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 22 Feb 2023 15:05:39 -0300 Subject: [PATCH 02/18] Added assumption fail total, made fails into their own counter and changed "SKIP" to "ASSUMPTION_FAIIL" in log --- test/test_runner.c | 7 ++++++- tools/mgba-rom-test-hydra/main.c | 31 ++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/test/test_runner.c b/test/test_runner.c index c2d3f66d25..eb5d12c778 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -187,7 +187,10 @@ void CB2_TestRunner(void) } break; case TEST_RESULT_PASS: result = "PASS"; break; - case TEST_RESULT_SKIP: result = "SKIP"; break; + case TEST_RESULT_SKIP: + result = "ASSUMPTION_FAIL"; + color = "\e[33m"; + break; case TEST_RESULT_INVALID: result = "INVALID"; break; case TEST_RESULT_ERROR: result = "ERROR"; break; case TEST_RESULT_TIMEOUT: result = "TIMEOUT"; break; @@ -196,6 +199,8 @@ void CB2_TestRunner(void) if (gTestRunnerState.result == TEST_RESULT_PASS) MgbaPrintf_(":P%s%s\e[0m", color, result); + else if (gTestRunnerState.result == TEST_RESULT_SKIP) + MgbaPrintf_(":A%s%s\e[0m", color, result); else if (gTestRunnerState.expectedResult == gTestRunnerState.result) MgbaPrintf_(":K%s%s\e[0m", color, result); else diff --git a/tools/mgba-rom-test-hydra/main.c b/tools/mgba-rom-test-hydra/main.c index 107ca339be..75c705f177 100644 --- a/tools/mgba-rom-test-hydra/main.c +++ b/tools/mgba-rom-test-hydra/main.c @@ -44,6 +44,8 @@ struct Runner char *output_buffer; int passes; int knownFails; + int assumptionFails; + int fails; int results; }; @@ -80,12 +82,17 @@ static void handle_read(struct Runner *runner) break; case 'P': - case 'F': + runner->passes++; + goto add_to_results; case 'K': - if (soc[1] == 'P') - runner->passes++; - else if (soc[1] == 'K') - runner->knownFails++; + runner->knownFails++; + goto add_to_results; + case 'A': + runner->assumptionFails++; + goto add_to_results; + case 'F': + runner->fails++; +add_to_results: runner->results++; soc += 2; fprintf(stdout, "%s: ", runner->test_name); @@ -420,6 +427,8 @@ int main(int argc, char *argv[]) int exit_code = 0; int passes = 0; int knownFails = 0; + int assumptionFails = 0; + int fails = 0; int results = 0; for (int i = 0; i < nrunners; i++) { @@ -435,6 +444,8 @@ int main(int argc, char *argv[]) exit_code = WEXITSTATUS(wstatus); passes += runners[i].passes; knownFails += runners[i].knownFails; + assumptionFails += runners[i].assumptionFails; + fails += runners[i].fails; results += runners[i].results; } @@ -445,11 +456,13 @@ int main(int argc, char *argv[]) else { fprintf(stdout, "\n- Tests TOTAL: %d\n", results); - fprintf(stdout, "- Tests \e[32mPASSED: \e[0m %d\n", passes); + fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes); if (knownFails > 0) - fprintf(stdout, "- Tests \e[33mKNOWN_FAILING:\e[0m %d\n", knownFails); - if (passes + knownFails < results) - fprintf(stdout, "- Tests \e[31mFAILED: \e[0m %d\n", results - passes - knownFails); + fprintf(stdout, "- Tests \e[33mKNOWN_FAILING\e[0m: %d\n", knownFails); + if (fails > 0) + fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails); + if (assumptionFails > 0) + fprintf(stdout, "- \e[33mASSUMPTIONS_FAILED\e[0m: %d\n", assumptionFails); } fprintf(stdout, "\n"); From e3ed11475457999e828349eb499b3fa0ae25405a Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 22 Feb 2023 15:09:47 -0300 Subject: [PATCH 03/18] Updated commands comment --- tools/mgba-rom-test-hydra/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/mgba-rom-test-hydra/main.c b/tools/mgba-rom-test-hydra/main.c index 75c705f177..f506d0428d 100644 --- a/tools/mgba-rom-test-hydra/main.c +++ b/tools/mgba-rom-test-hydra/main.c @@ -10,9 +10,9 @@ * N: Sets the test name to the remainder of the line. * R: Sets the result to the remainder of the line, and flushes any * output buffered since the previous R. - * - * //Missing P, F and K documentation, please tell me what to put here lol - * + * P/K/F/A: Sets the result to the remaining of the line, flushes any + * output since the previous P/K/F/A and increment the number of + * passes/known fails/assumption fails/fails. */ #include #include From 3ff8c95c4eac9c1cb92569e29a0109f4fe07bc43 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 23 Feb 2023 10:53:55 +0100 Subject: [PATCH 04/18] add meltan melmetal teachable moves --- src/data/pokemon/teachable_learnsets.h | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/data/pokemon/teachable_learnsets.h b/src/data/pokemon/teachable_learnsets.h index 19b22d9b3d..746aeb9b4c 100644 --- a/src/data/pokemon/teachable_learnsets.h +++ b/src/data/pokemon/teachable_learnsets.h @@ -30118,11 +30118,67 @@ static const u16 sZeraoraTeachableLearnset[] = { }; static const u16 sMeltanTeachableLearnset[] = { + MOVE_HEADBUTT, + MOVE_REST, + MOVE_PROTECT, + MOVE_SUBSTITUTE, + MOVE_THUNDER_WAVE, + MOVE_TOXIC, + MOVE_THUNDERBOLT, + MOVE_FLASH_CANNON, + MOVE_SNORE, + MOVE_FACADE, + MOVE_ROUND, + MOVE_ENDURE, + MOVE_SLEEP_TALK, + MOVE_IRON_DEFENSE, + MOVE_GYRO_BALL, + MOVE_STEEL_BEAM, MOVE_HIDDEN_POWER, MOVE_UNAVAILABLE, }; static const u16 sMelmetalTeachableLearnset[] = { + MOVE_HEADBUTT, + MOVE_REST, + MOVE_PROTECT, + MOVE_SUBSTITUTE, + MOVE_FACADE, + MOVE_BRICK_BREAK, + MOVE_THUNDER_WAVE, + MOVE_ROCK_SLIDE, + MOVE_THUNDER_PUNCH, + MOVE_TOXIC, + MOVE_ICE_PUNCH, + MOVE_THUNDERBOLT, + MOVE_THUNDER, + MOVE_EARTHQUAKE, + MOVE_SELF_DESTRUCT, + MOVE_SOLAR_BEAM, + MOVE_HYPER_BEAM, + MOVE_SUPERPOWER, + MOVE_FLASH_CANNON, + MOVE_ICE_BEAM, + MOVE_MEGA_PUNCH, + MOVE_MEGA_KICK, + MOVE_GIGA_IMPACT, + MOVE_SNORE, + MOVE_ROCK_TOMB, + MOVE_ROUND, + MOVE_ELECTRIC_TERRAIN, + MOVE_BRUTAL_SWING, + MOVE_BODY_SLAM, + MOVE_ENDURE, + MOVE_SLEEP_TALK, + MOVE_IRON_DEFENSE, + MOVE_GYRO_BALL, + MOVE_IRON_HEAD, + MOVE_HEAVY_SLAM, + MOVE_DARKEST_LARIAT, + MOVE_HIGH_HORSEPOWER, + MOVE_BODY_PRESS, + MOVE_STEEL_BEAM, + MOVE_STEEL_ROLLER, MOVE_HIDDEN_POWER, MOVE_UNAVAILABLE, }; From 318666e21d84bce7badcb107fe2cb76c91aaec71 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 7 Mar 2023 12:20:36 +0100 Subject: [PATCH 05/18] debug minor touches to give item max quantity and map number display --- src/debug.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/debug.c b/src/debug.c index 5c14dbfb0f..1701050420 100644 --- a/src/debug.c +++ b/src/debug.c @@ -147,7 +147,7 @@ enum { //Sound #define DEBUG_NUMBER_DIGITS_VARIABLES 5 #define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5 #define DEBUG_NUMBER_DIGITS_ITEMS 4 -#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2 +#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 3 #define DEBUG_NUMBER_ICON_X 210 #define DEBUG_NUMBER_ICON_Y 50 @@ -1015,8 +1015,8 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); @@ -1061,8 +1061,8 @@ static void DebugAction_Util_Warp_SelectMap(u8 taskId) gTasks[taskId].data[4] += 1; } - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); @@ -1905,15 +1905,18 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) } static void DebugAction_Give_Item_SelectQuantity(u8 taskId) { + u32 itemId = gTasks[taskId].data[5]; + if (JOY_NEW(DPAD_ANY)) { PlaySE(SE_SELECT); if (JOY_NEW(DPAD_UP)) { + u32 maxCapacity = (ItemId_GetPocket(itemId) - 1 == BERRIES_POCKET) ? MAX_BERRY_CAPACITY : MAX_BAG_ITEM_CAPACITY; gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= 100) - gTasks[taskId].data[3] = 99; + if (gTasks[taskId].data[3] > maxCapacity) + gTasks[taskId].data[3] = maxCapacity; } if (JOY_NEW(DPAD_DOWN)) { @@ -1947,7 +1950,7 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon PlaySE(MUS_OBTAIN_ITEM); - AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]); + AddBagItem(itemId, gTasks[taskId].data[3]); DebugAction_DestroyExtraWindow(taskId); } else if (JOY_NEW(B_BUTTON)) From fdebc994d23be0dedfa64f54fe2bf01c46e0acbe Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 7 Mar 2023 19:14:38 -0300 Subject: [PATCH 06/18] Updated Supreme Overlord's effect's code --- include/battle.h | 1 + src/battle_util.c | 48 ++++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/include/battle.h b/include/battle.h index 83b552e7e1..a43fc65cdf 100644 --- a/include/battle.h +++ b/include/battle.h @@ -662,6 +662,7 @@ struct BattleStruct u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party. u8 storedHealingWish:4; // Each battler as a bit. u8 storedLunarDance:4; // Each battler as a bit. + u16 supremeOverlordModifier[MAX_BATTLERS_COUNT]; }; #define F_DYNAMIC_TYPE_1 (1 << 6) diff --git a/src/battle_util.c b/src/battle_util.c index 9520e761f7..4b50bc7045 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -62,6 +62,7 @@ static u8 GetFlingPowerFromItemId(u16 itemId); static void SetRandomMultiHitCounter(); static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item); static u16 GetInverseTypeMultiplier(u16 multiplier); +static u16 GetSupremeOverlordModifier(u8 battlerId); extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattlescriptsForRunningByItem[]; @@ -4319,6 +4320,28 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId) return TRUE; } +// Supreme Overlord adds a damage boost for each fainted ally. +// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each. +static u16 GetSupremeOverlordModifier(u8 battlerId) +{ + u32 i; + u8 side = GetBattlerSide(battlerId); + struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; + u16 modifier = UQ_4_12(1.0); + bool8 appliedFirstBoost = FALSE; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE + && !GetMonData(&party[i], MON_DATA_IS_EGG) + && GetMonData(&party[i], MON_DATA_HP) == 0) + modifier += (!appliedFirstBoost) ? UQ_4_12(0.2) : UQ_4_12(0.1); + appliedFirstBoost = TRUE; + } + + return modifier; +} + u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg) { u8 effect = 0; @@ -4867,6 +4890,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone && CountUsablePartyMons(battler) < PARTY_SIZE) { gSpecialStatuses[battler].switchInAbilityDone = TRUE; + gBattleStruct->supremeOverlordModifier[battler] = GetSupremeOverlordModifier(battler); BattleScriptPushCursorAndCallback(BattleScript_SupremeOverlordActivates); effect++; } @@ -8761,28 +8785,6 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) return basePower; } -// Supreme Overlord adds a damage boost for each fainted ally. -// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each. -static u16 GetSupremeOverlordModifier(u8 battlerId) -{ - u32 i; - u8 side = GetBattlerSide(battlerId); - struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; - u16 modifier = UQ_4_12(1.0); - bool8 appliedFirstBoost = FALSE; - - for (i = 0; i < PARTY_SIZE; i++) - { - if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE - && !GetMonData(&party[i], MON_DATA_IS_EGG) - && GetMonData(&party[i], MON_DATA_HP) == 0) - modifier += (!appliedFirstBoost) ? UQ_4_12(0.2) : UQ_4_12(0.1); - appliedFirstBoost = TRUE; - } - - return modifier; -} - static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 updateFlags) { u32 i; @@ -8932,7 +8934,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, UQ_4_12(1.5)); break; case ABILITY_SUPREME_OVERLORD: - MulModifier(&modifier, GetSupremeOverlordModifier(battlerAtk)); + MulModifier(&modifier, gBattleStruct->supremeOverlordModifier[battlerAtk]); break; } From eb49e28e6cb9c57d03d5a5d952735a0d4c57fe7b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 8 Mar 2023 08:26:33 -0300 Subject: [PATCH 07/18] Renamed TEST_RESULT_SKIP to TEST_RESULT_ASSUMPTION_FAIL --- test/test.h | 4 ++-- test/test_runner.c | 8 ++++---- test/test_runner_battle.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test.h b/test/test.h index c69a4fa925..27475bb48e 100644 --- a/test/test.h +++ b/test/test.h @@ -9,7 +9,7 @@ enum TestResult { TEST_RESULT_FAIL, TEST_RESULT_PASS, - TEST_RESULT_SKIP, + TEST_RESULT_ASSUMPTION_FAIL, TEST_RESULT_INVALID, TEST_RESULT_ERROR, TEST_RESULT_TIMEOUT, @@ -77,7 +77,7 @@ s32 MgbaPrintf_(const char *fmt, ...); do \ { \ if (!(c)) \ - Test_ExitWithResult(TEST_RESULT_SKIP, "%s:%d: ASSUME failed", gTestRunnerState.test->filename, __LINE__); \ + Test_ExitWithResult(TEST_RESULT_ASSUMPTION_FAIL, "%s:%d: ASSUME failed", gTestRunnerState.test->filename, __LINE__); \ } while (0) #define EXPECT(c) \ diff --git a/test/test_runner.c b/test/test_runner.c index eb5d12c778..9d33301f9d 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -121,7 +121,7 @@ void CB2_TestRunner(void) // NOTE: Assumes that the compiler interns __FILE__. if (gTestRunnerState.skipFilename == gTestRunnerState.test->filename) { - gTestRunnerState.result = TEST_RESULT_SKIP; + gTestRunnerState.result = TEST_RESULT_ASSUMPTION_FAIL; } else { @@ -157,7 +157,7 @@ void CB2_TestRunner(void) color = "\e[32m"; MgbaPrintf_(":N%s", gTestRunnerState.test->name); } - else if (gTestRunnerState.result != TEST_RESULT_SKIP || gTestRunnerSkipIsFail) + else if (gTestRunnerState.result != TEST_RESULT_ASSUMPTION_FAIL || gTestRunnerSkipIsFail) { gTestRunnerState.exitCode = 1; color = "\e[31m"; @@ -187,7 +187,7 @@ void CB2_TestRunner(void) } break; case TEST_RESULT_PASS: result = "PASS"; break; - case TEST_RESULT_SKIP: + case TEST_RESULT_ASSUMPTION_FAIL: result = "ASSUMPTION_FAIL"; color = "\e[33m"; break; @@ -199,7 +199,7 @@ void CB2_TestRunner(void) if (gTestRunnerState.result == TEST_RESULT_PASS) MgbaPrintf_(":P%s%s\e[0m", color, result); - else if (gTestRunnerState.result == TEST_RESULT_SKIP) + else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL) MgbaPrintf_(":A%s%s\e[0m", color, result); else if (gTestRunnerState.expectedResult == gTestRunnerState.result) MgbaPrintf_(":K%s%s\e[0m", color, result); diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index e40ed3e50b..ec7ba275c2 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -720,7 +720,7 @@ static void CB2_BattleTest_NextTrial(void) case TEST_RESULT_PASS: STATE->observedPasses++; break; - case TEST_RESULT_SKIP: + case TEST_RESULT_ASSUMPTION_FAIL: STATE->skippedTrials++; if (STATE->skippedTrials > STATE->trials / 4) Test_ExitWithResult(TEST_RESULT_INVALID, "25%% of the trials were SKIPed"); From 24d8d3fbee471d51d119658765fa1ccbf9a35687 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 8 Mar 2023 09:09:48 -0300 Subject: [PATCH 08/18] Updated switch format --- test/test_runner.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/test_runner.c b/test/test_runner.c index 9d33301f9d..c8bd0f3a92 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -186,15 +186,25 @@ void CB2_TestRunner(void) result = "FAIL"; } break; - case TEST_RESULT_PASS: result = "PASS"; break; + case TEST_RESULT_PASS: + result = "PASS"; + break; case TEST_RESULT_ASSUMPTION_FAIL: result = "ASSUMPTION_FAIL"; color = "\e[33m"; break; - case TEST_RESULT_INVALID: result = "INVALID"; break; - case TEST_RESULT_ERROR: result = "ERROR"; break; - case TEST_RESULT_TIMEOUT: result = "TIMEOUT"; break; - default: result = "UNKNOWN"; break; + case TEST_RESULT_INVALID: + result = "INVALID"; + break; + case TEST_RESULT_ERROR: + result = "ERROR"; + break; + case TEST_RESULT_TIMEOUT: + result = "TIMEOUT"; + break; + default: + result = "UNKNOWN"; + break; } if (gTestRunnerState.result == TEST_RESULT_PASS) From 1553be1e7d946d1ecadb6c55a7c9a54a382381f8 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Wed, 8 Mar 2023 15:46:14 +0100 Subject: [PATCH 09/18] Update overworld_config.h reference in the debug system --- data/scripts/debug.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 191fe69327..a158cc2f47 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -52,7 +52,7 @@ Debug_FlagsNotSetMessage:: Debug_FlagsNotSetMessage_Text: .string "Feature unavailable!\n" .string "Please define a usable flag in:\l" - .string "'include/constants/overworld{UNDERSCORE}config.h'!$" + .string "'include/config/overworld.h'!$" Debug_Script_1:: end From c3674d6c1725caa65f5a36343293eaae5f4f483e Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Mar 2023 17:23:44 +0100 Subject: [PATCH 10/18] Wrong score for Work Up and Growth --- src/battle_ai_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 2d4d075282..0badf92ddf 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1117,10 +1117,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_GROWTH: case EFFECT_ATTACK_SPATK_UP: // work up - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if ((!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) && !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)) + || (!HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL))) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) - score -= 8; + // else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) + // score -= 8; break; case EFFECT_ROTOTILLER: if (isDoubleBattle) From 59a0def706a260dde608f0889d20be8cfe1941d1 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Mar 2023 17:30:07 +0100 Subject: [PATCH 11/18] delete leftover --- src/battle_ai_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 0badf92ddf..e1dbd2a6f4 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1120,8 +1120,6 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if ((!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) && !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)) || (!HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL))) score -= 10; - // else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) - // score -= 8; break; case EFFECT_ROTOTILLER: if (isDoubleBattle) From 27e342d7a64797d9648accff8c588a60570b76f8 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Mar 2023 19:25:26 +0100 Subject: [PATCH 12/18] Use function HasDamagingMove to avoid looping --- src/battle_ai_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index e1dbd2a6f4..4e39f61bfe 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1118,7 +1118,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_GROWTH: case EFFECT_ATTACK_SPATK_UP: // work up if ((!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) && !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)) - || (!HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL))) + || (!HasDamagingMove(battlerAtk))) score -= 10; break; case EFFECT_ROTOTILLER: From f06c040bca900ba7dae167e5bd9bde9c2c9d9802 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 8 Mar 2023 01:51:51 -0300 Subject: [PATCH 13/18] Updated the debug menu -Updated the text string used by Debug_FlagsNotSetMessage. -Renamed Debug_FlagsNotSetMessage to Debug_FlagsNotSetOverworldConfigMessage. -Added an equivalent for the battle config file called Debug_FlagsNotSetBattleConfigMessage, -DEBUG_FLAG_NO_COLLISION -> OW_FLAG_NO_COLLISION -And moved it to include/config/overworld.h, because at the end of the day it's still an overworld flag just like the other 2 already in that file. -Corrected miswritten preproc config in DebugAction_Flags_CatchingOnOff. -Updated the comment that describes the effect of DEBUG_OVERWORLD_MENU reducing the number of characters a tiny bit and fixing a typo. --- data/scripts/debug.inc | 21 +++++++++++++++++---- include/config/debug.h | 7 +------ include/config/overworld.h | 1 + src/debug.c | 21 +++++++++++---------- src/event_object_movement.c | 4 ++-- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 191fe69327..92e9062a39 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -41,18 +41,31 @@ Debug_CheatStart:: release end -Debug_FlagsNotSetMessage:: +Debug_FlagsNotSetOverworldConfigMessage:: lockall - message Debug_FlagsNotSetMessage_Text + message Debug_FlagsNotSetOverworldConfigMessage_Text waitmessage waitbuttonpress releaseall end -Debug_FlagsNotSetMessage_Text: +Debug_FlagsNotSetOverworldConfigMessage_Text: .string "Feature unavailable!\n" .string "Please define a usable flag in:\l" - .string "'include/constants/overworld{UNDERSCORE}config.h'!$" + .string "'include/config/overworld.h'!$" + +Debug_FlagsNotSetBattleConfigMessage:: + lockall + message Debug_FlagsNotSetBattleConfigMessage_Text + waitmessage + waitbuttonpress + releaseall + end + +Debug_FlagsNotSetBattleConfigMessage_Text: + .string "Feature unavailable!\n" + .string "Please define a usable flag in:\l" + .string "'include/config/battle.h'!$" Debug_Script_1:: end diff --git a/include/config/debug.h b/include/config/debug.h index b427fcb513..43d7438018 100644 --- a/include/config/debug.h +++ b/include/config/debug.h @@ -2,16 +2,11 @@ #define GUARD_CONFIG_DEBUG_H // Overworld Debug -#define DEBUG_OVERWORLD_MENU TRUE // Enables a overworld debug menu for changing flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. +#define DEBUG_OVERWORLD_MENU TRUE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default. #define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu. #define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS. #define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). -// Debug Flags -// To use the following debug features, replace the 0s with the flag ID you're assigning it to. -// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. -#define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used. - // Battle Debug Menu #define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. diff --git a/include/config/overworld.h b/include/config/overworld.h index fb438431b3..7831858d27 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -9,5 +9,6 @@ // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. #define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled. #define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to. +#define OW_FLAG_NO_COLLISION 0 // If this flag is set, the player will be able to walk over tiles with collision. Mainly intended for debugging purposes. #endif // GUARD_CONFIG_OVERWORLD_H diff --git a/src/debug.c b/src/debug.c index 5c14dbfb0f..2bd89504fa 100644 --- a/src/debug.c +++ b/src/debug.c @@ -275,7 +275,8 @@ static void DebugAction_Sound_MUS_SelectId(u8 taskId); static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); -extern u8 Debug_FlagsNotSetMessage[]; +extern u8 Debug_FlagsNotSetOverworldConfigMessage[]; +extern u8 Debug_FlagsNotSetBattleConfigMessage[]; extern u8 Debug_Script_1[]; extern u8 Debug_Script_2[]; extern u8 Debug_Script_3[]; @@ -1556,16 +1557,16 @@ static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) } static void DebugAction_Flags_CollisionOnOff(u8 taskId) { -#if DEBUG_FLAG_NO_COLLISION == 0 +#if OW_FLAG_NO_COLLISION == 0 Debug_DestroyMenu_Full(taskId); LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetMessage); + ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); #else - if (FlagGet(DEBUG_FLAG_NO_COLLISION)) + if (FlagGet(OW_FLAG_NO_COLLISION)) PlaySE(SE_PC_OFF); else PlaySE(SE_PC_LOGIN); - FlagToggle(DEBUG_FLAG_NO_COLLISION); + FlagToggle(OW_FLAG_NO_COLLISION); #endif } static void DebugAction_Flags_EncounterOnOff(u8 taskId) @@ -1573,7 +1574,7 @@ static void DebugAction_Flags_EncounterOnOff(u8 taskId) #if OW_FLAG_NO_ENCOUNTER == 0 Debug_DestroyMenu_Full(taskId); LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetMessage); + ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); #else if (FlagGet(OW_FLAG_NO_ENCOUNTER)) PlaySE(SE_PC_OFF); @@ -1587,7 +1588,7 @@ static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) #if OW_FLAG_NO_TRAINER_SEE == 0 Debug_DestroyMenu_Full(taskId); LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetMessage); + ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); #else if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) PlaySE(SE_PC_OFF); @@ -1601,7 +1602,7 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId) #if B_FLAG_NO_BAG_USE == 0 Debug_DestroyMenu_Full(taskId); LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetMessage); + ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage); #else if (FlagGet(B_FLAG_NO_BAG_USE)) PlaySE(SE_PC_OFF); @@ -1612,10 +1613,10 @@ static void DebugAction_Flags_BagUseOnOff(u8 taskId) } static void DebugAction_Flags_CatchingOnOff(u8 taskId) { -#if B_FLAG_NO_CATCHING_USE == 0 +#if B_FLAG_NO_CATCHING == 0 Debug_DestroyMenu_Full(taskId); LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetMessage); + ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage); #else if (FlagGet(B_FLAG_NO_CATCHING)) PlaySE(SE_PC_OFF); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 9b8cc1ac35..ccb6143bc2 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4654,8 +4654,8 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if DEBUG_FLAG_NO_COLLISION != 0 - if (FlagGet(DEBUG_FLAG_NO_COLLISION)) +#if OW_FLAG_NO_COLLISION != 0 + if (FlagGet(OW_FLAG_NO_COLLISION)) return COLLISION_NONE; #endif From ff7686482f40c2bb074f40c2f847ab8b8fefea20 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 8 Mar 2023 15:56:16 -0300 Subject: [PATCH 14/18] Updated PokeStorageSys related debug functions --- src/debug.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index 2bd89504fa..3e68c09bfb 100644 --- a/src/debug.c +++ b/src/debug.c @@ -85,6 +85,7 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_TRAINER_NAME, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, DEBUG_UTIL_MENU_ITEM_TRAINER_ID, + DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES, }; enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_1, @@ -224,6 +225,7 @@ static void DebugAction_Util_WatchCredits(u8 taskId); static void DebugAction_Util_Trainer_Name(u8 taskId); static void DebugAction_Util_Trainer_Gender(u8 taskId); static void DebugAction_Util_Trainer_Id(u8 taskId); +static void DebugAction_Util_Clear_Boxes(u8 taskId); static void DebugAction_Flags_Flags(u8 taskId); static void DebugAction_Flags_FlagsSelect(u8 taskId); @@ -330,6 +332,7 @@ static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits"); static const u8 sDebugText_Util_Trainer_Name[] = _("Trainer name"); static const u8 sDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); static const u8 sDebugText_Util_Trainer_Id[] = _("New Trainer Id"); +static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Boxes"); // Flags Menu static const u8 sDebugText_Flags_Flags[] = _("Set Flag XXXX"); static const u8 sDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); @@ -451,6 +454,7 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] = [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {sDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {sDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {sDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES}, }; static const struct ListMenuItem sDebugMenu_Items_Scripts[] = { @@ -530,6 +534,7 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) = [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name, [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, }; static void (*const sDebugMenu_Actions_Scripts[])(u8) = { @@ -1316,6 +1321,12 @@ static void DebugAction_Util_Trainer_Id(u8 taskId) Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } +static void DebugAction_Util_Clear_Boxes(u8 taskId) +{ + ResetPokemonStorageSystem(); + Debug_DestroyMenu_Full(taskId); + ScriptContext_Enable(); +} // ******************************* // Actions Scripts @@ -2179,7 +2190,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) { PlaySE(MUS_LEVEL_UP); ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0); - //Set flag for user convenience + // Set flag for user convenience FlagSet(FLAG_SYS_POKEMON_GET); Free(sDebugMonData); //Frees EWRAM of MonData Struct DebugAction_DestroyExtraWindow(taskId); @@ -2735,7 +2746,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu break; } - //Set flag for user convenience + // Set flag for user convenience FlagSet(FLAG_SYS_POKEMON_GET); Free(sDebugMonData); //Frees EWRAM of MonData Struct @@ -2767,11 +2778,12 @@ static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity int boxId, boxPosition; u32 personality; struct BoxPokemon boxMon; + u16 species = SPECIES_BULBASAUR; personality = Random32(); CreateBoxMon(&boxMon, - SPECIES_DEOXYS, + species, 100, 32, personality, @@ -2786,9 +2798,16 @@ static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) { gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; + SetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SPECIES, &species); + GetSetPokedexFlag(species, FLAG_SET_SEEN); + GetSetPokedexFlag(species, FLAG_SET_CAUGHT); + species++; } } } + + // Set flag for user convenience + FlagSet(FLAG_SYS_POKEMON_GET); } static void DebugAction_Give_CHEAT(u8 taskId) From 35645fe01c507bda54d6176157ac742856424f0f Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Wed, 8 Mar 2023 23:00:25 +0100 Subject: [PATCH 15/18] electrify works on all move types (#2817) --- src/battle_ai_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 2d4d075282..b31fc9ce62 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4641,7 +4641,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; // Give target more weaknesses break; case EFFECT_ELECTRIFY: - if (predictedMove != MOVE_NONE && gBattleMoves[predictedMove].type == TYPE_NORMAL + if (predictedMove != MOVE_NONE && (AI_DATA->abilities[battlerAtk] == ABILITY_VOLT_ABSORB || AI_DATA->abilities[battlerAtk] == ABILITY_MOTOR_DRIVE || AI_DATA->abilities[battlerAtk] == ABILITY_LIGHTNING_ROD)) From eead8e8e61e53b72eb530bec8c9ec3908dcad849 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 9 Mar 2023 09:49:50 +0100 Subject: [PATCH 16/18] Tests work with new pokemon disabled --- src/battle_message.c | 2 +- test/ability_intimidate.c | 28 ++++++++++++++-------------- test/ability_pastel_veil.c | 4 ++-- test/ability_stench.c | 4 ++-- test/hold_effect_red_card.c | 2 ++ test/mega_evolution.c | 6 +++--- test/move_effect_hit_escape.c | 2 ++ 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/battle_message.c b/src/battle_message.c index cf57247bf8..77ab90438a 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -284,7 +284,7 @@ static const u8 sText_PkmnPreventsPoisoningWith[] = _("{B_EFF_NAME_WITH_PREFIX}' static const u8 sText_PkmnPreventsConfusionWith[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nprevents confusion!"); static const u8 sText_PkmnRaisedFirePowerWith[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nraised its FIRE power!"); static const u8 sText_PkmnAnchorsItselfWith[] = _("{B_DEF_NAME_WITH_PREFIX} anchors\nitself with {B_DEF_ABILITY}!"); -static const u8 sText_PkmnCutsAttackWith[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\ncuts {B_DEF_NAME_WITH_PREFIX}'s ATTACK!"); +static const u8 sText_PkmnCutsAttackWith[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\ncuts {B_DEF_NAME_WITH_PREFIX}'s attack!"); static const u8 sText_PkmnPreventsStatLossWith[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nprevents stat loss!"); static const u8 sText_PkmnHurtsWith[] = _("{B_ATK_NAME_WITH_PREFIX} was hurt by\n{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}!"); static const u8 sText_PkmnTraced[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} TRACED\n{B_BUFF1}'s {B_BUFF2}!"); diff --git a/test/ability_intimidate.c b/test/ability_intimidate.c index f978b80ab0..08d8d606e4 100644 --- a/test/ability_intimidate.c +++ b/test/ability_intimidate.c @@ -10,11 +10,11 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after switch ou { u32 ability; PARAMETRIZE { ability = ABILITY_INTIMIDATE; } - PARAMETRIZE { ability = ABILITY_RECKLESS; } + PARAMETRIZE { ability = ABILITY_SHED_SKIN; } GIVEN { PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_STARAPTOR) { Ability(ability); }; + OPPONENT(SPECIES_ARBOK) { Ability(ability); }; } WHEN { TURN { SWITCH(opponent, 1); } TURN { MOVE(player, MOVE_TACKLE); } @@ -23,7 +23,7 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after switch ou { ABILITY_POPUP(opponent, ABILITY_INTIMIDATE); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); - MESSAGE("Foe Staraptor's Intimidate cuts Wobbuffet's ATTACK!"); + MESSAGE("Foe Arbok's Intimidate cuts Wobbuffet's attack!"); } HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { @@ -35,11 +35,11 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after KO", s16 { u32 ability; PARAMETRIZE { ability = ABILITY_INTIMIDATE; } - PARAMETRIZE { ability = ABILITY_RECKLESS; } + PARAMETRIZE { ability = ABILITY_SHED_SKIN; } GIVEN { PLAYER(SPECIES_WOBBUFFET) { Speed(2); }; OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); }; - OPPONENT(SPECIES_STARAPTOR) { Ability(ability); Speed(1); }; + OPPONENT(SPECIES_ARBOK) { Ability(ability); Speed(1); }; } WHEN { TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); } TURN { MOVE(player, MOVE_TACKLE); } @@ -49,7 +49,7 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after KO", s16 { ABILITY_POPUP(opponent, ABILITY_INTIMIDATE); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); - MESSAGE("Foe Staraptor's Intimidate cuts Wobbuffet's ATTACK!"); + MESSAGE("Foe Arbok's Intimidate cuts Wobbuffet's attack!"); } HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { @@ -63,11 +63,11 @@ DOUBLE_BATTLE_TEST("Intimidate doesn't activate on an empty field in a double ba ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION); PLAYER(SPECIES_WOBBUFFET) { }; PLAYER(SPECIES_WOBBUFFET) { HP(1); }; - PLAYER(SPECIES_STARAVIA) { Ability(ABILITY_INTIMIDATE); }; + PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); }; PLAYER(SPECIES_ABRA); OPPONENT(SPECIES_WOBBUFFET) { HP(1); }; OPPONENT(SPECIES_WOBBUFFET) { HP(1); }; - OPPONENT(SPECIES_STARAPTOR) { Ability(ABILITY_INTIMIDATE); }; + OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); }; OPPONENT(SPECIES_WYNAUT); } WHEN { TURN { MOVE(playerLeft, MOVE_EXPLOSION); SEND_OUT(playerLeft, 2); SEND_OUT(opponentLeft, 2); SEND_OUT(playerRight, 3); SEND_OUT(opponentRight, 3); } @@ -77,21 +77,21 @@ DOUBLE_BATTLE_TEST("Intimidate doesn't activate on an empty field in a double ba ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, playerLeft); // Everyone faints. - MESSAGE("Go! Staravia!"); - MESSAGE("2 sent out Staraptor!"); + MESSAGE("Go! Ekans!"); + MESSAGE("2 sent out Arbok!"); MESSAGE("Go! Abra!"); MESSAGE("2 sent out Wynaut!"); ABILITY_POPUP(playerLeft, ABILITY_INTIMIDATE); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); - MESSAGE("Staravia's Intimidate cuts Foe Staraptor's ATTACK!"); + MESSAGE("Ekans's Intimidate cuts Foe Arbok's attack!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); - MESSAGE("Staravia's Intimidate cuts Foe Wynaut's ATTACK!"); + MESSAGE("Ekans's Intimidate cuts Foe Wynaut's attack!"); ABILITY_POPUP(opponentLeft, ABILITY_INTIMIDATE); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); - MESSAGE("Foe Staraptor's Intimidate cuts Staravia's ATTACK!"); + MESSAGE("Foe Arbok's Intimidate cuts Ekans's attack!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); - MESSAGE("Foe Staraptor's Intimidate cuts Abra's ATTACK!"); + MESSAGE("Foe Arbok's Intimidate cuts Abra's attack!"); } } diff --git a/test/ability_pastel_veil.c b/test/ability_pastel_veil.c index 5d7a8f0203..ddc0806198 100644 --- a/test/ability_pastel_veil.c +++ b/test/ability_pastel_veil.c @@ -35,7 +35,7 @@ SINGLE_BATTLE_TEST("Pastel Veil immediately cures Mold Breaker poison") { GIVEN { ASSUME(gBattleMoves[MOVE_TOXIC].effect == EFFECT_TOXIC); - PLAYER(SPECIES_DRILBUR) { Ability(ABILITY_MOLD_BREAKER); } + PLAYER(SPECIES_PINSIR) { Ability(ABILITY_MOLD_BREAKER); } OPPONENT(SPECIES_PONYTA_GALARIAN) { Ability(ABILITY_PASTEL_VEIL); } } WHEN { TURN { MOVE(player, MOVE_TOXIC); } @@ -52,7 +52,7 @@ DOUBLE_BATTLE_TEST("Pastel Veil does not cure Mold Breaker poison on partner") { GIVEN { ASSUME(gBattleMoves[MOVE_TOXIC].effect == EFFECT_TOXIC); - PLAYER(SPECIES_DRILBUR) { Ability(ABILITY_MOLD_BREAKER); } + PLAYER(SPECIES_PINSIR) { Ability(ABILITY_MOLD_BREAKER); } PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_PONYTA_GALARIAN) { Ability(ABILITY_PASTEL_VEIL); } OPPONENT(SPECIES_WYNAUT); diff --git a/test/ability_stench.c b/test/ability_stench.c index 7285ee768c..18d9097680 100644 --- a/test/ability_stench.c +++ b/test/ability_stench.c @@ -6,7 +6,7 @@ SINGLE_BATTLE_TEST("Stench has a 10% chance to flinch") PASSES_RANDOMLY(1,10); GIVEN { ASSUME(gBattleMoves[MOVE_TACKLE].power > 0); - PLAYER(SPECIES_STUNKY) { Ability(ABILITY_STENCH); }; + PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); }; OPPONENT(SPECIES_WOBBUFFET); } WHEN { TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); } @@ -22,7 +22,7 @@ SINGLE_BATTLE_TEST("Stench does not stack with King's Rock") ASSUME(gItems[ITEM_KINGS_ROCK].holdEffect == HOLD_EFFECT_FLINCH); ASSUME(gBattleMoves[MOVE_TACKLE].power > 0); - PLAYER(SPECIES_STUNKY) { Ability(ABILITY_STENCH); Item(ITEM_KINGS_ROCK); }; + PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); Item(ITEM_KINGS_ROCK); }; OPPONENT(SPECIES_WOBBUFFET); } WHEN { TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); } diff --git a/test/hold_effect_red_card.c b/test/hold_effect_red_card.c index c32c489d5a..882007cfd4 100644 --- a/test/hold_effect_red_card.c +++ b/test/hold_effect_red_card.c @@ -184,6 +184,7 @@ SINGLE_BATTLE_TEST("Red Card does not activate if stolen by Magician") PARAMETRIZE { item = ITEM_POTION; activate = TRUE; } GIVEN { + ASSUME(P_GEN_6_POKEMON == TRUE); PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_RED_CARD); } OPPONENT(SPECIES_FENNEKIN) { Ability(ABILITY_MAGICIAN); Item(item); } OPPONENT(SPECIES_WYNAUT); @@ -360,6 +361,7 @@ SINGLE_BATTLE_TEST("Red Card does not activate if attacker's Sheer Force applied SINGLE_BATTLE_TEST("Red Card activates before Emergency Exit") { GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); PLAYER(SPECIES_GOLISOPOD) { MaxHP(100); HP(51); Item(ITEM_RED_CARD); } PLAYER(SPECIES_WIMPOD); OPPONENT(SPECIES_WOBBUFFET); diff --git a/test/mega_evolution.c b/test/mega_evolution.c index 13e9cd5b22..7080e85a3c 100644 --- a/test/mega_evolution.c +++ b/test/mega_evolution.c @@ -37,15 +37,15 @@ SINGLE_BATTLE_TEST("Mega Evolution affects turn order") { GIVEN { ASSUME(B_MEGA_EVO_TURN_ORDER); - PLAYER(SPECIES_DIANCIE) { Item(ITEM_DIANCITE); Speed(105); } + PLAYER(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(105); } OPPONENT(SPECIES_WOBBUFFET) { Speed(106); } } WHEN { TURN { MOVE(player, MOVE_CELEBRATE, megaEvolve: TRUE); } } SCENE { - MESSAGE("Diancie used Celebrate!"); + MESSAGE("Gardevoir used Celebrate!"); MESSAGE("Foe Wobbuffet used Celebrate!"); } THEN { - ASSUME(player->speed == 225); + ASSUME(player->speed == 205); } } diff --git a/test/move_effect_hit_escape.c b/test/move_effect_hit_escape.c index cc34db2e28..fb5ff2dd54 100644 --- a/test/move_effect_hit_escape.c +++ b/test/move_effect_hit_escape.c @@ -65,6 +65,7 @@ SINGLE_BATTLE_TEST("U-turn does not switch the user out if replacements fainted" SINGLE_BATTLE_TEST("U-turn does not switch the user out if Wimp Out activates") { GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_WIMPOD) { MaxHP(100); HP(51); Ability(ABILITY_WIMP_OUT); } @@ -82,6 +83,7 @@ SINGLE_BATTLE_TEST("U-turn does not switch the user out if Wimp Out activates") SINGLE_BATTLE_TEST("U-turn switches the user out if Wimp Out fails to activate") { GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_WIMPOD) { MaxHP(100); HP(51); Ability(ABILITY_WIMP_OUT); } From 9358265954b80410d1f9c6617c79108e68f47f32 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 9 Mar 2023 09:52:27 +0100 Subject: [PATCH 17/18] electrify ai speed check --- src/battle_ai_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 2d4d075282..e4edf45814 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2447,7 +2447,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_ELECTRIFY: - if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER + if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER //|| GetMoveTypeSpecial(battlerDef, predictedMove) == TYPE_ELECTRIC // Move will already be electric type || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) score -= 10; From 6f13e4cfc5fd7670d4c2d5165ff96c952c0e3622 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Fri, 10 Mar 2023 14:52:22 -0500 Subject: [PATCH 18/18] word-align battle_interface u8 array gfx (#2812) Co-authored-by: ghoulslash --- src/battle_interface.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index a793320f6a..35c0e60c63 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -607,7 +607,7 @@ static const struct WindowTemplate sHealthboxWindowTemplate = { .baseBlock = 0 }; -static const u8 sMegaTriggerGfx[] = INCBIN_U8("graphics/battle_interface/mega_trigger.4bpp"); +static const u8 ALIGNED(4) sMegaTriggerGfx[] = INCBIN_U8("graphics/battle_interface/mega_trigger.4bpp"); static const u16 sMegaTriggerPal[] = INCBIN_U16("graphics/battle_interface/mega_trigger.gbapal"); static const struct SpriteSheet sSpriteSheet_MegaTrigger = @@ -1436,10 +1436,10 @@ enum INDICATOR_COUNT, }; -static const u8 sMegaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/mega_indicator.4bpp"); +static const u8 ALIGNED(4) sMegaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/mega_indicator.4bpp"); static const u16 sMegaIndicatorPal[] = INCBIN_U16("graphics/battle_interface/mega_indicator.gbapal"); -static const u8 sAlphaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/alpha_indicator.4bpp"); -static const u8 sOmegaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/omega_indicator.4bpp"); +static const u8 ALIGNED(4) sAlphaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/alpha_indicator.4bpp"); +static const u8 ALIGNED(4) sOmegaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/omega_indicator.4bpp"); static const u16 sAlphaOmegaIndicatorPal[] = INCBIN_U16("graphics/battle_interface/alpha_indicator.gbapal"); static const struct SpriteSheet sMegaIndicator_SpriteSheets[] = @@ -2775,7 +2775,7 @@ static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 wi #define tSpriteId1 data[6] #define tSpriteId2 data[7] -static const u8 sAbilityPopUpGfx[] = INCBIN_U8("graphics/battle_interface/ability_pop_up.4bpp"); +static const u8 ALIGNED(4) sAbilityPopUpGfx[] = INCBIN_U8("graphics/battle_interface/ability_pop_up.4bpp"); static const u16 sAbilityPopUpPalette[] = INCBIN_U16("graphics/battle_interface/ability_pop_up.gbapal"); static const struct SpriteSheet sSpriteSheet_AbilityPopUp = @@ -3234,9 +3234,9 @@ static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow = }; #if B_LAST_USED_BALL_BUTTON == R_BUTTON - static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); + static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); #else - static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp"); + static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp"); #endif static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = {