From 6c05a8337e26b40f1cfebbf14cbc00ab0e2b6c8b Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Fri, 13 Nov 2009 14:51:31 +1000 Subject: New monster spell: Sleep. Give sleep to Aizul. Unlike Ensorcelled Hibernation, Sleep checks MR only, rather than MR and cold resistance. It also does not check monsters having SLEEP_WEARY. It will not act on something that is already sleep. --- crawl-ref/source/player.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 4ea7ac6b41..5233305c3a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -7079,6 +7079,26 @@ void player::hibernate(int) duration[DUR_SLEEP] = 3 + random2avg(5, 2); } +void player::put_to_sleep(int power) +{ + ASSERT(!crawl_state.arena); + + if (duration[DUR_SLEEP]) + { + mpr("You feel weary for a moment."); + return; + } + + mpr("You fall asleep!"); + + stop_delay(); + flash_colour = DARKGREY; + viewwindow(false); + + // As above, do this after redraw. + duration[DUR_SLEEP] = 5 + random2avg(power / 10, 5); +} + void player::awake() { ASSERT(!crawl_state.arena); -- cgit v1.2.3-54-g00ecf