a64e1c63c1
* 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>
198 lines
7.3 KiB
C
198 lines
7.3 KiB
C
#include "global.h"
|
|
#include "test/battle.h"
|
|
|
|
ASSUMPTIONS
|
|
{
|
|
ASSUME(gMovesInfo[MOVE_STRENGTH_SAP].effect == EFFECT_STRENGTH_SAP);
|
|
}
|
|
|
|
SINGLE_BATTLE_TEST("Strength Sap lowers Attack by 1 and restores HP based on target's Attack Stat", s16 hp)
|
|
{
|
|
u32 atkStat = 0;
|
|
|
|
PARAMETRIZE{ atkStat = 100; }
|
|
PARAMETRIZE{ atkStat = 50; }
|
|
|
|
GIVEN {
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(200); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(atkStat); }
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
|
} SCENE {
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
HP_BAR(player, captureDamage: &results[i].hp);
|
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
|
} THEN {
|
|
EXPECT_EQ(results[i].hp * -1, atkStat);
|
|
}
|
|
}
|
|
|
|
// Same as above, but Substitute is used before Strength Sap.
|
|
SINGLE_BATTLE_TEST("Strength Sap works exactly the same when attacker is behind substitute", s16 hp)
|
|
{
|
|
u32 atkStat = 0;
|
|
|
|
PARAMETRIZE{ atkStat = 100; }
|
|
PARAMETRIZE{ atkStat = 50; }
|
|
|
|
GIVEN {
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(200); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(atkStat); }
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
|
} SCENE {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
HP_BAR(player, captureDamage: &results[i].hp);
|
|
NOT MESSAGE("The SUBSTITUTE took damage for Foe Wobbuffet!");
|
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
|
} THEN {
|
|
EXPECT_EQ(results[i].hp * -1, atkStat);
|
|
}
|
|
}
|
|
|
|
// This test checks all stat stages from -6 to +6.
|
|
SINGLE_BATTLE_TEST("Strength Sap lowers Attack by 1 and restores HP based on target's Attack Stat and stat Change", s16 hp)
|
|
{
|
|
s32 j = 0, statStage = 0;
|
|
|
|
for (j = 0; j <= MAX_STAT_STAGE; j++) {
|
|
if (j == DEFAULT_STAT_STAGE - 1) { continue; } // Ignore -6, because Strength Sap won't work otherwise
|
|
PARAMETRIZE{ statStage = j; }
|
|
}
|
|
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_WORK_UP].effect == EFFECT_ATTACK_SPATK_UP);
|
|
ASSUME(gMovesInfo[MOVE_GROWL].effect == EFFECT_ATTACK_DOWN);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(50); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(60); }
|
|
} WHEN {
|
|
if (statStage > DEFAULT_STAT_STAGE) { // +
|
|
for (j = statStage; j > DEFAULT_STAT_STAGE; j--) {
|
|
TURN { MOVE(opponent, MOVE_HOWL); }
|
|
}
|
|
} else if (statStage < DEFAULT_STAT_STAGE) { // -
|
|
for (j = statStage; j < DEFAULT_STAT_STAGE - 1; j++) { // - 1 because Strength Sap always lowers Attack
|
|
TURN { MOVE(player, MOVE_GROWL); }
|
|
}
|
|
}
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
|
} SCENE {
|
|
if (statStage > DEFAULT_STAT_STAGE) { // +
|
|
for (j = statStage; j > DEFAULT_STAT_STAGE; j--) {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_HOWL, opponent);
|
|
}
|
|
} else if (statStage < DEFAULT_STAT_STAGE) { // -
|
|
for (j = statStage; j < DEFAULT_STAT_STAGE - 1; j++) {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_GROWL, player);
|
|
}
|
|
}
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
HP_BAR(player, captureDamage: &results[i].hp);
|
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
|
} THEN {
|
|
if (statStage < DEFAULT_STAT_STAGE) {
|
|
EXPECT_EQ(results[i].hp * -1, (60 * gStatStageRatios[statStage + 1][0] / gStatStageRatios[statStage + 1][1]));
|
|
} else {
|
|
EXPECT_EQ(results[i].hp * -1, (60 * gStatStageRatios[statStage][0] / gStatStageRatios[statStage][1]));
|
|
}
|
|
} FINALLY {
|
|
// This makes sure gStatStageRatios works correctly and the lower the attack stage the lower hp obtained.
|
|
for (j = 0; j < MAX_STAT_STAGE - 1; j++) {
|
|
EXPECT_GT(abs(results[j + 1].hp), abs(results[j].hp));
|
|
}
|
|
}
|
|
}
|
|
|
|
SINGLE_BATTLE_TEST("Strength Sap fails if target is at -6 Atk")
|
|
{
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_CHARM].effect == EFFECT_ATTACK_DOWN_2);
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_CHARM); }
|
|
TURN { MOVE(player, MOVE_CHARM); }
|
|
TURN { MOVE(player, MOVE_CHARM); }
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
|
} SCENE {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
NONE_OF {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
HP_BAR(player);
|
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
|
}
|
|
MESSAGE("Foe Wobbuffet's Attack won't go lower!");
|
|
}
|
|
}
|
|
|
|
SINGLE_BATTLE_TEST("Strength Sap restores more HP if Big Root is held", s16 hp)
|
|
{
|
|
u32 item;
|
|
|
|
PARAMETRIZE { item = ITEM_NONE; }
|
|
PARAMETRIZE { item = ITEM_BIG_ROOT; }
|
|
|
|
GIVEN {
|
|
ASSUME(gItemsInfo[ITEM_BIG_ROOT].holdEffect == HOLD_EFFECT_BIG_ROOT);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(200); Item(item); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(100); }
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
|
} SCENE {
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
HP_BAR(player, captureDamage: &results[i].hp);
|
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
|
} FINALLY {
|
|
EXPECT_GT(abs(results[1].hp), abs(results[0].hp));
|
|
}
|
|
}
|
|
|
|
SINGLE_BATTLE_TEST("Strength Sap makes attacker lose HP if target's ability is Liquid Ooze")
|
|
{
|
|
s16 lostHp;
|
|
s32 atkStat;
|
|
|
|
PARAMETRIZE { atkStat = 100; }
|
|
PARAMETRIZE { atkStat = 490; } // Checks that attacker can faint with no problems.
|
|
|
|
GIVEN {
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(atkStat); Ability(ABILITY_LIQUID_OOZE); }
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); if (atkStat == 490) { SEND_OUT(player, 1); } }
|
|
} SCENE {
|
|
MESSAGE("Wobbuffet used Strength Sap!");
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
|
ABILITY_POPUP(opponent, ABILITY_LIQUID_OOZE);
|
|
HP_BAR(player, captureDamage: &lostHp);
|
|
MESSAGE("It sucked up the liquid ooze!");
|
|
if (atkStat >= 490) {
|
|
MESSAGE("Wobbuffet fainted!");
|
|
MESSAGE("Go! Wobbuffet!");
|
|
}
|
|
} THEN {
|
|
EXPECT_EQ(lostHp, atkStat);
|
|
}
|
|
}
|