Add safe_wait to toggle search and wait prevention

This commit is contained in:
Pasi Kallinen
2020-10-02 18:50:19 +03:00
parent aaf88f9662
commit 396b819988
8 changed files with 50 additions and 25 deletions

View File

@@ -675,7 +675,9 @@ 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. Precede with the \(oqm\(cq prefix
to wait for a turn even next to a hostile monster.
to wait for a turn even next to a hostile monster, if
.op safe_wait
is on.
.lp a
Apply (use) a tool (pick-axe, key, lamp...).
.lp ""
@@ -884,7 +886,9 @@ Redraw the screen.
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.
even next to a hostile monster, if
.op safe_wait
is on.
.lp ""
Can also be used to figure out whether there is still a monster at
an adjacent \(lqremembered, unseen monster\(rq marker.
@@ -3987,6 +3991,9 @@ Persistent.
.lp safe_pet
Prevent you from (knowingly) attacking your pets (default on).
Persistent.
.lp safe_wait
Prevents you from waiting or searching when next to a hostile monster
(default on). Persistent.
.lp sanity_check
Evaluate monsters, objects, and map prior to each turn (default off).
Debug mode only.

View File

@@ -769,7 +769,8 @@ location other than the current position.
%.lp
\item[\tb{.}]
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.
to wait for a turn even next to a hostile monster, if {\it safe\verb+_+wait\/}
is on.
%.lp
\item[\tb{a}]
Apply (use) a tool (pick-axe, key, lamp \ldots).\\
@@ -968,7 +969,8 @@ Redraw the screen.
Search for secret doors and traps around you.
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.\\
even next to a hostile monster, if {\it safe\verb+_+wait\/}
is on.\\
%.lp ""
Can also be used to figure out whether there is still a monster at
an adjacent ``remembered, unseen monster'' marker.
@@ -4307,6 +4309,10 @@ depend upon the window port used or on the type of terminal. Persistent.
%.lp
\item[\ib{safe\verb+_+pet}]
Prevent you from (knowingly) attacking your pets (default on). Persistent.
%.lp
\item[\ib{safe\verb+_+wait}]
Prevents you from waiting or searching when next to a hostile monster
(default on). Persistent.
%+.lp
\item[\ib{sanity\verb+_+check}]
Evaluate monsters, objects, and map prior to each turn (default off).

View File

@@ -126,7 +126,8 @@ 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'
prevent searching or waiting next to a hostile monster if boolean option
safe_wait is on - override with 'm'
allow random mimics to show up mimicing more furniture than just stairs
scatter exploding bag of holding contents instead of outright deleting them
male hero poly'd into nymph chooses charm vs seduce message based on being

View File

@@ -424,6 +424,7 @@ E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int,
E void NDECL(deferred_goto);
E boolean FDECL(revive_corpse, (struct obj *));
E void FDECL(revive_mon, (ANY_P *, long));
E boolean FDECL(cmd_safety_prevention, (char *, char *, int *));
E int NDECL(donull);
E int NDECL(dowipe);
E void FDECL(legs_in_no_shape, (const char *, BOOLEAN_P));

View File

@@ -52,6 +52,7 @@ struct flag {
* clairvoyance */
boolean rest_on_space; /* space means rest */
boolean safe_dog; /* give complete protection to the dog */
boolean safe_wait; /* prevent wait or search next to hostile */
boolean showexp; /* show experience points */
boolean showscore; /* show score */
boolean silent; /* whether the bell rings or not */

View File

@@ -379,6 +379,8 @@ pfx_##a,
NoAlias, "display frequency when `running' or `travelling'")
NHOPTB(safe_pet, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&flags.safe_dog)
NHOPTB(safe_wait, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&flags.safe_wait)
NHOPTB(sanity_check, 0, opt_in, set_wizonly, Off, Yes, No, No, NoAlias,
&iflags.sanity_check)
NHOPTC(scores, 32, opt_in, set_in_game, No, Yes, No, No, NoAlias,

View File

@@ -1868,17 +1868,10 @@ register int aflag; /* intrinsic autosearch vs explicit searching */
int
dosearch()
{
if (!iflags.menu_requested && !g.multi && monster_nearby()) {
char buf[QBUFSZ];
buf[0] = '\0';
if (iflags.cmdassist || !g.already_found_flag++)
Sprintf(buf, " Use '%s' prefix to force another search.",
visctrl(g.Cmd.spkeys[NHKF_REQMENU])); /* default is "m" */
Norep("You already found a monster.%s", buf);
if (cmd_safety_prevention("another search",
"You already found a monster.",
&g.already_found_flag))
return 0;
}
g.already_found_flag = 0; /* start over */
return dosearch0(0);
}

View File

@@ -1982,22 +1982,36 @@ long timeout UNUSED;
}
}
boolean
cmd_safety_prevention(cmddesc, act, flagcounter)
char *cmddesc;
char *act;
int *flagcounter;
{
if (flags.safe_wait && !iflags.menu_requested
&& !g.multi && monster_nearby()) {
char buf[QBUFSZ];
buf[0] = '\0';
if (iflags.cmdassist || !*flagcounter++)
Sprintf(buf, " Use '%s' prefix to force %s.",
visctrl(g.Cmd.spkeys[NHKF_REQMENU]), cmddesc);
Norep("%s%s", act, buf);
return TRUE;
}
*flagcounter = 0;
return FALSE;
}
/* '.' command: do nothing == rest; also the
' ' command iff 'rest_on_space' option is On */
int
donull()
{
if (!iflags.menu_requested && !g.multi && monster_nearby()) {
char buf[QBUFSZ];
buf[0] = '\0';
if (iflags.cmdassist || !g.did_nothing_flag++)
Sprintf(buf, " Use '%s' prefix to force a no-op (to rest).",
visctrl(g.Cmd.spkeys[NHKF_REQMENU])); /* default is "m" */
Norep("Are you waiting to get hit?%s", buf);
if (cmd_safety_prevention("a no-op (to rest)",
"Are you waiting to get hit?",
&g.did_nothing_flag))
return 0;
}
g.did_nothing_flag = 0; /* reset */
return 1; /* Do nothing, but let other things happen */
}