Merge pull request #1397 from GriffinRichards/doc-moremisc

Clean up battle scripts
This commit is contained in:
GriffinR
2021-04-10 12:41:35 -04:00
committed by GitHub
36 changed files with 1468 additions and 1097 deletions

View File

@@ -40,16 +40,17 @@
#define MAX_TRAINER_ITEMS 4
// array entries for battle communication
#define MULTIUSE_STATE 0x0
#define CURSOR_POSITION 0x1
#define TASK_ID 0x1 // task Id and cursor position share the same field
#define SPRITES_INIT_STATE1 0x1 // shares the Id as well
#define SPRITES_INIT_STATE2 0x2
#define MOVE_EFFECT_BYTE 0x3
#define ACTIONS_CONFIRMED_COUNT 0x4
#define MULTISTRING_CHOOSER 0x5
#define MSG_DISPLAY 0x7
#define BATTLE_COMMUNICATION_ENTRIES_COUNT 0x8
#define MULTIUSE_STATE 0
#define CURSOR_POSITION 1
#define TASK_ID 1 // task Id and cursor position share the same field
#define SPRITES_INIT_STATE1 1 // shares the Id as well
#define SPRITES_INIT_STATE2 2
#define MOVE_EFFECT_BYTE 3
#define ACTIONS_CONFIRMED_COUNT 4
#define MULTISTRING_CHOOSER 5
#define MISS_TYPE 6
#define MSG_DISPLAY 7
#define BATTLE_COMMUNICATION_ENTRIES_COUNT 8
#define MOVE_TARGET_SELECTED 0x0
#define MOVE_TARGET_DEPENDS 0x1

View File

@@ -7,10 +7,30 @@ enum
AI_ITEM_HEAL_HP,
AI_ITEM_CURE_CONDITION,
AI_ITEM_X_STAT,
AI_ITEM_GUARD_SPECS,
AI_ITEM_GUARD_SPEC,
AI_ITEM_NOT_RECOGNIZABLE
};
enum {
AI_HEAL_CONFUSION,
AI_HEAL_PARALYSIS,
AI_HEAL_FREEZE,
AI_HEAL_BURN,
AI_HEAL_POISON,
AI_HEAL_SLEEP,
};
enum {
AI_X_ATTACK,
AI_X_DEFEND,
AI_X_SPEED,
AI_X_SPATK,
AI_X_SPDEF, // Unused
AI_X_ACCURACY,
AI_X_EVASION, // Unused
AI_DIRE_HIT,
};
void AI_TrySwitchOrUseItem(void);
u8 GetMostSuitableMonToSwitchInto(void);

View File

@@ -156,7 +156,7 @@ enum
CONTROLLER_CLEARUNKFLAG,
CONTROLLER_TOGGLEUNKFLAG,
CONTROLLER_HITANIMATION,
CONTROLLER_42,
CONTROLLER_CANTSWITCH,
CONTROLLER_PLAYSE,
CONTROLLER_PLAYFANFAREORBGM,
CONTROLLER_FAINTINGCRY,
@@ -227,7 +227,7 @@ void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused
void BtlController_EmitClearUnkFlag(u8 bufferId); // unused
void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused
void BtlController_EmitHitAnimation(u8 bufferId);
void BtlController_EmitCmd42(u8 bufferId);
void BtlController_EmitCantSwitch(u8 bufferId);
void BtlController_EmitPlaySE(u8 bufferId, u16 songId);
void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM);
void BtlController_EmitFaintingCry(u8 bufferId);

View File

@@ -223,7 +223,6 @@ extern const u8* const gBattleStringsTable[];
extern const u8* const gStatNamesTable[];
extern const u8* const gPokeblockWasTooXStringTable[];
extern const u8* const gRefereeStringsTable[];
extern const u8* const gStatNamesTable2[];
extern const u8 *const gRoundsStringTable[];
extern const u8 gText_PkmnIsEvolving[];
@@ -269,7 +268,7 @@ extern const u8 gText_Win[];
extern const u8 gText_Loss[];
extern const u8 gText_Draw[];
extern const u8 gText_StatRose[];
extern const u8 gText_PkmnsStatChanged2[];
extern const u8 gText_DefendersStatRose[];
extern const u8 gText_PkmnGettingPumped[];
extern const u8 gText_PkmnShroudedInMist[];
extern const u8 gText_PkmnsXPreventsSwitching[];

View File

@@ -302,4 +302,8 @@
#define BATTLE_TERRAIN_BUILDING 8
#define BATTLE_TERRAIN_PLAIN 9
#define B_WAIT_TIME_LONG 64
#define B_WAIT_TIME_MED 48
#define B_WAIT_TIME_SHORT 32
#endif // GUARD_CONSTANTS_BATTLE_H

View File

@@ -32,14 +32,17 @@
#define cEFFECT_CHOOSER gBattleCommunication + 3
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
#define cMISS_TYPE gBattleCommunication + 6
// Battle Script defines for getting the wanted battler
#define BS_TARGET 0
#define BS_ATTACKER 1
#define BS_EFFECT_BATTLER 2
#define BS_FAINTED 3
#define BS_BATTLER_0 7
#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon
#define BS_UNK_5 5
#define BS_UNK_6 6
#define BS_BATTLER_0 7
#define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability
#define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability
#define BS_SCRIPTING 10
@@ -54,12 +57,12 @@
#define ACC_CURR_MOVE 0
// compare operands
#define CMP_EQUAL 0x0
#define CMP_NOT_EQUAL 0x1
#define CMP_GREATER_THAN 0x2
#define CMP_LESS_THAN 0x3
#define CMP_COMMON_BITS 0x4
#define CMP_NO_COMMON_BITS 0x5
#define CMP_EQUAL 0
#define CMP_NOT_EQUAL 1
#define CMP_GREATER_THAN 2
#define CMP_LESS_THAN 3
#define CMP_COMMON_BITS 4
#define CMP_NO_COMMON_BITS 5
// Cmd_various
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
@@ -92,27 +95,29 @@
#define DMG_DOUBLED 2
// Cmd_jumpifcantswitch
#define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80
#define SWITCH_IGNORE_ESCAPE_PREVENTION (1 << 7)
// Cmd_statbuffchange
#define STAT_BUFF_ALLOW_PTR 0x1 // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_BUFF_NOT_PROTECT_AFFECTED 0x20
#define STAT_BUFF_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_BUFF_NOT_PROTECT_AFFECTED (1 << 5)
// stat change flags for Cmd_playstatchangeanimation
#define STAT_CHANGE_NEGATIVE 0x1
#define STAT_CHANGE_BY_TWO 0x2
#define STAT_CHANGE_MULTIPLE_STATS 0x4
#define STAT_CHANGE_CANT_PREVENT 0x8
#define STAT_CHANGE_NEGATIVE (1 << 0)
#define STAT_CHANGE_BY_TWO (1 << 1)
#define STAT_CHANGE_MULTIPLE_STATS (1 << 2)
#define STAT_CHANGE_CANT_PREVENT (1 << 3)
// stat flags for Cmd_playstatchangeanimation
#define BIT_HP 0x1
#define BIT_ATK 0x2
#define BIT_DEF 0x4
#define BIT_SPEED 0x8
#define BIT_SPATK 0x10
#define BIT_SPDEF 0x20
#define BIT_ACC 0x40
#define BIT_EVASION 0x80
#define BIT_HP (1 << 0)
#define BIT_ATK (1 << 1)
#define BIT_DEF (1 << 2)
#define BIT_SPEED (1 << 3)
#define BIT_SPATK (1 << 4)
#define BIT_SPDEF (1 << 5)
#define BIT_ACC (1 << 6)
#define BIT_EVASION (1 << 7)
#define PARTY_SCREEN_OPTIONAL (1 << 7) // Flag for first argument to openpartyscreen
// cases for Cmd_moveend
#define MOVEEND_RAGE 0

View File

@@ -214,10 +214,10 @@
#define STRINGID_STATROSE 210
#define STRINGID_STATHARSHLY 211
#define STRINGID_STATFELL 212
#define STRINGID_PKMNSSTATCHANGED 213
#define STRINGID_PKMNSSTATCHANGED2 214
#define STRINGID_PKMNSSTATCHANGED3 215
#define STRINGID_PKMNSSTATCHANGED4 216
#define STRINGID_ATTACKERSSTATROSE 213
#define STRINGID_DEFENDERSSTATROSE 214
#define STRINGID_ATTACKERSSTATFELL 215
#define STRINGID_DEFENDERSSTATFELL 216
#define STRINGID_CRITICALHIT 217
#define STRINGID_ONEHITKO 218
#define STRINGID_123POOF 219
@@ -326,7 +326,7 @@
#define STRINGID_SOOTHINGAROMA 322
#define STRINGID_ITEMSCANTBEUSEDNOW 323
#define STRINGID_FORXCOMMAYZ 324
#define STRINGID_USINGXTHEYOFZN 325
#define STRINGID_USINGITEMSTATOFPKMNROSE 325
#define STRINGID_PKMNUSEDXTOGETPUMPED 326
#define STRINGID_PKMNSXMADEYUSELESS 327
#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328
@@ -383,4 +383,218 @@
#define STRINGID_TRAINER1WINTEXT 379
#define STRINGID_TRAINER2WINTEXT 380
// The below IDs are all indexes into battle message tables,
// used to determine which of a set of messages to print.
// They are assigned to the MULTISTRING_CHOOSER byte of gBattleCommunication
// and read when e.g. the command printfromtable is used.
// gStatUpStringIds
#define B_MSG_ATTACKER_STAT_ROSE 0
#define B_MSG_DEFENDER_STAT_ROSE 1
#define B_MSG_STAT_WONT_INCREASE 2
#define B_MSG_STAT_ROSE_EMPTY 3
#define B_MSG_STAT_ROSE_ITEM 4
#define B_MSG_USED_DIRE_HIT 5
// gStatDownStringIds
#define B_MSG_ATTACKER_STAT_FELL 0
#define B_MSG_DEFENDER_STAT_FELL 1
#define B_MSG_STAT_WONT_DECREASE 2
#define B_MSG_STAT_FELL_EMPTY 3
// gMissStringIds
#define B_MSG_MISSED 0
#define B_MSG_PROTECTED 1
#define B_MSG_AVOIDED_ATK 2
#define B_MSG_AVOIDED_DMG 3
#define B_MSG_GROUND_MISS 4
// gAbsorbDrainStringIds
#define B_MSG_ABSORB 0
#define B_MSG_ABSORB_OOZE 1
// gLeechSeedStringIds
#define B_MSG_LEECH_SEED_SET 0
#define B_MSG_LEECH_SEED_MISS 1
#define B_MSG_LEECH_SEED_FAIL 2
#define B_MSG_LEECH_SEED_DRAIN 3
#define B_MSG_LEECH_SEED_OOZE 4
// gFirstTurnOfTwoStringIds
#define B_MSG_TURN1_RAZOR_WIND 0
#define B_MSG_TURN1_SOLAR_BEAM 1
#define B_MSG_TURN1_SKULL_BASH 2
#define B_MSG_TURN1_SKY_ATTACK 3
#define B_MSG_TURN1_FLY 4
#define B_MSG_TURN1_DIG 5
#define B_MSG_TURN1_DIVE 6
#define B_MSG_TURN1_BOUNCE 7
// gMoveWeatherChangeStringIds
#define B_MSG_STARTED_RAIN 0
#define B_MSG_STARTED_DOWNPOUR 1
#define B_MSG_WEATHER_FAILED 2
#define B_MSG_STARTED_SANDSTORM 3
#define B_MSG_STARTED_SUNLIGHT 4
#define B_MSG_STARTED_HAIL 5
// gRainContinuesStringIds
#define B_MSG_RAIN_CONTINUES 0
#define B_MSG_DOWNPOUR_CONTINUES 1
#define B_MSG_RAIN_STOPPED 2
// gSandStormHailContinuesStringIds / gSandStormHailDmgStringIds/ gSandStormHailEndStringIds
#define B_MSG_SANDSTORM 0
#define B_MSG_HAIL 1
// gReflectLightScreenSafeguardStringIds
#define B_MSG_SIDE_STATUS_FAILED 0
#define B_MSG_SET_REFLECT_SINGLE 1
#define B_MSG_SET_REFLECT_DOUBLE 2
#define B_MSG_SET_LIGHTSCREEN_SINGLE 3
#define B_MSG_SET_LIGHTSCREEN_DOUBLE 4
#define B_MSG_SET_SAFEGUARD 5
// gProtectLikeUsedStringIds
#define B_MSG_PROTECTED_ITSELF 0
#define B_MSG_BRACED_ITSELF 1
#define B_MSG_PROTECT_FAILED 2
// gRestUsedStringIds
#define B_MSG_REST 0
#define B_MSG_REST_STATUSED 1
// gWokeUpStringIds
#define B_MSG_WOKE_UP 0
#define B_MSG_WOKE_UP_UPROAR 1
// gUproarAwakeStringIds
#define B_MSG_CANT_SLEEP_UPROAR 0
#define B_MSG_UPROAR_KEPT_AWAKE 1
#define B_MSG_STAYED_AWAKE_USING 2
// gUproarOverTurnStringIds
#define B_MSG_UPROAR_CONTINUES 0
#define B_MSG_UPROAR_ENDS 1
// gStockpileUsedStringIds
#define B_MSG_STOCKPILED 0
#define B_MSG_CANT_STOCKPILE 1
// gSwallowFailStringIds
#define B_MSG_SWALLOW_FAILED 0
#define B_MSG_SWALLOW_FULL_HP 1
// gKOFailedStringIds
#define B_MSG_KO_MISS 0
#define B_MSG_KO_UNAFFECTED 1
// gMistUsedStringIds
#define B_MSG_SET_MIST 0
#define B_MSG_MIST_FAILED 1
// gFocusEnergyUsedStringIds
#define B_MSG_GETTING_PUMPED 0
#define B_MSG_FOCUS_ENERGY_FAILED 1
// gTransformUsedStringIds
#define B_MSG_TRANSFORMED 0
#define B_MSG_TRANSFORM_FAILED 1
// gSubsituteUsedStringIds
#define B_MSG_SET_SUBSTITUTE 0
#define B_MSG_SUBSTITUTE_FAILED 1
// gPartyStatusHealStringIds
#define B_MSG_BELL 0
#define B_MSG_BELL_SOUNDPROOF_ATTACKER 1
#define B_MSG_BELL_SOUNDPROOF_PARTNER 2
#define B_MSG_BELL_BOTH_SOUNDPROOF 3
#define B_MSG_SOOTHING_AROMA 4
// gFutureMoveUsedStringIds
#define B_MSG_FUTURE_SIGHT 0
#define B_MSG_DOOM_DESIRE 1
// gItemSwapStringIds
#define B_MSG_ITEM_SWAP_TAKEN 0
#define B_MSG_ITEM_SWAP_GIVEN 1
#define B_MSG_ITEM_SWAP_BOTH 2
// gSportsUsedStringIds
#define B_MSG_WEAKEN_ELECTRIC 0
#define B_MSG_WEAKEN_FIRE 1
// gCaughtMonStringIds
#define B_MSG_SENT_SOMEONES_PC 0
#define B_MSG_SENT_LANETTES_PC 1
#define B_MSG_SOMEONES_BOX_FULL 2
#define B_MSG_LANETTES_BOX_FULL 3
// gInobedientStringIds
#define B_MSG_LOAFING 0
#define B_MSG_WONT_OBEY 1
#define B_MSG_TURNED_AWAY 2
#define B_MSG_PRETEND_NOT_NOTICE 3
#define B_MSG_INCAPABLE_OF_POWER 4
// For randomly selecting a disobey string
// Skips the one used for Battle Palace
#define NUM_LOAF_STRINGS 4
// gSafariGetNearStringIds
#define B_MSG_CREPT_CLOSER 0
#define B_MSG_CANT_GET_CLOSER 1
// gSafariPokeblockResultStringIds
#define B_MSG_MON_CURIOUS 0
#define B_MSG_MON_ENTHRALLED 1
#define B_MSG_MON_IGNORED 2
// gFlashFireStringIds
#define B_MSG_FLASH_FIRE_BOOST 0
#define B_MSG_FLASH_FIRE_NO_BOOST 1
// gBerryEffectStringIds
#define B_MSG_CURED_PROBLEM 0
#define B_MSG_NORMALIZED_STATUS 1
// gNoEscapeStringIds
#define B_MSG_CANT_ESCAPE 0
#define B_MSG_DONT_LEAVE_BIRCH 1
#define B_MSG_PREVENTS_ESCAPE 2
#define B_MSG_CANT_ESCAPE_2 3
#define B_MSG_ATTACKER_CANT_ESCAPE 4
// gGotPoisonedStringIds / gGotParalyzedStringIds / gFellAsleepStringIds
// gGotBurnedStringIds / gGotFrozenStringIds / gAttractUsedStringIds
#define B_MSG_STATUSED 0
#define B_MSG_STATUSED_BY_ABILITY 1
// gBRNPreventionStringIds / gPRLZPreventionStringIds / gPSNPreventionStringIds
#define B_MSG_ABILITY_PREVENTS_MOVE_STATUS 0
#define B_MSG_ABILITY_PREVENTS_ABILITY_STATUS 1
#define B_MSG_STATUS_HAD_NO_EFFECT 2
// gGotDefrostedStringIds
#define B_MSG_DEFROSTED 0
#define B_MSG_DEFROSTED_BY_MOVE 1
// gBattlePalaceFlavorTextTable
#define B_MSG_GLINT_IN_EYE 0
#define B_MSG_GETTING_IN_POS 1
#define B_MSG_GROWL_DEEPLY 2
#define B_MSG_EAGER_FOR_MORE 3
// gRefereeStringsTable
#define B_MSG_REF_NOTHING_IS_DECIDED 0
#define B_MSG_REF_THATS_IT 1
#define B_MSG_REF_JUDGE_MIND 2
#define B_MSG_REF_JUDGE_SKILL 3
#define B_MSG_REF_JUDGE_BODY 4
#define B_MSG_REF_PLAYER_WON 5
#define B_MSG_REF_OPPONENT_WON 6
#define B_MSG_REF_DRAW 7
#define B_MSG_REF_COMMENCE_BATTLE 8
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@@ -21,6 +21,12 @@
#define QUIZ_AUTHOR_NAME_PLAYER 1
#define QUIZ_AUTHOR_NAME_OTHER_PLAYER 2
#define QUIZ_QUESTION_LEN 9
#define QUIZ_QUESTION_LEN 9
#endif
// Constants for how many good Pokéblocks the Contest Lady was given
// This determines how her performance is described when her TV show comes on
#define CONTEST_LADY_NORMAL 0
#define CONTEST_LADY_GOOD 1
#define CONTEST_LADY_BAD 2
#endif // GUARD_LILYCOVE_LADY_CONSTANTS_H

View File

@@ -19,7 +19,7 @@
#define TVSHOW_3_CHEERS_FOR_POKEBLOCKS 9
#define TVSHOW_BATTLE_UPDATE 10
#define TVSHOW_FAN_CLUB_SPECIAL 11
#define TVSHOW_CONTEST_LIVE_UPDATES_2 12
#define TVSHOW_LILYCOVE_CONTEST_LADY 12
// //
#define TVSHOW_POKEMON_TODAY_CAUGHT 21
#define TVSHOW_SMART_SHOPPER 22
@@ -215,4 +215,10 @@
#define TRENDWATCHER_STATE_BIGGER_FEMALE 5
#define TRENDWATCHER_STATE_OUTRO 6
// TV Show states for the Contest Lady's Live Updates show
#define CONTESTLADYLIVE_STATE_INTRO 0
#define CONTESTLADYLIVE_STATE_WON 1
#define CONTESTLADYLIVE_STATE_LOST 2
#define CONTESTLADYLIVE_STATE_LOST_BADLY 3
#endif //GUARD_CONSTANTS_TV_H

View File

@@ -344,10 +344,10 @@ extern const u8 gTVInSearchOfTrainersText05[];
extern const u8 gTVInSearchOfTrainersText06[];
extern const u8 gTVInSearchOfTrainersText07[];
extern const u8 gTVInSearchOfTrainersText08[];
extern const u8 gTVPokemonContestLiveUpdates2Text00[];
extern const u8 gTVPokemonContestLiveUpdates2Text01[];
extern const u8 gTVPokemonContestLiveUpdates2Text02[];
extern const u8 gTVPokemonContestLiveUpdates2Text03[];
extern const u8 ContestLadyShow_Text_Intro[];
extern const u8 ContestLadyShow_Text_Won[];
extern const u8 ContestLadyShow_Text_Lost[];
extern const u8 ContestLadyShow_Text_LostBadly[];
extern const u8 gPokeNewsTextSlateport_Upcoming[];
extern const u8 gPokeNewsTextSlateport_Ongoing[];
extern const u8 gPokeNewsTextSlateport_Ending[];

View File

@@ -179,7 +179,7 @@ typedef union // size = 0x24
/*0x18*/ u8 idolNameLanguage;
} fanClubSpecial;
// TVSHOW_CONTEST_LIVE_UPDATES_2
// TVSHOW_LILYCOVE_CONTEST_LADY
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
@@ -189,7 +189,7 @@ typedef union // size = 0x24
/*0x16*/ u8 pokeblockState;
/*0x17*/ u8 language;
/*0x18*/ u8 pokemonNameLanguage;
} contestLiveUpdates2;
} contestLady;
// Record Mixing Shows
// TVSHOW_POKEMON_TODAY_CAUGHT

View File

@@ -12,6 +12,6 @@ void BufferContestLadyMonName(u8 *dest1, u8 *dest2);
void BufferContestLadyPlayerName(u8 *dest);
void BufferContestLadyLanguage(u8 *dest);
void BufferContestName(u8 *dest, u8 category);
u8 sub_818E880(void);
u8 GetContestLadyPokeblockState(void);
#endif //GUARD_LILYCOVE_LADY_H