From 7778d9119380080cf5f40bd06b0e413116f5c07d Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 May 2023 05:30:51 -0700 Subject: [PATCH] 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. --- doc/fixes3-7-0.txt | 1 + src/dothrow.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index a004006be..23d22abcc 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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" buried troll whose auto-revive timer expired might triger panic with "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 diff --git a/src/dothrow.c b/src/dothrow.c index be50ce4e8..8571ce9f9 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -2458,7 +2458,14 @@ breakobj( boolean 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; if (objects[obj->otyp].oc_material == GLASS && !obj->oartifact && obj->oclass != GEM_CLASS) @@ -2486,9 +2493,10 @@ breakmsg(struct obj *obj, boolean in_view) switch (obj->oclass == POTION_CLASS ? POT_WATER : obj->otyp) { default: /* glass or crystal wand */ if (obj->oclass != WAND_CLASS) - impossible("breaking odd object?"); + impossible("breaking odd object (%d)?", obj->otyp); /*FALLTHRU*/ case CRYSTAL_PLATE_MAIL: + case HELM_OF_BRILLIANCE: case LENSES: case MIRROR: case CRYSTAL_BALL: