diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-06 15:10:29 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-06 15:12:26 -0600 |
commit | f9b61b5115bb93a1381cfc3032820489875624c5 (patch) | |
tree | 637b6b52c190b1feb0e17193784056324213cf08 /crawl-ref/source/beam.cc | |
parent | b192fdbbbeb85e80aae71e169417511b52e5ab19 (diff) | |
download | crawl-ref-f9b61b5115bb93a1381cfc3032820489875624c5.tar.gz crawl-ref-f9b61b5115bb93a1381cfc3032820489875624c5.zip |
Consolidate player/monster sleep checks.
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r-- | crawl-ref/source/beam.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index e3c8360fca..fab78fd095 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -4950,9 +4950,7 @@ bool _ench_flavour_affects_monster(beam_type flavour, const monsters* mon) break; case BEAM_SLEEP: - rc = !mon->has_ench(ENCH_SLEEP_WARY) // slept recently - && mon->holiness() == MH_NATURAL // no unnatural - && mon->res_cold() <= 0; // can't be hibernated + rc = mon->can_sleep(); break; case BEAM_PORKALATOR: @@ -5157,10 +5155,14 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon) return (MON_AFFECTED); case BEAM_SLEEP: - if (simple_monster_message(mon, " looks drowsy...")) - obvious_effect = true; - mon->put_to_sleep(); - return (MON_AFFECTED); + if (mon->can_sleep()) + { + if (simple_monster_message(mon, " looks drowsy...")) + obvious_effect = true; + mon->put_to_sleep(); + return (MON_AFFECTED); + } + return (MON_UNAFFECTED); case BEAM_BACKLIGHT: if (backlight_monsters(mon->pos(), hit, 0)) @@ -5202,9 +5204,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon) && mon->add_ench(ENCH_MIGHT)) { if (simple_monster_message(mon, " seems to grow stronger.")) - { obvious_effect = true; - } } return (MON_AFFECTED); |