From 3e18804371413d9da397bacdd317dd06fe285998 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 21 Jan 2020 17:03:54 -0800 Subject: [PATCH] half poison gas damage from wearing a wet towel Make wearing a wet towel confer new attribute Half_gas_damage in addition to the usual blindness. It reduces damage from being inside a gas cloud region and from being hit by poison gas breath attack. It also fully blocks breathing of potion vapors. Might make the Plane of Fire easier although overcoming its blindness with telepathy won't reveal elementals. Definitely has the potential to make blind-from-birth conduct easier which wasn't the intent and probably isn't significant. --- doc/fixes37.0 | 3 ++- include/youprop.h | 6 +++++- src/attrib.c | 11 ++++++++--- src/cmd.c | 4 +++- src/dothrow.c | 5 +++-- src/potion.c | 14 ++++++++++---- src/region.c | 7 +++++-- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 7f067bcf0..cdbe956cd 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.70 $ $NHDT-Date: 1579649788 2020/01/21 23:36:28 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.71 $ $NHDT-Date: 1579655025 2020/01/22 01:03:45 $ General Fixes and Modified Features ----------------------------------- @@ -117,6 +117,7 @@ tiny chance for randomly created spellbooks to be Discworld novels instead bestowed as a prayer boon or be found in statues) 'goldX', 'implicit_uncursed', and 'mention_walls' options changed to be persistent across save/restore +wearing a wet towel confers "half damage from poison gas" attribute Platform- and/or Interface-Specific New Features diff --git a/include/youprop.h b/include/youprop.h index 20d1045e8..0faafe102 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 youprop.h $NHDT-Date: 1568831820 2019/09/18 18:37:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $ */ +/* NetHack 3.6 youprop.h $NHDT-Date: 1579655025 2020/01/22 01:03:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -374,4 +374,8 @@ #define Hate_silver (u.ulycn >= LOW_PM || hates_silver(g.youmonst.data)) +/* _Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round + your head to ward off noxious fumes" [we require it to be damp or wet] */ +#define Half_gas_damage (ublindf && ublindf->otyp == TOWEL && ublindf->spe > 0) + #endif /* YOUPROP_H */ diff --git a/src/attrib.c b/src/attrib.c index 31c9fef67..eb069a1f0 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 attrib.c $NHDT-Date: 1575245050 2019/12/02 00:04:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ +/* NetHack 3.6 attrib.c $NHDT-Date: 1579655026 2020/01/22 01:03:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.74 $ */ /* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ @@ -277,11 +277,12 @@ int typ, fatal; /* if fatal is 0, limit damage to adjattrib */ boolean thrown_weapon; /* thrown weapons are less deadly */ { int i, loss, kprefix = KILLED_BY_AN; + boolean blast = !strcmp(reason, "blast"); /* inform player about being poisoned unless that's already been done; "blast" has given a "blast of poison gas" message; "poison arrow", "poison dart", etc have implicitly given poison messages too... */ - if (strcmp(reason, "blast") && !strstri(reason, "poison")) { + if (!blast && !strstri(reason, "poison")) { boolean plural = (reason[strlen(reason) - 1] == 's') ? 1 : 0; /* avoid "The" Orcus's sting was poisoned... */ @@ -290,7 +291,7 @@ boolean thrown_weapon; /* thrown weapons are less deadly */ plural ? "were" : "was"); } if (Poison_resistance) { - if (!strcmp(reason, "blast")) + if (blast) shieldeff(u.ux, u.uy); pline_The("poison doesn't seem to affect you."); return; @@ -315,8 +316,12 @@ boolean thrown_weapon; /* thrown weapons are less deadly */ g.context.botl = TRUE; pline_The("poison was deadly..."); } else if (i > 5) { + boolean cloud = !strcmp(reason, "gas cloud"); + /* HP damage; more likely--but less severe--with missiles */ loss = thrown_weapon ? rnd(6) : rn1(10, 6); + if ((blast || cloud) && Half_gas_damage) /* worn towel */ + loss = (loss + 1) / 2; losehp(loss, pkiller, kprefix); /* poison damage */ } else { /* attribute loss; if typ is A_STR, reduction in current and diff --git a/src/cmd.c b/src/cmd.c index 11eb394b2..90dd2be5c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1578764033 2020/01/11 17:33:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.391 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1579655026 2020/01/22 01:03:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.392 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2984,6 +2984,8 @@ int final; enlght_halfdmg(HALF_PHDAM, final); if (Half_spell_damage) enlght_halfdmg(HALF_SPDAM, final); + if (Half_gas_damage) + enl_msg(You_, "take", "took", " reduced poison gas damage", ""); /* polymorph and other shape change */ if (Protection_from_shape_changers) you_are("protected from shape changers", diff --git a/src/dothrow.c b/src/dothrow.c index ace9d4984..2369e1326 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dothrow.c $NHDT-Date: 1573688688 2019/11/13 23:44:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.164 $ */ +/* NetHack 3.6 dothrow.c $NHDT-Date: 1579655027 2020/01/22 01:03:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.181 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1977,7 +1977,8 @@ boolean from_invent; explode_oil(obj, x, y); } else if (distu(x, y) <= 2) { if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) { - if (obj->otyp != POT_WATER) { + /* wet towel protects both eyes and breathing */ + if (obj->otyp != POT_WATER && !Half_gas_damage) { if (!breathless(g.youmonst.data)) { /* [what about "familiar odor" when known?] */ You("smell a peculiar odor..."); diff --git a/src/potion.c b/src/potion.c index 5032e4e51..612ba9388 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1573848199 2019/11/15 20:03:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.167 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1579655028 2020/01/22 01:03:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1627,13 +1627,19 @@ register struct obj *obj; remains in inventory where our caller expects it to be */ obj->in_use = 1; - switch (obj->otyp) { + /* wearing a wet towel protects both eyes and breathing, even when + the breath effect might be beneficial; we still pass down to the + naming opportunity in case potion was thrown at hero by a monster */ + switch (Half_gas_damage ? TOWEL : obj->otyp) { + case TOWEL: + pline("Some vapor passes harmlessly around you."); + break; case POT_RESTORE_ABILITY: case POT_GAIN_ABILITY: if (obj->cursed) { - if (!breathless(g.youmonst.data)) + if (!breathless(g.youmonst.data)) { pline("Ulch! That potion smells terrible!"); - else if (haseyes(g.youmonst.data)) { + } else if (haseyes(g.youmonst.data)) { const char *eyes = body_part(EYE); if (eyecount(g.youmonst.data) != 1) diff --git a/src/region.c b/src/region.c index cc2215e7e..aca233561 100644 --- a/src/region.c +++ b/src/region.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 region.c $NHDT-Date: 1573957877 2019/11/17 02:31:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.45 $ */ +/* NetHack 3.6 region.c $NHDT-Date: 1579655029 2020/01/22 01:03:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) 1996 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -1024,7 +1024,10 @@ genericptr_t p2; pline("%s is burning your %s!", Something, makeplural(body_part(LUNG))); You("cough and spit blood!"); - losehp(Maybe_Half_Phys(rnd(dam) + 5), "gas cloud", KILLED_BY_AN); + dam = Maybe_Half_Phys(rnd(dam) + 5); + if (Half_gas_damage) /* worn towel */ + dam = (dam + 1) / 2; + losehp(dam, "gas cloud", KILLED_BY_AN); return FALSE; } else { You("cough!");