From 8dafc5e2081473dbf45543106a3b30c3dcae3e20 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 26 Jul 2023 17:36:37 -0400 Subject: [PATCH 1/4] Fixed B_ATK_TRAINER_NAME not working properly in tests --- src/battle_message.c | 3 ++- test/mega_evolution.c | 6 +++--- test/test_runner_battle.c | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/battle_message.c b/src/battle_message.c index 1585f8c47..64723e2b9 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -18,6 +18,7 @@ #include "recorded_battle.h" #include "string_util.h" #include "strings.h" +#include "test_runner.h" #include "text.h" #include "trainer_hill.h" #include "window.h" @@ -3074,7 +3075,7 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId) toCpy = gSaveBlock2Ptr->playerName; break; case B_POSITION_PLAYER_RIGHT: - if ((gBattleTypeFlags & BATTLE_TYPE_RECORDED) && !(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER))) + if (gTestRunnerEnabled) { toCpy = gLinkPlayers[0].name; } diff --git a/test/mega_evolution.c b/test/mega_evolution.c index 5597f5396..d27566028 100644 --- a/test/mega_evolution.c +++ b/test/mega_evolution.c @@ -27,7 +27,7 @@ DOUBLE_BATTLE_TEST("Mega Evolution's order is determined by Speed - opponent fas } WHEN { TURN { MOVE(opponentLeft, MOVE_CELEBRATE, megaEvolve: TRUE); MOVE(playerLeft, MOVE_CELEBRATE, megaEvolve: TRUE); } } SCENE { - MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 's Mega Ring!"); + MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 2's Mega Ring!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponentLeft); MESSAGE("Foe Gardevoir has Mega Evolved into Mega Gardevoir!"); MESSAGE("Venusaur's Venusaurite is reacting to 1's Mega Ring!"); @@ -49,7 +49,7 @@ DOUBLE_BATTLE_TEST("Mega Evolution's order is determined by Speed - player faste MESSAGE("Venusaur's Venusaurite is reacting to 1's Mega Ring!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, playerLeft); MESSAGE("Venusaur has Mega Evolved into Mega Venusaur!"); - MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 's Mega Ring!"); + MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 2's Mega Ring!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponentLeft); MESSAGE("Foe Gardevoir has Mega Evolved into Mega Gardevoir!"); } @@ -145,7 +145,7 @@ SINGLE_BATTLE_TEST("Regular Mega Evolution and Fervent Wish Mega Evolution can h ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, player); MESSAGE("Rayquaza has Mega Evolved into Mega Rayquaza!"); - MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 's Mega Ring!"); + MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 2's Mega Ring!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponent); MESSAGE("Foe Gardevoir has Mega Evolved into Mega Gardevoir!"); } THEN { diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 4de144c38..91c00f6cc 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -9,6 +9,7 @@ #include "random.h" #include "test_battle.h" #include "window.h" +#include "constants/trainers.h" #if defined(__INTELLISENSE__) #undef TestRunner_Battle_RecordAbilityPopUp @@ -232,11 +233,15 @@ static void BattleTest_Run(void *data) memset(&DATA, 0, sizeof(DATA)); DATA.recordedBattle.rngSeed = RNG_SEED_DEFAULT; + DATA.recordedBattle.opponentA = TRAINER_LINK_OPPONENT; DATA.recordedBattle.textSpeed = OPTIONS_TEXT_SPEED_FAST; DATA.recordedBattle.battleFlags = BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_IS_MASTER; if (test->type == BATTLE_TEST_DOUBLES) + { DATA.recordedBattle.battleFlags |= BATTLE_TYPE_DOUBLE; + DATA.recordedBattle.opponentB = TRAINER_LINK_OPPONENT; + } for (i = 0; i < STATE->battlersCount; i++) { DATA.recordedBattle.playersName[i][0] = CHAR_1 + i; From d9a17467cf4b6042e177bb2025e5890cb35b4df7 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 6 Aug 2023 14:28:02 -0400 Subject: [PATCH 2/4] Kept previous check while using gTestRunnerEnabled --- src/battle_message.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_message.c b/src/battle_message.c index 64723e2b9..ba4258382 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3075,7 +3075,8 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId) toCpy = gSaveBlock2Ptr->playerName; break; case B_POSITION_PLAYER_RIGHT: - if (gTestRunnerEnabled) + if (((gBattleTypeFlags & BATTLE_TYPE_RECORDED) && !(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER))) + || gTestRunnerEnabled) { toCpy = gLinkPlayers[0].name; } From 64ffc5a85dd2e6ca0d5ab1a3529d5ef0daee24d1 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Wed, 30 Aug 2023 21:58:53 +0200 Subject: [PATCH 3/4] Fixes Beat Up + Chloroblast (#3264) --- src/battle_script_commands.c | 5 +++-- src/data/battle_moves.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index af222e6ba..c6f6f1bf5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -14111,12 +14111,13 @@ static void Cmd_trysetfutureattack(void) static void Cmd_trydobeatup(void) { - CMD_ARGS(const u8 *endInstr, const u8 *failInstr); - #if B_BEAT_UP >= GEN_5 + CMD_ARGS(); + gBattleStruct->beatUpSlot++; gBattlescriptCurrInstr = cmd->nextInstr; #else + CMD_ARGS(const u8 *endInstr, const u8 *failInstr); struct Pokemon *party = GetBattlerParty(gBattlerAttacker); if (gBattleMons[gBattlerTarget].hp == 0) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index ebd64ae10..940dec57d 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -12615,7 +12615,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #else .power = 120, #endif - .effect = EFFECT_RECOIL_50, + .effect = EFFECT_STEEL_BEAM, .type = TYPE_GRASS, .accuracy = 95, .pp = 5, From d78d63e53777351a843b9bce9f416e6af7c5ed7b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 31 Aug 2023 04:07:06 -0300 Subject: [PATCH 4/4] Fixed redundant calls in Teleport's battle script (#3212) The battle script was originally making an extra call to attackcanceler and attackstring pointlessly whenever there was a jump to BattleScript_EffectBatonPass. This commit addresses that by relocating BattleScript_EffectTeleport's own calls to attackcanceler and attackstring. --- data/battle_scripts_1.s | 8 +++++--- include/battle_scripts.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 55e4cc351..6017e5349 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5401,15 +5401,15 @@ BattleScript_EffectHurricane: goto BattleScript_EffectHit BattleScript_EffectTeleport: - attackcanceler - attackstring .if B_TELEPORT_BEHAVIOR >= GEN_7 jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass .else - jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailedAtkCanceler .endif BattleScript_EffectTeleportTryToRunAway: + attackcanceler + attackstring ppreduce getifcantrunfrombattle BS_ATTACKER jumpifbyte CMP_EQUAL, gBattleCommunication, BATTLE_RUN_FORBIDDEN, BattleScript_ButItFailed @@ -5546,6 +5546,8 @@ BattleScript_EffectFakeOut:: setmoveeffect MOVE_EFFECT_FLINCH goto BattleScript_EffectHit +BattleScript_ButItFailedAtkCanceler:: + attackcanceler BattleScript_ButItFailedAtkStringPpReduce:: attackstring BattleScript_ButItFailedPpReduce:: diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 95f068cf5..a6b897077 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -471,6 +471,7 @@ extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_BerserkGeneRet[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[]; +extern const u8 BattleScript_ButItFailedAtkCanceler[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[];