flavor enhance zap downwards/upwards when hiding

Changes to be committed:
	modified:   doc/fixes35.0
	modified:   include/extern.h
	modified:   src/apply.c
	modified:   src/zap.c

    On 3/23/2015 6:41 PM, a bug reporter wrote:
    > When you're hiding under an item (e.g. via garter snake polyform), and
    > that item gets polyshuddered into nonexistence, you continue hiding
    > (under nothing).
    This was addressed previously.

    > (Incidentally, it's a bit weird that you use > to aim at items that are
    > flavorwise above you at the time.)

    This addresses the flavorwise concern.
This commit is contained in:
nhmall
2015-03-28 11:20:44 -04:00
parent 2fce0074b3
commit c035402c14
4 changed files with 37 additions and 11 deletions

View File

@@ -1100,6 +1100,8 @@ pressing # when cursor positioning toggles automatic description of features
under the cursor
cursor positioning ignores uninteresting dungeon features
allow reading many more items
when you're hiding under something a zap downward should not hit that
something, while a zap upward should
Platform- and/or Interface-Specific New Features

View File

@@ -2629,7 +2629,7 @@ E boolean FDECL(obj_resists, (struct obj *,int,int));
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);

View File

@@ -3037,7 +3037,7 @@ do_break_wand(obj)
/* 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 {
@@ -3054,7 +3054,7 @@ do_break_wand(obj)
* 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);

View File

@@ -1750,9 +1750,9 @@ struct obj *obj, *otmp;
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);
@@ -1892,10 +1892,11 @@ struct obj *obj, *otmp;
/* 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;
@@ -1917,7 +1918,14 @@ bhitpile(obj,fhito,tx,ty)
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);
@@ -2568,7 +2576,7 @@ struct obj *obj; /* wand or spell */
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);
}
@@ -2688,7 +2696,7 @@ struct obj *obj; /* wand or spell */
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) {
@@ -2724,6 +2732,22 @@ struct obj *obj; /* wand or spell */
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;
@@ -3095,7 +3119,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
}
}
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 &&