sovereignx/test/battle/move_effect/reflect.c
DizzyEggg a7b9d139da
Fix Wall Werrors on modern (#3412)
* Fix Wall Werror errors

* fix hgss pokedex modern errors

* tests build on modern

* learnset change

* Update src/battle_ai_util.c

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>

* Update src/battle_anim_new.c

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>

* Update src/debug.c

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>

* Update src/debug.c

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>

* Update src/pokedex_plus_hgss.c

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>

* review changes

* unused cmd args

* various args back

---------

Co-authored-by: Philipp AUER <SBird1337@users.noreply.github.com>
2023-10-13 18:39:35 +02:00

77 lines
2.6 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_REFLECT].effect == EFFECT_REFLECT);
}
SINGLE_BATTLE_TEST("Reflect reduces physical damage", s16 damage)
{
u32 move;
PARAMETRIZE { move = MOVE_CELEBRATE; }
PARAMETRIZE { move = MOVE_REFLECT; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_LT(results[1].damage, results[0].damage);
}
}
SINGLE_BATTLE_TEST("Reflect applies for 5 turns")
{
s16 damage[6];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_REFLECT); MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[1]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[2]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[3]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[4]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
HP_BAR(player, captureDamage: &damage[5]);
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(1.0), damage[1]);
EXPECT_MUL_EQ(damage[0], Q_4_12(1.0), damage[2]);
EXPECT_MUL_EQ(damage[0], Q_4_12(1.0), damage[3]);
EXPECT_MUL_EQ(damage[0], Q_4_12(1.0), damage[4]);
EXPECT_LT(damage[0], damage[5]);
}
}
SINGLE_BATTLE_TEST("Reflect fails if already active")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_REFLECT); }
TURN { MOVE(player, MOVE_REFLECT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT, player);
MESSAGE("Wobbuffet used Reflect!");
MESSAGE("But it failed!");
}
}