From: PatR Date: Sun, 22 May 2022 07:21:58 +0000 (-0700) Subject: tweak #wizkill X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a962a4f6ea5475df0224dbebda37341c2968d8ac;p=nethack tweak #wizkill When using 'm #wizkill' to kill monster(s) off without giving the hero any credit or blame, temporarily force context.mon_moving On so that collateral damage (other monsters killed by targetted gas spore's explosion) also don't give the hero any credit or blame. Make sure that some message identifying the monster is given when targetted monster is killed even if hero can't see or sense it. --- diff --git a/src/cmd.c b/src/cmd.c index 2c203b435..b74e3a348 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1203,12 +1203,33 @@ wiz_kill(void) } 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 */ + /* we don't require that the monster be seen or sensed so + we issue our own message in order to name it in case it + isn't; note that if it triggers other kills, those might + be referred to as "it" */ + if (!iflags.menu_requested) { + boolean namedpet = has_mgivenname(mtmp) && !Hallucination; + + /* normal case: hero is credited/blamed */ + You("%s %s!", nonliving(mtmp->data) ? "destroy" : "kill", + !mtmp->mtame ? noit_mon_nam(mtmp) + : x_monnam(mtmp, ARTICLE_YOUR, "poor", + SUPPRESS_IT | (namedpet ? SUPPRESS_SADDLE : 0), + FALSE)); + xkilled(mtmp, XKILL_NOMSG); + } else { /* 'm'-prefix */ + /* we know that monsters aren't moving because player has + just issued this #wizkill command, but if 'mtmp' is a + gas spore whose explosion kills any other monsters we + need to have the mon_moving flag be True in order to + avoid blaming or crediting hero for their deaths */ + g.context.mon_moving = TRUE; + pline("%s is %s.", noit_Monnam(mtmp), + nonliving(mtmp->data) ? "destroyed" : "killed"); + /* Null second arg suppresses message */ + monkilled(mtmp, (char *) 0, AD_PHYS); + g.context.mon_moving = FALSE; + } } else { There("is no monster there."); break;