From ef3f75856919597e7366f0dc22c50f9fb49cd194 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 29 May 2007 02:51:47 +0000 Subject: [PATCH] dull spellbook (trunk only) Something else forwarded from the newsgroup long time ago: attempting to read a dull spellbook ought to have a chance of making the hero fall asleep. --- doc/fixes35.0 | 1 + src/spell.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 225180b9b..1a16289ed 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -345,6 +345,7 @@ some monsters will use fire to prevent selves being turned into green slime add `#vanquished' debug mode command C and #name commands are now same and use menu to choose monster vs object hallucination provides partial protection against gaze attacks +attempting to read "dull" spellbook might cause hero to fall asleep Platform- and/or Interface-Specific New Features diff --git a/src/spell.c b/src/spell.c index 150551cb4..c1feb26f6 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)spell.c 3.5 2006/12/06 */ +/* SCCS Id: @(#)spell.c 3.5 2007/05/29 */ /* Copyright (c) M. Stephenson 1988 */ /* NetHack may be freely redistributed. See license for details. */ @@ -427,6 +427,27 @@ register struct obj *spellbook; register boolean confused = (Confusion != 0); boolean too_hard = FALSE; + /* attempting to read dull book may make hero fall asleep */ + if (!confused && booktype != SPE_BLANK_PAPER && + !strcmp(OBJ_DESCR(objects[booktype]), "dull")) { + const char *eyes; + int dullbook = rnd(25) - ACURR(A_WIS); + + /* adjust chance if hero stayed awake, got interrupted, retries */ + if (context.spbook.delay && spellbook == context.spbook.book) + dullbook -= rnd(objects[booktype].oc_level); + + if (dullbook > 0) { + eyes = body_part(EYE); + if (eyecount(youmonst.data) > 1) eyes = makeplural(eyes); + pline("This book is so dull that you can't keep your %s open.", + eyes); + dullbook += rnd(2 * objects[booktype].oc_level); + fall_asleep(-dullbook, TRUE); + return 1; + } + } + if (context.spbook.delay && !confused && spellbook == context.spbook.book && /* handle the sequence: start reading, get interrupted, have context.spbook.book become erased somehow, resume reading it */