From ceec9fda44634cacf08e284f8b7226381da559dc Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 3 Sep 2024 00:05:29 -0700 Subject: [PATCH] fix github issue #1278 - spellbook discovery Issue reported by ars3niy: having a pauper wizard #enhance bare-handed fighting to basic caused the hero to learn all level 1 spellbooks. Spellbook discovery for wizards when advancing skills is intentional, to replace the old Luck-based chance of writing unknown books with magic markers. (The Luck bias for wizards still applies for scrolls.) Discovering spellbooks when advancing non-spell skills does feel wrong. Change it to only happen when advancing spell skills. This isn't pauper-specific, it's just a lot more noticeable in that state. There may be better ways to cope with this, but for the time being I'm marking the issue 'fixed'. Fixes #1278 --- doc/fixes3-7-0.txt | 2 ++ src/weapon.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 03f119fee..b2f4651bb 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2024,6 +2024,8 @@ eating a pyrolisk egg on the floor triggered an "object lost" panic core object creation and the curses interface's window handling both became confused by the 'pauper' option/conduct because they assumed that invent being Null meant that the game hadn't started yet +wizards were discovering unread spellbooks whenever any skill was advanced; do so + only when a spell skill is advanced Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/weapon.c b/src/weapon.c index d34d9eb89..e10c456fa 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1148,7 +1148,11 @@ skill_advance(int skill) P_SKILL(skill) >= P_MAX_SKILL(skill) ? "most" : "more", P_NAME(skill)); - skill_based_spellbook_id(); + /* wizards discover spellbook IDs depending on spell 'school' skill limits; + this allows them to successfully write books for unknown spells without + the Luck bias they used to have over other roles */ + if (skill >= P_FIRST_SPELL && skill <= P_LAST_SPELL) + skill_based_spellbook_id(); } static const struct skill_range {