sovereignx/test/battle/move_effect/recoil.c
Nephrite 4a1a6c5625
Battlemove refactored (recoil, crit and Z moves) (#3575)
* Unified EFFECT_RECOIL

Combined EFFECT_RECOIL_25/33/50/33_STATUS into a single EFFECT; added an extra field to BattleMove 'secondaryData' that contains the franction of HP recoil; argument still holds status effect for Flare Blitz/Volt Tackle

* BattleMove struct change

Added critrate, recoil, multihit fields, made zMove into a union of effect/powerOverride for status/non-status moves respectively. Added new recoil field and zMove field to all moves. To-do: crit rate, multihit

* Critrate field added

Moves use a critRate field instead of a flag - obsoletes EFFECT_ALWAYS_CRIT

* Just a little define

Makes clear that critBoost = 3 means ALWAYS CRIT

* Added a proper recoil field

Just to make it unambiguous and flexible - can finally have a move with 69% recoil.

* Fixed AI damage calculation for multi-strike moves

* Fixes + removed unused effects

* Tests fixes

Two to fix: pass when run in isolation but not when the whole group is run, which is annoying...

* Minor fixes

* Minor tweaks

* Fixed move effects

* recoil tests

---------

Co-authored-by: Alex <alexthenotes@gmail.com>
2023-12-19 16:10:07 +01:00

89 lines
2.9 KiB
C

#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Take Down deals 25% of recoil damage to the user")
{
s16 directDamage;
s16 recoilDamage;
GIVEN {
ASSUME(gBattleMoves[MOVE_TAKE_DOWN].effect == EFFECT_RECOIL);
ASSUME(gBattleMoves[MOVE_TAKE_DOWN].recoil == 25);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TAKE_DOWN); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAKE_DOWN, player);
HP_BAR(opponent, captureDamage: &directDamage);
HP_BAR(player, captureDamage: &recoilDamage);
} THEN {
EXPECT_MUL_EQ(directDamage, UQ_4_12(0.25), recoilDamage);
}
}
SINGLE_BATTLE_TEST("Double Edge deals 33% of recoil damage to the user")
{
s16 directDamage;
s16 recoilDamage;
GIVEN {
ASSUME(gBattleMoves[MOVE_DOUBLE_EDGE].effect == EFFECT_RECOIL);
ASSUME(gBattleMoves[MOVE_DOUBLE_EDGE].recoil == 33);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_DOUBLE_EDGE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_EDGE, player);
HP_BAR(opponent, captureDamage: &directDamage);
HP_BAR(player, captureDamage: &recoilDamage);
} THEN {
EXPECT_MUL_EQ(directDamage, UQ_4_12(0.33), recoilDamage);
}
}
SINGLE_BATTLE_TEST("Head Smash deals 50% of recoil damage to the user")
{
s16 directDamage;
s16 recoilDamage;
GIVEN {
ASSUME(gBattleMoves[MOVE_HEAD_SMASH].effect == EFFECT_RECOIL);
ASSUME(gBattleMoves[MOVE_HEAD_SMASH].recoil == 50);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_HEAD_SMASH); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEAD_SMASH, player);
HP_BAR(opponent, captureDamage: &directDamage);
HP_BAR(player, captureDamage: &recoilDamage);
} THEN {
EXPECT_MUL_EQ(directDamage, UQ_4_12(0.50), recoilDamage);
}
}
SINGLE_BATTLE_TEST("Flare Blitz deals 33% of recoil damage to the user and can burn target")
{
s16 directDamage;
s16 recoilDamage;
GIVEN {
ASSUME(gBattleMoves[MOVE_FLARE_BLITZ].effect == EFFECT_RECOIL);
ASSUME(gBattleMoves[MOVE_FLARE_BLITZ].recoil == 33);
ASSUME(gBattleMoves[MOVE_FLARE_BLITZ].argument == STATUS1_BURN);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_FLARE_BLITZ); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FLARE_BLITZ, player);
HP_BAR(opponent, captureDamage: &directDamage);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent);
STATUS_ICON(opponent, burn: TRUE);
HP_BAR(player, captureDamage: &recoilDamage);
} THEN {
EXPECT_MUL_EQ(directDamage, UQ_4_12(0.33), recoilDamage);
}
}