From: Pasi Kallinen Date: Thu, 24 Feb 2022 13:10:39 +0000 (+0200) Subject: Allow using #wiztelekinesis on yourself X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16a8caac973047a09bbd914ba0dc6bb735a3c6e6;p=nethack Allow using #wiztelekinesis on yourself --- diff --git a/src/cmd.c b/src/cmd.c index fc6cab1d1..e94c6cd8d 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1236,20 +1236,25 @@ wiz_telekinesis(void) pline("Pick a monster to hurtle."); do { - if (mtmp && !DEADMONSTER(mtmp) && canspotmon(mtmp)) { - cc.x = mtmp->mx; - cc.y = mtmp->my; - } - ans = getpos(&cc, TRUE, "a monster"); if (ans < 0 || cc.x < 0) 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)) + || u_at(cc.x, cc.y)) { if (!getdir("which direction?")) return ECMD_CANCEL; - mhurtle(mtmp, u.dx, u.dy, 6); + if (mtmp) { + mhurtle(mtmp, u.dx, u.dy, 6); + if (!DEADMONSTER(mtmp) && canspotmon(mtmp)) { + cc.x = mtmp->mx; + cc.y = mtmp->my; + } + } else { + hurtle(u.dx, u.dy, 6, FALSE); + cc.x = u.ux, cc.y = u.uy; + } } } while (TRUE);