diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-31 22:56:26 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-31 22:56:26 +0000 |
commit | 6ce835d28c2081d13222a9faedc350ece4abb11b (patch) | |
tree | fd4e17d21f8fcecb94a9e672717516eb25edadce /crawl-ref/source/beam.cc | |
parent | 14fce897135078ec3542c0d96b751f58544bae99 (diff) | |
download | crawl-ref-6ce835d28c2081d13222a9faedc350ece4abb11b.tar.gz crawl-ref-6ce835d28c2081d13222a9faedc350ece4abb11b.zip |
Fix 1869850: Targeting now respects mimics' (un)known status correctly,
so that * and / work for unknown ones, and + and - for known
ones. Also, mimics become known if you hit them since the
resulting message ("moderately damaged" or "looks slightly
unstable") will give that away anyway.
Implement the first part of FR 1903048: Added a range parameter to
direction(), so that when targeting for weapons of reaching we can check
whether a monster is within the range of 2 squares (grid_distance).
Does not handle submerged monsters.
Eventually, this could be used to also limit max range for certain spells
(Freeze, I'm looking at you!)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3995 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index bc76bf2e5d..a9d8abf02c 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2347,10 +2347,25 @@ bool check_line_of_sight( int sx, int sy, int tx, int ty ) */ void mimic_alert(monsters *mimic) { + bool should_id = !testbits(mimic->flags, MF_KNOWN_MIMIC) + && player_monster_visible(mimic) && mons_near(mimic); + + // If we got here, we at least got a resists message, if not + // a full wounds printing. Thus, might as well id the mimic. if (mimic->has_ench(ENCH_TP)) + { + if (should_id) + mimic->flags |= MF_KNOWN_MIMIC; + return; - - monster_teleport( mimic, !one_chance_in(3) ); + } + + const bool instant_tele = !one_chance_in(3); + monster_teleport( mimic, instant_tele ); + + // at least for this short while, we know it's a mimic + if (!instant_tele && should_id) + mimic->flags |= MF_KNOWN_MIMIC; } // end mimic_alert() static bool _isBouncy(bolt &beam, unsigned char gridtype) |