From b98a70e3ecaa4cbb5eb18c99de61cf84a2b52213 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 5 Dec 2023 04:52:02 +0000 Subject: [PATCH] Dwarvish cloaks somewhat protect inventory from cold and fire The change to Sokoban difficulty calculation introduced a balance issue: previously the Sokoban prize was obtainable before item- destruction attacks became common and would protect from them, whereas now they commonly appear in Sokoban itself, before the prize is accessible. This makes scrolls and potions much less usable as escape items, and potions of healing less usable for HP recovery, because they either get stashed or destroyed (and in either case aren't usable by the character in time-critical situations). This commit attempts to alleviate the problem by adding a way to protect items from cold and fire in the early game. It's a little unreliable, and requires equipping an item that has bad stats and generally isn't otherwise used, but which is generally easy to find early on. Not included in this commit, but probably necessary for a "finished" version of the feature: some way of letting players know the new mechanic. It shows up in enlightenment, but there should probably be at least rumors (and maybe even a major Oracle consultation) hinting at the mechanic. We might also want to change the unIDed description of the dwarvish cloak as a hint, although that would require, e.g., new database entries. --- doc/fixes3-7-0.txt | 1 + src/zap.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index c4d2a2403..91f050432 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -616,6 +616,7 @@ yet another fix for display problems during restore: if game is saved while being obfuscated by hallucination, but when displaying the hero there instead it would access steed pointer before that has been set up resistances gained from worn or wielded items also protect hero's inventory +dwarvish cloaks somewhat protect hero's inventory from cold and fire non-metallic gloves protect worn rings from shock message "Oops! food rations out of your grasp!" occurred due to perm_invent in mid-operation overwriting all of xname's/doname's obufs; fixed by diff --git a/src/zap.c b/src/zap.c index dd3f6d259..22c11e64d 100644 --- a/src/zap.c +++ b/src/zap.c @@ -5392,7 +5392,7 @@ adtyp_to_prop(int dmgtyp) } /* Is hero wearing or wielding an object with resistance to attack - damage type? Returns the percentage protectoin that the object + damage type? Returns the percentage protection that the object gives. */ int u_adtyp_resistance_obj(int dmgtyp) @@ -5402,8 +5402,16 @@ u_adtyp_resistance_obj(int dmgtyp) if (!prop) return 0; + /* Items that give an extrinsic resistance give 99% protection to + your items */ if ((u.uprops[prop].extrinsic & (W_ARMOR | W_ACCESSORY | W_WEP)) != 0) - return 99; /* 99% protected */ + return 99; + + /* Dwarvish cloaks give a 90% protection to items against heat and + cold */ + if (uarmc && uarmc->otyp == DWARVISH_CLOAK && + (dmgtyp == AD_COLD || dmgtyp == AD_FIRE)) + return 90; return 0; }