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.
This commit is contained in:
PatR
2017-10-19 23:08:46 -07:00
parent da9c3f0ed4
commit 4fad1ba3cc
5 changed files with 37 additions and 12 deletions

View File

@@ -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

View File

@@ -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 *));

View File

@@ -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)

View File

@@ -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)) {

View File

@@ -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