mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-30 14:18:10 -05:00
Decomped CanSeeInvisibleMonsters
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
.public AbilityIsActive
|
||||
.public DefenderAbilityIsActive__02301A0C
|
||||
.public DUNGEON_PTR
|
||||
.public DefenderAbilityIsActive__02301A0C
|
||||
.public EntityIsValid__023000E4
|
||||
.public GravityIsActive
|
||||
.public ItemIsActive__022FF898
|
||||
.public ov29_022FAFD4
|
||||
|
||||
@@ -166,20 +166,3 @@ _02301ED4:
|
||||
bl IsTypeAffectedByGravity
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end HasTypeAffectedByGravity
|
||||
|
||||
arm_func_start CanSeeInvisibleMonsters
|
||||
CanSeeInvisibleMonsters: ; 0x02301EEC
|
||||
stmdb sp!, {r3, lr}
|
||||
ldr r1, [r0, #0xb4]
|
||||
ldrb r1, [r1, #0xf1]
|
||||
cmp r1, #3
|
||||
moveq r0, #1
|
||||
ldmeqia sp!, {r3, pc}
|
||||
mov r1, #0x21
|
||||
bl ItemIsActive__022FF898
|
||||
cmp r0, #0
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end CanSeeInvisibleMonsters
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
// Called to check if a monster should treat another as an ally, enemy, or ignore it.
|
||||
// (Examples of the "ignore" case: target is a shopkeeper, there is a decoy on the floor, etc.)
|
||||
//
|
||||
// r0: Pointer to entity 1
|
||||
// r1: Pointer to entity 2
|
||||
// r2: If false, return TREATMENT_IGNORE if entity 2 is invisible and entity 1 cannot see invisible monsters
|
||||
// r3: If true, return TREATMENT_IGNORE if entity 1 is a team member and entity 2 has the STATUS_PETRIFIED status
|
||||
// entity1: Pointer to entity 1
|
||||
// entity2: Pointer to entity 2
|
||||
// see_invisible_targets: If false, return TREATMENT_IGNORE if entity 2 is invisible and entity 1 cannot see invisible monsters
|
||||
// ignore_petrified_targets: If true, return TREATMENT_IGNORE if entity 1 is a team member and entity 2 has the STATUS_PETRIFIED status
|
||||
// return: Treatment that monster 1 should apply to monster 2
|
||||
enum monster_treatment GetTreatmentBetweenMonsters(struct entity *pokemon, struct entity *target_pokemon, bool8 ignore_invisible, bool8 check_petrified);
|
||||
enum monster_treatment GetTreatmentBetweenMonsters(struct entity *entity1, struct entity *entity2, bool8 see_invisible_targets, bool8 ignore_petrified_targets);
|
||||
|
||||
#endif //PMDSKY_DUNGEON_AI_TARGETING_1_H
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
|
||||
bool8 IsTacticSet(struct entity *pokemon, enum tactic_id tactic_id);
|
||||
// Returns whether a certain monster can see other invisible monsters.
|
||||
// To be precise, this function returns true if the monster is holding Goggle Specs or if it has the status status::STATUS_EYEDROPS.
|
||||
bool8 CanSeeInvisibleMonsters(struct entity *entity);
|
||||
// Returns whether a monster is set to use a specific tactic.
|
||||
bool8 IsTacticSet(struct entity *entity, enum tactic_id tactic_id);
|
||||
|
||||
#endif //PMDSKY_DUNGEON_POKEMON_ATTRIBUTES_1_H
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "dungeon_ai_targeting_1.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
const enum monster_treatment MONSTER_TREATMENT_DATA[4][2][2][2] = {
|
||||
@@ -52,13 +53,11 @@ enum decoy_ai_treatment
|
||||
DECOY_AI_TREATMENT_WILD = 3,
|
||||
};
|
||||
|
||||
extern bool8 CanSeeInvisibleMonsters(struct entity *pokemon);
|
||||
|
||||
enum monster_treatment GetTreatmentBetweenMonsters(struct entity *pokemon, struct entity *target_pokemon, bool8 ignore_invisible, bool8 check_petrified)
|
||||
enum monster_treatment GetTreatmentBetweenMonsters(struct entity *entity1, struct entity *entity2, bool8 see_invisible_targets, bool8 ignore_petrified_targets)
|
||||
{
|
||||
struct monster *pokemon_info = GetEntInfo(pokemon);
|
||||
struct monster *target_data = GetEntInfo(target_pokemon);
|
||||
if (pokemon == target_pokemon)
|
||||
struct monster *pokemon_info = GetEntInfo(entity1);
|
||||
struct monster *target_data = GetEntInfo(entity2);
|
||||
if (entity1 == entity2)
|
||||
return TREATMENT_TREAT_AS_ALLY;
|
||||
|
||||
if (pokemon_info->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER || target_data->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER)
|
||||
@@ -67,10 +66,10 @@ enum monster_treatment GetTreatmentBetweenMonsters(struct entity *pokemon, struc
|
||||
if (pokemon_info->monster_behavior == BEHAVIOR_RESCUE_TARGET || target_data->monster_behavior == BEHAVIOR_RESCUE_TARGET)
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
if (check_petrified && !pokemon_info->is_not_team_member && target_data->frozen_class_status.freeze == STATUS_FROZEN_PETRIFIED)
|
||||
if (ignore_petrified_targets && !pokemon_info->is_not_team_member && target_data->frozen_class_status.freeze == STATUS_FROZEN_PETRIFIED)
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
if (!ignore_invisible && target_data->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE && !CanSeeInvisibleMonsters(pokemon))
|
||||
if (!see_invisible_targets && target_data->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE && !CanSeeInvisibleMonsters(entity1))
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
u8 pokemon_targeting_decoy = pokemon_info->decoy_ai_tracker;
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
bool8 IsTacticSet(struct entity *pokemon, enum tactic_id tactic_id)
|
||||
extern bool8 ItemIsActive__022FF898(struct entity *entity, enum item_id item_id);
|
||||
|
||||
bool8 CanSeeInvisibleMonsters(struct entity *entity)
|
||||
{
|
||||
struct monster *pokemon_info = GetEntInfo(pokemon);
|
||||
if (GetEntInfo(entity)->blinker_class_status.blinded == STATUS_BLINKER_EYEDROPS)
|
||||
return TRUE;
|
||||
|
||||
if (ItemIsActive__022FF898(entity, ITEM_GOGGLE_SPECS))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsTacticSet(struct entity *entity, enum tactic_id tactic_id)
|
||||
{
|
||||
struct monster *pokemon_info = GetEntInfo(entity);
|
||||
if (pokemon_info->is_team_leader)
|
||||
return tactic_id == TACTIC_YOU_GO_THE_OTHER_WAY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user