From 66d4d67e675d2a2c490bfe1a6bb7f2855c9977b9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 30 Mar 2025 22:31:53 +0200 Subject: [PATCH] status_checks_1 merged with dungeon ai targeting --- include/dungeon_ai_targeting.h | 6 + include/dungeon_engine.h | 2 +- include/status_checks_1.h | 13 --- ld_script.txt | 1 - src/code_8066D04.c | 1 - src/code_8069E0C.c | 1 - src/code_806E8B0.c | 2 +- src/code_80718D8.c | 1 - src/code_8072B78.c | 2 +- src/code_8073CF0.c | 1 - src/code_8077274_1.c | 2 +- src/dungeon_8067A80.c | 1 - src/dungeon_ai_attack.c | 1 - src/dungeon_ai_item_weight.c | 1 - src/dungeon_ai_leader.c | 1 - src/dungeon_ai_targeting.c | 171 +++++++++++++++++++++++++++++ src/dungeon_engine.c | 2 +- src/dungeon_items.c | 1 - src/dungeon_main.c | 1 - src/dungeon_menu_items.c | 1 - src/dungeon_menu_moves.c | 2 +- src/dungeon_menu_team.c | 1 - src/dungeon_misc.c | 1 - src/dungeon_move.c | 1 - src/dungeon_move_util.c | 1 - src/dungeon_music.c | 2 +- src/dungeon_util.c | 1 - src/move_checks.c | 2 +- src/move_effects_target.c | 1 - src/move_orb_actions_1.c | 1 - src/move_orb_actions_2.c | 1 - src/move_orb_actions_3.c | 1 - src/move_orb_actions_4.c | 1 - src/status.c | 1 - src/status_checks_1.c | 193 --------------------------------- 35 files changed, 185 insertions(+), 237 deletions(-) delete mode 100644 include/status_checks_1.h delete mode 100644 src/status_checks_1.c diff --git a/include/dungeon_ai_targeting.h b/include/dungeon_ai_targeting.h index 081e2a1cf..b79b5ad3e 100644 --- a/include/dungeon_ai_targeting.h +++ b/include/dungeon_ai_targeting.h @@ -3,6 +3,12 @@ #include "structs/dungeon_entity.h" +void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum); +bool8 HasNegativeStatus(Entity *pokemon); +bool8 IsSleeping(Entity *pokemon); +bool8 HasLowHealth(Entity *pokemon); +s32 sub_8070828(Entity *pokemon, bool8 displayMessage); +void sub_80709C8(u8 *buffer, EntityInfo *entityInfo); bool8 CheckVariousStatuses2(Entity *pokemon, bool8 checkBlinker); bool8 sub_8070BC0(Entity* entity); bool8 CheckVariousConditions(Entity *pokemon); diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index 4c1ec87dd..b324adcbb 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -3,7 +3,7 @@ #include "structs/dungeon_entity.h" -extern const s16 gSpeedTurns[MAX_SPEED_STAGE + 1][25]; +extern const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25]; void RunFractionalTurn(bool8 param_1); diff --git a/include/status_checks_1.h b/include/status_checks_1.h deleted file mode 100644 index 572d67d2a..000000000 --- a/include/status_checks_1.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef GUARD_STATUS_CHECKS_1_H -#define GUARD_STATUS_CHECKS_1_H - -#include "structs/dungeon_entity.h" - -void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum); -bool8 HasNegativeStatus(Entity *pokemon); -bool8 IsSleeping(Entity *pokemon); -bool8 HasLowHealth(Entity *pokemon); -s32 sub_8070828(Entity *pokemon, bool8 displayMessage); -void sub_80709C8(u8 *buffer, EntityInfo *entityInfo); - -#endif // GUARD_STATUS_CHECKS_1_H diff --git a/ld_script.txt b/ld_script.txt index d39a28c04..0352b60ea 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -244,7 +244,6 @@ SECTIONS { src/code_806FDF4.o(.text); src/status_checks.o(.text); src/dungeon_movement.o(.text); - src/status_checks_1.o(.text); src/dungeon_ai_targeting.o(.text); src/dungeon_pokemon_attributes.o(.text); src/code_80718D8.o(.text); diff --git a/src/code_8066D04.c b/src/code_8066D04.c index f7affe1bf..e451f63df 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -35,7 +35,6 @@ #include "pokemon_3.h" #include "position_util.h" #include "sprite.h" -#include "status_checks_1.h" #include "string_format.h" #include "text_1.h" #include "trap.h" diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index 3a00643b6..ec075b0e7 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -37,7 +37,6 @@ #include "position_util.h" #include "random.h" #include "sprite.h" -#include "status_checks_1.h" #include "weather.h" extern void sub_8042900(Entity *r0); diff --git a/src/code_806E8B0.c b/src/code_806E8B0.c index 77cf77679..2845cc0a4 100644 --- a/src/code_806E8B0.c +++ b/src/code_806E8B0.c @@ -2,7 +2,6 @@ #include "constants/ability.h" #include "structs/str_dungeon.h" #include "dungeon_pokemon_attributes.h" -#include "status_checks_1.h" #include "text_util.h" #include "dungeon_message.h" #include "string_format.h" @@ -20,6 +19,7 @@ #include "structs/str_damage.h" #include "dungeon_util.h" #include "dungeon_config.h" +#include "dungeon_ai_targeting.h" void sub_8042940(Entity *r0); void sub_80428B0(Entity *r0); diff --git a/src/code_80718D8.c b/src/code_80718D8.c index 9be1121c8..112b1f45d 100644 --- a/src/code_80718D8.c +++ b/src/code_80718D8.c @@ -12,7 +12,6 @@ #include "dungeon_util.h" #include "dungeon.h" #include "pokemon_3.h" -#include "status_checks_1.h" #include "code_805D8C8.h" #include "structs/str_806B7F8.h" #include "dungeon_ai_targeting.h" diff --git a/src/code_8072B78.c b/src/code_8072B78.c index b0227f48d..ff1f91a18 100644 --- a/src/code_8072B78.c +++ b/src/code_8072B78.c @@ -8,11 +8,11 @@ #include "dungeon_util.h" #include "moves.h" #include "pokemon_mid.h" -#include "status_checks_1.h" #include "structs/dungeon_entity.h" #include "structs/map.h" #include "structs/str_pokemon.h" #include "structs/str_806B7F8.h" +#include "dungeon_ai_targeting.h" extern u8 *gUnknown_80FE2EC[]; diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index 8d7dfbcd5..3ff9de11b 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -17,7 +17,6 @@ #include "dungeon_items.h" #include "moves.h" #include "dungeon_random.h" -#include "status_checks_1.h" #include "code_803E668.h" #include "constants/dungeon.h" #include "constants/iq_skill.h" diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index c587a997f..64b9996cd 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -21,12 +21,12 @@ #include "pokemon.h" #include "pokemon_3.h" #include "pokemon_mid.h" -#include "status_checks_1.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "structs/str_806B7F8.h" #include "dungeon_config.h" +#include "dungeon_ai_targeting.h" extern u8 *gUnknown_80FA8BC[]; extern u8 *gUnknown_80FA824[]; diff --git a/src/dungeon_8067A80.c b/src/dungeon_8067A80.c index c2e425222..5bee38fa2 100644 --- a/src/dungeon_8067A80.c +++ b/src/dungeon_8067A80.c @@ -35,7 +35,6 @@ #include "pokemon_3.h" #include "position_util.h" #include "sprite.h" -#include "status_checks_1.h" #include "string_format.h" #include "text_1.h" #include "trap.h" diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 92453078f..acfd0444c 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -25,7 +25,6 @@ #include "move_util.h" #include "moves.h" #include "position_util.h" -#include "status_checks_1.h" #include "status_checks.h" #include "structs/str_dungeon.h" #include "targeting_flags.h" diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index 672fc1355..3c6183e3b 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -9,7 +9,6 @@ #include "dungeon_util.h" #include "moves.h" #include "number_util.h" -#include "status_checks_1.h" u32 GetAIUseItemProbability(Entity *targetPokemon, Item *item, u32 itemTargetFlags) { diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 5e3333fe7..8b318c9c2 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -27,7 +27,6 @@ #include "pokemon_3.h" #include "pokemon.h" #include "status.h" -#include "status_checks_1.h" #include "trap.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/dungeon_ai_targeting.c b/src/dungeon_ai_targeting.c index a9ce2b067..4681f7852 100644 --- a/src/dungeon_ai_targeting.c +++ b/src/dungeon_ai_targeting.c @@ -17,7 +17,18 @@ #include "dungeon_util.h" #include "structs/map.h" #include "dungeon_move_util.h" +#include "code_800D090.h" +#include "dungeon_message.h" +#include "constants/weather.h" +#include "pokemon_mid.h" +#include "pokemon.h" +#include "structs/str_dungeon.h" +#include "weather.h" +#include "dungeon_strings.h" +extern const u8 gUnknown_8106FA4[]; + +extern void sub_80429B4(Entity *r0); extern void ShowVisualFlags(Entity *r0); const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; @@ -61,6 +72,166 @@ const u8 gTreatmentData[3][2][2][2] = { } }; +s32 sub_8070828(Entity *pokemon, bool8 displayMessage) +{ + bool8 flag; + + flag = FALSE; + if (!EntityIsValid(pokemon)) { + return 0; + } + else { + if ((AbilityIsActive(pokemon, ABILITY_SWIFT_SWIM)) && (GetApparentWeather(pokemon) == WEATHER_RAIN)) { + flag = TRUE; + } + if ((AbilityIsActive(pokemon, ABILITY_CHLOROPHYLL)) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) { + flag = TRUE; + } + if (displayMessage && SetVisualFlags(GetEntInfo(pokemon), 0x40, flag)) { + sub_80429B4(pokemon); + LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FEE80); + } + if (flag) { + return 2; + } + else { + return 1; + } + } +} + +void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum) +{ + if (((gDungeon->unk181e8.blinded || + gDungeon->unk181e8.hallucinating) || + (param_2->invisibleClassStatus.status == STATUS_INVISIBLE)) && + (param_2->isNotTeamMember)) + { + strcpy(buffer, gUnknown_80F8988); + } + else + { + if (param_2->curseClassStatus.status == STATUS_DECOY) { + strcpy(buffer, gUnknown_80F8968); + } + else + { + if (param_2->isNotTeamMember) { + if ((param_2->joinedAt.id == 0x4A) || (param_2->monsterBehavior == BEHAVIOR_RESCUE_TARGET)) { + CopyYellowMonsterNametoBuffer(buffer, param_2->apparentID); + } + else + CopyCyanMonsterNametoBuffer(buffer, param_2->apparentID); + } + else + { + sub_808D9DC(buffer, &gRecruitedPokemonRef->pokemon2[param_2->teamIndex],colorNum); + } + } + } +} + +void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum) +{ + if (entityInfo->curseClassStatus.status == STATUS_DECOY) { + sprintfStatic(buffer, gUnknown_8106FA4, colorNum + 0x30, gUnknown_80F8974); + } + else if (entityInfo->isNotTeamMember) { + CopyCyanMonsterNametoBuffer(buffer, entityInfo->apparentID); + } + else { + sub_808D9DC(buffer, &gRecruitedPokemonRef->pokemon2[entityInfo->teamIndex], colorNum); + } +} + +void sub_80709C8(u8 *buffer, EntityInfo *entityInfo) +{ + if (((gDungeon->unk181e8.blinded || + gDungeon->unk181e8.hallucinating) || + (entityInfo->invisibleClassStatus.status == STATUS_INVISIBLE)) && + (entityInfo->isNotTeamMember)) + { + strcpy(buffer, gUnknown_80F8994); + } + else + { + if (entityInfo->curseClassStatus.status == STATUS_DECOY) { + strcpy(buffer, gUnknown_80F8974); + } + else + { + if (entityInfo->isNotTeamMember) { + CopyMonsterNameToBuffer(buffer, entityInfo->apparentID); + } + else + { + sub_808DA0C(buffer, &gRecruitedPokemonRef->pokemon2[entityInfo->teamIndex]); + } + } + } +} + +bool8 HasNegativeStatus(Entity *pokemon) +{ + EntityInfo *pokemonInfo = GetEntInfo(pokemon); + s32 i; + if (pokemonInfo->sleepClassStatus.status == STATUS_SLEEP || + pokemonInfo->sleepClassStatus.status == STATUS_NIGHTMARE || + pokemonInfo->sleepClassStatus.status == STATUS_YAWNING || + pokemonInfo->burnClassStatus.status != STATUS_NONE || + (pokemonInfo->frozenClassStatus.status != STATUS_INGRAIN && pokemonInfo->frozenClassStatus.status != STATUS_NONE) || + pokemonInfo->cringeClassStatus.status != STATUS_NONE || + pokemonInfo->curseClassStatus.status == STATUS_CURSED || + pokemonInfo->curseClassStatus.status == STATUS_DECOY || + pokemonInfo->leechSeedClassStatus.status == STATUS_LEECH_SEED || + pokemonInfo->sureShotClassStatus.status == STATUS_WHIFFER || + pokemonInfo->blinkerClassStatus.status == STATUS_BLINKER || + pokemonInfo->blinkerClassStatus.status == STATUS_CROSS_EYED || + pokemonInfo->muzzled.muzzled == TRUE || + pokemonInfo->exposed || + pokemonInfo->perishSongTurns != 0) + { + return TRUE; + } + for (i = 0; i < MAX_MON_MOVES; i++) + { + Move *moves = pokemonInfo->moves.moves; + if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags2 & MOVE_FLAG_SEALED) + { + return TRUE; + } + } + for (i = 0; i < NUM_SPEED_COUNTERS; i++) + { + if (pokemonInfo->speedDownCounters[i] != 0) + { + return TRUE; + } + } + return FALSE; +} + +bool8 IsSleeping(Entity *pokemon) +{ + if (GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_SLEEP && + GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_NAPPING && + GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_NIGHTMARE) + { + return FALSE; + } + return TRUE; +} + +bool8 HasLowHealth(Entity *pokemon) +{ + EntityInfo *pokemonInfo = GetEntInfo(pokemon); + if (pokemonInfo->HP <= pokemonInfo->maxHPStat / 4) + { + return TRUE; + } + return FALSE; +} + // TODO CheckVariousStatuses, CheckVariousStatuses2, CheckVariousConditions all check for different conditions that interfere with a Pokémon's ability to act, // but I'm not sure what the reason is for each function checking the conditions that they do. // These functions could use better names if someone figures out a clear pattern/reasoning. diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index fcce8d72e..def054e53 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -33,7 +33,7 @@ extern void sub_807EAA0(u32, u32); static void sub_8044454(void); static bool8 xxx_dungeon_80442D0(bool8); -const s16 gSpeedTurns[MAX_SPEED_STAGE + 1][25] = { +const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25] = { [0] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0}, [1] = {0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0}, [2] = {0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0}, diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 069af8b1c..11cfb8a1c 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -19,7 +19,6 @@ #include "dungeon_ai_targeting.h" #include "string_format.h" #include "items.h" -#include "status_checks_1.h" #include "structs/map.h" #include "trap.h" #include "math.h" diff --git a/src/dungeon_main.c b/src/dungeon_main.c index a5c8ed9b8..6bf3ddaf5 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -52,7 +52,6 @@ #include "pokemon.h" #include "pokemon_3.h" #include "sprite.h" -#include "status_checks_1.h" #include "string_format.h" #include "trap.h" #include "weather.h" diff --git a/src/dungeon_menu_items.c b/src/dungeon_menu_items.c index 6e6f85b26..5ca5e1eec 100644 --- a/src/dungeon_menu_items.c +++ b/src/dungeon_menu_items.c @@ -20,7 +20,6 @@ #include "code_803E724.h" #include "trap.h" #include "dungeon_map_access.h" -#include "status_checks_1.h" #include "dungeon_items.h" #include "dungeon_leader.h" #include "menu_input.h" diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index 8fbb50e9b..1a359a4a2 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -23,11 +23,11 @@ #include "move_util.h" #include "music.h" #include "pokemon.h" -#include "status_checks_1.h" #include "string_format.h" #include "text_1.h" #include "text_2.h" #include "text_3.h" +#include "dungeon_ai_targeting.h" extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index a0b6a104d..cbb4e9b65 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -39,7 +39,6 @@ #include "pokemon.h" #include "pokemon_3.h" #include "sprite.h" -#include "status_checks_1.h" #include "string_format.h" #include "text_2.h" #include "weather.h" diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 59b5f8fc1..d49aa4a4a 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -32,7 +32,6 @@ #include "dungeon_ai_targeting.h" #include "dungeon_movement.h" #include "dungeon_util.h" -#include "status_checks_1.h" #include "exclusive_pokemon.h" #include "dungeon_config.h" #include "game_options.h" diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 07ad908f9..fb01c7196 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -38,7 +38,6 @@ #include "sprite.h" #include "status.h" #include "status_actions.h" -#include "status_checks_1.h" #include "weather.h" #include "targeting_flags.h" #include "text_util.h" diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 617afc321..3f86cc53d 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -38,7 +38,6 @@ #include "sprite.h" #include "status.h" #include "status_actions.h" -#include "status_checks_1.h" #include "weather.h" #include "targeting_flags.h" #include "text_util.h" diff --git a/src/dungeon_music.c b/src/dungeon_music.c index 53b3b6a54..30a883443 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -7,8 +7,8 @@ #include "dungeon_music.h" #include "dungeon_util.h" #include "music.h" -#include "status_checks_1.h" #include "text_util.h" +#include "dungeon_ai_targeting.h" extern MenuInputStruct gDungeonMenu; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 74c9a80ee..4a4e36f06 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -27,7 +27,6 @@ #include "string_format.h" #include "items.h" #include "trap.h" -#include "status_checks_1.h" extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; diff --git a/src/move_checks.c b/src/move_checks.c index a996c1118..4692f779b 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -15,11 +15,11 @@ #include "number_util.h" #include "status.h" #include "status_actions.h" -#include "status_checks_1.h" #include "text_util.h" #include "trap.h" #include "weather.h" #include "dungeon_config.h" +#include "dungeon_ai_targeting.h" bool8 CanUseOnSelfWithStatusChecker(Entity *pokemon, Move *move) { diff --git a/src/move_effects_target.c b/src/move_effects_target.c index c9d9499d0..e35dc2763 100644 --- a/src/move_effects_target.c +++ b/src/move_effects_target.c @@ -26,7 +26,6 @@ #include "dungeon_util.h" #include "pokemon.h" #include "status_checks.h" -#include "status_checks_1.h" #include "structs/map.h" #include "structs/str_dungeon.h" #include "dungeon_misc.h" diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index 41cc68ab6..e0fc97eb5 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -26,7 +26,6 @@ #include "number_util.h" #include "pokemon.h" #include "status_actions.h" -#include "status_checks_1.h" #include "status.h" #include "structs/dungeon_entity.h" #include "structs/map.h" diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index 979398c26..215b57d99 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -26,7 +26,6 @@ #include "number_util.h" #include "pokemon.h" #include "status_actions.h" -#include "status_checks_1.h" #include "status.h" #include "structs/dungeon_entity.h" #include "structs/map.h" diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 5bfa94928..0a8ea45d0 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -33,7 +33,6 @@ #include "pokemon.h" #include "status.h" #include "status_actions.h" -#include "status_checks_1.h" #include "structs/dungeon_entity.h" #include "structs/map.h" #include "structs/str_dungeon.h" diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index bde3d4194..41da2a6f5 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -25,7 +25,6 @@ #include "moves.h" #include "number_util.h" #include "pokemon.h" -#include "status_checks_1.h" #include "status.h" #include "structs/map.h" #include "structs/str_dungeon.h" diff --git a/src/status.c b/src/status.c index a6ccf6059..5ea9fb340 100644 --- a/src/status.c +++ b/src/status.c @@ -18,7 +18,6 @@ #include "math.h" #include "move_effects_target.h" #include "number_util.h" -#include "status_checks_1.h" #include "structs/map.h" #include "structs/str_dungeon.h" #include "dungeon_config.h" diff --git a/src/status_checks_1.c b/src/status_checks_1.c deleted file mode 100644 index ba6032b8b..000000000 --- a/src/status_checks_1.c +++ /dev/null @@ -1,193 +0,0 @@ -#include "global.h" -#include "status_checks_1.h" - -#include "code_800D090.h" -#include "dungeon_message.h" -#include "constants/ability.h" -#include "constants/iq_skill.h" -#include "constants/status.h" -#include "constants/weather.h" -#include "run_dungeon.h" -#include "dungeon_items.h" -#include "dungeon_map_access.h" -#include "dungeon_movement.h" -#include "dungeon_pokemon_attributes.h" -#include "dungeon_util.h" -#include "pokemon_mid.h" -#include "pokemon.h" -#include "structs/str_dungeon.h" -#include "weather.h" - -extern void sub_80429B4(Entity *r0); - -extern u8 *gUnknown_80FEE80[]; -extern u8 *gUnknown_80F8974[]; -extern u8 *gUnknown_80F8994[]; -extern u8 *gUnknown_80F8968[]; -extern u8 *gUnknown_80F8988[]; -extern u8 gUnknown_8106FA4[]; - -s32 sub_8070828(Entity *pokemon, bool8 displayMessage) -{ - bool8 flag; - - flag = FALSE; - if (!EntityIsValid(pokemon)) { - return 0; - } - else { - if ((AbilityIsActive(pokemon, ABILITY_SWIFT_SWIM)) && (GetApparentWeather(pokemon) == WEATHER_RAIN)) { - flag = TRUE; - } - if ((AbilityIsActive(pokemon, ABILITY_CHLOROPHYLL)) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) { - flag = TRUE; - } - if (displayMessage && SetVisualFlags(GetEntInfo(pokemon), 0x40, flag)) { - sub_80429B4(pokemon); - LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FEE80); - } - if (flag) { - return 2; - } - else { - return 1; - } - } -} - -void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum) -{ - if (((gDungeon->unk181e8.blinded || - gDungeon->unk181e8.hallucinating) || - (param_2->invisibleClassStatus.status == STATUS_INVISIBLE)) && - (param_2->isNotTeamMember)) - { - strcpy(buffer, *gUnknown_80F8988); - } - else - { - if (param_2->curseClassStatus.status == STATUS_DECOY) { - strcpy(buffer, *gUnknown_80F8968); - } - else - { - if (param_2->isNotTeamMember) { - if ((param_2->joinedAt.id == 0x4A) || (param_2->monsterBehavior == BEHAVIOR_RESCUE_TARGET)) { - CopyYellowMonsterNametoBuffer(buffer, param_2->apparentID); - } - else - CopyCyanMonsterNametoBuffer(buffer, param_2->apparentID); - } - else - { - sub_808D9DC(buffer, &gRecruitedPokemonRef->pokemon2[param_2->teamIndex],colorNum); - } - } - } -} - -void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum) -{ - if (entityInfo->curseClassStatus.status == STATUS_DECOY) { - sprintfStatic(buffer, gUnknown_8106FA4, colorNum + 0x30, *gUnknown_80F8974); - } - else if (entityInfo->isNotTeamMember) { - CopyCyanMonsterNametoBuffer(buffer, entityInfo->apparentID); - } - else { - sub_808D9DC(buffer, &gRecruitedPokemonRef->pokemon2[entityInfo->teamIndex], colorNum); - } -} - -void sub_80709C8(u8 *buffer, EntityInfo *entityInfo) -{ - if (((gDungeon->unk181e8.blinded || - gDungeon->unk181e8.hallucinating) || - (entityInfo->invisibleClassStatus.status == STATUS_INVISIBLE)) && - (entityInfo->isNotTeamMember)) - { - strcpy(buffer, *gUnknown_80F8994); - } - else - { - if (entityInfo->curseClassStatus.status == STATUS_DECOY) { - strcpy(buffer, *gUnknown_80F8974); - } - else - { - if (entityInfo->isNotTeamMember) { - CopyMonsterNameToBuffer(buffer, entityInfo->apparentID); - } - else - { - sub_808DA0C(buffer, &gRecruitedPokemonRef->pokemon2[entityInfo->teamIndex]); - } - } - } -} - -bool8 HasNegativeStatus(Entity *pokemon) -{ - EntityInfo *pokemonInfo = GetEntInfo(pokemon); - s32 i; - if (pokemonInfo->sleepClassStatus.status == STATUS_SLEEP || - pokemonInfo->sleepClassStatus.status == STATUS_NIGHTMARE || - pokemonInfo->sleepClassStatus.status == STATUS_YAWNING || - pokemonInfo->burnClassStatus.status != STATUS_NONE || - (pokemonInfo->frozenClassStatus.status != STATUS_INGRAIN && pokemonInfo->frozenClassStatus.status != STATUS_NONE) || - pokemonInfo->cringeClassStatus.status != STATUS_NONE || - pokemonInfo->curseClassStatus.status == STATUS_CURSED || - pokemonInfo->curseClassStatus.status == STATUS_DECOY || - pokemonInfo->leechSeedClassStatus.status == STATUS_LEECH_SEED || - pokemonInfo->sureShotClassStatus.status == STATUS_WHIFFER || - pokemonInfo->blinkerClassStatus.status == STATUS_BLINKER || - pokemonInfo->blinkerClassStatus.status == STATUS_CROSS_EYED || - pokemonInfo->muzzled.muzzled == TRUE || - pokemonInfo->exposed || - pokemonInfo->perishSongTurns != 0) - { - return TRUE; - } - for (i = 0; i < MAX_MON_MOVES; i++) - { - Move *moves = pokemonInfo->moves.moves; - if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags2 & MOVE_FLAG_SEALED) - { - return TRUE; - } - } - for (i = 0; i < NUM_SPEED_COUNTERS; i++) - { - if (pokemonInfo->speedDownCounters[i] != 0) - { - return TRUE; - } - } - return FALSE; -} - -bool8 IsSleeping(Entity *pokemon) -{ - if (GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_SLEEP && - GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_NAPPING && - GetEntInfo(pokemon)->sleepClassStatus.status != STATUS_NIGHTMARE) - { - return FALSE; - } - return TRUE; -} - -bool8 HasLowHealth(Entity *pokemon) -{ - EntityInfo *pokemonInfo = GetEntInfo(pokemon); - s32 maxHPStat = pokemonInfo->maxHPStat; - if (maxHPStat < 0) - { - maxHPStat += 3; - } - if (pokemonInfo->HP <= maxHPStat >> 2) - { - return TRUE; - } - return FALSE; -}