mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
f1b9872bf0
Thank you to SBird for providing mgba-rom-test binaries and Spikes/Toxic Spikes tests! Co-authored-by: sbird <sbird@no.tld>
78 lines
2.6 KiB
C
78 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")
|
|
{
|
|
u16 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!");
|
|
}
|
|
}
|