fix for breaking a crystal helm

Avoid impossible warning "breaking odd object?" when throwing a helm
of brilliance causes it to break.  Presumably dropping one while
levitating or zapping one of the floor with striking/force bolt would
yield similar result.

While in there, reduce the chance of breakage from 99% to 5% for both
helm of brilliance and crystal plate mail.
This commit is contained in:
PatR
2023-05-03 05:30:51 -07:00
parent d2f4edc209
commit 7778d91193
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -1554,6 +1554,7 @@ if hero was killed by a wand zapped by a monster, cause of death was reported
throttle the difficulty of the monsters in theme room "buried zombies" throttle the difficulty of the monsters in theme room "buried zombies"
buried troll whose auto-revive timer expired might triger panic with buried troll whose auto-revive timer expired might triger panic with
"revive default case 6" "revive default case 6"
throwing a helm of brilliance could yield "breaking odd object?"
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
+10 -2
View File
@@ -2458,7 +2458,14 @@ breakobj(
boolean boolean
breaktest(struct obj *obj) breaktest(struct obj *obj)
{ {
if (obj_resists(obj, 1, 99)) int nonbreakchance = 1; /* chance for non-artifacts to resist */
/* this may need to be changed if actual glass armor gets added someday;
for now, it affects crystal plate mail and helm of brilliance */
if (obj->oclass == ARMOR_CLASS)
nonbreakchance = 95;
if (obj_resists(obj, nonbreakchance, 99))
return 0; return 0;
if (objects[obj->otyp].oc_material == GLASS && !obj->oartifact if (objects[obj->otyp].oc_material == GLASS && !obj->oartifact
&& obj->oclass != GEM_CLASS) && obj->oclass != GEM_CLASS)
@@ -2486,9 +2493,10 @@ breakmsg(struct obj *obj, boolean in_view)
switch (obj->oclass == POTION_CLASS ? POT_WATER : obj->otyp) { switch (obj->oclass == POTION_CLASS ? POT_WATER : obj->otyp) {
default: /* glass or crystal wand */ default: /* glass or crystal wand */
if (obj->oclass != WAND_CLASS) if (obj->oclass != WAND_CLASS)
impossible("breaking odd object?"); impossible("breaking odd object (%d)?", obj->otyp);
/*FALLTHRU*/ /*FALLTHRU*/
case CRYSTAL_PLATE_MAIL: case CRYSTAL_PLATE_MAIL:
case HELM_OF_BRILLIANCE:
case LENSES: case LENSES:
case MIRROR: case MIRROR:
case CRYSTAL_BALL: case CRYSTAL_BALL: