MCPcopy Create free account
hub / github.com/NetHack/NetHack / confused_book

Function confused_book

src/spell.c:188–207  ·  view source on GitHub ↗

study while confused: returns TRUE if the book is destroyed */

Source from the content-addressed store, hash-verified

186
187/* study while confused: returns TRUE if the book is destroyed */
188staticfn boolean
189confused_book(struct obj *spellbook)
190{
191 boolean gone = FALSE;
192
193 if (!rn2(3) && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) {
194 spellbook->in_use = TRUE; /* in case called from learn() */
195 pline(
196 "Being confused you have difficulties in controlling your actions.");
197 display_nhwindow(WIN_MESSAGE, FALSE);
198 You("accidentally tear the spellbook to pieces.");
199 trycall(spellbook);
200 useup(spellbook);
201 gone = TRUE;
202 } else {
203 You("find yourself reading the %s line over and over again.",
204 spellbook == svc.context.spbook.book ? "next" : "first");
205 }
206 return gone;
207}
208
209/* pacify or tame an undead monster */
210staticfn void

Callers 2

learnFunction · 0.85
study_bookFunction · 0.85

Calls 5

rn2Function · 0.85
YouFunction · 0.85
trycallFunction · 0.85
useupFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected