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

136 lines
6.4 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(MoveHasMoveEffect(MOVE_BUG_BITE, MOVE_EFFECT_BUG_BITE));
ASSUME(gMovesInfo[MOVE_BUG_BITE].pp == 20);
}
// Pretty much copy/paste of the Berry Fling Test.
SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its effect")
{
u16 item = ITEM_NONE;
u32 status1 = STATUS1_NONE, effect = HOLD_EFFECT_NONE, statId = 0;
PARAMETRIZE { item = ITEM_NONE; }
PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; }
PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; }
PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; }
PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; }
PARAMETRIZE { item = ITEM_PECHA_BERRY; effect = HOLD_EFFECT_CURE_PSN; status1 = STATUS1_POISON; }
PARAMETRIZE { item = ITEM_PECHA_BERRY; effect = HOLD_EFFECT_CURE_PSN; status1 = STATUS1_TOXIC_POISON; }
PARAMETRIZE { item = ITEM_RAWST_BERRY; effect = HOLD_EFFECT_CURE_BRN; status1 = STATUS1_BURN; }
PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FROSTBITE; }
PARAMETRIZE { item = ITEM_APICOT_BERRY; effect = HOLD_EFFECT_SP_DEFENSE_UP; statId = STAT_SPDEF; }
PARAMETRIZE { item = ITEM_MARANGA_BERRY; effect = HOLD_EFFECT_MARANGA_BERRY; statId = STAT_SPDEF; }
PARAMETRIZE { item = ITEM_GANLON_BERRY; effect = HOLD_EFFECT_DEFENSE_UP; statId = STAT_DEF; }
PARAMETRIZE { item = ITEM_KEE_BERRY; effect = HOLD_EFFECT_KEE_BERRY; statId = STAT_DEF; }
PARAMETRIZE { item = ITEM_LIECHI_BERRY; effect = HOLD_EFFECT_ATTACK_UP; statId = STAT_ATK; }
PARAMETRIZE { item = ITEM_PETAYA_BERRY; effect = HOLD_EFFECT_SP_ATTACK_UP; statId = STAT_SPATK; }
PARAMETRIZE { item = ITEM_SALAC_BERRY; effect = HOLD_EFFECT_SPEED_UP; statId = STAT_SPEED; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(399); MaxHP(400); Status1(status1); Moves(MOVE_SLEEP_TALK, MOVE_BUG_BITE); }
OPPONENT(SPECIES_WOBBUFFET) { Item(item); }
} WHEN {
// Chesto Berry can only be applied if the pokemon is asleep and uses Sleep Talk.
if (item == ITEM_CHESTO_BERRY) {
TURN { MOVE(player, MOVE_SLEEP_TALK); }
} else {
TURN { MOVE(player, MOVE_BUG_BITE); }
}
} SCENE {
if (item == ITEM_CHESTO_BERRY) {
MESSAGE("Wobbuffet used Sleep Talk!");
}
MESSAGE("Wobbuffet used Bug Bite!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player);
HP_BAR(opponent);
if (effect == HOLD_EFFECT_RESTORE_HP || effect == HOLD_EFFECT_ENIGMA_BERRY) {
if (item == ITEM_ORAN_BERRY) {
MESSAGE("Wobbuffet's Oran Berry restored health!");
} else if (item == ITEM_SITRUS_BERRY) {
MESSAGE("Wobbuffet's Sitrus Berry restored health!");
} else {
MESSAGE("Wobbuffet's Enigma Berry restored health!");
}
HP_BAR(player);
}
else if (effect == HOLD_EFFECT_RESTORE_PP) {
MESSAGE("Wobbuffet's Leppa Berry restored Bug Bite's PP!");
}
else if (status1 != STATUS1_NONE) {
if (status1 == STATUS1_BURN) {
MESSAGE("Wobbuffet's Rawst Berry healed its burn!");
} else if (status1 == STATUS1_SLEEP) {
MESSAGE("Wobbuffet's Chesto Berry woke it from its sleep!");
} else if (status1 == STATUS1_PARALYSIS) {
MESSAGE("Wobbuffet's Cheri Berry cured paralysis!");
} else if (status1 == STATUS1_TOXIC_POISON || status1 == STATUS1_POISON) {
MESSAGE("Wobbuffet's Pecha Berry cured poison!");
} else if (status1 == STATUS1_FROSTBITE) {
MESSAGE("Wobbuffet's Aspear Berry healed its frostbite!");
}
NOT STATUS_ICON(player, status1);
}
else if (statId != 0) {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
if (statId == STAT_ATK) {
MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!");
} else if (statId == STAT_DEF) {
if (item == ITEM_GANLON_BERRY) {
MESSAGE("Using Ganlon Berry, the Defense of Wobbuffet rose!");
} else {
MESSAGE("Using Kee Berry, the Defense of Wobbuffet rose!");
}
} else if (statId == STAT_SPDEF) {
if (item == ITEM_APICOT_BERRY) {
MESSAGE("Using Apicot Berry, the Sp. Def of Wobbuffet rose!");
} else {
MESSAGE("Using Maranga Berry, the Sp. Def of Wobbuffet rose!");
}
} else if (statId == STAT_SPEED) {
MESSAGE("Using Salac Berry, the Speed of Wobbuffet rose!");
} else if (statId == STAT_SPATK) {
MESSAGE("Using Petaya Berry, the Sp. Atk of Wobbuffet rose!");
}
}
} THEN {
if (effect == HOLD_EFFECT_RESTORE_HP) {
EXPECT_EQ(player->hp, player->maxHP);
} else if (effect == HOLD_EFFECT_RESTORE_PP) {
EXPECT_EQ(player->pp[1], 20);
} else if (status1 != STATUS1_NONE) {
EXPECT_EQ(player->status1, STATUS1_NONE);
}
else if (statId != 0) {
EXPECT_EQ(player->statStages[statId], DEFAULT_STAT_STAGE + 1);
}
EXPECT_EQ(opponent->item, ITEM_NONE); // Opponent's Berry was eaten.
}
}
SINGLE_BATTLE_TEST("Tanga Berry activates before Bug Bite")
{
GIVEN {
ASSUME(gItemsInfo[ITEM_TANGA_BERRY].holdEffect == HOLD_EFFECT_RESIST_BERRY);
ASSUME(gItemsInfo[ITEM_TANGA_BERRY].holdEffectParam == TYPE_BUG);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Item(ITEM_TANGA_BERRY); }
} WHEN {
TURN { MOVE(player, MOVE_BUG_BITE); }
} SCENE {
MESSAGE("Wobbuffet used Bug Bite!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Foe Wobbuffet ate its Tanga Berry!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player);
HP_BAR(opponent);
MESSAGE("Tanga Berry weakened the damage to Foe Wobbuffet!");
} THEN {
EXPECT_EQ(player->item, ITEM_NONE);
}
}