]> granicus.if.org Git - nethack/commitdiff
Chargeable rings may get charged when hit with electricity
authorPasi Kallinen <paxed@alt.org>
Mon, 21 Feb 2022 19:04:50 +0000 (21:04 +0200)
committerPasi Kallinen <paxed@alt.org>
Mon, 21 Feb 2022 19:06:29 +0000 (21:06 +0200)
... instead of being destroyed. Normal charging limits apply.

doc/fixes3-7-0.txt
src/zap.c

index b3bb1bfd98131adb3852396c52687e57d8228e0a..91d92bdef2671d814c6816a6efd68b59c06c48e6 100644 (file)
@@ -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
index 9830c0b69170fef11f45efc19cab9cf9755ce8d0..015e266baf3487c0c8424177cc609f7019451f1b 100644 (file)
--- 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++)