Fix Smack Down anim + move anim tests (#4774)

* Fix Smack Down anim + move anim tests

* really agbcc

* fix undefined reference

* hopefully everything works
This commit is contained in:
DizzyEggg 2024-06-13 21:30:28 +02:00 committed by GitHub
parent f868de066d
commit 84d13d0abf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 3 deletions

View file

@ -5168,7 +5168,6 @@ Move_SMACK_DOWN::
createvisualtask AnimTask_SmokescreenImpact, 0x8, 0x400, 0x1902
fadetobg BG_IN_AIR
waitbgfadeout
createvisualtask AnimTask_StartSlidingBg, 5, 0x0, 0x0, 0x0, 0xffff
createvisualtask AnimTask_SeismicTossBgAccelerateDownAtEnd, 3
goto SeismicTossWeak

View file

@ -695,6 +695,7 @@ struct BattleTestData
struct BattleTestRunnerState
{
u8 battlersCount;
bool8 forceMoveAnim;
u16 parametersCount; // Valid only in BattleTest_Setup.
u16 parameters;
u16 runParameter;
@ -996,6 +997,8 @@ void SendOut(u32 sourceLine, struct BattlePokemon *, u32 partyIndex);
#define NONE_OF for (OpenQueueGroup(__LINE__, QUEUE_GROUP_NONE_OF); gBattleTestRunnerState->data.queueGroupType != QUEUE_GROUP_NONE; CloseQueueGroup(__LINE__))
#define NOT NONE_OF
#define FORCE_MOVE_ANIM(set) gBattleTestRunnerState->forceMoveAnim = (set)
#define ABILITY_POPUP(battler, ...) QueueAbility(__LINE__, battler, (struct AbilityEventContext) { __VA_ARGS__ })
#define ANIMATION(type, id, ...) QueueAnimation(__LINE__, type, id, (struct AnimationEventContext) { __VA_ARGS__ })
#define HP_BAR(battler, ...) QueueHP(__LINE__, battler, (struct HPEventContext) { APPEND_TRUE(__VA_ARGS__) })

View file

@ -18,6 +18,7 @@
#include "sprite.h"
#include "task.h"
#include "test_runner.h"
#include "test/battle.h"
#include "constants/battle_anim.h"
#include "constants/moves.h"
@ -239,6 +240,9 @@ void LaunchBattleAnimation(u32 animType, u32 animId)
TestRunner_Battle_RecordAnimation(animType, animId);
// Play Transform and Ally Switch even in Headless as these move animations also change mon data.
if (gTestRunnerHeadless
#if TESTING // Because gBattleTestRunnerState is not seen outside of test env.
&& !gBattleTestRunnerState->forceMoveAnim
#endif // TESTING
&& !(animType == ANIM_TYPE_MOVE && (animId == MOVE_TRANSFORM || animId == MOVE_ALLY_SWITCH)))
{
gAnimScriptCallback = Nop;
@ -446,7 +450,7 @@ static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets)
u32 i;
u32 ignoredTgt = gBattlerAttacker;
u32 target = GetBattlerMoveTargetType(gBattleAnimAttacker, gAnimMoveIndex);
switch (battlerAnimId)
{
case ANIM_ATTACKER:
@ -458,7 +462,7 @@ static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets)
ignoredTgt = gBattlerAttacker;
break;
}
switch (target)
{
case MOVE_TARGET_FOES_AND_ALLY:

View file

@ -0,0 +1,25 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Move Animation Test: Smack Down works when used 15 times in a row")
{
u16 j, nTurns = 15;
FORCE_MOVE_ANIM(TRUE);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
for (j = 0; j < nTurns; j++)
{
TURN { MOVE(player, MOVE_SMACK_DOWN); MOVE(opponent, MOVE_HELPING_HAND); } // Helping Hand, so there's no anim on the opponent's side.
}
} SCENE {
for (j = 0; j < nTurns; j++)
{
ANIMATION(ANIM_TYPE_MOVE, MOVE_SMACK_DOWN, player);
}
} THEN {
FORCE_MOVE_ANIM(FALSE);
}
}