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:
@@ -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);
|
||||
|
||||
2
src/do.c
2
src/do.c
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
26
src/hack.c
26
src/hack.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user