From 601438e980ddf88311064c97fa66d09845755ed4 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sat, 19 Oct 2024 22:51:20 +0200 Subject: [PATCH] Centralise AI Tests trainer name (#5532) --- include/test/battle.h | 2 ++ test/battle/ai/ai_flag_sequence_switching.c | 12 ++++++------ test/battle/ai/ai_switching.c | 14 +++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/test/battle.h b/include/test/battle.h index e3d18b5a65..819d05cbff 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -735,6 +735,8 @@ extern struct BattleTestRunnerState *const gBattleTestRunnerState; #define APPEND_COMMA_TRUE(a) , a, TRUE #define R_APPEND_TRUE(...) __VA_OPT__(FIRST(__VA_ARGS__), TRUE RECURSIVELY(R_FOR_EACH(APPEND_COMMA_TRUE, EXCEPT_1(__VA_ARGS__)))) +#define AI_TRAINER_NAME "{PKMN} TRAINER LEAF" + /* Test */ #define TO_DO_BATTLE_TEST(_name) \ diff --git a/test/battle/ai/ai_flag_sequence_switching.c b/test/battle/ai/ai_flag_sequence_switching.c index 1b4a264a24..b91df65d15 100644 --- a/test/battle/ai/ai_flag_sequence_switching.c +++ b/test/battle/ai/ai_flag_sequence_switching.c @@ -27,14 +27,14 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SEQUENCE_SWITCHING: AI will always switch after a } } SCENE { if (aiSequenceSwitchingFlag) { - MESSAGE("{PKMN} TRAINER LEAF sent out Machoke!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Machamp!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Mankey!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Primeape!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Magnezone!"); + MESSAGE(AI_TRAINER_NAME " sent out Machoke!"); + MESSAGE(AI_TRAINER_NAME " sent out Machamp!"); + MESSAGE(AI_TRAINER_NAME " sent out Mankey!"); + MESSAGE(AI_TRAINER_NAME " sent out Primeape!"); + MESSAGE(AI_TRAINER_NAME " sent out Magnezone!"); } else { - MESSAGE("{PKMN} TRAINER LEAF sent out Magnezone!"); + MESSAGE(AI_TRAINER_NAME " sent out Magnezone!"); } } } diff --git a/test/battle/ai/ai_switching.c b/test/battle/ai/ai_switching.c index 59a6d88493..b9d4d6115d 100644 --- a/test/battle/ai/ai_switching.c +++ b/test/battle/ai/ai_switching.c @@ -35,7 +35,7 @@ AI_SINGLE_BATTLE_TEST("AI switches if Perish Song is about to kill") TURN { ; } TURN { EXPECT_SWITCH(opponent, 1); } } SCENE { - MESSAGE("{PKMN} TRAINER LEAF sent out Crobat!"); + MESSAGE(AI_TRAINER_NAME " sent out Crobat!"); } } @@ -58,11 +58,11 @@ AI_DOUBLE_BATTLE_TEST("AI will not try to switch for the same pokemon for 2 spot } WHEN { TURN { EXPECT_SWITCH(opponentLeft, 3); }; } SCENE { - MESSAGE("{PKMN} TRAINER LEAF withdrew Gengar!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Raticate!"); + MESSAGE(AI_TRAINER_NAME " withdrew Gengar!"); + MESSAGE(AI_TRAINER_NAME " sent out Raticate!"); NONE_OF { - MESSAGE("{PKMN} TRAINER LEAF withdrew Haunter!"); - MESSAGE("{PKMN} TRAINER LEAF sent out Raticate!"); + MESSAGE(AI_TRAINER_NAME " withdrew Haunter!"); + MESSAGE(AI_TRAINER_NAME " sent out Raticate!"); } } } @@ -160,9 +160,9 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_MON_CHOICES: AI will not switch in a Pokemo } SCENE { MESSAGE("Foe Kadabra fainted!"); if (alakazamFirst) { - MESSAGE("{PKMN} TRAINER LEAF sent out Alakazam!"); + MESSAGE(AI_TRAINER_NAME " sent out Alakazam!"); } else { - MESSAGE("{PKMN} TRAINER LEAF sent out Blastoise!"); + MESSAGE(AI_TRAINER_NAME " sent out Blastoise!"); } } }