diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index a0683d946fcee..ea306a379dbbf 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -507,6 +507,7 @@ "death_drops": "mon_zombie_hulk_death_drops", "regenerates": 15, "flags": [ + "ALL_SEEING", "SEES", "HEARS", "GOODHEARING", diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index 7756eb3a845b6..00172e42f799f 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -990,6 +990,7 @@ Other monster flags. - ```ACIDPROOF``` Immune to acid. - ```ACIDTRAIL``` Leaves a trail of acid. - ```ACID_BLOOD``` Makes monster bleed acid. Does not automatically dissolve in a pool of acid on death. +- ```ALL_SEEING``` Can see every creature within its vision (highest of day/night vision counts) on the same Z-level. - ```ALWAYS_VISIBLE``` This monster can always be seen regardless of line of sight or light level. - ```ANIMAL``` Is an _animal_ for purposes of the `Animal Empathy` trait. - ```AQUATIC``` Confined to water. diff --git a/src/creature.cpp b/src/creature.cpp index f6f6d7657ab5d..12d5442c95d34 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -352,6 +352,11 @@ bool Creature::sees( const Creature &critter ) const const Character *ch = critter.as_character(); const int wanted_range = rl_dist( pos(), critter.pos() ); + if( this->has_flag( MF_ALL_SEEING ) ) { + const monster *m = this->as_monster(); + return wanted_range < std::max( m->type->vision_day, m->type->vision_night ); + } + // Can always see adjacent monsters on the same level. // We also bypass lighting for vertically adjacent monsters, but still check for floors. if( wanted_range <= 1 && ( posz() == critter.posz() || here.sees( pos(), critter.pos(), 1 ) ) ) { diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index 29a9142abde94..48e03ace47eff 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -199,7 +199,8 @@ std::string enum_to_string( m_flag data ) case MF_ATTACK_LOWER: return "ATTACK_LOWER"; case MF_DEADLY_VIRUS: return "DEADLY_VIRUS"; case MF_ALWAYS_VISIBLE: return "ALWAYS_VISIBLE"; - case MF_ALWAYS_SEES_YOU: return "ALWAYS_SEES_YOU"; + case MF_ALWAYS_SEES_YOU: return "ALWAYS_SEES_YOU"; + case MF_ALL_SEEING: return "ALL_SEEING"; // *INDENT-ON* case m_flag::MF_MAX: break; diff --git a/src/mtype.h b/src/mtype.h index 96038e0785720..2697342e97247 100644 --- a/src/mtype.h +++ b/src/mtype.h @@ -173,6 +173,7 @@ enum m_flag : int { MF_DEADLY_VIRUS, // This monster can inflict the zombie_virus effect MF_ALWAYS_VISIBLE, // This monster can always be seen regardless of los or light or anything MF_ALWAYS_SEES_YOU, // This monster always knows where the avatar is + MF_ALL_SEEING, // This monster can see everything within its vision range regardless of light or obstacles MF_MAX // Sets the length of the flags - obviously must be LAST };