From: Pasi Kallinen Date: Sun, 12 Apr 2020 14:21:23 +0000 (+0300) Subject: Prevent searching or waiting next to a hostile X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac94c44b0b06a0a795913eacb77583524037e408;p=nethack Prevent searching or waiting next to a hostile Generally speaking there's no reason to wait or search next to a hostile monster, so let's just prevent those actions. You can still do those commands by prefixing them with the 'm' prefix. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 36ccd7e13..bc0d48031 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -674,7 +674,8 @@ For ports with mouse support, the command is also invoked when a mouse-click takes place on a location other than the current position. .lp . -Wait or rest, do nothing for one turn. +Wait or rest, do nothing for one turn. Precede with the \(oqm\(cq prefix +to wait for a turn even next to a hostile monster. .lp a Apply (use) a tool (pick-axe, key, lamp...). .lp "" @@ -882,6 +883,8 @@ Redraw the screen. .lp s Search for secret doors and traps around you. It usually takes several tries to find something. +Precede with the \(oqm\(cq prefix to search for a turn +even next to a hostile monster. .lp "" Can also be used to figure out whether there is still a monster at an adjacent \(lqremembered, unseen monster\(rq marker. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 13db12a25..da0f1f3c3 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -768,7 +768,8 @@ support, the command is also invoked when a mouse-click takes place on a location other than the current position. %.lp \item[\tb{.}] -Wait or rest, do nothing for one turn. +Wait or rest, do nothing for one turn. Precede with the `{\tt m}' prefix +to wait for a turn even next to a hostile monster. %.lp \item[\tb{a}] Apply (use) a tool (pick-axe, key, lamp \ldots).\\ @@ -965,7 +966,9 @@ Redraw the screen. %.lp \item[\tb{s}] Search for secret doors and traps around you. -It usually takes several tries to find something.\\ +It usually takes several tries to find something. +Precede with the `{\tt m}' prefix to wait for a turn +even next to a hostile monster.\\ %.lp "" Can also be used to figure out whether there is still a monster at an adjacent ``remembered, unseen monster'' marker. diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 6feb94b74..62ba55bb8 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -126,6 +126,7 @@ it's possible to wish for tins of the Riders in wizard mode; eating one is fatal but if you're life-saved or decline to die, the game crashed revival via undead turning of corpse carried by hero said "your corpse comes alive" even when revived monster was undead +prevent searching or waiting next to a hostile monster - override with 'm' Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index 9883f4d74..6828acc80 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2995,6 +2995,8 @@ int NDECL((*cmd_func)); || cmd_func == doloot /* travel: pop up a menu of interesting targets in view */ || cmd_func == dotravel + /* wait and search: allow even if next to a hostile monster */ + || cmd_func == donull || cmd_func == dosearch /* wizard mode ^V and ^T */ || cmd_func == wiz_level_tele || cmd_func == dotelecmd /* 'm' prefix allowed for some extended commands */ diff --git a/src/detect.c b/src/detect.c index ca4179a7c..bc5c6e9e0 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1782,6 +1782,10 @@ register int aflag; /* intrinsic autosearch vs explicit searching */ int dosearch() { + if (!iflags.menu_requested && !g.multi && monster_nearby()) { + Norep("You already found a monster."); + return 0; + } return dosearch0(0); } diff --git a/src/do.c b/src/do.c index ce57fb802..d8075f790 100644 --- a/src/do.c +++ b/src/do.c @@ -1970,6 +1970,11 @@ long timeout UNUSED; int donull() { + if (!iflags.menu_requested && !g.multi && monster_nearby()) { + Norep("Are you waiting to get hit?"); + return 0; + } + return 1; /* Do nothing, but let other things happen */ }