diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2021-12-19 16:38:51 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 16:38:51 -0600 |
commit | 8e1c66d8bd01807285b05d8333f36cd2d70e062c (patch) | |
tree | bb1bf94d56b770eca66780948ff9e05401967ed1 /src/dungeon_visibility.c | |
parent | 087405b9d975b447ef7b17afd1e73e449cc7881b (diff) | |
parent | 0369264407563b64d60c885f8bf79322b6f663c8 (diff) |
Merge pull request #85 from AnonymousRandomPerson/master
More AI decomp
Diffstat (limited to 'src/dungeon_visibility.c')
-rw-r--r-- | src/dungeon_visibility.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c new file mode 100644 index 0000000..862e1a0 --- /dev/null +++ b/src/dungeon_visibility.c @@ -0,0 +1,34 @@ +#include "global.h" +#include "dungeon_visibility.h" + +#include "constants/status.h" +#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_range.h" +#include "dungeon_util.h" + +bool8 CanSee(struct DungeonEntity *entity, struct DungeonEntity *targetEntity) +{ + if (!EntityExists(entity) || !EntityExists(targetEntity) || !targetEntity->visible) + { + return FALSE; + } + if (targetEntity->entityType == ENTITY_POKEMON) + { + if (entity->entityType == ENTITY_POKEMON) + { + if (!CanSeeInvisible(entity) && targetEntity->entityData->transformStatus == TRANSFORM_STATUS_INVISIBLE) + { + return FALSE; + } + if (entity->entityData->eyesightStatus == EYESIGHT_STATUS_BLINKER) + { + return FALSE; + } + } + else if (targetEntity->entityData->transformStatus == TRANSFORM_STATUS_INVISIBLE) + { + return FALSE; + } + } + return InSameRoom_2(&entity->posWorld, &targetEntity->posWorld); +} |