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

234 lines
9.7 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_STICKY_WEB].effect == EFFECT_STICKY_WEB);
}
SINGLE_BATTLE_TEST("Sticky Web lowers Speed by 1 on switch-in")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(player, MOVE_STICKY_WEB); }
TURN { SWITCH(opponent, 1); }
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, player);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
MESSAGE("2 sent out Wynaut!");
MESSAGE("Foe Wynaut was caught in a Sticky Web!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Wynaut's Speed fell!");
}
}
SINGLE_BATTLE_TEST("Sticky Web can only be set up 1 time")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STICKY_WEB); }
TURN { MOVE(player, MOVE_STICKY_WEB); }
} SCENE {
MESSAGE("Wobbuffet used Sticky Web!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, player);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
MESSAGE("Wobbuffet used Sticky Web!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, player);
MESSAGE("But it failed!");
}
}
DOUBLE_BATTLE_TEST("Sticky Web lowers Speed by 1 in a double battle after Explosion fainting both mons")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION);
PLAYER(SPECIES_WOBBUFFET) {Speed(5);}
PLAYER(SPECIES_WOBBUFFET) {HP(1500); Speed(10);}
PLAYER(SPECIES_WOBBUFFET) {Speed(10);}
OPPONENT(SPECIES_WOBBUFFET) {HP(1); Speed(1);}
OPPONENT(SPECIES_WOBBUFFET) {HP(1); Speed(1);}
OPPONENT(SPECIES_WYNAUT) {Speed(10);}
OPPONENT(SPECIES_WYNAUT) {Speed(10);}
} WHEN {
TURN { MOVE(playerRight, MOVE_STICKY_WEB); MOVE(playerLeft, MOVE_EXPLOSION); SEND_OUT(playerLeft, 2); SEND_OUT(opponentLeft, 2); SEND_OUT(opponentRight, 3); }
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, playerRight);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, playerLeft);
MESSAGE("2 sent out Wynaut!");
MESSAGE("Foe Wynaut was caught in a Sticky Web!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft);
MESSAGE("Foe Wynaut's Speed fell!");
MESSAGE("2 sent out Wynaut!");
MESSAGE("Foe Wynaut was caught in a Sticky Web!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight);
MESSAGE("Foe Wynaut's Speed fell!");
}
}
SINGLE_BATTLE_TEST("Sticky Web raises Speed by 1 for a Pokemon with Contrary")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SHUCKLE) { Ability(ABILITY_CONTRARY); }
} WHEN {
TURN { MOVE(player, MOVE_STICKY_WEB); }
TURN { SWITCH(opponent, 1); }
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, player);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
MESSAGE("2 sent out Shuckle!");
MESSAGE("Foe Shuckle was caught in a Sticky Web!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Shuckle's Speed rose!");
}
}
#define BATTLER_OPPONENT (opponentSetUpper == 0 ? opponentLeft : opponentRight)
#define BATTLER_PLAYER (playerSetUpper == 0 ? playerLeft : playerRight)
DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - the battler which set up Sticky Web has its Speed lowered instead")
{
u8 playerSetUpper, opponentSetUpper; // 0 left, 1 right
PARAMETRIZE {playerSetUpper = 0; opponentSetUpper = 0; }
PARAMETRIZE {playerSetUpper = 0; opponentSetUpper = 1; }
PARAMETRIZE {playerSetUpper = 1; opponentSetUpper = 0; }
PARAMETRIZE {playerSetUpper = 1; opponentSetUpper = 1; }
GIVEN {
PLAYER(SPECIES_SQUIRTLE);
PLAYER(SPECIES_CHARMANDER);
PLAYER(SPECIES_CORVIKNIGHT) { Ability(ABILITY_MIRROR_ARMOR); Item(ITEM_IRON_BALL); } // Iron Ball, so that flying type Corviknight is affected by Sticky Web.
OPPONENT(SPECIES_CATERPIE);
OPPONENT(SPECIES_WEEDLE);
} WHEN {
TURN { MOVE(BATTLER_OPPONENT, MOVE_STICKY_WEB); }
TURN { MOVE(BATTLER_PLAYER, MOVE_STICKY_WEB); }
TURN { SWITCH(playerRight, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, BATTLER_OPPONENT);
MESSAGE("A sticky web spreads out on the ground around your team!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, BATTLER_PLAYER);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
MESSAGE("Go! Corviknigh!");
MESSAGE("Corviknigh was caught in a Sticky Web!");
ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, BATTLER_OPPONENT);
if (opponentSetUpper == 0) {
MESSAGE("Foe Caterpie's Speed fell!");
} else {
MESSAGE("Foe Weedle's Speed fell!");
}
}
}
#undef BATTLER_OPPONENT
#undef BATTLER_PLAYER
DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - no one has their Speed lowered if the set upper switched")
{
u16 speedPlayer, speedOpponent;
// We need to make sure Sticky Web user saves for both sides, so it doesn't matter who sets it first.
PARAMETRIZE { speedPlayer = 5; speedOpponent = 10; }
PARAMETRIZE { speedPlayer = 10; speedOpponent = 5; }
GIVEN {
PLAYER(SPECIES_SQUIRTLE) { Speed(speedPlayer); }
PLAYER(SPECIES_CHARMANDER) { Speed(speedPlayer); }
PLAYER(SPECIES_CORVIKNIGHT) { Ability(ABILITY_MIRROR_ARMOR); Item(ITEM_IRON_BALL); Speed(speedOpponent); } // Iron Ball, so that flying type Corviknight is affected by Sticky Web.
OPPONENT(SPECIES_CATERPIE) { Speed(speedOpponent); }
OPPONENT(SPECIES_WEEDLE) { Speed(speedOpponent); }
OPPONENT(SPECIES_PIDGEY) { Speed(speedOpponent); } // Flying type,so not affected by Sticky Web.
} WHEN {
TURN { MOVE(opponentLeft, MOVE_STICKY_WEB); MOVE(playerRight, MOVE_STICKY_WEB); }
TURN { SWITCH(opponentLeft, 2); }
TURN { SWITCH(playerRight, 2); }
} SCENE {
if (speedPlayer > speedOpponent) {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, playerRight);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, opponentLeft);
MESSAGE("A sticky web spreads out on the ground around your team!");
} else {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, opponentLeft);
MESSAGE("A sticky web spreads out on the ground around your team!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, playerRight);
MESSAGE("A sticky web spreads out on the ground around the opposing team!");
}
MESSAGE("Go! Corviknigh!");
MESSAGE("Corviknigh was caught in a Sticky Web!");
ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR);
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft);
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
EXPECT_EQ(playerRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
EXPECT_EQ(opponentLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
EXPECT_EQ(opponentRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
}
}
DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - no one has their Speed lowered if the set upper fainted")
{
bool8 hasReplacement;
// We need to make sure Sticky Web user saves for both sides, so it doesn't matter who sets it first.
PARAMETRIZE {hasReplacement = TRUE;}
PARAMETRIZE {hasReplacement = FALSE;}
GIVEN {
ASSUME(gMovesInfo[MOVE_MEMENTO].effect == EFFECT_MEMENTO);
PLAYER(SPECIES_SQUIRTLE) {Speed(5); }
PLAYER(SPECIES_CHARMANDER) {Speed(5); }
PLAYER(SPECIES_CORVIKNIGHT) {Ability(ABILITY_MIRROR_ARMOR); Item(ITEM_IRON_BALL); Speed(5); } // Iron Ball, so that flying type Corviknight is affected by Sticky Web.
OPPONENT(SPECIES_CATERPIE) {Speed(7); }
OPPONENT(SPECIES_WEEDLE) {Speed(7); }
if (hasReplacement) {
OPPONENT(SPECIES_PIDGEY) {Speed(7); }
}
} WHEN {
TURN { MOVE(opponentLeft, MOVE_STICKY_WEB); }
if (hasReplacement) {
TURN { MOVE(opponentLeft, MOVE_MEMENTO, target:playerLeft); SEND_OUT(opponentLeft, 2); }
} else {
TURN { MOVE(opponentLeft, MOVE_MEMENTO, target:playerLeft);}
}
TURN { SWITCH(playerRight, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, opponentLeft);
MESSAGE("A sticky web spreads out on the ground around your team!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_MEMENTO, opponentLeft);
MESSAGE("Foe Caterpie fainted!");
if (hasReplacement) {
MESSAGE("2 sent out Pidgey!");
}
MESSAGE("Go! Corviknigh!");
MESSAGE("Corviknigh was caught in a Sticky Web!");
ABILITY_POPUP(playerRight, ABILITY_MIRROR_ARMOR);
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft);
} THEN {
if (hasReplacement) {
EXPECT_EQ(opponentLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
}
EXPECT_EQ(playerLeft->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
EXPECT_EQ(playerRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
EXPECT_EQ(opponentRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
}
}