From 6daa6e2de9d26cccc27104f534e3dd44fbcc8636 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 1 Feb 2019 18:24:23 -0800 Subject: [PATCH] curing deafness Make healing magic which cures blindness also cure deafness. So, drinking non-cursed potion of healing or any extra healing or full healing; breathing fumes from blessed potion of healing or non-cursed potion of extra healing or any potion of full healing; prayer reward to cure blindness as a minor trouble. (Doesn't affect unicorn horns which already treat deafness and blindness as two distinct troubles that are eligible to be cured.) More of a missing feature than a bug fix, so I listed it in the new features section of the fixes file. --- doc/fixes36.2 | 3 ++- src/potion.c | 8 ++++++-- src/pray.c | 32 +++++++++++++++++++++++++------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 1c5b9edfa..33fca088c 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.242 $ $NHDT-Date: 1548978603 2019/01/31 23:50:03 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.243 $ $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -547,6 +547,7 @@ in wizard mode, ^T can be preceded by 'm' prefix in order to test teleporting without having wizard mode override various restrictions include isaac64 for pseudo random number generation core prng and display prng use different contexts +when healing magic other than unicorn horn cures blindness, cure deafness too NetHack Community Patches (or Variation) Included diff --git a/src/potion.c b/src/potion.c index b0c5e5523..7d8afd0ba 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1547518427 2019/01/15 02:13:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1161,6 +1161,8 @@ register boolean curesick, cureblind; mundane 'dirt', but if it doesn't, blindness isn't cured */ u.ucreamed = 0; make_blinded(0L, TRUE); + /* heal deafness too */ + make_deaf(0L, TRUE); } if (curesick) { make_vomiting(0L, TRUE); @@ -1642,8 +1644,10 @@ register struct obj *obj; u.uhp++, context.botl = 1; if (obj->blessed) cureblind = TRUE; - if (cureblind) + if (cureblind) { make_blinded(0L, !u.ucreamed); + make_deaf(0L, TRUE); + } exercise(A_CON, TRUE); break; case POT_SICKNESS: diff --git a/src/pray.c b/src/pray.c index d63778d52..bc9a9ba82 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1540596912 2018/10/26 23:35:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.104 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1549074257 2019/02/02 02:24:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -247,6 +247,11 @@ in_trouble() && (!u.uswallow || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))) return TROUBLE_BLIND; + /* deafness isn't it's own trouble; healing magic cures deafness + when it cures blindness, so do the same with trouble repair */ + if ((HDeaf & TIMEOUT) > 1L) + return TROUBLE_BLIND; + for (i = 0; i < A_MAX; i++) if (ABASE(i) < AMAX(i)) return TROUBLE_POISONED; @@ -513,14 +518,27 @@ int trouble; } (void) encumber_msg(); break; - case TROUBLE_BLIND: { + case TROUBLE_BLIND: { /* handles deafness as well as blindness */ + char msgbuf[BUFSZ]; const char *eyes = body_part(EYE); + boolean cure_deaf = (HDeaf & TIMEOUT) ? TRUE : FALSE; - if (eyecount(youmonst.data) != 1) - eyes = makeplural(eyes); - Your("%s %s better.", eyes, vtense(eyes, "feel")); - u.ucreamed = 0; - make_blinded(0L, FALSE); + msgbuf[0] = '\0'; + if (Blinded) { + if (eyecount(youmonst.data) != 1) + eyes = makeplural(eyes); + Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel")); + u.ucreamed = 0; + make_blinded(0L, FALSE); + } + if (cure_deaf) { + make_deaf(0L, FALSE); + if (!Deaf) + Sprintf(eos(msgbuf), "%s can hear again", + !*msgbuf ? "You" : " and you"); + } + if (*msgbuf) + pline("%s.", msgbuf); break; } case TROUBLE_WOUNDED_LEGS: -- 2.40.0