From: nhmall Date: Mon, 8 Feb 2021 13:41:23 +0000 (-0500) Subject: make engraving an occupation pr#460 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afc16f116e9a55f2195552a9d55c75ccfa06f686;p=nethack make engraving an occupation pr#460 copperwater commented 8 hours ago: Instead of inexplicably paralyzing the player for the duration of their engraving. Many a character has died by trying to engrave something and then sitting there diligently writing it while monsters surround and attack them. (This was especially prominent back in the 3.4.3 era when repeated Elbereths were viable, but it still occurs today with e.g. using a hard stone to engrave Elbereth). There were also some other oddities - for instance, if something teleported the player away while they were engraving, they would continue to "engrave" (be paralyzed) on their new location, but would not produce any text there; the full engraving would be placed on their initial position. In this commit, I have converted engraving to use the occupation framework, which treats it as an interruptible activity. This necessitated some logical restructuring, mostly involving the engraving being written out in chunks as the player spends more uninterrupted time on it. I've tried to keep this free of regressions except for those inherent to the occupation system. What has NOT changed: o The rate of engraving is still 10 characters per turn, or 1 character using slow methods. o The formulas for determining how much a bladed weapon or marker can engrave before getting exhausted are kept. Though this is a bit convoluted, and if it's not considered important to preserve the existing behavior, I would recommend simplifying it by decreasing the maximum engraving length for weapons by 1 so that each point of enchantment simply gets you 2 characters' worth of engraving (e.g. a -2 weapon will only engrave 1 or 2 characters before dulling to -3, rather than giving it a third "grace character". o The input buffer is still modified based on confusion/blindness/etc only at the time when the player inputs it (if they gain a debilitating status while engraving, it will not affect the text). My personal preference is to make the text affected in scenarios like that, but it's not strictly necessary to do here, so I didn't. o Wand messages such as "The floor is riddled by bullet holes", and blinding from engraving lightning, still appear before the hero starts to take any time engraving. As noted above, getting blinded by the wand still has no effect on accurately engraving the text, unless the hero was already blind or impaired. What has changed: o Moving off the engraving or losing the object being engraved with causes the player to stop engraving. o Wands can still engrave an arbitrary amount of text using a single charge, but if the hero is interrupted and decides to start engraving again, they will consume a second charge. As it adds a new field to g.context, this is a save-breaking change. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 3d7b4be45..6dc3aafc8 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -854,6 +854,7 @@ add cross-compile to WASM (github #385, #403, #412) differentiating gendered monster tiles from NullCGT (#430) check bones data directly for deja vu messages (#374) unify code for extracting an object from a monster's inventory (#455) +make engraving an occupation (#460) Code Cleanup and Reorganization