From: Pasi Kallinen Date: Sat, 18 Sep 2021 18:24:48 +0000 (+0300) Subject: Walking near buried zombifying corpses wakes them up X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12800bf84bc3384502a2faf3ae1c44e1d5b9849a;p=nethack Walking near buried zombifying corpses wakes them up Moving without stealth will reduce the zombifying timeout of buried corpses under and around hero's location. --- diff --git a/src/hack.c b/src/hack.c index dbb353036..d225827ba 100644 --- a/src/hack.c +++ b/src/hack.c @@ -17,6 +17,7 @@ static boolean doorless_door(int, int); static void move_update(boolean); static int pickup_checks(void); static void maybe_smudge_engr(int, int, int, int); +static void check_buried_zombies(xchar, xchar); static void domove_core(void); #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE) @@ -1371,6 +1372,25 @@ u_rooted(void) return FALSE; } +/* reduce zombification timeout of buried zombies around px, py */ +static void +check_buried_zombies(xchar x, xchar y) +{ + struct obj *otmp; + long t; + + for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) { + if (otmp->otyp == CORPSE && otmp->timed + && otmp->ox >= x - 1 && otmp->ox <= x + 1 + && otmp->oy >= y - 1 && otmp->oy <= y + 1 + && (t = peek_timer(ZOMBIFY_MON, obj_to_any(otmp))) > 0) { + t = stop_timer(ZOMBIFY_MON, obj_to_any(otmp)); + (void) start_timer(max(1, t - rn2(10)), TIMER_OBJECT, + ZOMBIFY_MON, obj_to_any(otmp)); + } + } +} + void domove(void) { @@ -1970,6 +1990,9 @@ domove_core(void) nomul(0); } + if (!Levitation && !Flying && !Stealth) + check_buried_zombies(u.ux, u.uy); + if (hides_under(g.youmonst.data) || g.youmonst.data->mlet == S_EEL || u.dx || u.dy) (void) hideunder(&g.youmonst);