diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-10 11:05:50 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-10 11:05:50 +0000 |
commit | 1a21d2008a3f9bce922aa7d759b3e1df875ab37a (patch) | |
tree | 966a858c5aab2ba26f8819a6724f1571f2ad2af3 /crawl-ref/source/beam.cc | |
parent | 16c8c1117fda477278eaf4983d93df1fa83e603a (diff) | |
download | crawl-ref-1a21d2008a3f9bce922aa7d759b3e1df875ab37a.tar.gz crawl-ref-1a21d2008a3f9bce922aa7d759b3e1df875ab37a.zip |
Tweaked beam to-hit calculation.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@608 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index cf946b4ff0..e3b168d10c 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2975,6 +2975,14 @@ static bool fuzz_invis_tracer(bolt &beem) return (true); } +// A first step towards to-hit sanity for beams. We're still being +// very kind to the player, but it should be fairer to monsters than +// 4.0. +bool test_hit(int attack, int defence) +{ + return (random2(attack) >= random2avg(defence, 2)); +} + // return amount of extra range used up by affectation of the player static int affect_player( struct bolt &beam ) { @@ -3039,7 +3047,7 @@ static int affect_player( struct bolt &beam ) if (you.duration[DUR_DEFLECT_MISSILES]) beamHit = random2(beamHit / 3); - if (beamHit < dodge) + if (!test_hit(beamHit, dodge)) { mprf("The %s misses you.", beam.name.c_str()); return (0); // no extra used by miss! @@ -3089,7 +3097,7 @@ static int affect_player( struct bolt &beam ) // miss message - if (beamHit < dodge || you.duration[DUR_DEFLECT_MISSILES]) + if (!test_hit(beamHit, dodge) || you.duration[DUR_DEFLECT_MISSILES]) { mprf("The %s misses you.", beam.name.c_str()); return (0); @@ -3584,7 +3592,10 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) // explosions always 'hit' const bool engulfs = (beam.is_explosion || beam.is_big_cloud); - if (!engulfs && beam.hit < random2(mon->evasion)) + // FIXME We're randomising mon->evasion, which is further + // randomised inside test_hit. This is so we stay close to the 4.0 + // to-hit system (which had very little love for monsters). + if (!engulfs && !test_hit(beam.hit, random2(mon->evasion))) { // if the PLAYER cannot see the monster, don't tell them anything! if (player_monster_visible( &menv[tid] ) && mons_near(mon)) |