From 05923e795f391c81ec56ef563b3661ca9b51ada3 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sat, 13 Nov 2004 04:14:14 +0000 Subject: [PATCH] cockatrice eggs vs gravity Eggs thrown straight up which don't splatter on the ceiling yield "you've got it all over your face", so wearing a helmet shouldn't protect against petrification from cockatrice eggs in that situation. This was part of my delayed helm vs hat stuff; I can't remember whether it was done before or after this same issue came up in the newsgroup. --- doc/fixes34.4 | 1 + src/dothrow.c | 47 ++++++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 1a0ee51c7..f4982786c 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -63,6 +63,7 @@ panic on subsequent move if engulfer gets turned to stone and poly'd hero also has attached ball&chain give more specific messages when dropping weapons due to slippery fingers various helmet messages changed to distinguish between "helm" and "hat" +helmets don't protect against cockatrice eggs thrown straight up Platform- and/or Interface-Specific Fixes diff --git a/src/dothrow.c b/src/dothrow.c index 164079977..7ea090515 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dothrow.c 3.4 2003/12/04 */ +/* SCCS Id: @(#)dothrow.c 3.4 2004/11/11 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -733,6 +733,8 @@ struct obj *obj; boolean hitsroof; { const char *almost; + boolean petrifier = ((obj->otyp == EGG || obj->otyp == CORPSE) && + touch_petrifies(&mons[obj->corpsenm])); /* note: obj->quan == 1 */ if (hitsroof) { @@ -767,10 +769,15 @@ boolean hitsroof; obj = 0; /* it's now gone */ switch (otyp) { case EGG: - if (touch_petrifies(&mons[ocorpsenm]) && - !uarmh && !Stone_resistance && - !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) - goto petrify; + if (petrifier && !Stone_resistance && + !(poly_when_stoned(youmonst.data) && + polymon(PM_STONE_GOLEM))) { + /* egg ends up "all over your face"; perhaps + visored helmet should still save you here */ + if (uarmh) Your("%s fails to protect you.", + helm_simple_name(uarmh)); + goto petrify; + } case CREAM_PIE: case BLINDING_VENOM: pline("You've got it all over your %s!", body_part(FACE)); @@ -812,20 +819,21 @@ boolean hitsroof; if (less_damage && dmg < (Upolyd ? u.mh : u.uhp)) { if (!artimsg) pline("Fortunately, you are wearing a hard helmet."); - } else if (flags.verbose && - !(obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm]))) - pline("%s does not protect you.", Yname2(uarmh)); - } else if (obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm])) { - if (!Stone_resistance && - !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - petrify: - killer.format = KILLED_BY; - Strcpy(killer.name, "elementary physics"); /* "what goes up..." */ - You("turn to stone."); - if (obj) dropy(obj); /* bypass most of hitfloor() */ - done(STONING); - return obj ? TRUE : FALSE; + /* helmet definitely protects you when it blocks petrification */ + } else if (!petrifier) { + if (flags.verbose) + Your("%s does not protect you.", helm_simple_name(uarmh)); } + } else if (petrifier && !Stone_resistance && + !(poly_when_stoned(youmonst.data) && + polymon(PM_STONE_GOLEM))) { + petrify: + killer.format = KILLED_BY; + Strcpy(killer.name, "elementary physics"); /* "what goes up..." */ + You("turn to stone."); + if (obj) dropy(obj); /* bypass most of hitfloor() */ + done(STONING); + return obj ? TRUE : FALSE; } hitfloor(obj); losehp(Maybe_Half_Phys(dmg), "falling object", KILLED_BY_AN); @@ -1739,7 +1747,8 @@ struct obj *obj; pline_The("gold hits the %s, then falls back on top of your %s.", ceiling(u.ux,u.uy), body_part(HEAD)); /* some self damage? */ - if(uarmh) pline("Fortunately, you are wearing a helmet!"); + if (uarmh) pline("Fortunately, you are wearing %s!", + an(helm_simple_name(uarmh))); } bhitpos.x = u.ux; bhitpos.y = u.uy; -- 2.50.1