From: Pasi Kallinen Date: Mon, 21 Feb 2022 19:04:50 +0000 (+0200) Subject: Chargeable rings may get charged when hit with electricity X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef6a88e1e10287c7e09fb8f7f5cf97bc877103d2;p=nethack Chargeable rings may get charged when hit with electricity ... instead of being destroyed. Normal charging limits apply. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index b3bb1bfd9..91d92bdef 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -801,6 +801,7 @@ always give a message when monster changes form via polytrap if seen illiterate hero receiving a spellbook from their deity gets the spell shoved directly into their mind instead adjust levels of sleep, confuse monster, and charm monster spells +chargeable rings have a chance of getting charged when hit with electricity Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/zap.c b/src/zap.c index 9830c0b69..015e266ba 100644 --- a/src/zap.c +++ b/src/zap.c @@ -5070,6 +5070,7 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp) int dmg, xresist, skip, dindx; const char *mult; boolean physical_damage; + boolean chargeit = FALSE; physical_damage = FALSE; xresist = skip = 0; @@ -5137,6 +5138,9 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp) || obj->otyp == RIN_SHOCK_RESISTANCE) { skip++; break; + } else if (objects[obj->otyp].oc_charged && rn2(3)) { + chargeit = TRUE; + break; } dindx = 5; dmg = 0; @@ -5162,7 +5166,9 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp) break; } - if (!skip) { + if (chargeit) + recharge(obj, 0); + else if (!skip) { if (obj->in_use) --quan; /* one will be used up elsewhere */ for (i = cnt = 0L; i < quan; i++)