From 1532a052c0241c5496a74a3f903bfc077894440b Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 27 Feb 2024 11:27:02 -0800 Subject: [PATCH] spellbook of blank paper named Making Money Reported directly to devteam, polymorphing a spellbook could produce a blank spellbook with a Discworld novel's title attached. --- doc/fixes3-7-0.txt | 3 +++ src/zap.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 131a26118..217bc3d5f 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1367,6 +1367,9 @@ the number of items destroyed by elemental effects is based on the damage randomize the spellbook in the second level of vlad's tower monsters weren't randomly generating if exactly one square was outside LOS, and it contained a monster +when a spellbook was polymorphed into a novel and then incrementing spestudied + field turned it into a blank spellbook, the novel's title would stick: + "{spellbook of blank paper|plain spellbook} named " Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/zap.c b/src/zap.c index 94b0a960f..3609c3a8a 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1789,9 +1789,12 @@ poly_obj(struct obj *obj, int id) case SPBOOK_CLASS: while (otmp->otyp == SPE_POLYMORPH) - otmp->otyp = rnd_class(SPE_DIG, SPE_BLANK_PAPER); - /* reduce spellbook abuse; non-blank books degrade */ - if (otmp->otyp != SPE_BLANK_PAPER) { + otmp->otyp = rnd_class(gb.bases[SPBOOK_CLASS], SPE_BLANK_PAPER); + /* reduce spellbook abuse; non-blank books degrade; + 3.7: novels don't use spestudied so shouldn't degrade to blank + (but don't force spestudied to zero for them since a non-zero + value could get passed along to a future polymorph) */ + if (otmp->otyp != SPE_BLANK_PAPER && otmp->otyp != SPE_NOVEL) { otmp->spestudied = obj->spestudied + 1; if (otmp->spestudied > MAX_SPELL_STUDY) { otmp->otyp = SPE_BLANK_PAPER;