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>
194 lines
7.6 KiB
C
194 lines
7.6 KiB
C
#include "global.h"
|
|
#include "test/battle.h"
|
|
#include "battle_ai_util.h"
|
|
|
|
ASSUMPTIONS
|
|
{
|
|
ASSUME(MoveHasMoveEffect(MOVE_BODY_SLAM, MOVE_EFFECT_PARALYSIS) == TRUE);
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Facade")
|
|
{
|
|
u16 status1, expectedMove;
|
|
|
|
PARAMETRIZE { status1 = STATUS1_NONE; expectedMove = MOVE_BODY_SLAM; }
|
|
PARAMETRIZE { status1 = STATUS1_BURN; expectedMove = MOVE_FACADE; }
|
|
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_FACADE].effect == EFFECT_FACADE);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(60); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_BODY_SLAM, MOVE_FACADE); Status1(status1); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, expectedMove); }
|
|
} SCENE {
|
|
if (expectedMove == MOVE_FACADE)
|
|
MESSAGE("Wobbuffet fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Smelling Salt")
|
|
{
|
|
u16 status1, expectedMove;
|
|
|
|
PARAMETRIZE { status1 = STATUS1_NONE; expectedMove = MOVE_BODY_SLAM; }
|
|
PARAMETRIZE { status1 = STATUS1_PARALYSIS; expectedMove = MOVE_SMELLING_SALTS; }
|
|
|
|
GIVEN {
|
|
ASSUME(B_UPDATED_MOVE_DATA >= GEN_6);
|
|
ASSUME(gMovesInfo[MOVE_SMELLING_SALTS].effect == EFFECT_DOUBLE_POWER_ON_ARG_STATUS);
|
|
ASSUME(gMovesInfo[MOVE_SMELLING_SALTS].argument == STATUS1_PARALYSIS);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(60); Status1(status1); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_BODY_SLAM, MOVE_SMELLING_SALTS); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, expectedMove); }
|
|
} SCENE {
|
|
if (expectedMove == MOVE_SMELLING_SALTS)
|
|
MESSAGE("Wobbuffet fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Wake Up Slap")
|
|
{
|
|
u16 status1, expectedMove;
|
|
|
|
PARAMETRIZE { status1 = STATUS1_NONE; expectedMove = MOVE_BODY_SLAM; }
|
|
PARAMETRIZE { status1 = STATUS1_SLEEP; expectedMove = MOVE_WAKE_UP_SLAP; }
|
|
|
|
GIVEN {
|
|
ASSUME(B_UPDATED_MOVE_DATA >= GEN_6);
|
|
ASSUME(gMovesInfo[MOVE_WAKE_UP_SLAP].effect == EFFECT_DOUBLE_POWER_ON_ARG_STATUS);
|
|
ASSUME(gMovesInfo[MOVE_WAKE_UP_SLAP].argument == STATUS1_SLEEP);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_MEGANIUM) { HP(35); Status1(status1); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_BODY_SLAM, MOVE_WAKE_UP_SLAP); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, expectedMove); }
|
|
} SCENE {
|
|
if (expectedMove == MOVE_WAKE_UP_SLAP)
|
|
MESSAGE("Meganium fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Grav Apple")
|
|
{
|
|
u32 movePlayer;
|
|
u16 expectedMove;
|
|
|
|
PARAMETRIZE { movePlayer = MOVE_CELEBRATE; expectedMove = MOVE_DRUM_BEATING; }
|
|
PARAMETRIZE { movePlayer = MOVE_GRAVITY; expectedMove = MOVE_GRAV_APPLE; }
|
|
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_GRAV_APPLE].effect == EFFECT_GRAV_APPLE);
|
|
ASSUME(gMovesInfo[MOVE_GRAV_APPLE].power == gMovesInfo[MOVE_DRUM_BEATING].power);
|
|
ASSUME(MoveHasMoveEffect(MOVE_DRUM_BEATING, MOVE_EFFECT_SPD_MINUS_1) == TRUE);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(81); Speed(20); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Speed(10); Moves(MOVE_DRUM_BEATING, MOVE_GRAV_APPLE); }
|
|
} WHEN {
|
|
TURN { MOVE(player, movePlayer); EXPECT_MOVE(opponent, MOVE_DRUM_BEATING); }
|
|
TURN { MOVE(player, MOVE_CELEBRATE); EXPECT_MOVE(opponent, expectedMove); }
|
|
} SCENE {
|
|
if (expectedMove == MOVE_GRAV_APPLE)
|
|
MESSAGE("Wobbuffet fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Flail")
|
|
{
|
|
u16 hp, expectedMove;
|
|
|
|
PARAMETRIZE { hp = 490; expectedMove = MOVE_BODY_SLAM; }
|
|
PARAMETRIZE { hp = 5; expectedMove = MOVE_FLAIL; }
|
|
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_FLAIL].effect == EFFECT_FLAIL);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { Speed(10); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { HP(hp); MaxHP(490); Speed(20); Moves(MOVE_BODY_SLAM, MOVE_FLAIL); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, expectedMove); }
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI will only use Dream Eater if target is asleep")
|
|
{
|
|
u16 status1, expectedMove;
|
|
|
|
PARAMETRIZE { status1 = STATUS1_NONE; expectedMove = MOVE_BODY_SLAM; }
|
|
PARAMETRIZE { status1 = STATUS1_SLEEP; expectedMove = MOVE_DREAM_EATER; }
|
|
|
|
GIVEN {
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_MEGANIUM) { HP(38); Status1(status1); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_BODY_SLAM, MOVE_DREAM_EATER); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, expectedMove); }
|
|
} SCENE {
|
|
if (expectedMove == MOVE_DREAM_EATER)
|
|
MESSAGE("Meganium fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI sees increased base power of Spit Up")
|
|
{
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_STOCKPILE].effect == EFFECT_STOCKPILE);
|
|
ASSUME(gMovesInfo[MOVE_SPIT_UP].effect == EFFECT_SPIT_UP);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(43); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_STOCKPILE, MOVE_SPIT_UP, MOVE_TACKLE); }
|
|
} WHEN {
|
|
TURN { EXPECT_MOVE(opponent, MOVE_STOCKPILE); }
|
|
TURN { EXPECT_MOVE(opponent, MOVE_SPIT_UP); }
|
|
} SCENE {
|
|
MESSAGE("Wobbuffet fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI can choose Counter or Mirror Coat if the predicted move split is correct and user doesn't faint")
|
|
{
|
|
u16 playerMove = MOVE_NONE, opponentMove = MOVE_NONE;
|
|
|
|
PARAMETRIZE { playerMove = MOVE_STRENGTH; opponentMove = MOVE_COUNTER; }
|
|
PARAMETRIZE { playerMove = MOVE_POWER_GEM; opponentMove = MOVE_MIRROR_COAT; }
|
|
|
|
GIVEN {
|
|
ASSUME(gMovesInfo[MOVE_COUNTER].effect == EFFECT_COUNTER);
|
|
ASSUME(gMovesInfo[MOVE_MIRROR_COAT].effect == EFFECT_MIRROR_COAT);
|
|
ASSUME(gMovesInfo[MOVE_STRENGTH].category == DAMAGE_CATEGORY_PHYSICAL);
|
|
ASSUME(gMovesInfo[MOVE_POWER_GEM].category == DAMAGE_CATEGORY_SPECIAL);
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_WOBBUFFET) { Speed(1); }
|
|
OPPONENT(SPECIES_WOBBUFFET) { HP(102); Speed(100); Moves(opponentMove, MOVE_STRENGTH); }
|
|
} WHEN {
|
|
TURN { MOVE(player, playerMove); EXPECT_MOVE(opponent, MOVE_STRENGTH); }
|
|
TURN { MOVE(player, playerMove); EXPECT_MOVE(opponent, opponentMove); }
|
|
TURN { MOVE(player, playerMove); EXPECT_MOVE(opponent, MOVE_STRENGTH); }
|
|
} SCENE {
|
|
MESSAGE("Foe Wobbuffet fainted!");
|
|
}
|
|
}
|
|
|
|
AI_SINGLE_BATTLE_TEST("AI chooses moves with secondary effect that have a 100% chance to trigger")
|
|
{
|
|
u16 ability;
|
|
|
|
PARAMETRIZE { ability = ABILITY_NONE; }
|
|
PARAMETRIZE { ability = ABILITY_SERENE_GRACE; }
|
|
|
|
GIVEN {
|
|
AI_LOG;
|
|
ASSUME(MoveHasMoveEffectWithChance(MOVE_SHADOW_BALL, MOVE_EFFECT_SP_DEF_MINUS_1, 20));
|
|
ASSUME(MoveHasMoveEffectWithChance(MOVE_OCTAZOOKA, MOVE_EFFECT_ACC_MINUS_1, 50));
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
PLAYER(SPECIES_REGICE);
|
|
OPPONENT(SPECIES_REGIROCK) { Ability(ability); Moves(MOVE_SHADOW_BALL, MOVE_OCTAZOOKA); }
|
|
} WHEN {
|
|
if (ability == ABILITY_NONE)
|
|
TURN { EXPECT_MOVE(opponent, MOVE_SHADOW_BALL); }
|
|
else
|
|
TURN { EXPECT_MOVES(opponent, MOVE_OCTAZOOKA); }
|
|
}
|
|
}
|