From 25527a63157eec805bc4c6baad35b62af24bd35e Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 18 Mar 2007 03:26:43 +0000 Subject: [PATCH] silver vs lycanthropy (trunk only) Monster werecritters are vulnerable to silver when in human form as well as when in beast form, but hero inflicted with lycanthropy was only vulnerable while in beast form. Add pseudo-property Hate_silver to handle that correctly. Also, add silver vulnerability to enlightenment feedback. Lastly, hero vulnerable to silver had Con abused if hit by silver missile but not when hit hand-to-hand; add an exercise() call to the latter. --- doc/fixes34.4 | 1 + include/youprop.h | 8 +++++++- src/artifact.c | 5 ++--- src/cmd.c | 1 + src/mhitu.c | 4 +++- src/mthrowu.c | 8 ++++---- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index e9d76c0b4..96e41d28c 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -341,6 +341,7 @@ lit candle or potion of oil which burned out while equipped would leave stale weapon/alternate-weapon/quiver pointer that could cause panic or crash wielded/worn figurine which auto-transformed had same stale pointer bug format names of not yet id'd artifacts such that obj type shows for non-weapons +hero with lycanthropy is vulnerable to silver in human form as well as beast Platform- and/or Interface-Specific Fixes diff --git a/include/youprop.h b/include/youprop.h index 6f6f59d80..a0feebc94 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)youprop.h 3.5 2006/09/01 */ +/* SCCS Id: @(#)youprop.h 3.5 2007/03/16 */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -359,8 +359,14 @@ #define Lifesaved u.uprops[LIFESAVED].extrinsic +/* + * Some pseudo-properties. + */ + /* unconscious() includes u.usleep but not is_fainted(); the multi test is redundant but allows the function calls to be skipped most of the time */ #define Unaware (multi < 0 && (unconscious() || is_fainted())) +#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data)) + #endif /* YOUPROP_H */ diff --git a/src/artifact.c b/src/artifact.c index c38098f80..54d8645c8 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -560,7 +560,7 @@ touch_artifact(obj,mon) /* can pick it up unless you're totally non-synch'd with the artifact */ if (badclass && badalign && self_willed) { if (yours) { - if (obj->where != OBJ_INVENT) + if (!carried(obj)) pline("%s your grasp!", Tobjnam(obj, "evade")); else pline("%s beyond your control!", Tobjnam(obj, "are")); @@ -1613,8 +1613,7 @@ boolean loseit; /* whether to drop it if hero can longer touch it */ if (touch_artifact(obj, &youmonst)) { /* nothing to do if hero can successfully handle this object */ - if (!(objects[obj->otyp].oc_material == SILVER && - (u.ulycn >= LOW_PM || hates_silver(youmonst.data)))) + if (!(objects[obj->otyp].oc_material == SILVER && Hate_silver)) return 1; /* we didn't get " evades your grasp" message; give alt message */ You_cant("handle %s anymore!", thesimpleoname(obj)); diff --git a/src/cmd.c b/src/cmd.c index 0bc158776..a24a15d08 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1127,6 +1127,7 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ #endif if (Sleeping) enl_msg("You ", "fall", "fell", " asleep", ""); if (Hunger) enl_msg("You hunger", "", "ed", " rapidly", ""); + if (Hate_silver) you_are("harmed by silver",""); /*** Vision and senses ***/ if (See_invisible) enl_msg(You_, "see", "saw", " invisible", diff --git a/src/mhitu.c b/src/mhitu.c index 96eed6609..ee2bdb37f 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -945,8 +945,10 @@ hitmu(mtmp, mattk) hitmsg(mtmp, mattk); if (!dmg) break; if (objects[otmp->otyp].oc_material == SILVER && - hates_silver(youmonst.data)) + Hate_silver) { pline_The("silver sears your flesh!"); + exercise(A_CON, FALSE); + } if (u.mh > 1 && u.mh > ((u.uac>0) ? dmg : dmg+u.uac) && objects[otmp->otyp].oc_material == IRON && (u.umonnum==PM_BLACK_PUDDING diff --git a/src/mthrowu.c b/src/mthrowu.c index 05babac91..687a757ff 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mthrowu.c 3.5 2007/01/27 */ +/* SCCS Id: @(#)mthrowu.c 3.5 2007/03/17 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -60,11 +60,11 @@ const char *name; /* if null, then format `obj' */ else You("are almost hit by %s.", onm); return(0); } else { - if(Blind || !flags.verbose) You("are hit!"); + if (Blind || !flags.verbose) You("are hit%s", exclam(dam)); else You("are hit by %s%s", onm, exclam(dam)); - if (obj && objects[obj->otyp].oc_material == SILVER - && hates_silver(youmonst.data)) { + if (obj && objects[obj->otyp].oc_material == SILVER && + Hate_silver) { /* extra damage already applied by dmgval() */ pline_The("silver sears your flesh!"); exercise(A_CON, FALSE);