From: PatR Date: Fri, 20 Oct 2017 06:08:46 +0000 (-0700) Subject: fix #H6285 - speaking vs strangulation X-Git-Tag: NetHack-3.6.1_RC01~249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fad1ba3cca44c2a8553c92531912fa05de4ab8a;p=nethack fix #H6285 - speaking vs strangulation Reading a scroll while blind is permitted if you know its label, but message is "as you pronounce the words, the scroll vanishes" unless you are poly'd into a form which can't make sounds, in which case you "cogitate" rather than "pronouce". Switch to the cogitate variant if you are suffering from strangulation. Casting spells didn't even have the distinction; you could cast them without regard to speech capability. Check for that. Unlike with scrolls, now you can't cast if you can't speak (or grunt or bark or whatever) instead of having a variant description of the action, so this is a bigger change. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 9c74120fd..2b20433be 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -453,6 +453,10 @@ give feedback when released from a bear trap features entry was split across two lines recovery of strength lost due to weakness from hunger was vulnerable to abuse monsters hit by scroll of earth boulder did not get angry +hero could "pronounce the words on the scroll" when blind (if its label is + known) even while being strangled at the time +hero could cast spells while poly'd into a form which can't speak (or grunt,&c) + or while being strangled Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index fbbd8bd74..abc38311b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1505170345 2017/09/11 22:52:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.604 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1508479720 2017/10/20 06:08:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.618 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1423,6 +1423,7 @@ E boolean FDECL(hates_silver, (struct permonst *)); E boolean FDECL(mon_hates_silver, (struct monst *)); E boolean FDECL(passes_bars, (struct permonst *)); E boolean FDECL(can_blow, (struct monst *)); +E boolean FDECL(can_chant, (struct monst *)); E boolean FDECL(can_be_strangled, (struct monst *)); E boolean FDECL(can_track, (struct permonst *)); E boolean FDECL(breakarm, (struct permonst *)); diff --git a/src/mondata.c b/src/mondata.c index 32ea5bccc..d849658f9 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1492733172 2017/04/21 00:06:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.62 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1508479720 2017/10/20 06:08:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.63 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -325,7 +325,7 @@ struct permonst *mptr; /* returns True if monster can blow (whistle, etc) */ boolean can_blow(mtmp) -register struct monst *mtmp; +struct monst *mtmp; { if ((is_silent(mtmp->data) || mtmp->data->msound == MS_BUZZ) && (breathless(mtmp->data) || verysmall(mtmp->data) @@ -336,6 +336,18 @@ register struct monst *mtmp; return TRUE; } +/* for casting spells and reading scrolls while blind */ +boolean +can_chant(mtmp) +struct monst *mtmp; +{ + if ((mtmp == &youmonst && Strangled) + || is_silent(mtmp->data) || !has_head(mtmp->data) + || mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE) + return FALSE; + return TRUE; +} + /* True if mon is vulnerable to strangulation */ boolean can_be_strangled(mon) diff --git a/src/read.c b/src/read.c index 29513f7ef..69d588427 100644 --- a/src/read.c +++ b/src/read.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 read.c $NHDT-Date: 1467718299 2016/07/05 11:31:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.140 $ */ +/* NetHack 3.6 read.c $NHDT-Date: 1508479721 2017/10/20 06:08:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.148 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -192,6 +192,7 @@ doread() return 1; } else if (scroll->otyp == T_SHIRT || scroll->otyp == ALCHEMY_SMOCK) { char buf[BUFSZ]; + if (Blind) { You_cant("feel any Braille writing."); return 0; @@ -237,10 +238,13 @@ doread() : card_msgs[scroll->o_id % (SIZE(card_msgs) - 1)]); } /* Make a credit card number */ - pline("\"%d0%d %d%d1 0%d%d0\"", ((scroll->o_id % 89) + 10), - (scroll->o_id % 4), (((scroll->o_id * 499) % 899999) + 100000), - (scroll->o_id % 10), (!(scroll->o_id % 3)), - ((scroll->o_id * 7) % 10)); + pline("\"%d0%d %ld%d1 0%d%d0\"", + (((int) scroll->o_id % 89) + 10), + ((int) scroll->o_id % 4), + ((((long) scroll->o_id * 499L) % 899999L) + 100000L), + ((int) scroll->o_id % 10), + (!((int) scroll->o_id % 3)), + (((int) scroll->o_id * 7) % 10)); u.uconduct.literate++; return 1; } else if (scroll->otyp == CAN_OF_GREASE) { @@ -339,6 +343,8 @@ doread() } scroll->in_use = TRUE; /* scroll, not spellbook, now being read */ if (scroll->otyp != SCR_BLANK_PAPER) { + boolean silently = !can_chant(&youmonst); + /* a few scroll feedback messages describe something happening to the scroll itself, so avoid "it disappears" for those */ nodisappear = (scroll->otyp == SCR_FIRE @@ -348,7 +354,7 @@ doread() pline(nodisappear ? "You %s the formula on the scroll." : "As you %s the formula on it, the scroll disappears.", - is_silent(youmonst.data) ? "cogitate" : "pronounce"); + silently ? "cogitate" : "pronounce"); else pline(nodisappear ? "You read the scroll." : "As you read the scroll, it disappears."); @@ -357,8 +363,7 @@ doread() pline("Being so trippy, you screw up..."); else pline("Being confused, you %s the magic words...", - is_silent(youmonst.data) ? "misunderstand" - : "mispronounce"); + silently ? "misunderstand" : "mispronounce"); } } if (!seffects(scroll)) { diff --git a/src/spell.c b/src/spell.c index 955620f57..0447da70b 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 spell.c $NHDT-Date: 1450584420 2015/12/20 04:07:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */ +/* NetHack 3.6 spell.c $NHDT-Date: 1508479722 2017/10/20 06:08:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) M. Stephenson 1988 */ /* NetHack may be freely redistributed. See license for details. */ @@ -644,6 +644,9 @@ rejectcasting() if (Stunned) { You("are too impaired to cast a spell."); return TRUE; + } else if (!can_chant(&youmonst)) { + You("are unable to chant the incantation."); + return TRUE; } else if (!freehand()) { /* Note: !freehand() occurs when weapon and shield (or two-handed * weapon) are welded to hands, so "arms" probably doesn't need