Chargeable rings may get charged when hit with electricity

... instead of being destroyed. Normal charging limits apply.
This commit is contained in:
Pasi Kallinen
2022-02-21 21:04:50 +02:00
parent 5fa2576f7a
commit ef6a88e1e1
2 changed files with 8 additions and 1 deletions

View 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 illiterate hero receiving a spellbook from their deity gets the spell shoved
directly into their mind instead directly into their mind instead
adjust levels of sleep, confuse monster, and charm monster spells 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 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -5070,6 +5070,7 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp)
int dmg, xresist, skip, dindx; int dmg, xresist, skip, dindx;
const char *mult; const char *mult;
boolean physical_damage; boolean physical_damage;
boolean chargeit = FALSE;
physical_damage = FALSE; physical_damage = FALSE;
xresist = skip = 0; xresist = skip = 0;
@@ -5137,6 +5138,9 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp)
|| obj->otyp == RIN_SHOCK_RESISTANCE) { || obj->otyp == RIN_SHOCK_RESISTANCE) {
skip++; skip++;
break; break;
} else if (objects[obj->otyp].oc_charged && rn2(3)) {
chargeit = TRUE;
break;
} }
dindx = 5; dindx = 5;
dmg = 0; dmg = 0;
@@ -5162,7 +5166,9 @@ destroy_one_item(struct obj *obj, int osym, int dmgtyp)
break; break;
} }
if (!skip) { if (chargeit)
recharge(obj, 0);
else if (!skip) {
if (obj->in_use) if (obj->in_use)
--quan; /* one will be used up elsewhere */ --quan; /* one will be used up elsewhere */
for (i = cnt = 0L; i < quan; i++) for (i = cnt = 0L; i < quan; i++)