pull request #1119 - refine impact vs zombies

Pull request by entrez:  refine the recent change to have buried
zombies be affected (emerge from ground sooner) by objects that
impact the ground on or near their burial spot.

Closes #1119
This commit is contained in:
PatR
2023-11-05 21:56:31 -08:00
6 changed files with 31 additions and 7 deletions

View File

@@ -995,7 +995,8 @@ extern boolean test_move(coordxy, coordxy, coordxy, coordxy, int);
extern int wiz_debug_cmd_traveldisplay(void); extern int wiz_debug_cmd_traveldisplay(void);
#endif #endif
extern boolean u_rooted(void); extern boolean u_rooted(void);
extern void check_buried_zombies(coordxy, coordxy); extern void impact_disturbs_zombies(struct obj *, boolean);
extern void disturb_buried_zombies(coordxy, coordxy);
extern boolean u_maybe_impaired(void); extern boolean u_maybe_impaired(void);
extern const char *u_locomotion(const char *); extern const char *u_locomotion(const char *);
extern void handle_tip(int); extern void handle_tip(int);

View File

@@ -305,7 +305,6 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
&& cansee(x,y)) { && cansee(x,y)) {
doaltarobj(obj); doaltarobj(obj);
} }
check_buried_zombies(x, y);
gb.bhitpos = save_bhitpos; gb.bhitpos = save_bhitpos;
return res; return res;
@@ -779,6 +778,7 @@ dropz(struct obj *obj, boolean with_impact)
place_object(obj, u.ux, u.uy); place_object(obj, u.ux, u.uy);
if (with_impact) if (with_impact)
container_impact_dmg(obj, u.ux, u.uy); container_impact_dmg(obj, u.ux, u.uy);
impact_disturbs_zombies(obj, with_impact);
if (obj == uball) if (obj == uball)
drop_ball(u.ux, u.uy); drop_ball(u.ux, u.uy);
else if (gl.level.flags.has_shop) else if (gl.level.flags.has_shop)

View File

@@ -627,6 +627,7 @@ really_kick_object(coordxy x, coordxy y)
} }
if (!flooreffects(gk.kickedobj, u.ux, u.uy, "fall")) { if (!flooreffects(gk.kickedobj, u.ux, u.uy, "fall")) {
place_object(gk.kickedobj, u.ux, u.uy); place_object(gk.kickedobj, u.ux, u.uy);
impact_disturbs_zombies(gk.kickedobj, TRUE);
stackobj(gk.kickedobj); stackobj(gk.kickedobj);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
@@ -770,6 +771,7 @@ really_kick_object(coordxy x, coordxy y)
donate_gold(gtg, shkp, FALSE); donate_gold(gtg, shkp, FALSE);
} }
place_object(gk.kickedobj, gb.bhitpos.x, gb.bhitpos.y); place_object(gk.kickedobj, gb.bhitpos.x, gb.bhitpos.y);
impact_disturbs_zombies(gk.kickedobj, TRUE);
stackobj(gk.kickedobj); stackobj(gk.kickedobj);
newsym(gk.kickedobj->ox, gk.kickedobj->oy); newsym(gk.kickedobj->ox, gk.kickedobj->oy);
return 1; return 1;

View File

@@ -1777,9 +1777,11 @@ throwit(struct obj *obj,
/* container contents might break; /* container contents might break;
do so before turning ownership of gt.thrownobj over to shk do so before turning ownership of gt.thrownobj over to shk
(container_impact_dmg handles item already owned by shop) */ (container_impact_dmg handles item already owned by shop) */
if (!IS_SOFT(levl[gb.bhitpos.x][gb.bhitpos.y].typ)) if (!IS_SOFT(levl[gb.bhitpos.x][gb.bhitpos.y].typ)) {
/* <x,y> is spot where you initiated throw, not gb.bhitpos */ /* <x,y> is spot where you initiated throw, not gb.bhitpos */
container_impact_dmg(obj, u.ux, u.uy); container_impact_dmg(obj, u.ux, u.uy);
impact_disturbs_zombies(obj, TRUE);
}
/* charge for items thrown out of shop; /* charge for items thrown out of shop;
shk takes possession for items thrown into one */ shk takes possession for items thrown into one */
if ((*u.ushops || obj->unpaid) && obj != uball) if ((*u.ushops || obj->unpaid) && obj != uball)

View File

@@ -291,6 +291,15 @@ moverock(void)
goto cannot_push; goto cannot_push;
} }
if (closed_door(rx, ry))
goto nopushmsg;
/* at this point the boulder should be able to move (though
potentially into something like a trap, pool, or lava) */
/* rumbling disturbs buried zombies */
disturb_buried_zombies(sx, sy);
if (ttmp) { if (ttmp) {
int newlev = 0; /* lint suppression */ int newlev = 0; /* lint suppression */
d_level dest; d_level dest;
@@ -401,8 +410,6 @@ moverock(void)
} }
} }
if (closed_door(rx, ry))
goto nopushmsg;
if (boulder_hits_pool(otmp, rx, ry, TRUE)) if (boulder_hits_pool(otmp, rx, ry, TRUE))
continue; continue;
@@ -1592,9 +1599,20 @@ u_rooted(void)
return FALSE; return FALSE;
} }
/* maybe disturb buried zombies when an object is dropped or thrown nearby */
void
impact_disturbs_zombies(struct obj *obj, boolean violent)
{
/* if object won't make a noticeable impact, let buried zombies rest */
if (obj->owt < (violent ? 10 : 100) || is_flimsy(obj))
return;
disturb_buried_zombies(obj->ox, obj->oy);
}
/* reduce zombification timeout of buried zombies around px, py */ /* reduce zombification timeout of buried zombies around px, py */
void void
check_buried_zombies(coordxy x, coordxy y) disturb_buried_zombies(coordxy x, coordxy y)
{ {
struct obj *otmp; struct obj *otmp;
long t; long t;
@@ -2601,7 +2619,7 @@ domove_core(void)
} }
if (!Levitation && !Flying && !Stealth) if (!Levitation && !Flying && !Stealth)
check_buried_zombies(u.ux, u.uy); disturb_buried_zombies(u.ux, u.uy);
if (hides_under(gy.youmonst.data) || gy.youmonst.data->mlet == S_EEL if (hides_under(gy.youmonst.data) || gy.youmonst.data->mlet == S_EEL
|| u.dx || u.dy) || u.dx || u.dy)

View File

@@ -4033,6 +4033,7 @@ wake_nearto(coordxy x, coordxy y, int distance)
} }
} }
} }
disturb_buried_zombies(x, y);
} }
/* NOTE: we must check for mimicry before calling this routine */ /* NOTE: we must check for mimicry before calling this routine */