diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-02 15:05:33 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-02 15:05:33 +0000 |
commit | d8537ce97fcc261408188af698b908948a0a2b84 (patch) | |
tree | 5783fae57cda6312329c0c1d46a0d82cc27181f8 /crawl-ref/source/beam.cc | |
parent | ee11c9b3ddae51109d602aa87fc5eb96a3d9e4a4 (diff) | |
download | crawl-ref-d8537ce97fcc261408188af698b908948a0a2b84.tar.gz crawl-ref-d8537ce97fcc261408188af698b908948a0a2b84.zip |
Experimental support for monster shields, needs more work for rationalising shield class for monsters with player and beam to-hit.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2727 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 4e532cb96d..ba3c94cacc 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3129,14 +3129,14 @@ static int affect_player( bolt &beam ) #endif if (hit < block) { - you.shield_blocks++; mprf( "You block the %s.", beam.name.c_str() ); - exercise( SK_SHIELDS, exer + 1 ); + you.shield_block_succeeded(); return (BEAM_STOP); } // some training just for the "attempt" - exercise( SK_SHIELDS, exer ); + if (coinflip()) + exercise( SK_SHIELDS, exer ); } if (player_light_armour(true) && !beam.aimed_at_feet @@ -3878,6 +3878,26 @@ static int affect_monster(bolt &beam, monsters *mon) return (0); } + // The monster may block the beam. + if (!engulfs && beam_is_blockable(beam)) + { + const int shield_block = mon->shield_bonus(); + if (shield_block > 0) + { + const int hit = random2( beam.hit * 130 / 100 + + mon->shield_block_penalty() ); + if (hit < shield_block && mons_near(mon) + && player_monster_visible(mon)) + { + mprf("%s blocks the %s.", + mon->name(DESC_CAP_THE).c_str(), + beam.name.c_str()); + mon->shield_block_succeeded(); + return (BEAM_STOP); + } + } + } + update_hurt_or_helped(beam, mon); // the beam hit. |