]> granicus.if.org Git - nethack/commitdiff
Illiterate and blank spellbooks from gods
authorPasi Kallinen <paxed@alt.org>
Sat, 5 Mar 2022 14:42:42 +0000 (16:42 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 5 Mar 2022 14:42:46 +0000 (16:42 +0200)
Make gods avoid giving blank spellbooks as gifts, if you're
illiterate.  But if you do get a blank spellbook as a gift,
don't force-learn that non-existent spell.

src/pray.c

index 44f0c6e501898da4b7c721d085741a76e0477ba5..b1bc82913ca7033bcce92e90db6c46ae83d8ef80 100644 (file)
@@ -1196,13 +1196,14 @@ pleased(aligntyp g_align)
                         && !P_RESTRICTED(spell_skilltype(otmp->otyp)))
                         break; /* usable, but not yet known */
                 } else {
-                    if (!objects[SPE_BLANK_PAPER].oc_name_known
-                        || carrying(MAGIC_MARKER))
+                    if ((!objects[SPE_BLANK_PAPER].oc_name_known
+                         || carrying(MAGIC_MARKER)) && u.uconduct.literate)
                         break;
                 }
                 otmp->otyp = rnd_class(g.bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
             }
-            if (!u.uconduct.literate && !known_spell(otmp->otyp)) {
+            if (!u.uconduct.literate && (otmp->otyp != SPE_BLANK_PAPER)
+                && !known_spell(otmp->otyp)) {
                 if (force_learn_spell(otmp->otyp))
                     pline("Divine knowledge of %s fills your mind!",
                           OBJ_NAME(objects[otmp->otyp]));