| 236 | } |
| 237 | |
| 238 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 239 | |
| 240 | /* the #wizkill command - pick targets and reduce them to 0HP; |
| 241 | by default, the hero is credited/blamed; use 'm' prefix to avoid that */ |
| 242 | int |
| 243 | wiz_kill(void) |
| 244 | { |
| 245 | struct monst *mtmp; |
| 246 | coord cc; |
| 247 | int ans; |
| 248 | char c, qbuf[QBUFSZ]; |
| 249 | const char *prompt = "Pick first monster to slay"; |
| 250 | boolean save_verbose = flags.verbose, |
| 251 | save_autodescribe = iflags.autodescribe; |
| 252 | d_level uarehere = u.uz; |
| 253 | |
| 254 | cc.x = u.ux, cc.y = u.uy; |
| 255 | for (;;) { |
| 256 | pline("%s:", prompt); |
| 257 | prompt = "Next monster"; |
| 258 | |
| 259 | flags.verbose = FALSE; |
| 260 | iflags.autodescribe = TRUE; |
| 261 | ans = getpos(&cc, TRUE, "a monster"); |
| 262 | flags.verbose = save_verbose; |
| 263 | iflags.autodescribe = save_autodescribe; |
| 264 | if (ans < 0 || cc.x < 1) |
| 265 | break; |
| 266 | |
| 267 | mtmp = 0; |
| 268 | if (u_at(cc.x, cc.y)) { |
| 269 | if (u.usteed) { |
| 270 | Sprintf(qbuf, "Kill %.110s?", mon_nam(u.usteed)); |
| 271 | if ((c = ynq(qbuf)) == 'q') |
| 272 | break; |
| 273 | if (c == 'y') |
| 274 | mtmp = u.usteed; |
| 275 | } |
| 276 | if (!mtmp) { |
| 277 | Sprintf(qbuf, "%s?", Role_if(PM_SAMURAI) ? "Perform seppuku" |
| 278 | : "Commit suicide"); |
| 279 | if (paranoid_query(TRUE, qbuf)) { |
| 280 | Sprintf(svk.killer.name, "%s own player", uhis()); |
| 281 | svk.killer.format = KILLED_BY; |
| 282 | done(DIED); |
| 283 | } |
| 284 | break; |
| 285 | } |
| 286 | } else if (u.uswallow) { |
| 287 | mtmp = next2u(cc.x, cc.y) ? u.ustuck : 0; |
| 288 | } else { |
| 289 | mtmp = m_at(cc.x, cc.y); |
| 290 | } |
| 291 | |
| 292 | /* whether there's an unseen monster here or not, player will know |
| 293 | that there's no monster here after the kill or failed attempt; |
| 294 | let hero know too */ |
| 295 | (void) unmap_invisible(cc.x, cc.y); |
nothing calls this directly
no test coverage detected