fix pull request #513 - applying books

Applying a novel to flip through its pages described them as having
"ink" rather than "magical ink" but that wasn't a very suitable way
to distinguish them from spellbooks since their ink never fades.

The Book of the Dead's pages "glowed faintly red" even when the
hero couldn't see them.

Fixes #513
This commit is contained in:
PatR
2021-05-18 18:31:04 -07:00
parent 09ec492dd8
commit 11e98efb94
2 changed files with 17 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.539 $ $NHDT-Date: 1621380392 2021/05/18 23:26:32 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.540 $ $NHDT-Date: 1621387861 2021/05/19 01:31:01 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -681,6 +681,7 @@ forgetting an item's known/dknown/bknown/&c settings when picked up by unseen
monster made it possible to trigger a latent shop bug with globs; monster made it possible to trigger a latent shop bug with globs;
avoid clearing dknown flag for globs avoid clearing dknown flag for globs
fix globby_bill_fixup to use shopkeeper instead of Null for glob pricing fix globby_bill_fixup to use shopkeeper instead of Null for glob pricing
applying a book to check readability treated novels as if they were spellbooks
curses: 'msg_window' option wasn't functional for curses unless the binary curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 apply.c $NHDT-Date: 1615158480 2021/03/07 23:08:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.340 $ */ /* NetHack 3.7 apply.c $NHDT-Date: 1621387861 2021/05/19 01:31:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3957,45 +3957,43 @@ flip_through_book(struct obj *obj)
return 0; return 0;
} }
You("flip through the pages of the spellbook."); You("flip through the pages of %s.", thesimpleoname(obj));
if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
if (Deaf) { if (!Deaf)
You_see("the pages glow faintly %s.", hcolor(NH_RED));
} else {
You_hear("the pages make an unpleasant %s sound.", You_hear("the pages make an unpleasant %s sound.",
Hallucination ? "chuckling" Hallucination ? "chuckling"
: "rustling"); : "rustling");
} else if (!Blind)
return 1; You_see("the pages glow faintly %s.", hcolor(NH_RED));
else
You_feel("the pages tremble.");
} else if (Blind) { } else if (Blind) {
pline("The pages feel %s.", pline("The pages feel %s.",
Hallucination ? "freshly picked" Hallucination ? "freshly picked"
: "rough and dry"); : "rough and dry");
return 1;
} else if (obj->otyp == SPE_BLANK_PAPER) { } else if (obj->otyp == SPE_BLANK_PAPER) {
pline("This spellbook %s.", pline("This spellbook %s.",
Hallucination ? "doesn't have much of a plot" Hallucination ? "doesn't have much of a plot"
: "has nothing written in it"); : "has nothing written in it");
makeknown(obj->otyp); makeknown(obj->otyp);
return 1; } else if (Hallucination) {
}
if (Hallucination) {
You("enjoy the animated initials."); You("enjoy the animated initials.");
} else if (obj->otyp == SPE_NOVEL) {
pline("This looks like it might be interesting to read.");
} else { } else {
static const char* fadeness[] = { static const char *fadeness[] = {
"fresh", "fresh",
"slightly faded", "slightly faded",
"very faded", "very faded",
"extremely faded", "extremely faded",
"barely visible" "barely visible"
}; };
int findx = min(obj->spestudied, MAX_SPELL_STUDY);
int index = min(obj->spestudied, MAX_SPELL_STUDY);
pline("The%s ink in this spellbook is %s.", pline("The%s ink in this spellbook is %s.",
objects[obj->otyp].oc_magic ? " magical" : "", objects[obj->otyp].oc_magic ? " magical" : "",
fadeness[index]); fadeness[findx]);
} }
return 1; return 1;