Skip to content

Commit

Permalink
Add ALL_SEEING monster flag (CleverRaven#59398)
Browse files Browse the repository at this point in the history
* ALL_SEEING

* Relentless hulk smash

Co-authored-by: Venera3 <[email protected]>
  • Loading branch information
2 people authored and alef committed Aug 5, 2022
1 parent 349d69d commit 13cdbea
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/json/monsters/zed_misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
"death_drops": "mon_zombie_hulk_death_drops",
"regenerates": 15,
"flags": [
"ALL_SEEING",
"SEES",
"HEARS",
"GOODHEARING",
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) ) {
Expand Down
3 changes: 2 additions & 1 deletion src/monstergenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ std::string enum_to_string<m_flag>( 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;
Expand Down
1 change: 1 addition & 0 deletions src/mtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down

0 comments on commit 13cdbea

Please sign in to comment.