`spestudied' manipulation again (trunk only)

Refine last week's change dealing with polymorphing spellbooks:  when
a spellbook has faded to blank after multiple readings, randomize its
spestudied value so that it doesn't always polymorph into another blank
book on the first subsequent transformation attempt.
This commit is contained in:
nethack.rankin
2006-02-07 05:20:16 +00:00
parent cf05c21190
commit 24e15f7b2e

View File

@@ -356,6 +356,8 @@ learn()
if (book->spestudied > MAX_SPELL_STUDY) {
pline("This spellbook is too faint to be read any more.");
book->otyp = booktype = SPE_BLANK_PAPER;
/* reset spestudied as if polymorph had taken place */
book->spestudied = rn2(book->spestudied);
} else if (spellknow(i) <= 1000) {
Your("knowledge of %s is keener.", splname);
incrnknow(i);
@@ -376,6 +378,8 @@ learn()
/* pre-used due to being the product of polymorph */
pline("This spellbook is too faint to read even once.");
book->otyp = booktype = SPE_BLANK_PAPER;
/* reset spestudied as if polymorph had taken place */
book->spestudied = rn2(book->spestudied);
} else {
spl_book[i].sp_id = booktype;
spl_book[i].sp_lev = objects[booktype].oc_level;