pull request #386 - discovering teleport scroll

Since teleporation gives a "you matrialize" message even when
arriving close by, the old behavior of not learning a scroll of
teleportation when you land quite close to your original spot
no longer made sense.  Always [almost] discover teleport scroll
when reading it.

Also adds one-shot teleport control when reading a blessed scroll
of teleportation.  I changed that to be prevented when hero is
stunned, same as with full-fledged teleport control.

I reworded or reformatted several of the comments.  And removed
the EDITLEVEL increment in patchlevel.h; save and bones file
contents are not affected.

I've also added an unrelated comment about reading mechanics to
doread().

Closes #386
This commit is contained in:
PatR
2020-09-18 15:34:29 -07:00
parent 7592eebdf6
commit 81ec2bfa2a
6 changed files with 59 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 read.c $NHDT-Date: 1596498202 2020/08/03 23:43:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.201 $ */
/* NetHack 3.7 read.c $NHDT-Date: 1600468453 2020/09/18 22:34:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.202 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -217,9 +217,27 @@ doread()
register struct obj *scroll;
boolean confused, nodisappear;
/*
* Reading while blind is allowed in most cases, including the
* Book of the Dead but not regular spellbooks. For scrolls, the
* description has to have been seen or magically learned (so only
* when scroll->dknown is true): hero recites the label while
* holding the unfurled scroll. We deliberately don't require
* free hands because that would cripple scroll of remove curse,
* but we ought to be requiring hands or at least limbs. The
* recitation could be sub-vocal; actual speech isn't required.
*
* Reading while confused is allowed and can produce alternate
* outcome.
*
* Reading while stunned is currently allowed but probably should
* be prevented....
*/
g.known = FALSE;
if (check_capacity((char *) 0))
return 0;
scroll = getobj(readable, "read");
if (!scroll)
return 0;
@@ -1358,8 +1376,14 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
case SCR_TELEPORTATION:
if (confused || scursed) {
level_tele();
/* gives "materialize on different/same level!" message, must
be a teleport scroll */
g.known = TRUE;
} else {
g.known = scrolltele(sobj);
scrolltele(sobj);
/* this will call learnscroll() as appropriate, and has results
which maybe shouldn't result in the scroll becoming known;
either way, no need to set g.known here */
}
break;
case SCR_GOLD_DETECTION: