diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index c8305e942..2ba8d4f9e 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1618,6 +1618,7 @@ entering the tutorial stashed hero's equipment for eventual return to normal too soon and allowed any items gathered on the first level to be kept entering the tutorial and then returning to play made the tutorial branch be eligible for a portal destination via wizard's Eye of the Aethiopica +'hard helmet' was based on being metallic so overlooked crystal helmet Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 2ede94ff9..59e84ba66 100644 --- a/include/extern.h +++ b/include/extern.h @@ -564,6 +564,7 @@ extern int stop_donning(struct obj *); extern int Armor_off(void); extern int Armor_gone(void); extern int Helmet_off(void); +extern boolean hard_helmet(struct obj *); extern void wielding_corpse(struct obj *, struct obj *, boolean); extern int Gloves_off(void); extern int Boots_on(void); diff --git a/src/ball.c b/src/ball.c index 18d6d55e8..a0abbca1b 100644 --- a/src/ball.c +++ b/src/ball.c @@ -55,7 +55,7 @@ ballfall(void) pline_The("iron ball falls on your %s.", body_part(HEAD)); if (uarmh) { - if (is_metallic(uarmh)) { + if (hard_helmet(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); dmg = 3; } else if (Verbose(0, ballfall)) diff --git a/src/dig.c b/src/dig.c index d080142d1..7ea05bc07 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1459,7 +1459,7 @@ zap_dig(void) } You("loosen a rock from the %s.", ceiling(u.ux, u.uy)); pline("It falls on your %s!", body_part(HEAD)); - dmg = rnd((uarmh && is_metallic(uarmh)) ? 2 : 6); + dmg = rnd(hard_helmet(uarmh) ? 2 : 6); losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN); otmp = mksobj_at(ROCK, u.ux, u.uy, FALSE, FALSE); if (otmp) { diff --git a/src/do_wear.c b/src/do_wear.c index 687a65ad3..fc692b705 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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) { diff --git a/src/dothrow.c b/src/dothrow.c index b0bd3b874..831a1b0a7 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1334,7 +1334,7 @@ toss_up(struct obj *obj, boolean hitsroof) } else { /* neither potion nor other breaking object */ int material = objects[otyp].oc_material; boolean is_silver = (material == SILVER), - less_damage = (uarmh && is_metallic(uarmh) + less_damage = (hard_helmet(uarmh) && (!is_silver || !Hate_silver)), harmless = (stone_missile(obj) && passes_rocks(gy.youmonst.data)), diff --git a/src/hack.c b/src/hack.c index 7f7ba2eea..0d1d6fc43 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2945,7 +2945,7 @@ spoteffects(boolean pick) ceiling(u.ux, u.uy)); if (mtmp->mtame) { /* jumps to greet you, not attack */ ; - } else if (uarmh && is_metallic(uarmh)) { + } else if (hard_helmet(uarmh)) { pline("Its blow glances off your %s.", helm_simple_name(uarmh)); } else if (u.uac + 3 <= rnd(20)) { diff --git a/src/mhitu.c b/src/mhitu.c index e79f6d47e..fd28433b1 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -526,7 +526,7 @@ mattacku(register struct monst *mtmp) return 0; /* lurkers don't attack */ obj = which_armor(mtmp, WORN_HELMET); - if (obj && is_metallic(obj)) { + if (hard_helmet(obj)) { Your("blow glances off %s %s.", s_suffix(mon_nam(mtmp)), helm_simple_name(obj)); } else { diff --git a/src/muse.c b/src/muse.c index d1c007f13..3104bd838 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1430,7 +1430,7 @@ find_offensive(struct monst *mtmp) */ nomore(MUSE_SCR_EARTH); if (obj->otyp == SCR_EARTH - && ((helmet && is_metallic(helmet)) || mtmp->mconf + && (hard_helmet(helmet) || mtmp->mconf || amorphous(mtmp->data) || passes_walls(mtmp->data) || noncorporeal(mtmp->data) || unsolid(mtmp->data) || !rn2(10)) @@ -1875,7 +1875,7 @@ rnd_offensive_item(struct monst *mtmp) case 0: { struct obj *helmet = which_armor(mtmp, W_ARMH); - if ((helmet && is_metallic(helmet)) || amorphous(pm) + if (hard_helmet(helmet) || amorphous(pm) || passes_walls(pm) || noncorporeal(pm) || unsolid(pm)) return SCR_EARTH; } /* fall through */ diff --git a/src/objnam.c b/src/objnam.c index d930378b6..5b9212e67 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -5095,7 +5095,7 @@ helm_simple_name(struct obj *helmet) * fedora, cornuthaum, dunce cap -> hat * all other types of helmets -> helm */ - return (helmet && !is_metallic(helmet)) ? "hat" : "helm"; + return !hard_helmet(helmet) ? "hat" : "helm"; } /* gloves vs gauntlets; depends upon discovery state */ diff --git a/src/potion.c b/src/potion.c index ac5f48975..d18ed4430 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1173,7 +1173,7 @@ peffect_levitation(struct obj *otmp) resulted in incrementing 'nothing' */ gp.potion_nothing = 0; /* not nothing after all */ } else if (has_ceiling(&u.uz)) { - int dmg = rnd(!uarmh ? 10 : !is_metallic(uarmh) ? 6 : 3); + int dmg = rnd(!uarmh ? 10 : !hard_helmet(uarmh) ? 6 : 3); You("hit your %s on the %s.", body_part(HEAD), ceiling(u.ux, u.uy)); diff --git a/src/read.c b/src/read.c index 2f3fdd2e6..4261ac383 100644 --- a/src/read.c +++ b/src/read.c @@ -2164,7 +2164,11 @@ seffects(struct obj *sobj) /* sobj - scroll or fake spellbook for spell */ } void -drop_boulder_on_player(boolean confused, boolean helmet_protects, boolean byu, boolean skip_uswallow) +drop_boulder_on_player( + boolean confused, + boolean helmet_protects, + boolean byu, + boolean skip_uswallow) { int dmg; struct obj *otmp2; @@ -2185,7 +2189,7 @@ drop_boulder_on_player(boolean confused, boolean helmet_protects, boolean byu, b You("are hit by %s!", doname(otmp2)); dmg = (int) (dmgval(otmp2, &gy.youmonst) * otmp2->quan); if (uarmh && helmet_protects) { - if (is_metallic(uarmh)) { + if (hard_helmet(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); if (dmg > 2) dmg = 2; @@ -2237,7 +2241,7 @@ drop_boulder_on_monster(coordxy x, coordxy y, boolean confused, boolean byu) mdmg = dmgval(otmp2, mtmp) * otmp2->quan; if (helmet) { - if (is_metallic(helmet)) { + if (hard_helmet(helmet)) { if (canspotmon(mtmp)) pline("Fortunately, %s is wearing a hard helmet.", mon_nam(mtmp)); diff --git a/src/trap.c b/src/trap.c index 02e7ca072..e46694567 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1197,7 +1197,7 @@ trapeffect_rocktrap( pline("Unfortunately, you are wearing %s.", an(helm_simple_name(uarmh))); /* helm or hat */ dmg = 2; - } else if (is_metallic(uarmh)) { + } else if (hard_helmet(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); dmg = 2; } else if (Verbose(3, trapeffect_rocktrap)) { diff --git a/src/zap.c b/src/zap.c index 7fef5cb79..89fb322c4 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3148,7 +3148,7 @@ zap_updown(struct obj *obj) /* wand or spell */ /* similar to zap_dig() */ pline("A rock is dislodged from the %s and falls on your %s.", ceiling(x, y), body_part(HEAD)); - dmg = rnd((uarmh && is_metallic(uarmh)) ? 2 : 6); + dmg = rnd(hard_helmet(uarmh) ? 2 : 6); losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN); if ((otmp = mksobj_at(ROCK, x, y, FALSE, FALSE)) != 0) { (void) xname(otmp); /* set dknown, maybe bknown */