sovereignx/test/battle/move_effect/triple_arrows.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

91 lines
2.8 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TRIPLE_ARROWS].effect == EFFECT_TRIPLE_ARROWS);
}
SINGLE_BATTLE_TEST("Triple Arrows may lower Defense by one stage")
{
u32 ability;
u32 chance;
PARAMETRIZE { ability = ABILITY_HUSTLE; chance = 50; }
PARAMETRIZE { ability = ABILITY_SERENE_GRACE; chance = 100; }
PASSES_RANDOMLY(chance, 100, RNG_TRIPLE_ARROWS_DEFENSE_DOWN);
GIVEN {
PLAYER(SPECIES_TOGEPI) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_ARROWS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Wobbuffet's Defense fell!");
}
}
SINGLE_BATTLE_TEST("Triple Arrows makes the foe flinch 30% of the time")
{
u32 ability;
u32 chance;
PARAMETRIZE { ability = ABILITY_HUSTLE; chance = 30; }
PARAMETRIZE { ability = ABILITY_SERENE_GRACE; chance = 60; }
PASSES_RANDOMLY(chance, 100, RNG_TRIPLE_ARROWS_FLINCH);
GIVEN {
PLAYER(SPECIES_TOGEPI) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_ARROWS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player);
MESSAGE("Foe Wobbuffet flinched!");
}
}
SINGLE_BATTLE_TEST("Triple Arrows lands a critical hit")
{
ASSUME(B_CRIT_CHANCE >= GEN_7);
ASSUME(gBattleMoves[MOVE_TRIPLE_ARROWS].critBoost == 1);
PASSES_RANDOMLY(1, 8, RNG_CRITICAL_HIT);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_ARROWS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player);
MESSAGE("A critical hit!");
}
}
SINGLE_BATTLE_TEST("Triple Arrows can lower Defense and cause flinch at the time")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_ARROWS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Wobbuffet's Defense fell!");
MESSAGE("Foe Wobbuffet flinched!");
}
}
SINGLE_BATTLE_TEST("Triple Arrows's flinching is prevented by Inner Focus")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_RIOLU) { Ability(ABILITY_INNER_FOCUS); }
} WHEN {
TURN { MOVE(player, MOVE_TRIPLE_ARROWS);
MOVE(opponent, MOVE_TACKLE);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player);
NONE_OF { MESSAGE("Foe Wobbuffet flinched!"); }
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
}
}