Merge pull request #126 from AnonymousRandomPerson/main
Some checks failed
build / build (push) Has been cancelled

Decomped more AI functions
This commit is contained in:
AnonymousRandomPerson 2025-05-11 00:11:39 -04:00 committed by GitHub
commit 8a72c0d12c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 3195 additions and 3181 deletions

View File

@ -6,7 +6,7 @@
.public _02099784
.public _02099E44
.public _020A2CF8
.public _020B09B4
.public MONSTER_DATA_TABLE_PTR
.public _0229AFC0
.public _0229AFCC
.public _0229AFE4

View File

@ -1,14 +1,38 @@
#pragma once
.public ARM9_UNKNOWN_PTR__NA_20A2C84
.public ARM9_UNKNOWN_TABLE__NA_20A20B0
.public AllocateTemp1024ByteBufferFromPool
.public ArrayCopy32
.public ArrayFill32
.public BAG_CAPACITY_TABLE
.public BAG_CAPACITY_TABLE_SPECIAL_EPISODES
.public CopyBitsFrom
.public CopyBitsTo
.public DUNGEON_RESTRICTIONS
.public DecompressAtNormalVeneer
.public DungeonFloorToGroupFloor
.public GetAtSize
.public GetBaseForm
.public GetItemIdFromList
.public GetNbFloorsPlusOne
.public LoadFileFromRom
.public LoadM2nAndN2m
.public MISSION_FLOORS_FORBIDDEN
.public MONSTER_SPRITE_DATA
.public MemAlloc
.public MemFree
.public MemZero
.public RANK_UP_TABLE
.public RandIntSafe
.public StringFromId
.public UNOWN_SPECIES_ADDITIONAL_CHAR_PTR_TABLE
.public UnloadFile
.public _020A0C68
.public _020A0C69
.public _020A0C6A
.public _020A0C6C
.public _020A0C6E
.public _020A1864
.public _020A1880
.public _020A1884
.public _020A189C
.public _020A18C0
.public _020A20B1
.public _020A2D09
.public _020A31B8
@ -17,86 +41,15 @@
.public _020A31F4
.public _020A31FC
.public _020A3200
.public _020A3210
.public _020A322C
.public _020A3248
.public _020A3258
.public _020A327C
.public _020A328C
.public _020A32D4
.public _020A32F8
.public _020A3330
.public _020A45C8_JP
.public _020AFF7C
.public _020AFF80
.public _020AFF88
.public _020B09B0
.public _020B09B4
.public MONSTER_DATA_TABLE_PTR
.public _020B09C0
.public _020B09C8
.public _020B09D0
.public _020B12F4_EU
.public _020B1308_EU
.public _s32_div_f
.public AllocateTemp1024ByteBufferFromPool
.public ARM9_UNKNOWN_PTR__NA_20A2C84
.public ARM9_UNKNOWN_TABLE__NA_20A20B0
.public ArrayCopy32
.public ArrayFill32
.public BAG_CAPACITY_TABLE
.public BAG_CAPACITY_TABLE_SPECIAL_EPISODES
.public CopyBitsFrom
.public CopyBitsTo
.public Debug_Print0
.public DecompressAtNormalVeneer
.public DexNumbersEqual
.public DirectoryFileMngr_OpenDirectoryFile
.public DUNGEON_RESTRICTIONS
.public DungeonFloorToGroupFloor
.public DungeonToGroundMoveset
.public EnableAllLearnableIqSkills
.public FemaleToMaleForm
.public FORBIDDEN_FORGOT_MOVE_LIST
.public GetAtSize
.public GetInfoGroundMoveset
.public GetInfoMoveGround
.public GetItemIdFromList
.public GetKeyM2NSwitch
.public GetKeyN2MSwitch
.public GetLanguage
.public GetMovesetEggPtr
.public GetMovesetHmTmPtr
.public GetMovesetIdx__02013CAC
.public GetMovesetLevelUpPtr
.public GetNbFloorsPlusOne
.public GetNbMoves
.public GroundToDungeonMoveset
.public HandleSir0Translation
.public HIDDEN_POWER_BASE_POWER_TABLE
.public IsValidTeamMember
.public ItemZInit
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
.public LEVEL_UP_DATA_MONSTER_ID
.public LoadFileFromRom
.public MemAlloc
.public MemFree
.public MemZero
.public MISSION_FLOORS_FORBIDDEN
.public MONSTER_SPRITE_DATA
.public PointsToZero
.public Rand16Bit
.public RandIntSafe
.public RANK_UP_TABLE
.public RemoveActiveMembersFromAllTeams
.public RemoveActiveMembersFromRescueTeam
.public RemoveActiveMembersFromSpecialEpisodeTeam
.public StrcpyName
.public StringFromId
.public StrncmpSimple
.public strncpy
.public StrncpyName
.public StrncpySimple
.public sub_01FF8F28
.public sub_0200302C
.public sub_020030FC
.public sub_0200A124
@ -114,21 +67,4 @@
.public sub_0200B3C0
.public sub_0200B3D4
.public sub_0200B3FC
.public sub_02015090
.public sub_02025304_JP
.public sub_02050FF8
.public sub_02054FB8
.public sub_02054FEC
.public sub_02055020
.public sub_020550DC
.public sub_020550E0
.public sub_02055118
.public sub_020560B8
.public sub_020564B0
.public sub_02056504
.public TEAM_MEMBER_TABLE
.public TEAM_MEMBER_TABLE_PTR
.public UnloadFile
.public UNOWN_SPECIES_ADDITIONAL_CHAR_PTR_TABLE
.public vsprintf
.public ZInit8

View File

@ -0,0 +1,83 @@
#pragma once
.public Debug_Print0
.public DecompressAtNormalVeneer
.public DexNumbersEqual
.public DirectoryFileMngr_OpenDirectoryFile
.public DungeonToGroundMoveset
.public EnableAllLearnableIqSkills
.public FORBIDDEN_FORGOT_MOVE_LIST
.public FemaleToMaleForm
.public GetDexNumber
.public GetInfoGroundMoveset
.public GetInfoMoveGround
.public GetKeyM2NSwitch
.public GetKeyN2MSwitch
.public GetLanguage
.public GetMonsterGender
.public GetMovesetEggPtr
.public GetMovesetHmTmPtr
.public GetMovesetIdx__02013CAC
.public GetMovesetLevelUpPtr
.public GetNameRaw
.public GetNameString
.public GetNbMoves
.public GetSpriteSize
.public GroundToDungeonMoveset
.public HIDDEN_POWER_BASE_POWER_TABLE
.public HandleSir0Translation
.public IsValidTeamMember
.public ItemZInit
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
.public LEVEL_UP_DATA_MONSTER_ID
.public LoadFileFromRom
.public LoadMonsterMd
.public MemAlloc
.public MemFree
.public PointsToZero
.public Rand16Bit
.public RandIntSafe
.public RemoveActiveMembersFromAllTeams
.public RemoveActiveMembersFromRescueTeam
.public RemoveActiveMembersFromSpecialEpisodeTeam
.public SprintfStatic__02052418
.public StrcpyName
.public StrncmpSimple
.public StrncpyName
.public StrncpySimple
.public TEAM_MEMBER_TABLE
.public TEAM_MEMBER_TABLE_PTR
.public UnloadFile
.public ZInit8
.public _020A1880
.public _020A1884
.public _020A189C
.public _020A18C0
.public _020A3210
.public _020A322C
.public _020A3248
.public _020A3258
.public _020A327C
.public _020A328C
.public _020A32D4
.public _020A32F8
.public _020A3330
.public MONSTER_DATA_TABLE_PTR
.public _020B09C8
.public _020B09D0
.public _020B12F4_EU
.public _020B1308_EU
.public _s32_div_f
.public sub_01FF8F28
.public sub_02015090
.public sub_02025304_JP
.public sub_02050FF8
.public sub_02054FB8
.public sub_02054FEC
.public sub_02055020
.public sub_020550DC
.public sub_020550E0
.public sub_02055118
.public sub_020560B8
.public sub_020564B0
.public sub_02056504
.public vsprintf

View File

@ -1,2 +0,0 @@
#pragma once
.public IsBlinded

View File

@ -1666,7 +1666,7 @@ _01FF948C:
mov r0, #0
bx lr
_01FF9494:
ldr r2, _01FF94D0 ; =_020B09B4
ldr r2, _01FF94D0 ; =MONSTER_DATA_TABLE_PTR
mov r3, r0, lsl #0x1f
ldr r2, [r2, #0x14]
mov r0, r0, asr #1
@ -1682,7 +1682,7 @@ _01FF9494:
bx lr
.align 2, 0
_01FF94CC: .word 0x0000022B
_01FF94D0: .word _020B09B4
_01FF94D0: .word MONSTER_DATA_TABLE_PTR
arm_func_end GetKeyN2M
arm_func_start GetKeyN2MBaseForm
@ -1743,7 +1743,7 @@ GetKeyM2N: ; 0x01FF9540
_01FF9564:
mov r0, #0
_01FF9568:
ldr r1, _01FF95A4 ; =_020B09B4
ldr r1, _01FF95A4 ; =MONSTER_DATA_TABLE_PTR
mov r2, r0, lsl #0x1f
ldr r3, [r1, #0x1c]
mov r1, r0, asr #1
@ -1759,7 +1759,7 @@ _01FF9568:
bx lr
.align 2, 0
_01FF95A0: .word 0x00000483
_01FF95A4: .word _020B09B4
_01FF95A4: .word MONSTER_DATA_TABLE_PTR
_01FF95A8: .word 0x000003FF
arm_func_end GetKeyM2N

File diff suppressed because it is too large Load Diff

2822
asm/main_02052890.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -31967,8 +31967,8 @@ ITEM_TABLES_PTRS_1:
.global _020B09B0
_020B09B0:
.byte 0x00, 0x00, 0x00, 0x00
.global _020B09B4
_020B09B4:
.global MONSTER_DATA_TABLE_PTR
MONSTER_DATA_TABLE_PTR:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global _020B09C0
_020B09C0:

View File

@ -1,113 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_02300500.inc"
.text
arm_func_start MonsterHasImmobilizingStatus
MonsterHasImmobilizingStatus: ; 0x02300500
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xc4]
cmp r0, #3
cmpne r0, #5
cmpne r0, #0
movne r0, #1
moveq r0, #0
bx lr
arm_func_end MonsterHasImmobilizingStatus
arm_func_start MonsterHasAttackInterferingStatus
MonsterHasAttackInterferingStatus: ; 0x02300520
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd0]
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasAttackInterferingStatus
arm_func_start MonsterHasSkillInterferingStatus
MonsterHasSkillInterferingStatus: ; 0x0230053C
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd8]
cmp r0, #1
moveq r0, #1
bxeq lr
cmp r0, #2
moveq r0, #1
bxeq lr
cmp r0, #4
moveq r0, #1
bxeq lr
cmp r0, #5
moveq r0, #1
bxeq lr
cmp r0, #6
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasSkillInterferingStatus
arm_func_start MonsterHasLeechSeedStatus
MonsterHasLeechSeedStatus: ; 0x02300588
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xe0]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasLeechSeedStatus
arm_func_start MonsterHasWhifferStatus
MonsterHasWhifferStatus: ; 0x023005A4
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xec]
cmp r0, #2
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasWhifferStatus
arm_func_start IsMonsterVisuallyImpaired
IsMonsterVisuallyImpaired: ; 0x023005C0
stmdb sp!, {r4, lr}
ldr r4, [r0, #0xb4]
bl IsBlinded
cmp r0, #0
movne r0, #1
ldmneia sp!, {r4, pc}
ldrb r0, [r4, #0xf1]
cmp r0, #2
moveq r0, #1
ldmeqia sp!, {r4, pc}
cmp r0, #4
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r4, pc}
arm_func_end IsMonsterVisuallyImpaired
arm_func_start IsMonsterMuzzled
IsMonsterMuzzled: ; 0x023005FC
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf3]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end IsMonsterMuzzled
arm_func_start MonsterHasMiracleEyeStatus
MonsterHasMiracleEyeStatus: ; 0x02300618
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf5]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasMiracleEyeStatus

View File

@ -3,6 +3,28 @@
#include "dungeon_mode.h"
// Checks if a monster has the sleep, nightmare, or yawning status. Note that this excludes the napping status.
bool8 IsMonsterDrowsy(struct entity *monster);
// Checks if a monster has one of the statuses in the "burn" group, which includes the traditionally non-volatile status conditions (except sleep) in the main series: STATUS_BURN, STATUS_POISONED, STATUS_BADLY_POISONED, STATUS_PARALYSIS, and STATUS_IDENTIFYING.
// STATUS_IDENTIFYING is probably included based on enum status_id? Unless it's handled differently somehow.
bool8 MonsterHasNonvolatileNonsleepStatus(struct entity *monster);
// Checks if a monster has one of the non-self-inflicted statuses in the "freeze" group, which includes status conditions that immobilize the monster: STATUS_FROZEN, STATUS_SHADOW_HOLD, STATUS_WRAPPED, STATUS_PETRIFIED, STATUS_CONSTRICTION, and STATUS_FAMISHED.
bool8 MonsterHasImmobilizingStatus(struct entity *monster);
// Checks if a monster has one of the statuses in the "cringe" group, which includes status conditions that interfere with the monster's ability to attack: STATUS_CRINGE, STATUS_CONFUSED, STATUS_PAUSED, STATUS_COWERING, STATUS_TAUNTED, STATUS_ENCORE, STATUS_INFATUATED, and STATUS_DOUBLE_SPEED.
// STATUS_DOUBLE_SPEED is probably included based on enum status_id? Unless it's handled differently somehow.
bool8 MonsterHasAttackInterferingStatus(struct entity *monster);
// Checks if a monster has one of the non-self-inflicted statuses in the "curse" group, which loosely includes status conditions that interfere with the monster's skills or ability to do things: STATUS_CURSED, STATUS_DECOY, STATUS_GASTRO_ACID, STATUS_HEAL_BLOCK, STATUS_EMBARGO.
bool8 MonsterHasSkillInterferingStatus(struct entity *monster);
// Checks if a monster is afflicted with Leech Seed.
bool8 MonsterHasLeechSeedStatus(struct entity *monster);
// Checks if a monster has the whiffer status.
bool8 MonsterHasWhifferStatus(struct entity *monster);
// Checks if a monster's vision is impaired somehow. This includes the checks in IsBlinded, as well as STATUS_CROSS_EYED and STATUS_DROPEYE.
bool8 IsMonsterVisuallyImpaired(struct entity *monster, bool8 check_held_item);
// Checks if a monster has the muzzled status.
bool8 IsMonsterMuzzled(struct entity *monster);
// Checks if a monster has the Miracle Eye status.
bool8 MonsterHasMiracleEyeStatus(struct entity *monster);
// Checks if a monster has any "negative" status conditions. This includes a wide variety of non-self-inflicted statuses that could traditionally be viewed as actual "status conditions", as well as speed being lowered and moves being sealed.
// monster: entity pointer
// check_held_item: flag for whether to check for the held item (see IsMonsterVisuallyImpaired)

View File

@ -1,12 +0,0 @@
#ifndef PMDSKY_DUNGEON_LOGIC_0_H
#define PMDSKY_DUNGEON_LOGIC_0_H
#include "dungeon_mode.h"
// Checks if a monster has the sleep, nightmare, or yawning status. Note that this excludes the napping status.
bool8 IsMonsterDrowsy(struct entity *monster);
//Checks if a monster has one of the statuses in the "burn" group, which includes the traditionally non-volatile status conditions (except sleep) in the main series: STATUS_BURN, STATUS_POISONED, STATUS_BADLY_POISONED, STATUS_PARALYSIS, and STATUS_IDENTIFYING.
// STATUS_IDENTIFYING is probably included based on enum status_id? Unless it's handled differently somehow.
bool8 MonsterHasNonvolatileNonsleepStatus(struct entity *monster);
#endif //PMDSKY_DUNGEON_LOGIC_0_H

View File

@ -174,6 +174,25 @@ struct curse_class_status {
u8 curse_damage_countdown;
};
struct leech_seed_class_status {
u8 leech_seed; // 0x0: STATUS_LEECH_SEED if 1
// 0x4: Used to track the statuses::statuses_unique_id of the relevant monster for
// statuses like Leech Seed and Destiny Bond.
u32 statuses_applier_id;
// 0x8: Index into entity_table_hdr::monster_slot_ptrs in the dungeon that the user
// (drainer) is held.
u8 leech_seed_source_monster_index;
u8 leech_seed_turns; // 0x9: Turns left for the status in statuses::leech_seed
// 0xA: Turns left until residual damage for the status in statuses::leech_seed, if applicable.
// Behaves weirdly without an afflictor
u8 leech_seed_damage_countdown;
};
struct sure_shot_class_status {
u8 sure_shot; // 0x0: STATUS_SURE_SHOT if 1
u8 sure_shot_turns; // 0x1: Turns left for the status in statuses::sure_shot
};
struct long_toss_class_status {
u8 status; // 0x0: STATUS_LONG_TOSS if 1
};
@ -296,23 +315,8 @@ struct monster {
struct bide_class_status bide_class_status; // 0xD2
struct reflect_class_status reflect_class_status; // 0xD5
struct curse_class_status curse_class_status; // 0xD8
u8 leech_seed; // 0xE0: STATUS_LEECH_SEED if 1
u8 field_0xe1;
u8 field_0xe2;
u8 field_0xe3;
// 0xE4: Used to track the statuses::statuses_unique_id of the relevant monster for
// statuses like Leech Seed and Destiny Bond.
u32 statuses_applier_id;
// 0xE8: Index into entity_table_hdr::monster_slot_ptrs in the dungeon that the user
// (drainer) is held.
u8 leech_seed_source_monster_index;
u8 leech_seed_turns; // 0xE9: Turns left for the status in statuses::leech_seed
// 0xEA: Turns left until residual damage for the status in statuses::leech_seed, if applicable.
// Behaves weirdly without an afflictor
u8 leech_seed_damage_countdown;
u8 field_0xEB;
u8 sure_shot; // 0xEC: STATUS_SURE_SHOT if 1
u8 sure_shot_turns; // 0xED: Turns left for the status in statuses::sure_shot
struct leech_seed_class_status leech_seed_class_status; // 0xE0
struct sure_shot_class_status sure_shot_class_status; // 0xEC
struct long_toss_class_status long_toss_class_status; // 0xEE
struct invisible_class_status invisible_class_status; // 0xEF
struct blinker_class_status blinker_class_status; // 0xF1

8
include/main_02052874.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef PMDSKY_MAIN_02052874_H
#define PMDSKY_MAIN_02052874_H
#include "enums.h"
enum mobility_type GetMobilityType(s16 monster_id);
#endif //PMDSKY_MAIN_02052874_H

16
include/monster_data.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef PMDSKY_MONSTER_DATA_TABLE_PTR_H
#define PMDSKY_MONSTER_DATA_TABLE_PTR_H
#include "enums.h"
struct monster_data {
u8 fill0[0x16];
enum mobility_type mobility_type;
u8 fill17[0x2D];
};
struct monster_data_table {
struct monster_data entries[MONSTER_RESERVE_45 + 1];
};
#endif //PMDSKY_MONSTER_DATA_TABLE_PTR_H

View File

@ -39,6 +39,8 @@ Static main
Object asm/main_02034974.o
Object src/number_util.o
Object asm/main_02051098.o
Object src/main_02052874.o
Object asm/main_02052890.o
Object src/main_02054BE0.o
Object asm/main_02054C24.o
Object src/pokemon.o
@ -296,9 +298,8 @@ Overlay OVY_29
Object asm/overlay_29_022FF8C8.o
Object src/overlay_29_023000E4.o
Object asm/overlay_29_02300108.o
Object src/dungeon_logic_0.o
Object asm/overlay_29_02300500.o
Object src/dungeon_logic.o
Object src/dungeon_logic_1.o
Object asm/overlay_29_023007A8.o
Object src/dungeon_capabilities.o
Object asm/overlay_29_023008DC.o

View File

@ -6,14 +6,13 @@
#include "dungeon_statuses.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "main_02052874.h"
#include "main_02054BE0.h"
#include "number_util.h"
#include "overlay_29_0231E9F0.h"
#include "targeting.h"
#include "util.h"
extern enum mobility_type GetMobilityType(s16 monster_id);
u32 GetAiUseItemProbability(struct entity *item_consumer, struct item *item, u32 flags)
{
u32 item_weight = 0;

View File

@ -1,74 +1,101 @@
#include "dungeon_logic.h"
#include "dungeon_logic_0.h"
#include "dungeon_statuses.h"
#include "dungeon_util_static.h"
extern bool8 MonsterHasImmobilizingStatus(struct entity *monster);
extern bool8 MonsterHasAttackInterferingStatus(struct entity *monster);
extern bool8 MonsterHasSkillInterferingStatus(struct entity *monster);
extern bool8 MonsterHasLeechSeedStatus(struct entity *monster);
extern bool8 MonsterHasWhifferStatus(struct entity *monster);
extern bool8 IsMonsterVisuallyImpaired(struct entity *monster, bool8 check_held_item);
extern bool8 IsMonsterMuzzled(struct entity *monster);
extern bool8 MonsterHasMiracleEyeStatus(struct entity *monster);
bool8 MonsterHasNegativeStatus(struct entity *monster, bool8 check_held_item)
bool8 IsMonsterDrowsy(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (IsMonsterDrowsy(monster))
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_SLEEP)
return TRUE;
if (MonsterHasNonvolatileNonsleepStatus(monster))
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_NIGHTMARE)
return TRUE;
if (MonsterHasImmobilizingStatus(monster))
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_YAWNING)
return TRUE;
return FALSE;
}
bool8 MonsterHasNonvolatileNonsleepStatus(struct entity *monster)
{
return GetEntInfo(monster)->burn_class_status.burn != STATUS_BURN_NONE;
}
bool8 MonsterHasImmobilizingStatus(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (pokemon_info->frozen_class_status.freeze != STATUS_FROZEN_WRAP &&
pokemon_info->frozen_class_status.freeze != STATUS_FROZEN_INGRAIN &&
pokemon_info->frozen_class_status.freeze != STATUS_FROZEN_NONE)
return TRUE;
return FALSE;
}
bool8 MonsterHasAttackInterferingStatus(struct entity *monster)
{
return GetEntInfo(monster)->cringe_class_status.cringe != STATUS_NONE;
}
bool8 MonsterHasSkillInterferingStatus(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (pokemon_info->curse_class_status.curse == STATUS_CURSE_CURSED)
return TRUE;
if (pokemon_info->curse_class_status.curse == STATUS_CURSE_DECOY)
return TRUE;
if (pokemon_info->curse_class_status.curse == STATUS_CURSE_GASTRO_ACID)
return TRUE;
if (pokemon_info->curse_class_status.curse == STATUS_CURSE_HEAL_BLOCK)
return TRUE;
if (pokemon_info->curse_class_status.curse == STATUS_CURSE_EMBARGO)
return TRUE;
return FALSE;
}
bool8 MonsterHasLeechSeedStatus(struct entity *monster)
{
return GetEntInfo(monster)->leech_seed_class_status.leech_seed == STATUS_LEECH_SEED_LEECH_SEED;
}
bool8 MonsterHasWhifferStatus(struct entity *monster)
{
return GetEntInfo(monster)->sure_shot_class_status.sure_shot == STATUS_SURE_SHOT_WHIFFER;
}
bool8 IsMonsterVisuallyImpaired(struct entity *monster, bool8 check_held_item)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (IsBlinded(monster, check_held_item))
return TRUE;
if (pokemon_info->blinker_class_status.blinded == STATUS_BLINKER_CROSS_EYED)
return TRUE;
if (pokemon_info->blinker_class_status.blinded == STATUS_BLINKER_DROPEYE)
return TRUE;
return FALSE;
}
bool8 IsMonsterMuzzled(struct entity *monster)
{
if (GetEntInfo(monster)->muzzled == TRUE)
return TRUE;
return FALSE;
}
bool8 MonsterHasMiracleEyeStatus(struct entity *monster)
{
if (GetEntInfo(monster)->miracle_eye == TRUE)
return TRUE;
if (MonsterHasAttackInterferingStatus(monster))
return TRUE;
if (MonsterHasSkillInterferingStatus(monster))
return TRUE;
if (MonsterHasLeechSeedStatus(monster))
return TRUE;
if (MonsterHasWhifferStatus(monster))
return TRUE;
if (IsMonsterVisuallyImpaired(monster, check_held_item))
return TRUE;
if (IsMonsterMuzzled(monster))
return TRUE;
if (MonsterHasMiracleEyeStatus(monster))
return TRUE;
if (pokemon_info->exposed)
return TRUE;
if (pokemon_info->perish_song_turns != 0)
return TRUE;
for (s32 i = 0; i < MAX_MON_MOVES; i++)
{
bool8 move_exists;
struct move *move = &pokemon_info->moves.moves[i];
if (move->flags0 & MOVE_FLAG_EXISTS)
move_exists = TRUE;
else
move_exists = FALSE;
if (move_exists && move->flags2 & MOVE_FLAG_SEALED)
return TRUE;
}
for (s32 i = 0; i < NUM_SPEED_COUNTERS; i++)
{
if (pokemon_info->speed_down_counters[i] != 0)
return TRUE;
}
return FALSE;
}

View File

@ -1,22 +0,0 @@
#include "dungeon_logic_0.h"
#include "dungeon_util_static.h"
bool8 IsMonsterDrowsy(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_SLEEP)
return TRUE;
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_NIGHTMARE)
return TRUE;
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_YAWNING)
return TRUE;
return FALSE;
}
bool8 MonsterHasNonvolatileNonsleepStatus(struct entity *monster)
{
return GetEntInfo(monster)->burn_class_status.burn != STATUS_BURN_NONE;
}

66
src/dungeon_logic_1.c Normal file
View File

@ -0,0 +1,66 @@
#include "dungeon_logic.h"
#include "dungeon_util_static.h"
// This file cannot be combined with dungeon_logic.c, as this causes all the functions in dungeon_logic.c to be inlined within MonsterHasNegativeStatus.
bool8 MonsterHasNegativeStatus(struct entity *monster, bool8 check_held_item)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (IsMonsterDrowsy(monster))
return TRUE;
if (MonsterHasNonvolatileNonsleepStatus(monster))
return TRUE;
if (MonsterHasImmobilizingStatus(monster))
return TRUE;
if (MonsterHasAttackInterferingStatus(monster))
return TRUE;
if (MonsterHasSkillInterferingStatus(monster))
return TRUE;
if (MonsterHasLeechSeedStatus(monster))
return TRUE;
if (MonsterHasWhifferStatus(monster))
return TRUE;
if (IsMonsterVisuallyImpaired(monster, check_held_item))
return TRUE;
if (IsMonsterMuzzled(monster))
return TRUE;
if (MonsterHasMiracleEyeStatus(monster))
return TRUE;
if (pokemon_info->exposed)
return TRUE;
if (pokemon_info->perish_song_turns != 0)
return TRUE;
for (s32 i = 0; i < MAX_MON_MOVES; i++)
{
bool8 move_exists;
struct move *move = &pokemon_info->moves.moves[i];
if (move->flags0 & MOVE_FLAG_EXISTS)
move_exists = TRUE;
else
move_exists = FALSE;
if (move_exists && move->flags2 & MOVE_FLAG_SEALED)
return TRUE;
}
for (s32 i = 0; i < NUM_SPEED_COUNTERS; i++)
{
if (pokemon_info->speed_down_counters[i] != 0)
return TRUE;
}
return FALSE;
}

9
src/main_02052874.c Normal file
View File

@ -0,0 +1,9 @@
#include "main_02052874.h"
#include "monster_data.h"
extern struct monster_data_table *MONSTER_DATA_TABLE_PTR;
enum mobility_type GetMobilityType(s16 monster_id)
{
return MONSTER_DATA_TABLE_PTR->entries[monster_id].mobility_type;
}