E boolean FDECL(obj_shudders, (struct obj *));
E void FDECL(do_osshock, (struct obj *));
E int FDECL(bhito, (struct obj *,struct obj *));
-E int FDECL(bhitpile, (struct obj *,int (*)(OBJ_P,OBJ_P),int,int));
+E int FDECL(bhitpile, (struct obj *,int (*)(OBJ_P,OBJ_P),int,int,SCHAR_P));
E int FDECL(zappable, (struct obj *));
E void FDECL(zapnodir, (struct obj *));
E int NDECL(dozap);
/* if (context.botl) bot(); */
}
if (affects_objects && level.objects[x][y]) {
- (void) bhitpile(obj, bhito, x, y);
+ (void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) bot(); /* potion effects */
}
} else {
* since it's also used by retouch_equipment() for polyself.)
*/
if (affects_objects && level.objects[x][y]) {
- (void) bhitpile(obj, bhito, x, y);
+ (void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) bot(); /* potion effects */
}
damage = zapyourself(obj, FALSE);
if (Is_box(obj)) (void) boxlock(obj, otmp);
if (obj_shudders(obj)) {
- boolean cover = ((obj->ox == u.ux && obj->oy == u.uy) &&
- u.uundetected &&
- hides_under(youmonst.data));
+ boolean cover = ((obj == level.objects[u.ux][u.uy]) &&
+ u.uundetected &&
+ hides_under(youmonst.data));
if (cansee(obj->ox, obj->oy)) learn_it = TRUE;
do_osshock(obj);
/* returns nonzero if something was hit */
int
-bhitpile(obj,fhito,tx,ty)
+bhitpile(obj,fhito,tx,ty,zdir)
struct obj *obj;
int FDECL((*fhito), (OBJ_P,OBJ_P));
int tx, ty;
+ schar zdir;
{
int hitanything = 0;
register struct obj *otmp, *next_obj;
for(otmp = level.objects[tx][ty]; otmp; otmp = next_obj) {
/* Fix for polymorph bug, Tim Wright */
next_obj = otmp->nexthere;
- hitanything += (*fhito)(otmp, obj);
+ /*
+ * game flavor: if you are hiding under something,
+ * a zap downwards shouldn't hit that obj, so honor that.
+ */
+ if (!(u.uundetected && (zdir > 0) &&
+ (otmp == level.objects[u.ux][u.uy]) &&
+ hides_under(youmonst.data)))
+ hitanything += (*fhito)(otmp, obj);
}
if(poly_zapped >= 0)
create_polymon(level.objects[tx][ty], poly_zapped);
if (u.dz < 0) {
You("probe towards the %s.", ceiling(x,y));
} else {
- ptmp += bhitpile(obj, bhito, x, y);
+ ptmp += bhitpile(obj, bhito, x, y, u.dz);
You("probe beneath the %s.", surface(x,y));
ptmp += display_binventory(x, y, TRUE);
}
if (u.dz > 0) {
/* zapping downward */
- (void) bhitpile(obj, bhito, x, y);
+ (void) bhitpile(obj, bhito, x, y, u.dz);
/* subset of engraving effects; none sets `disclose' */
if ((e = engr_at(x, y)) != 0 && e->engr_type != HEADSTONE) {
break;
}
}
+ } else if (u.dz < 0) {
+ /* zapping upward */
+
+ /* game flavor: if you're hiding under "something"
+ * a zap upward should hit that "something".
+ */
+ if (u.uundetected && hides_under(youmonst.data)) {
+ int hitit = 0;
+ otmp = level.objects[u.ux][u.uy];
+
+ if (otmp) hitit = bhito(otmp, obj);
+ if (hitit) {
+ (void) hideunder(&youmonst);
+ disclose = TRUE;
+ }
+ }
}
return disclose;
}
}
if(fhito) {
- if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y))
+ if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y,0))
range--;
} else {
if(weapon == KICKED_WEAPON &&