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/beam.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/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 1cf809f8e5..3c5297f4e1 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2886,6 +2886,15 @@ static bool fuzz_invis_tracer(bolt &beem) if (dist > 2) return (false); + const int beam_src = beam_source(beem); + if (beam_src != MHITNOT && beam_src != MHITYOU) + { + // Monsters that can sense invisible + const monsters *mon = &menv[beam_src]; + if (mons_sense_invis(mon)) + return (!dist); + } + // Apply fuzz now. int xfuzz = random_range(-2, 2), yfuzz = random_range(-2, 2); @@ -2960,6 +2969,10 @@ static int affect_player( struct bolt &beam ) // use beamHit, NOT beam.hit, for modification of tohit.. geez! beamHit = beam.hit; + // Monsters shooting at an invisible player are very inaccurate. + if (you.invis && !beam.can_see_invis) + beamHit /= 2; + if (beam.name[0] != '0') { if (!beam.is_explosion && !beam.aimed_at_feet) @@ -3523,10 +3536,14 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) // explosions always 'hit' const bool engulfs = (beam.is_explosion || beam.is_big_cloud); + int beam_hit = beam.hit; + if (menv[tid].invisible() && !beam.can_see_invis) + beam_hit /= 2; + // FIXME We're randomising mon->evasion, which is further // randomised inside test_beam_hit. This is so we stay close to the 4.0 // to-hit system (which had very little love for monsters). - if (!engulfs && !test_beam_hit(beam.hit, random2(mon->ev))) + if (!engulfs && !test_beam_hit(beam_hit, random2(mon->ev))) { // if the PLAYER cannot see the monster, don't tell them anything! if (player_monster_visible( &menv[tid] ) && mons_near(mon)) |