]> granicus.if.org Git - nethack/commitdiff
You can reread a spellbook to refresh your memory at any time
authorcopperwater <aosdict@gmail.com>
Sun, 2 Sep 2018 18:55:03 +0000 (14:55 -0400)
committerPasi Kallinen <paxed@alt.org>
Mon, 28 Sep 2020 15:25:06 +0000 (18:25 +0300)
Aimed at fixing the problem where the player knows they're going to
forget a spell in a few thousand turns, so they go back and get the
book... only to find out that they "know it quite well already", and
need to wait an indeterminate amount of time until they are on the verge
of forgetting it (< 2000 turns) before the book will let them read it
again.

This commit simply removes that 2000 turn limit, so the player can fully
restore their memory at any time with the spellbook. Naturally, this
still consumes a read charge, so the book won't ultimately last as long
if you keep rereading it early.

If you do have more than 2000 turns left, the game will prompt you to
confirm that you do want to refresh your memory anyway. As before,
rereading with fewer turns will not prompt.

src/spell.c

index 4b509c61c5be2d8eec3b8e7bd11cda7180aa4056..312ca447529f108a71cc17cd74eb99f245f09023 100644 (file)
@@ -393,10 +393,7 @@ learn(VOID_ARGS)
             book->otyp = booktype = SPE_BLANK_PAPER;
             /* reset spestudied as if polymorph had taken place */
             book->spestudied = rn2(book->spestudied);
-        } else if (spellknow(i) > KEEN / 10) {
-            You("know %s quite well already.", splname);
-            costly = FALSE;
-        } else { /* spellknow(i) <= KEEN/10 */
+        } else {
             Your("knowledge of %s is %s.", splname,
                  spellknow(i) ? "keener" : "restored");
             incrnknow(i, 1);
@@ -443,7 +440,7 @@ int
 study_book(spellbook)
 register struct obj *spellbook;
 {
-    int booktype = spellbook->otyp;
+    int booktype = spellbook->otyp, i;
     boolean confused = (Confusion != 0);
     boolean too_hard = FALSE;
 
@@ -529,6 +526,16 @@ register struct obj *spellbook;
             return 0;
         }
 
+        /* check to see if we already know it and want to refresh our memory */
+        for (i = 0; i < MAXSPELL; i++)
+            if (spellid(i) == booktype || spellid(i) == NO_SPELL)
+                break;
+        if (spellid(i) == booktype && spellknow(i) > KEEN / 10) {
+            You("know \"%s\" quite well already.", OBJ_NAME(objects[booktype]));
+            if (yn("Refresh your memory anyway?") == 'n')
+                return 0;
+        }
+
         /* Books are often wiser than their readers (Rus.) */
         spellbook->in_use = TRUE;
         if (!spellbook->blessed && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) {