]> granicus.if.org Git - nethack/commitdiff
Prevent searching or waiting next to a hostile
authorPasi Kallinen <paxed@alt.org>
Sun, 12 Apr 2020 14:21:23 +0000 (17:21 +0300)
committerPasi Kallinen <paxed@alt.org>
Sun, 12 Apr 2020 14:32:29 +0000 (17:32 +0300)
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.

doc/Guidebook.mn
doc/Guidebook.tex
doc/fixes37.0
src/cmd.c
src/detect.c
src/do.c

index 36ccd7e13d45348751950c04124ed6a76a76a57e..bc0d4803117685bff4c88ab70a73872e1649b43c 100644 (file)
@@ -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.
index 13db12a251f6e1e5a2a03baf93b4c803a769bfbd..da0f1f3c386349415e57e38aef0d1fa7a2996b70 100644 (file)
@@ -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.
index 6feb94b743d68c886d2591ce21e1641e05003ae2..62ba55bb84338155dd1de375dcfdcd24c700a699 100644 (file)
@@ -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 <mon> 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
index 9883f4d74c3fe4e88ae60bd06cdfb83bc3801c9f..6828acc80afb9706ee0793d4752bbba0736c4c83 100644 (file)
--- 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 */
index ca4179a7cdff8c9d70beedf8adcc0c926fc82a71..bc5c6e9e0a248dc3479eb85c75d35963dc9e763a 100644 (file)
@@ -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);
 }
 
index ce57fb802460a8863ca81fa62ed76088ed38c018..d8075f790cf305abe70da960d9e0c81d1eadbd26 100644 (file)
--- 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 */
 }