]> granicus.if.org Git - nethack/commitdiff
`spestudied' manipulation again (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 7 Feb 2006 05:20:16 +0000 (05:20 +0000)
committernethack.rankin <nethack.rankin>
Tue, 7 Feb 2006 05:20:16 +0000 (05:20 +0000)
     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.

src/spell.c

index b11118ca9d6541ac2dcda519d8ae6b06dcc0814b..e85abb6b7fc880b429bed04a62e33a8be935ea65 100644 (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;