Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

This commit is contained in:
nhmall
2022-05-21 21:22:42 -04:00
6 changed files with 84 additions and 5 deletions
+4
View File
@@ -1709,6 +1709,10 @@ Default key is \(oq\(haI\(cq.
Set one or more intrinsic attributes. Set one or more intrinsic attributes.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp "#wizkill "
Remove monsters from play by just pointing at them.
Autocompletes.
Debug mode only.
.lp #wizlevelport .lp #wizlevelport
Teleport to another level. Teleport to another level.
Autocompletes. Autocompletes.
+5
View File
@@ -1837,6 +1837,11 @@ Set one or more intrinsic attributes.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
%.lp %.lp
\item[\tb{\#wizkill}]
Remove monsters from play by just pointing at them.
Autocompletes.
Debug mode only.
%.lp
\item[\tb{\#wizlevelport}] \item[\tb{\#wizlevelport}]
Teleport to another level. Teleport to another level.
Autocompletes. Autocompletes.
+1
View File
@@ -1641,6 +1641,7 @@ display detected door traps and chest traps as trapped doors and trapped
if built with DEBUG enabled and running in wizard mode, starting play with if built with DEBUG enabled and running in wizard mode, starting play with
DEBUGFILES=seethru in environment makes clouds on the Plane of Air, DEBUGFILES=seethru in environment makes clouds on the Plane of Air,
water on Plane of Water, and fumaroles on Plane of Fire be transparent water on Plane of Water, and fumaroles on Plane of Fire be transparent
add wizard mode #wizkill command to remove monster(s) from play
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+69 -3
View File
@@ -114,6 +114,7 @@ static int wiz_where(void);
static int wiz_detect(void); static int wiz_detect(void);
static int wiz_panic(void); static int wiz_panic(void);
static int wiz_polyself(void); static int wiz_polyself(void);
static int wiz_kill(void);
static int wiz_load_lua(void); static int wiz_load_lua(void);
static int wiz_level_tele(void); static int wiz_level_tele(void);
static int wiz_level_change(void); static int wiz_level_change(void);
@@ -1155,6 +1156,68 @@ wiz_detect(void)
return ECMD_OK; return ECMD_OK;
} }
/* the #wizkill command - pick targets and reduce them to 0HP;
by default, the hero is credited/blamed; use 'm' prefix to avoid that */
static int
wiz_kill()
{
struct monst *mtmp;
coord cc;
int ans;
char c, qbuf[QBUFSZ];
const char *prompt = "Pick first monster to slay";
boolean save_verbose = flags.verbose;
cc.x = u.ux, cc.y = u.uy;
for (;;) {
pline("%s:", prompt);
prompt = "Next monster";
flags.verbose = FALSE;
ans = getpos(&cc, TRUE, "a monster");
flags.verbose = save_verbose;
if (ans < 0 || cc.x < 1)
break;
mtmp = 0;
if (u_at(cc.x, cc.y)) {
if (u.usteed) {
Sprintf(qbuf, "Kill %.110s?", mon_nam(u.usteed));
if ((c = ynq(qbuf)) == 'q')
break;
if (c == 'y')
mtmp = u.usteed;
}
if (!mtmp) {
Sprintf(qbuf, "%s?", Role_if(PM_SAMURAI) ? "Perform seppuku"
: "Commit suicide");
if (paranoid_query(TRUE, qbuf)) {
Sprintf(g.killer.name, "%s own player", uhis());
g.killer.format = KILLED_BY;
done(DIED);
}
break;
}
} else {
mtmp = m_at(cc.x, cc.y);
}
if (mtmp) {
/* we don't require that monster be seen or sensed but when it
isn't, death message will be "You kill it" or "It is killed" */
if (!iflags.menu_requested)
killed(mtmp); /* normal case: hero is credited/blamed */
else
monkilled(mtmp, "", AD_PHYS); /* 'm'-prefix */
} else {
There("is no monster there.");
break;
}
}
/* distinction between ECMD_CANCEL and ECMD_OK is unimportant here */
return ECMD_OK; /* no time elapses */
}
/* the #wizloadlua command - load an arbitrary lua file */ /* the #wizloadlua command - load an arbitrary lua file */
static int static int
wiz_load_lua(void) wiz_load_lua(void)
@@ -1166,7 +1229,7 @@ wiz_load_lua(void)
buf[0] = '\0'; buf[0] = '\0';
getlin("Load which lua file?", buf); getlin("Load which lua file?", buf);
if (buf[0] == '\033' || buf[0] == '\0') if (buf[0] == '\033' || buf[0] == '\0')
return 0; return ECMD_CANCEL;
if (!strchr(buf, '.')) if (!strchr(buf, '.'))
strcat(buf, ".lua"); strcat(buf, ".lua");
(void) load_lua(buf, &sbi); (void) load_lua(buf, &sbi);
@@ -1185,7 +1248,7 @@ wiz_load_splua(void)
buf[0] = '\0'; buf[0] = '\0';
getlin("Load which des lua file?", buf); getlin("Load which des lua file?", buf);
if (buf[0] == '\033' || buf[0] == '\0') if (buf[0] == '\033' || buf[0] == '\0')
return 0; return ECMD_CANCEL;
if (!strchr(buf, '.')) if (!strchr(buf, '.'))
strcat(buf, ".lua"); strcat(buf, ".lua");
@@ -1303,7 +1366,7 @@ wiz_telekinesis(void)
pline("Pick a monster to hurtle."); pline("Pick a monster to hurtle.");
do { do {
ans = getpos(&cc, TRUE, "a monster"); ans = getpos(&cc, TRUE, "a monster");
if (ans < 0 || cc.x < 0) if (ans < 0 || cc.x < 1)
return ECMD_CANCEL; return ECMD_CANCEL;
if ((((mtmp = m_at(cc.x, cc.y)) != 0) && canspotmon(mtmp)) if ((((mtmp = m_at(cc.x, cc.y)) != 0) && canspotmon(mtmp))
@@ -2524,6 +2587,9 @@ struct ext_func_tab extcmdlist[] = {
wiz_identify, IFBURIED | WIZMODECMD, NULL }, wiz_identify, IFBURIED | WIZMODECMD, NULL },
{ '\0', "wizintrinsic", "set an intrinsic", { '\0', "wizintrinsic", "set an intrinsic",
wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL }, wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ '\0', "wizkill", "slay a monster",
wiz_kill, (IFBURIED | AUTOCOMPLETE | WIZMODECMD
| CMD_M_PREFIX | NOFUZZERCMD), NULL },
{ C('v'), "wizlevelport", "teleport to another level", { C('v'), "wizlevelport", "teleport to another level",
wiz_level_tele, IFBURIED | WIZMODECMD | CMD_M_PREFIX, NULL }, wiz_level_tele, IFBURIED | WIZMODECMD | CMD_M_PREFIX, NULL },
{ '\0', "wizloaddes", "load and execute a des-file lua script", { '\0', "wizloaddes", "load and execute a des-file lua script",
+3
View File
@@ -136,6 +136,8 @@ getpos_help(boolean force, const char *goal)
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_PREV]), visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_PREV]),
GLOC_MONS); GLOC_MONS);
} }
if (goal && !strcmp(goal, "a monster"))
goto skip_non_mons;
if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) {
getpos_help_keyxhelp(tmpwin, getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]), visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]),
@@ -195,6 +197,7 @@ getpos_help(boolean force, const char *goal)
: "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)", : "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC])); visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
} }
skip_non_mons:
/* disgusting hack; the alternate selection characters work for any /* disgusting hack; the alternate selection characters work for any
getpos call, but only matter for dowhatis (and doquickwhatis) */ getpos call, but only matter for dowhatis (and doquickwhatis) */
doing_what_is = (goal == what_is_an_unknown_object); doing_what_is = (goal == what_is_an_unknown_object);
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 objnam.c $NHDT-Date: 1652332281 2022/05/12 05:11:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.361 $ */ /* NetHack 3.7 objnam.c $NHDT-Date: 1653171584 2022/05/21 22:19:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.364 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -4514,7 +4514,7 @@ readobjnam(char *bp, struct obj *no_wish)
* Disallow such topology tweaks for WIZKIT startup wishes. * Disallow such topology tweaks for WIZKIT startup wishes.
*/ */
wiztrap: wiztrap:
if (wizard && !g.program_state.wizkit_wishing) { if (wizard && !g.program_state.wizkit_wishing && !d.oclass) {
/* [inline code moved to separate routine to unclutter readobjnam] */ /* [inline code moved to separate routine to unclutter readobjnam] */
if ((d.otmp = wizterrainwish(&d)) != 0) if ((d.otmp = wizterrainwish(&d)) != 0)
return d.otmp; return d.otmp;