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
+2
View File
@@ -1100,6 +1100,8 @@ pressing # when cursor positioning toggles automatic description of features
under the cursor under the cursor
cursor positioning ignores uninteresting dungeon features cursor positioning ignores uninteresting dungeon features
allow reading many more items 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 Platform- and/or Interface-Specific New Features
+1 -1
View File
@@ -2629,7 +2629,7 @@ E boolean FDECL(obj_resists, (struct obj *,int,int));
E boolean FDECL(obj_shudders, (struct obj *)); E boolean FDECL(obj_shudders, (struct obj *));
E void FDECL(do_osshock, (struct obj *)); E void FDECL(do_osshock, (struct obj *));
E int FDECL(bhito, (struct obj *,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 int FDECL(zappable, (struct obj *));
E void FDECL(zapnodir, (struct obj *)); E void FDECL(zapnodir, (struct obj *));
E int NDECL(dozap); E int NDECL(dozap);
+2 -2
View File
@@ -3037,7 +3037,7 @@ do_break_wand(obj)
/* if (context.botl) bot(); */ /* if (context.botl) bot(); */
} }
if (affects_objects && level.objects[x][y]) { 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 */ if (context.botl) bot(); /* potion effects */
} }
} else { } else {
@@ -3054,7 +3054,7 @@ do_break_wand(obj)
* since it's also used by retouch_equipment() for polyself.) * since it's also used by retouch_equipment() for polyself.)
*/ */
if (affects_objects && level.objects[x][y]) { 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 */ if (context.botl) bot(); /* potion effects */
} }
damage = zapyourself(obj, FALSE); damage = zapyourself(obj, FALSE);
+32 -8
View File
@@ -1750,9 +1750,9 @@ struct obj *obj, *otmp;
if (Is_box(obj)) (void) boxlock(obj, otmp); if (Is_box(obj)) (void) boxlock(obj, otmp);
if (obj_shudders(obj)) { if (obj_shudders(obj)) {
boolean cover = ((obj->ox == u.ux && obj->oy == u.uy) && boolean cover = ((obj == level.objects[u.ux][u.uy]) &&
u.uundetected && u.uundetected &&
hides_under(youmonst.data)); hides_under(youmonst.data));
if (cansee(obj->ox, obj->oy)) learn_it = TRUE; if (cansee(obj->ox, obj->oy)) learn_it = TRUE;
do_osshock(obj); do_osshock(obj);
@@ -1892,10 +1892,11 @@ struct obj *obj, *otmp;
/* returns nonzero if something was hit */ /* returns nonzero if something was hit */
int int
bhitpile(obj,fhito,tx,ty) bhitpile(obj,fhito,tx,ty,zdir)
struct obj *obj; struct obj *obj;
int FDECL((*fhito), (OBJ_P,OBJ_P)); int FDECL((*fhito), (OBJ_P,OBJ_P));
int tx, ty; int tx, ty;
schar zdir;
{ {
int hitanything = 0; int hitanything = 0;
register struct obj *otmp, *next_obj; 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) { for(otmp = level.objects[tx][ty]; otmp; otmp = next_obj) {
/* Fix for polymorph bug, Tim Wright */ /* Fix for polymorph bug, Tim Wright */
next_obj = otmp->nexthere; 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) if(poly_zapped >= 0)
create_polymon(level.objects[tx][ty], poly_zapped); create_polymon(level.objects[tx][ty], poly_zapped);
@@ -2568,7 +2576,7 @@ struct obj *obj; /* wand or spell */
if (u.dz < 0) { if (u.dz < 0) {
You("probe towards the %s.", ceiling(x,y)); You("probe towards the %s.", ceiling(x,y));
} else { } else {
ptmp += bhitpile(obj, bhito, x, y); ptmp += bhitpile(obj, bhito, x, y, u.dz);
You("probe beneath the %s.", surface(x,y)); You("probe beneath the %s.", surface(x,y));
ptmp += display_binventory(x, y, TRUE); ptmp += display_binventory(x, y, TRUE);
} }
@@ -2688,7 +2696,7 @@ struct obj *obj; /* wand or spell */
if (u.dz > 0) { if (u.dz > 0) {
/* zapping downward */ /* zapping downward */
(void) bhitpile(obj, bhito, x, y); (void) bhitpile(obj, bhito, x, y, u.dz);
/* subset of engraving effects; none sets `disclose' */ /* subset of engraving effects; none sets `disclose' */
if ((e = engr_at(x, y)) != 0 && e->engr_type != HEADSTONE) { if ((e = engr_at(x, y)) != 0 && e->engr_type != HEADSTONE) {
@@ -2724,6 +2732,22 @@ struct obj *obj; /* wand or spell */
break; 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; return disclose;
@@ -3095,7 +3119,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
} }
} }
if(fhito) { if(fhito) {
if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y)) if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y,0))
range--; range--;
} else { } else {
if(weapon == KICKED_WEAPON && if(weapon == KICKED_WEAPON &&