mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-28 03:34:22 -05:00
status_checks_1 merged with dungeon ai targeting
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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[];
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user