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

332 lines
13 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_WATER_PLEDGE].effect == EFFECT_PLEDGE);
ASSUME(gMovesInfo[MOVE_FIRE_PLEDGE].effect == EFFECT_PLEDGE);
ASSUME(gMovesInfo[MOVE_GRASS_PLEDGE].effect == EFFECT_PLEDGE);
}
DOUBLE_BATTLE_TEST("Water and Fire Pledge create a rainbow on the user's side of the field for four turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_FIRE_PLEDGE, target: opponentRight);
}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Wobbuffet used Water Pledge!");
MESSAGE("Wobbuffet is waiting for Wynaut's move…{PAUSE 16}");
MESSAGE("Wynaut used Fire Pledge!");
MESSAGE("The two moves become one! It's a combined move!{PAUSE 16}");
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerRight);
HP_BAR(opponentRight);
MESSAGE("A rainbow appeared in the sky on your team's side!");
MESSAGE("The rainbow on your side disappeared!");
}
}
DOUBLE_BATTLE_TEST("Rainbow doubles the chance of secondary move effects")
{
PASSES_RANDOMLY(20, 100, RNG_SECONDARY_EFFECT);
GIVEN {
ASSUME(MoveHasMoveEffect(MOVE_EMBER, MOVE_EFFECT_BURN) == TRUE);
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_FIRE_PLEDGE, target: opponentRight);
}
TURN { MOVE(playerLeft, MOVE_EMBER, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, playerLeft);
MESSAGE("Foe Wynaut was burned!");
}
}
DOUBLE_BATTLE_TEST("Rainbow flinch chance does not stack with Serene Grace")
{
PASSES_RANDOMLY(60, 100, RNG_SECONDARY_EFFECT);
GIVEN {
ASSUME(MoveHasMoveEffect(MOVE_BITE, MOVE_EFFECT_FLINCH) == TRUE);
PLAYER(SPECIES_TOGEPI) { Speed(8); Ability(ABILITY_SERENE_GRACE); }
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(4); }
OPPONENT(SPECIES_WYNAUT) { Speed(3); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_FIRE_PLEDGE, target: opponentRight);
}
TURN { MOVE(playerLeft, MOVE_BITE, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BITE, playerLeft);
MESSAGE("Foe Wynaut flinched!");
}
}
DOUBLE_BATTLE_TEST("Fire and Grass Pledge summons Sea Of Fire for four turns that damages the opponent")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_GRASS_PLEDGE, target: opponentRight);
}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Wobbuffet used Fire Pledge!");
MESSAGE("Wobbuffet is waiting for Wynaut's move…{PAUSE 16}");
MESSAGE("Wynaut used Grass Pledge!");
MESSAGE("The two moves become one! It's a combined move!{PAUSE 16}");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerRight);
HP_BAR(opponentRight);
MESSAGE("A sea of fire enveloped the opposing team!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SEA_OF_FIRE, opponentRight);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentLeft);
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentRight);
MESSAGE("The opposing Foe Wynaut was hurt by the sea of fire!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentLeft);
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentRight);
MESSAGE("The opposing Foe Wynaut was hurt by the sea of fire!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentLeft);
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentRight);
MESSAGE("The opposing Foe Wynaut was hurt by the sea of fire!");
MESSAGE("The sea of fire around the opposing team disappeared!");
}
}
DOUBLE_BATTLE_TEST("Sea Of Fire deals 1/8th damage per turn")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_GRASS_PLEDGE, target: opponentRight);
}
} SCENE {
s32 maxHPopponentLeft = GetMonData(&OPPONENT_PARTY[0], MON_DATA_MAX_HP);
s32 maxHPopponentRight = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP);
HP_BAR(opponentLeft, damage: maxHPopponentLeft / 8);
HP_BAR(opponentRight, damage: maxHPopponentRight / 8);
}
}
DOUBLE_BATTLE_TEST("Grass and Water Pledge create a swamp on the user's side of the field for four turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_WATER_PLEDGE, target: opponentRight);
}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Wobbuffet used Grass Pledge!");
MESSAGE("Wobbuffet is waiting for Wynaut's move…{PAUSE 16}");
MESSAGE("Wynaut used Water Pledge!");
MESSAGE("The two moves become one! It's a combined move!{PAUSE 16}");
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerRight);
HP_BAR(opponentRight);
MESSAGE("A swamp enveloped the opposing team!");
MESSAGE("The swamp around the opposing team disappeared!");
}
}
DOUBLE_BATTLE_TEST("Swamp reduces the speed of the effected side by 1/4th")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
PLAYER(SPECIES_WYNAUT) { Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(12); }
OPPONENT(SPECIES_WYNAUT) { Speed(8); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_WATER_PLEDGE, target: opponentRight);
}
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentRight);
}
}
DOUBLE_BATTLE_TEST("The base power of a combined pledge move effect is 150")
{
s16 hyperBeamDamage;
s16 combinedPledgeDamage;
GIVEN {
ASSUME(gMovesInfo[MOVE_HYPER_BEAM].power == 150);
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(opponentRight, MOVE_HYPER_BEAM, target: playerRight);
MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_FIRE_PLEDGE, target: opponentRight);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPER_BEAM, opponentRight);
HP_BAR(playerRight, captureDamage: &hyperBeamDamage);
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerRight);
HP_BAR(opponentRight, captureDamage: &combinedPledgeDamage);
} THEN {
EXPECT_EQ(hyperBeamDamage, combinedPledgeDamage);
}
}
DOUBLE_BATTLE_TEST("Pledge moves can not be redirected by absorbing abilities")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_LILEEP) { Ability(ABILITY_STORM_DRAIN); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_WATER_PLEDGE, target: opponentRight);}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_PLEDGE, playerLeft);
HP_BAR(opponentRight);
}
}
DOUBLE_BATTLE_TEST("Pledge status timer does not reset if combined move is used again")
{
u16 pledgeMove1, pledgeMove2;
PARAMETRIZE { pledgeMove1 = MOVE_WATER_PLEDGE; pledgeMove2 = MOVE_FIRE_PLEDGE; }
PARAMETRIZE { pledgeMove1 = MOVE_FIRE_PLEDGE; pledgeMove2 = MOVE_GRASS_PLEDGE; }
PARAMETRIZE { pledgeMove1 = MOVE_GRASS_PLEDGE; pledgeMove2 = MOVE_WATER_PLEDGE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, pledgeMove1, target: opponentLeft);
MOVE(playerRight, pledgeMove2, target: opponentRight);
}
TURN { MOVE(playerLeft, pledgeMove1, target: opponentLeft);
MOVE(playerRight, pledgeMove2, target: opponentRight);
}
TURN {}
TURN {}
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, pledgeMove1, playerRight);
ANIMATION(ANIM_TYPE_MOVE, pledgeMove1, playerRight);
if (pledgeMove1 == MOVE_WATER_PLEDGE && pledgeMove2 == MOVE_FIRE_PLEDGE)
{
NOT MESSAGE("A rainbow appeared in the sky on your team's side!");
MESSAGE("The rainbow on your side disappeared!");
}
if (pledgeMove1 == MOVE_FIRE_PLEDGE && pledgeMove2 == MOVE_GRASS_PLEDGE)
{
NOT MESSAGE("A sea of fire enveloped the opposing team!");
MESSAGE("The sea of fire around the opposing team disappeared!");
}
if (pledgeMove1 == MOVE_GRASS_PLEDGE && pledgeMove2 == MOVE_WATER_PLEDGE)
{
NOT MESSAGE("A swamp enveloped the opposing team!");
MESSAGE("The swamp around the opposing team disappeared!");
}
}
}
DOUBLE_BATTLE_TEST("Pledge moves get same attack type bonus from partner", s16 damage)
{
u32 species;
PARAMETRIZE { species = SPECIES_WOBBUFFET; }
PARAMETRIZE { species = SPECIES_CHARMANDER; }
GIVEN {
PLAYER(species) { Speed(4); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(8); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentLeft);
MOVE(playerRight, MOVE_GRASS_PLEDGE, target: opponentRight);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerRight);
HP_BAR(opponentRight, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage);
}
}
DOUBLE_BATTLE_TEST("Damage calculation: Combined pledge move")
{
s16 dmg;
s16 expectedDamage;
PARAMETRIZE { expectedDamage = 159; }
PARAMETRIZE { expectedDamage = 156; }
PARAMETRIZE { expectedDamage = 154; }
PARAMETRIZE { expectedDamage = 153; }
PARAMETRIZE { expectedDamage = 151; }
PARAMETRIZE { expectedDamage = 150; }
PARAMETRIZE { expectedDamage = 148; }
PARAMETRIZE { expectedDamage = 147; }
PARAMETRIZE { expectedDamage = 145; }
PARAMETRIZE { expectedDamage = 144; }
PARAMETRIZE { expectedDamage = 142; }
PARAMETRIZE { expectedDamage = 141; }
PARAMETRIZE { expectedDamage = 139; }
PARAMETRIZE { expectedDamage = 138; }
PARAMETRIZE { expectedDamage = 136; }
PARAMETRIZE { expectedDamage = 135; }
GIVEN {
ASSUME(gMovesInfo[MOVE_GRASS_PLEDGE].category == DAMAGE_CATEGORY_SPECIAL);
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WOBBUFFET) { HP(521); SpDefense(152); Speed(3); }
OPPONENT(SPECIES_CHARIZARD) { Speed(8); }
OPPONENT(SPECIES_EEVEE) { SpAttack(126); Speed(5); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_FIRE_PLEDGE, target: playerLeft, WITH_RNG(RNG_DAMAGE_MODIFIER, i));
MOVE(opponentRight, MOVE_GRASS_PLEDGE, target: playerRight, WITH_RNG(RNG_DAMAGE_MODIFIER, i));
}
}
SCENE {
HP_BAR(playerRight, captureDamage: &dmg);
}
THEN {
EXPECT_EQ(expectedDamage, dmg);
}
}