Decomped MonsterHasMiracleEyeStatus

This commit is contained in:
AnonymousRandomPerson
2025-05-10 23:20:27 -04:00
parent 8de2c1430a
commit e966925e00
8 changed files with 177 additions and 192 deletions

View File

@@ -1 +0,0 @@
#pragma once

View File

@@ -1,15 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_02300618.inc"
.text
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,27 +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);
// 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);
#endif //PMDSKY_DUNGEON_LOGIC_0_H

View File

@@ -296,9 +296,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_02300618.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

@@ -1,67 +1,101 @@
#include "dungeon_logic.h"
#include "dungeon_logic_0.h"
#include "dungeon_statuses.h"
#include "dungeon_util_static.h"
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,93 +0,0 @@
#include "dungeon_logic_0.h"
#include "dungeon_statuses.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;
}
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 == 1)
return TRUE;
return FALSE;
}

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;
}