diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 02da5bc775..b23992d332 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1033,9 +1033,8 @@ .4byte \failInstr .endm - .macro copyfoestats unused:req + .macro copyfoestats .byte 0xbd - .4byte \unused .endm .macro rapidspinfree diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bacf15e1c6..a57ce67c25 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4258,7 +4258,7 @@ BattleScript_EffectPsychUp:: attackcanceler attackstring ppreduce - copyfoestats BattleScript_ButItFailed + copyfoestats attackanimation waitanimation printstring STRINGID_PKMNCOPIEDSTATCHANGES diff --git a/src/battle_message.c b/src/battle_message.c index 9082bbef6c..860a3d5ac2 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1202,7 +1202,8 @@ const u16 gGotBurnedStringIds[] = const u16 gGotFrostbiteStringIds[] = { - [B_MSG_STATUSED] = STRINGID_PKMNGOTFROSTBITE + [B_MSG_STATUSED] = STRINGID_PKMNGOTFROSTBITE, + [B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNGOTFROSTBITE }; const u16 gFrostbiteHealedStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7138ad9803..ff4104b19e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -61,6 +61,7 @@ #include "constants/songs.h" #include "constants/trainer_slide.h" #include "constants/trainers.h" +#include "test/battle.h" #include "battle_util.h" #include "constants/pokemon.h" #include "config/battle.h" @@ -2397,7 +2398,7 @@ static inline bool32 TryTeraShellDistortTypeMatchups(u32 battlerDef) // According to Gen5 Weakness berry activation happens after the attackanimation. // It doesn't have any impact on gameplay and is only a visual thing which can be adjusted later. -static inline bool32 TryActivateWeakenessBerry(u32 battlerDef) +static inline bool32 TryActivateWeaknessBerry(u32 battlerDef) { if (gSpecialStatuses[battlerDef].berryReduced && gBattleMons[battlerDef].item != ITEM_NONE) { @@ -2440,7 +2441,7 @@ static bool32 ProcessPreAttackAnimationFuncs(void) if (TryTeraShellDistortTypeMatchups(battlerDef)) return TRUE; - if (TryActivateWeakenessBerry(battlerDef)) + if (TryActivateWeaknessBerry(battlerDef)) return TRUE; } } @@ -2450,7 +2451,7 @@ static bool32 ProcessPreAttackAnimationFuncs(void) return TRUE; if (TryTeraShellDistortTypeMatchups(gBattlerTarget)) return TRUE; - if (TryActivateWeakenessBerry(gBattlerTarget)) + if (TryActivateWeaknessBerry(gBattlerTarget)) return TRUE; } @@ -7431,6 +7432,11 @@ static void Cmd_getswitchedmondata(void) if (gBattleControllerExecFlags) return; + if (TESTING + && gBattlerPartyIndexes[battler] == gBattleStruct->monToSwitchIntoId[battler] + && gBattleStruct->hpBefore[battler] != 0) // battler is alive + Test_ExitWithResult(TEST_RESULT_ERROR, 0, ":L:%s:%d: battler is trying to switch to themself", __FILE__, __LINE__); + gBattlerPartyIndexes[battler] = gBattleStruct->monToSwitchIntoId[battler]; BtlController_EmitGetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_ALL_BATTLE, 1u << gBattlerPartyIndexes[battler]); @@ -14269,7 +14275,7 @@ static void Cmd_halvehp(void) // Psych Up static void Cmd_copyfoestats(void) { - CMD_ARGS(const u8 *unused); + CMD_ARGS(); s32 i; @@ -14277,8 +14283,9 @@ static void Cmd_copyfoestats(void) { gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i]; } + gBattleScripting.battler = gBattlerTarget; - gBattlescriptCurrInstr = cmd->nextInstr; // Has an unused jump ptr(possibly for a failed attempt) parameter. + gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_rapidspinfree(void) diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 20271a588d..51f0ca02dd 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -2016,9 +2016,9 @@ void CloseTurn(u32 sourceLine) { if (!(DATA.actionBattlers & (1 << i))) { - if (IsAITest() && (i & BIT_SIDE) == B_SIDE_OPPONENT) // If Move was not specified, allow any move used. + if (IsAITest() && (i & BIT_SIDE) == B_SIDE_OPPONENT) // If Move was not specified, allow any move used. SetAiActionToPass(sourceLine, i); - else + else Move(sourceLine, &gBattleMons[i], (struct MoveContext) { move: MOVE_CELEBRATE, explicitMove: TRUE }); } }