Follow up on disturbing buried zombies

Change 852f8e4 by requiring a minimum impact before a buried zombie
nearby will be disturbed: light, but still excluding things like
scrolls, if it's a violent impact (dropped while levitating, thrown, or
kicked), and fairly heavy if the hero is just placing the item on the
ground normally.

Moving the call out of flooreffects meant it no longer applied to
pushing boulders around, so have moverock disturb nearby zombies.  I
additionally had wake_nearby do the same thing.

Finally, I renamed check_buried_zombies (which doesn't really reflect
what it does) to disturb_buried_zombies.
This commit is contained in:
Michael Meyer
2023-11-03 13:47:20 -04:00
committed by PatR
parent e384e3a5a1
commit 98d2b0ecb3
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);
#endif
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 const char *u_locomotion(const char *);
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)) {
doaltarobj(obj);
}
check_buried_zombies(x, y);
gb.bhitpos = save_bhitpos;
return res;
@@ -779,6 +778,7 @@ dropz(struct obj *obj, boolean with_impact)
place_object(obj, u.ux, u.uy);
if (with_impact)
container_impact_dmg(obj, u.ux, u.uy);
impact_disturbs_zombies(obj, with_impact);
if (obj == uball)
drop_ball(u.ux, u.uy);
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")) {
place_object(gk.kickedobj, u.ux, u.uy);
impact_disturbs_zombies(gk.kickedobj, TRUE);
stackobj(gk.kickedobj);
newsym(u.ux, u.uy);
}
@@ -770,6 +771,7 @@ really_kick_object(coordxy x, coordxy y)
donate_gold(gtg, shkp, FALSE);
}
place_object(gk.kickedobj, gb.bhitpos.x, gb.bhitpos.y);
impact_disturbs_zombies(gk.kickedobj, TRUE);
stackobj(gk.kickedobj);
newsym(gk.kickedobj->ox, gk.kickedobj->oy);
return 1;

View File

@@ -1777,9 +1777,11 @@ throwit(struct obj *obj,
/* container contents might break;
do so before turning ownership of gt.thrownobj over to shk
(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 */
container_impact_dmg(obj, u.ux, u.uy);
impact_disturbs_zombies(obj, TRUE);
}
/* charge for items thrown out of shop;
shk takes possession for items thrown into one */
if ((*u.ushops || obj->unpaid) && obj != uball)

View File

@@ -291,6 +291,15 @@ moverock(void)
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) {
int newlev = 0; /* lint suppression */
d_level dest;
@@ -401,8 +410,6 @@ moverock(void)
}
}
if (closed_door(rx, ry))
goto nopushmsg;
if (boulder_hits_pool(otmp, rx, ry, TRUE))
continue;
@@ -1592,9 +1599,20 @@ u_rooted(void)
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 */
void
check_buried_zombies(coordxy x, coordxy y)
disturb_buried_zombies(coordxy x, coordxy y)
{
struct obj *otmp;
long t;
@@ -2601,7 +2619,7 @@ domove_core(void)
}
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
|| 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 */