github issue #1060 - crystal helmet

Issue reported by vultur-cadens:  changing helm of brilliance to
crystal made it stop being classified as "hard helmet" so it gave
less protection against things falling onto the hero's head.

Change the is_metallic() tests used on helmets to new hard_helmet().
Unlike when thrown, crystal helmets don't break when objects fall
on them.

Fixes #1060
This commit is contained in:
PatR
2023-06-14 06:13:11 -07:00
parent 0440eb5091
commit 450f060132
14 changed files with 44 additions and 14 deletions

View File

@@ -512,6 +512,30 @@ Helmet_off(void)
return 0;
}
/* hard helms provide better protection against against falling rocks */
boolean
hard_helmet(struct obj *obj)
{
static const char crystal_[] = "crystal ";
const char *ostr;
int otyp;
if (!obj || !is_helmet(obj))
return FALSE;
if (is_metallic(obj))
return TRUE;
/* make helm of brilliance (crystal helmet) be classified 'hard'; this
test would work for crystal plate mail too if suits reached here */
otyp = obj->otyp;
if (objects[otyp].oc_material == GLASS
&& (((ostr = OBJ_NAME(objects[otyp])) != 0
&& !strncmp(ostr, crystal_, 8))
|| ((ostr = OBJ_DESCR(objects[otyp])) != 0
&& !strncmp(ostr, crystal_, 8))))
return TRUE;
return FALSE;
}
static int
Gloves_on(void)
{