]> granicus.if.org Git - nethack/commitdiff
Moving a monster with telekinesis hurles it through the air
authorPasi Kallinen <paxed@alt.org>
Thu, 24 Feb 2022 17:27:56 +0000 (19:27 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 24 Feb 2022 17:27:59 +0000 (19:27 +0200)
... and at the end of the flight, it can't avoid a trap, if it
lands on one.

include/hack.h
src/dothrow.c
src/trap.c

index 037751b8eb2cfe66e490b9c360812695ed3fcd03..4b2a094cf950c1f256c021f0c53a22e7aee47435 100644 (file)
@@ -390,6 +390,7 @@ typedef struct sortloot_item Loot;
 #define TOOKPLUNGE    0x10 /* used '>' to enter pit below you */
 #define VIASITTING    0x20 /* #sit while at trap location (affects message) */
 #define FAILEDUNTRAP  0x40 /* trap activated by failed untrap attempt */
+#define HURTLING      0x80 /* monster is hurtling through air */
 
 /* Flags to control test_move in hack.c */
 #define DO_MOVE 0   /* really doing the move */
index 874e3b20b91bc424505663ff634be25470260449..d71b42e12437c36cc54c85eb5e1186687889c447 100644 (file)
@@ -921,7 +921,7 @@ mhurtle_step(genericptr_t arg, int x, int y)
         set_apparxy(mon);
         if (is_waterwall(x, y))
             return FALSE;
-        res = mintrap(mon, NO_TRAP_FLAGS); /* TODO: TEMPFLIGHT? */
+        res = mintrap(mon, HURTLING);
         if (res == Trap_Killed_Mon
             || res == Trap_Caught_Mon
             || res == Trap_Moved_Mon)
@@ -1039,7 +1039,10 @@ mhurtle(struct monst *mon, int dx, int dy, int range)
     cc.x = mon->mx + (dx * range);
     cc.y = mon->my + (dy * range);
     (void) walk_path(&mc, &cc, mhurtle_step, (genericptr_t) mon);
-    (void) minliquid(mon);
+    if (!DEADMONSTER(mon) && t_at(mon->mx, mon->my))
+        mintrap(mon, FORCEBUNGLE);
+    else
+        (void) minliquid(mon);
     return;
 }
 
index d3127dfd0e6ffae2302628f8385b5abb7448b423..3f365bddd2e39d2e10ad97c87d970518440fe0a3 100644 (file)
@@ -965,6 +965,7 @@ check_in_air(struct monst *mtmp, unsigned trflags)
 
     return (is_floater(mtmp->data)
             || (is_flyer(mtmp->data) && !plunged)
+            || (trflags & HURTLING) != 0
             || (mtmp == &g.youmonst ?
                 (Levitation || (Flying && !plunged)) : 0));
 }
@@ -3171,6 +3172,7 @@ mintrap(register struct monst *mtmp, long mintrapflags)
     } else {
         register int tt = trap->ttyp;
         boolean forcetrap = ((mintrapflags & FORCETRAP) != 0);
+        boolean forcebungle = (mintrapflags & FORCEBUNGLE) != 0;
         /* monster has seen such a trap before */
         boolean already_seen = ((mtmp->mtrapseen & (1 << (tt - 1))) != 0
                                 || (tt == HOLE && !mindless(mptr)));
@@ -3183,7 +3185,7 @@ mintrap(register struct monst *mtmp, long mintrapflags)
             if (floor_trigger(tt) && check_in_air(mtmp, mintrapflags)) {
                 return Trap_Effect_Finished;
             }
-            if (already_seen && rn2(4))
+            if (already_seen && rn2(4) && !forcebungle)
                 return Trap_Effect_Finished;
         }