diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-07 20:27:45 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-07 20:27:45 +0000 |
commit | 5fa864a78e4ebd44189a31827edeead3f0c12597 (patch) | |
tree | 103a4942b363bcf3a5b021d831f572f439ceca09 /crawl-ref/source/mon-util.cc | |
parent | 4a27714410c3f8f0f5113421a77e21a43242a0c2 (diff) | |
download | crawl-ref-5fa864a78e4ebd44189a31827edeead3f0c12597.tar.gz crawl-ref-5fa864a78e4ebd44189a31827edeead3f0c12597.zip |
Implemented Erik's invisibility proposal:
- M_SENSE_INVIS for perceptive monsters; split existing monsters with see
invisible into M_SEE_INVIS and M_SENSE_INVIS.
- Monsters that can't see invisible get to-hit penalties vs invisible players
and monsters in both melee and at range.
- Monsters that sense where you are know where to shoot and attack, but still
get to-hit penalties because they don't know exactly where you are.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1260 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 086a63bd15..7c0da9cf5d 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -519,16 +519,21 @@ bool mons_is_unique( int mc ) return (mons_class_flag(mc, M_UNIQUE)); } -char mons_see_invis( struct monsters *mon ) +bool mons_sense_invis(const monsters *mon) +{ + return (mons_class_flag(mon->type, M_SENSE_INVIS)); +} + +bool mons_see_invis(const monsters *mon) { if (mon->type == MONS_PLAYER_GHOST || mon->type == MONS_PANDEMONIUM_DEMON) return (mon->ghost->values[ GVAL_SEE_INVIS ]); else if (((seekmonster(mon->type))->bitfields & M_SEE_INVIS) != 0) - return (1); + return (true); else if (scan_mon_inv_randarts( mon, RAP_EYESIGHT ) > 0) - return (1); + return (true); - return (0); + return (false); } // end mons_see_invis() @@ -554,7 +559,7 @@ bool mons_player_visible( struct monsters *mon ) if (player_in_water()) return (true); - if (mons_see_invis( mon )) + if (mons_see_invis( mon ) || mons_sense_invis(mon)) return (true); return (false); @@ -568,7 +573,6 @@ unsigned char mons_char(int mc) return (unsigned char) smc->showchar; } // end mons_char() - char mons_itemuse(int mc) { return (smc->gmon_use); @@ -3859,6 +3863,16 @@ bool monsters::needs_berserk(bool check_spells) const return (true); } +bool monsters::can_see_invisible() const +{ + return (mons_see_invis(this)); +} + +bool monsters::invisible() const +{ + return (has_ench(ENCH_INVIS)); +} + ///////////////////////////////////////////////////////////////////////// // mon_enchant |