sovereignx/test/battle/ability/zero_to_hero.c
LOuroboros a64e1c63c1
Move data unification (#3999)
* Made gBattleMoves handle the InGame name and description of battle moves
No more multiple arrays in separate, individual files.

Note:
-Keep an eye on Task_LearnedMove.

* Reintroduced move names

Misc:
-Fixed Trick-or-Treat and Light of Ruin's expanded names.
-Introduced a new field for Z-Move names, and a constant for their name length.
-Added a few TODOs to GetBattleMoveName.
-Updated GetMaxMoveName and GetZMoveName. There's no reason not to let GetBattleMoveName handle everything on its own.

* Updated GetBattleMoveName to handle Z-Move Names

Misc:
-Removed pointless TODO about MOVE_NAME_LENGTH.
 -The compiler doesn't allow to have a move name with a value higher than MOVE_NAME_LENGTH, therefore it's pointless to worry about it.

* Fixed a couple of expanded move names

* Removed zMoveName variable of struct BattleMove and extended the name variable's size

* Ditched no longer used MOVE_NAME_LENGTH constant

* Corrected the names of the max moves
I should have done this after updating the size of the name variable of the struct BattleMove, but I didn't think about it at all until Cancer Fairy indirectly gave me the idea.

* Fixed U-turn's name

* Brought back MOVE_NAME_LENGTH
I think it doesn't make sense to have a Z_MOVE_NAME_LENGTH because the length in question is used for all battle moves, not just the Z-Moves.

* Introduced a union for Move/Z-Move names in the struct BattleMove

* Fixed the union for gBattleMoves move names
Also updated GetBattleMoveName to properly handle Max Move names.
Also also renamed the "zMoveName" variable to "bigMoveName" which better reflects its purpose. Z-Move names weren't the only thing it covered, since it also handles Max Move names.

* Removed deprecated GetZMoveName and GetMaxMoveName

* Reintroduced mention to gMoveNames in sGFRomHeader

* Fixed move names and ported move descriptions

* Fused the struct ContestMove into the struct BattleMove

* Removed no longer used Z_MOVE_NAME_LENGTH constant

* Renamed the struct BattleMove's bigMoveName variable and introduced macros to prettify move names

* Reintroduced the contest parameters for Pokémon moves

* Renamed gBattleMoves to gMovesInfo
This is consistent with gSpeciesInfo, the array that contains most of the species data.

* Renamed the BattleMove struct to MovesInfo
This is consistent with the struct SpeciesInfo, which contains the variables used by the gSpeciesInfo array.

* Removed empty lines separating battle params from contest params in gMovesInfo

* Renamed MovesInfo to MoveInfo

* Added Cancer Fairy's HANDLE_EXPANDED_MOVE_NAME macro
Used to handle moves with expanded names in a more comfortable manner.
Also fixed Trick-or-Treat's expanded name.

* Renamed GetBattleMoveName to GetMoveName

* Added a comment pointing out that the shared move descriptions are shared move descriptions

* Re-aligned one of the escape characters of CHECK_MOVE_FLAG

* Renamed the battle_moves.h file to moves_info.h instead for consistency's sake

* Applied Eduardo's adjustments

* Using compound string for regular move names as well, saving 1180 bytes and making their use consistent
* Move description formatting

* Updated Pursuit test after merge

* Renamed the BATTLE_CATEGORY constants to DAMAGE_CATEGORY

---------

Co-authored-by: Nephrite <thechurchofcage@gmail.com>
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
2024-01-29 08:51:32 -03:00

175 lines
6.4 KiB
C

#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Zero to Hero transforms Palafin when it switches out")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(player, 1); }
TURN { SWITCH(player, 0); }
} SCENE {
MESSAGE("Palafin, that's enough! Come back!");
MESSAGE("Go! Wobbuffet!");
MESSAGE("Wobbuffet, that's enough! Come back!");
MESSAGE("Go! Palafin!");
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); }
}
SINGLE_BATTLE_TEST("Zero to Hero can't be surpressed by Neutralizing Gas")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_KOFFING) { Ability(ABILITY_NEUTRALIZING_GAS); }
} WHEN {
TURN { SWITCH(player, 1); }
TURN { SWITCH(player, 0); }
} SCENE {
ABILITY_POPUP(opponent, ABILITY_NEUTRALIZING_GAS);
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); }
}
SINGLE_BATTLE_TEST("Zero to Hero transforms both player and opponent")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(player, 1); SWITCH(opponent, 1); }
TURN { SWITCH(player, 0); SWITCH(opponent, 0); }
} SCENE {
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
ABILITY_POPUP(opponent, ABILITY_ZERO_TO_HERO);
MESSAGE("Foe Palafin underwent a heroic transformation!");
} THEN {
EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO);
EXPECT_EQ(opponent->species, SPECIES_PALAFIN_HERO);
}
}
SINGLE_BATTLE_TEST("Zero to Hero will activate if a switch move is used")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_FLIP_TURN].effect == EFFECT_HIT_ESCAPE);
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_FLIP_TURN); SEND_OUT(player, 1); }
TURN { SWITCH(player, 0); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FLIP_TURN, player);
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); }
}
SINGLE_BATTLE_TEST("Gastro Acid, Worry Seed, and Simple Beam fail if the target has the Ability Zero to Hero")
{
u16 move;
PARAMETRIZE { move = MOVE_GASTRO_ACID; }
PARAMETRIZE { move = MOVE_WORRY_SEED; }
PARAMETRIZE { move = MOVE_SIMPLE_BEAM; }
GIVEN {
ASSUME(gMovesInfo[MOVE_GASTRO_ACID].effect == EFFECT_GASTRO_ACID);
ASSUME(gMovesInfo[MOVE_WORRY_SEED].effect == EFFECT_WORRY_SEED);
ASSUME(gMovesInfo[MOVE_SIMPLE_BEAM].effect == EFFECT_SIMPLE_BEAM);
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, move, player);
MESSAGE("But it failed!");
}
}
SINGLE_BATTLE_TEST("Role Play, Skill Swap, and Entrainment fail if either Pokémon has Zero to Hero")
{
u16 move;
PARAMETRIZE { move = MOVE_ROLE_PLAY; }
PARAMETRIZE { move = MOVE_SKILL_SWAP; }
PARAMETRIZE { move = MOVE_ENTRAINMENT; }
GIVEN {
ASSUME(gMovesInfo[MOVE_ROLE_PLAY].effect == EFFECT_ROLE_PLAY);
ASSUME(gMovesInfo[MOVE_SKILL_SWAP].effect == EFFECT_SKILL_SWAP);
ASSUME(gMovesInfo[MOVE_ENTRAINMENT].effect == EFFECT_ENTRAINMENT);
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, move, player);
MESSAGE("But it failed!");
}
}
SINGLE_BATTLE_TEST("Transform doesn't apply the heroic transformation message when copying Palafin")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(player, 1); }
TURN { SWITCH(player, 0); MOVE(opponent, MOVE_TRANSFORM); }
} SCENE {
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRANSFORM, opponent);
MESSAGE("Foe Wobbuffet transformed into Palafin!");
NOT ABILITY_POPUP(opponent, ABILITY_ZERO_TO_HERO);
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); }
}
SINGLE_BATTLE_TEST("Imposter doesn't apply the heroic transformation message when copying Palafin")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_DITTO) { Ability(ABILITY_IMPOSTER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(player, 1); SWITCH(opponent, 1); }
TURN { SWITCH(player, 0); SWITCH(opponent, 0); }
} SCENE {
ABILITY_POPUP(player, ABILITY_ZERO_TO_HERO);
MESSAGE("Palafin underwent a heroic transformation!");
ABILITY_POPUP(opponent, ABILITY_IMPOSTER);
MESSAGE("Foe Ditto transformed into Palafin using Imposter!");
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_ZERO_TO_HERO);
MESSAGE("Foe Ditto underwent a heroic transformation!");
}
} THEN { EXPECT_EQ(player->species, SPECIES_PALAFIN_HERO); }
}
// Write Trace test and move this one to that file (including every other ability that can't be copied)
SINGLE_BATTLE_TEST("Zero to Hero cannot be copied by Trace")
{
GIVEN {
PLAYER(SPECIES_PALAFIN_ZERO) { Ability(ABILITY_ZERO_TO_HERO); }
OPPONENT(SPECIES_RALTS) { Ability(ABILITY_TRACE); }
} WHEN {
TURN {}
} SCENE {
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_TRACE);
MESSAGE("Foe Ralts Traced Palafin's Zero to Hero!");
}
}
}