From 621d21ebb9d1ff29506a9a6522840565283defb1 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 3 Dec 2025 21:35:17 +0000 Subject: [PATCH] Archeologists can decipher scroll labels Prior to this commit, Archeologists had an incredibly difficult start, worse than was intended. This is intended to make it a bit easier (whilst making the role more different from other roles) via allowing them to identify scroll types earlier in the game than the other roles are able to (they do it using a knowledge of ancient languages that lets them read scroll labels that other roles couldn't). --- doc/Guidebook.mn | 3 ++- doc/fixes3-7-0.txt | 9 +++++---- src/invent.c | 44 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 72d3f3be3..1094c6662 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -131,7 +131,8 @@ will vary with your background and training: .pg \fIArcheologists\fP understand dungeons pretty well; this enables them to move quickly and sneak up on the local nasties. They start equipped -with the tools for a proper scientific expedition. +with the tools for a proper scientific expedition, and are able to read +ancient languages. .pg \fIBarbarians\fP are warriors out of the hinterland, hardened to battle. They begin their quests with naught but uncommon strength, a trusty hauberk, diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index bb0b879c9..3729ff0b9 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1551,6 +1551,10 @@ you cannot sacrifice objects/corpses while stunned or confused that they work; /y and /n for them now only work when lootabc is off writing on an unidentified scroll of blank paper identifies blank paper dumplogs include spells and skills +uncursed genocide while hallucinating deliberately mis-reports hero's role as + target but was also inappropriately showing it to livelog/#chronicle +livelog/#chronicle for bribing a demon lord reported random monster and + currency if hero was hallucinating Fixes to 3.7.0-x General Problems Exposed Via git Repository @@ -2849,10 +2853,7 @@ archeologists' fedora is lucky telepathic hero can discern which particular monster just read a scroll add "make fetch-docs" to download pre-formatted documentation monsters will use throw-and-return weapons such as an aklys -uncursed genocide while hallucinating deliberately mis-reports hero's role as - target but was also inappropriately showing it to livelog/#chronicle -livelog/#chronicle for bribing a demon lord reported random monster and - currency if hero was hallucinating +archeologists can identify scrolls by deciphering their labels Platform- and/or Interface-Specific New Features diff --git a/src/invent.c b/src/invent.c index ddd7ffefb..f3c7f3803 100644 --- a/src/invent.c +++ b/src/invent.c @@ -965,8 +965,6 @@ merged(struct obj **potmp, struct obj **pobj) * This is called when adding objects to the hero's inventory normally (via * addinv) or when an object in the hero's inventory has been polymorphed * in-place. - * - * It may be valid to merge this code with addinv_core2(). */ void addinv_core1(struct obj *obj) @@ -1017,22 +1015,47 @@ addinv_core1(struct obj *obj) } /* - * Adjust hero intrinsics as if this object was being added to the hero's - * inventory. Called _after_ the object has been added to the hero's - * inventory. + * Adjust hero intrinsics (and perform other side effects) as if this + * object was being added to the hero's inventory. Called _after_ the + * object has been added to the hero's inventory. + * + * This can be used either for updating intrinsics, or to allow the hero to + * react to objects that are now in inventory. * * This is called when adding objects to the hero's inventory normally (via - * addinv) or when an object in the hero's inventory has been polymorphed - * in-place. + * addinv), when an object in the hero's inventory has been polymorphed + * in-place, or when the hero re-examines objects that they picked up while + * blind. + * + * This may occasionally be called on an item that was already in inventory, + * so it should be written to work even if called multiple times in a row + * (e.g. do not assume that the object was not in inventory already). */ void addinv_core2(struct obj *obj) { if (confers_luck(obj)) { /* new luckstone must be in inventory by this point - * for correct calculation */ + for correct calculation */ set_moreluck(); } + + /* Archeologists can decipher the writing on a scroll label to work out + what they are (exception: unlabeled scrolls don't have a label to + decipher) */ + if (Role_if(PM_ARCHEOLOGIST) && obj->oclass == SCROLL_CLASS && + obj->otyp != SCR_BLANK_PAPER && !Blind && + !objects[obj->otyp].oc_name_known) { + observe_object(obj); + pline("You decipher the label on %s.", yname(obj)); + makeknown(obj->otyp); + + /* conduct: this is avoidable via not picking up / wishing for + scrolls */ + if (!u.uconduct.literate++) + livelog_printf(LL_CONDUCT, + "became literate by deciphering a scroll label"); + } } /* @@ -2738,12 +2761,15 @@ learn_unseen_invent(void) return; /* sanity check */ for (otmp = gi.invent; otmp; otmp = otmp->nobj) { - if (otmp->dknown && (otmp->bknown || !Role_if(PM_CLERIC))) + if (otmp->dknown && (otmp->bknown || !Role_if(PM_CLERIC)) && + (otmp->oclass != SCROLL_CLASS || !Role_if(PM_ARCHEOLOGIST))) continue; /* already seen */ invupdated = TRUE; /* xname() will set dknown, perhaps bknown (for priest[ess]); result from xname() is immediately released for re-use */ maybereleaseobuf(xname(otmp)); + addinv_core2(otmp); /* you react to seeing the object */ + /* * If object->eknown gets implemented (see learnwand(zap.c)), * handle deferred discovery here.