Tests for Body Press + body press interaction with Wonder room (#4792)

This commit is contained in:
DizzyEggg 2024-06-14 09:43:10 +02:00 committed by GitHub
parent 4b1ff3ad7f
commit 1a4f277d6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 99 additions and 3 deletions

View file

@ -9218,7 +9218,11 @@ static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 m
else if (gMovesInfo[move].effect == EFFECT_BODY_PRESS)
{
atkStat = gBattleMons[battlerAtk].defense;
atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF];
// Edge case: Body Press used during Wonder Room. For some reason, it still uses Defense over Sp.Def, but uses Sp.Def stat changes
if (gFieldStatuses & STATUS_FIELD_WONDER_ROOM)
atkStage = gBattleMons[battlerAtk].statStages[STAT_SPDEF];
else
atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF];
}
else
{

View file

@ -1,8 +1,100 @@
#include "global.h"
#include "test/battle.h"
TO_DO_BATTLE_TEST("Body Press's damage depends on the user's base Defense instead of its base Attack");
TO_DO_BATTLE_TEST("Body Press's damage depends on the user's Defense stat stages");
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_BODY_PRESS].effect == EFFECT_BODY_PRESS);
}
SINGLE_BATTLE_TEST("Body Press's damage depends on the user's base Defense instead of its base Attack", s16 damage)
{
u32 def, atk;
PARAMETRIZE { def = 150; atk = 179; } // Atk is higher
PARAMETRIZE { atk = 150; def = 179; } // Atk is lower
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Attack(atk); Defense(def); }
} WHEN {
TURN { MOVE(opponent, MOVE_BODY_PRESS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_BODY_PRESS, opponent);
HP_BAR(player, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_GT(results[1].damage, results[0].damage);
}
}
SINGLE_BATTLE_TEST("Body Press's damage depends on the user's Defense and not Attack stat stages", s16 damage)
{
u32 move;
PARAMETRIZE { move = MOVE_IRON_DEFENSE; }
PARAMETRIZE { move = MOVE_SWORDS_DANCE; }
PARAMETRIZE { move = MOVE_CELEBRATE; } // Nothing, stats are default
GIVEN {
ASSUME(gMovesInfo[MOVE_IRON_DEFENSE].effect == EFFECT_DEFENSE_UP_2);
ASSUME(gMovesInfo[MOVE_SWORDS_DANCE].effect == EFFECT_ATTACK_UP_2);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Attack(150); Defense(150); }
} WHEN {
TURN { MOVE(opponent, move); }
TURN { MOVE(opponent, MOVE_BODY_PRESS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BODY_PRESS, opponent);
HP_BAR(player, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_GT(results[0].damage, results[1].damage);
EXPECT_EQ(results[1].damage, results[2].damage);
}
}
SINGLE_BATTLE_TEST("Body Press uses Defense Stat even in Wonder Room", s16 damage)
{
u32 move;
PARAMETRIZE { move = MOVE_WONDER_ROOM; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
ASSUME(gMovesInfo[MOVE_WONDER_ROOM].effect == EFFECT_WONDER_ROOM);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { SpDefense(50); Defense(150); }
} WHEN {
TURN { MOVE(opponent, move); }
TURN { MOVE(opponent, MOVE_BODY_PRESS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BODY_PRESS, opponent);
HP_BAR(player, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage);
}
}
SINGLE_BATTLE_TEST("Body Press uses Special Defense stat Stages in Wonder Room", s16 damage)
{
u32 move;
PARAMETRIZE { move = MOVE_IRON_DEFENSE; }
PARAMETRIZE { move = MOVE_AMNESIA; }
PARAMETRIZE { move = MOVE_CELEBRATE; } // Nothing, stats are default
GIVEN {
ASSUME(gMovesInfo[MOVE_IRON_DEFENSE].effect == EFFECT_DEFENSE_UP_2);
ASSUME(gMovesInfo[MOVE_AMNESIA].effect == EFFECT_SPECIAL_DEFENSE_UP_2);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { SpDefense(150); Defense(150); }
} WHEN {
TURN { MOVE(opponent, move); MOVE(player, MOVE_WONDER_ROOM); }
TURN { MOVE(opponent, MOVE_BODY_PRESS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BODY_PRESS, opponent);
HP_BAR(player, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_GT(results[1].damage, results[0].damage);
EXPECT_EQ(results[0].damage, results[2].damage);
}
}
// Could be split into multiple tests or maybe to separate files based on the modifier?
TO_DO_BATTLE_TEST("Body Press's damage is influenced by all other Attack modifiers that are not stat stages");