Fix Psych Up message and cleanup and don't allow switching to self in tests (#7277)

This commit is contained in:
PhallenTree 2025-07-05 13:47:36 +01:00 committed by GitHub
parent c360900a5b
commit 38a3963ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 11 deletions

View File

@ -1033,9 +1033,8 @@
.4byte \failInstr
.endm
.macro copyfoestats unused:req
.macro copyfoestats
.byte 0xbd
.4byte \unused
.endm
.macro rapidspinfree

View File

@ -4258,7 +4258,7 @@ BattleScript_EffectPsychUp::
attackcanceler
attackstring
ppreduce
copyfoestats BattleScript_ButItFailed
copyfoestats
attackanimation
waitanimation
printstring STRINGID_PKMNCOPIEDSTATCHANGES

View File

@ -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[] =

View File

@ -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)

View File

@ -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 });
}
}