R1049 - various wand of digging bugs

- Breaking wand of digging dug through rock which should be undiggable.
Checks assumed pits would never show up in solid rock.
- Breaking wand of digging near shop walls wouldn't anger the shopkeeper
Checks assumed pits would never show up in walls, also, added a special
case to pay_for_damage to handle the case where you're falling thru and
can't be asked to pay.
- Shop walls wouldn't be restored if there are pits in the way.
Checks assumed pits would never show up in walls.
- If there was a hole outside the shop, you could kick stuff out of the
door into the hole without shopkeeper noticing.  Added the missing check.
This commit is contained in:
cohrs
2002-08-21 23:06:58 +00:00
parent a78e08d0c5
commit 5d492abf6f
10 changed files with 48 additions and 21 deletions
+5
View File
@@ -212,6 +212,11 @@ don't see chest trap gas colors while Blind
adjust fruit name in potion juice messages if it has the form "foo of bar" adjust fruit name in potion juice messages if it has the form "foo of bar"
wielded camera passes harmlessly through shade wielded camera passes harmlessly through shade
reading spellbooks while confused should allow tearing the book reading spellbooks while confused should allow tearing the book
Breaking wand of digging dug through rock which should be undiggable.
Breaking wand of digging near shop walls wouldn't anger the shopkeeper
Shop walls wouldn't be restored if there were pits in the way.
If there were a hole outside a shop, you could kick stuff out of the door
into the hole without the shopkeeper noticing.
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+1 -1
View File
@@ -1779,7 +1779,7 @@ E int FDECL(shk_move, (struct monst *));
E void FDECL(after_shk_move, (struct monst *)); E void FDECL(after_shk_move, (struct monst *));
E boolean FDECL(is_fshk, (struct monst *)); E boolean FDECL(is_fshk, (struct monst *));
E void FDECL(shopdig, (int)); E void FDECL(shopdig, (int));
E void FDECL(pay_for_damage, (const char *)); E void FDECL(pay_for_damage, (const char *,BOOLEAN_P));
E boolean FDECL(costly_spot, (XCHAR_P,XCHAR_P)); E boolean FDECL(costly_spot, (XCHAR_P,XCHAR_P));
E struct obj *FDECL(shop_object, (XCHAR_P,XCHAR_P)); E struct obj *FDECL(shop_object, (XCHAR_P,XCHAR_P));
E void FDECL(price_quote, (struct obj *)); E void FDECL(price_quote, (struct obj *));
+9 -1
View File
@@ -2556,6 +2556,7 @@ do_break_wand(obj)
register struct monst *mon; register struct monst *mon;
int dmg, damage; int dmg, damage;
boolean affects_objects; boolean affects_objects;
boolean shop_damage = FALSE;
int expltype = EXPL_MAGICAL; int expltype = EXPL_MAGICAL;
char confirm[QBUFSZ], the_wand[BUFSZ], buf[BUFSZ]; char confirm[QBUFSZ], the_wand[BUFSZ], buf[BUFSZ];
@@ -2643,10 +2644,13 @@ do_break_wand(obj)
if (!isok(x,y)) continue; if (!isok(x,y)) continue;
if (obj->otyp == WAN_DIGGING) { if (obj->otyp == WAN_DIGGING) {
if(dig_check(BY_OBJECT, FALSE, x, y)) if(dig_check(BY_OBJECT, FALSE, x, y)) {
if ((IS_WALL(levl[x][y].typ) || IS_DOOR(levl[x][y].typ)) &&
*in_rooms(x,y,SHOPBASE)) shop_damage = TRUE;
digactualhole(x, y, BY_OBJECT, digactualhole(x, y, BY_OBJECT,
(rn2(obj->spe) < 3 || !Can_dig_down(&u.uz)) ? (rn2(obj->spe) < 3 || !Can_dig_down(&u.uz)) ?
PIT : HOLE); PIT : HOLE);
}
continue; continue;
} else if(obj->otyp == WAN_CREATE_MONSTER) { } else if(obj->otyp == WAN_CREATE_MONSTER) {
/* u.ux,u.uy creates it near you--x,y might create it in rock */ /* u.ux,u.uy creates it near you--x,y might create it in rock */
@@ -2679,6 +2683,10 @@ do_break_wand(obj)
} }
} }
/* Note: if player fell thru, this call is a no-op.
Damage is handled in digactualhole in that case */
if (shop_damage) pay_for_damage("dig into", FALSE);
if (obj->otyp == WAN_LIGHT) if (obj->otyp == WAN_LIGHT)
litroom(TRUE, obj); /* only needs to be done once */ litroom(TRUE, obj); /* only needs to be done once */
+10 -7
View File
@@ -186,7 +186,7 @@ dig_check(madeby, verbose, x, y)
} else if (Is_waterlevel(&u.uz)) { } else if (Is_waterlevel(&u.uz)) {
if(verbose) pline_The("water splashes and subsides."); if(verbose) pline_The("water splashes and subsides.");
return(FALSE); return(FALSE);
} else if ((IS_WALL(levl[x][y].typ) && } else if ((IS_ROCK(levl[x][y].typ) && levl[x][y].typ != SDOOR &&
(levl[x][y].wall_info & W_NONDIGGABLE) != 0) (levl[x][y].wall_info & W_NONDIGGABLE) != 0)
|| (ttmp && || (ttmp &&
(ttmp->ttyp == MAGIC_PORTAL || !Can_dig_down(&u.uz)))) { (ttmp->ttyp == MAGIC_PORTAL || !Can_dig_down(&u.uz)))) {
@@ -381,7 +381,7 @@ dig()
newsym(dpx, dpy); newsym(dpx, dpy);
if(digtxt && !digging.quiet) pline(digtxt); /* after newsym */ if(digtxt && !digging.quiet) pline(digtxt); /* after newsym */
if(dmgtxt) if(dmgtxt)
pay_for_damage(dmgtxt); pay_for_damage(dmgtxt, FALSE);
if(Is_earthlevel(&u.uz) && !rn2(3)) { if(Is_earthlevel(&u.uz) && !rn2(3)) {
register struct monst *mtmp; register struct monst *mtmp;
@@ -531,7 +531,7 @@ int ttyp;
if(madeby_u) { if(madeby_u) {
You("dig a pit in the %s.", surface_type); You("dig a pit in the %s.", surface_type);
if (shopdoor) pay_for_damage("ruin"); if (shopdoor) pay_for_damage("ruin", FALSE);
} else if (!madeby_obj && canseemon(madeby)) } else if (!madeby_obj && canseemon(madeby))
pline("%s digs a pit in the %s.", Monnam(madeby), surface_type); pline("%s digs a pit in the %s.", Monnam(madeby), surface_type);
else if (cansee(x, y) && flags.verbose) else if (cansee(x, y) && flags.verbose)
@@ -580,13 +580,15 @@ int ttyp;
impact_drop((struct obj *)0, x, y, 0); impact_drop((struct obj *)0, x, y, 0);
if (oldobjs != newobjs) if (oldobjs != newobjs)
(void) pickup(1); (void) pickup(1);
if (shopdoor && madeby_u) pay_for_damage("ruin"); if (shopdoor && madeby_u) pay_for_damage("ruin", FALSE);
} else { } else {
d_level newlevel; d_level newlevel;
if (*u.ushops && madeby_u) if (*u.ushops && madeby_u)
shopdig(1); /* shk might snatch pack */ shopdig(1); /* shk might snatch pack */
/* handle earlier damage, eg breaking wand of digging */
else if (!madeby_u) pay_for_damage("dig into", TRUE);
You("fall through..."); You("fall through...");
/* Earlier checks must ensure that the destination /* Earlier checks must ensure that the destination
@@ -599,7 +601,7 @@ int ttyp;
spoteffects(FALSE); spoteffects(FALSE);
} }
} else { } else {
if (shopdoor && madeby_u) pay_for_damage("ruin"); if (shopdoor && madeby_u) pay_for_damage("ruin", FALSE);
if (newobjs) if (newobjs)
impact_drop((struct obj *)0, x, y, 0); impact_drop((struct obj *)0, x, y, 0);
if (mtmp) { if (mtmp) {
@@ -643,7 +645,8 @@ boolean pit_only;
boolean nohole = !Can_dig_down(&u.uz); boolean nohole = !Can_dig_down(&u.uz);
if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL || nohole)) || if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL || nohole)) ||
(IS_WALL(lev->typ) && (lev->wall_info & W_NONDIGGABLE) != 0)) { (IS_ROCK(lev->typ) && lev->typ != SDOOR &&
(lev->wall_info & W_NONDIGGABLE) != 0)) {
pline_The("%s here is too hard to dig in.", surface(u.ux,u.uy)); pline_The("%s here is too hard to dig in.", surface(u.ux,u.uy));
} else if (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) { } else if (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) {
@@ -1261,7 +1264,7 @@ zap_dig()
} /* while */ } /* while */
tmp_at(DISP_END,0); /* closing call */ tmp_at(DISP_END,0); /* closing call */
if (shopdoor || shopwall) if (shopdoor || shopwall)
pay_for_damage(shopdoor ? "destroy" : "dig into"); pay_for_damage(shopdoor ? "destroy" : "dig into", FALSE);
return; return;
} }
+9 -2
View File
@@ -541,8 +541,15 @@ xchar x, y;
} }
/* the object might have fallen down a hole */ /* the object might have fallen down a hole */
if (kickobj->where == OBJ_MIGRATING) if (kickobj->where == OBJ_MIGRATING) {
if (costly) {
if(isgold)
costly_gold(x, y, kickobj->quan);
else (void)stolen_value(kickobj, x, y,
(boolean)shkp->mpeaceful, FALSE);
}
return 1; return 1;
}
bhitroom = *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE); bhitroom = *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE);
if (costly && (!costly_spot(bhitpos.x, bhitpos.y) || if (costly && (!costly_spot(bhitpos.x, bhitpos.y) ||
@@ -1014,7 +1021,7 @@ dumb:
unblock_point(x,y); /* vision */ unblock_point(x,y); /* vision */
if (shopdoor) { if (shopdoor) {
add_damage(x, y, 400L); add_damage(x, y, 400L);
pay_for_damage("break"); pay_for_damage("break", FALSE);
} }
if (in_town(x, y)) if (in_town(x, y))
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+2 -1
View File
@@ -367,7 +367,8 @@ int expltype;
if (shopdamage) { if (shopdamage) {
pay_for_damage(adtyp == AD_FIRE ? "burn away" : pay_for_damage(adtyp == AD_FIRE ? "burn away" :
adtyp == AD_COLD ? "shatter" : adtyp == AD_COLD ? "shatter" :
adtyp == AD_DISN ? "disintegrate" : "destroy"); adtyp == AD_DISN ? "disintegrate" : "destroy",
FALSE);
} }
/* explosions are noisy */ /* explosions are noisy */
+1 -1
View File
@@ -422,7 +422,7 @@ still_chewing(x,y)
unblock_point(x, y); /* vision */ unblock_point(x, y); /* vision */
newsym(x, y); newsym(x, y);
if (digtxt) You(digtxt); /* after newsym */ if (digtxt) You(digtxt); /* after newsym */
if (dmgtxt) pay_for_damage(dmgtxt); if (dmgtxt) pay_for_damage(dmgtxt, FALSE);
(void) memset((genericptr_t)&digging, 0, sizeof digging); (void) memset((genericptr_t)&digging, 0, sizeof digging);
return 0; return 0;
} }
+5 -4
View File
@@ -3410,8 +3410,9 @@ coord *mm;
#endif /* KOPS */ #endif /* KOPS */
void void
pay_for_damage(dmgstr) pay_for_damage(dmgstr, cant_mollify)
const char *dmgstr; const char *dmgstr;
boolean cant_mollify;
{ {
register struct monst *shkp = (struct monst *)0; register struct monst *shkp = (struct monst *)0;
char shops_affected[5]; char shops_affected[5];
@@ -3521,11 +3522,11 @@ const char *dmgstr;
(void) mnearto(shkp, x, y, TRUE); (void) mnearto(shkp, x, y, TRUE);
} }
if((um_dist(x, y, 1) && !uinshp) || if((um_dist(x, y, 1) && !uinshp) || cant_mollify ||
#ifndef GOLDOBJ #ifndef GOLDOBJ
(u.ugold + ESHK(shkp)->credit) < cost_of_damage (u.ugold + ESHK(shkp)->credit) < cost_of_damage
#else #else
(money_cnt(invent) + ESHK(shkp)->credit) < cost_of_damage (money_cnt(invent) + ESHK(shkp)->credit) < cost_of_damage
#endif #endif
|| !rn2(50)) { || !rn2(50)) {
if(um_dist(x, y, 1) && !uinshp) { if(um_dist(x, y, 1) && !uinshp) {
+4 -2
View File
@@ -283,9 +283,11 @@ register int x, y, typ;
case TRAPDOOR: case TRAPDOOR:
lev = &levl[x][y]; lev = &levl[x][y];
if (*in_rooms(x, y, SHOPBASE) && if (*in_rooms(x, y, SHOPBASE) &&
((typ == HOLE || typ == TRAPDOOR) || IS_DOOR(lev->typ))) ((typ == HOLE || typ == TRAPDOOR) ||
IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
add_damage(x, y, /* schedule repair */ add_damage(x, y, /* schedule repair */
(IS_DOOR(lev->typ) && !flags.mon_moving) ? 200L : 0L); ((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
&& !flags.mon_moving) ? 200L : 0L);
lev->doormask = 0; /* subsumes altarmask, icedpool... */ lev->doormask = 0; /* subsumes altarmask, icedpool... */
if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */ if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */
lev->typ = ROOM; lev->typ = ROOM;
+2 -2
View File
@@ -2783,7 +2783,7 @@ struct obj *obj; /* object tossed/used */
if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) tmp_at(DISP_END, 0); if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) tmp_at(DISP_END, 0);
if(shopdoor) if(shopdoor)
pay_for_damage("destroy"); pay_for_damage("destroy", FALSE);
return (struct monst *)0; return (struct monst *)0;
} }
@@ -3456,7 +3456,7 @@ register int dx,dy;
if (shopdamage) if (shopdamage)
pay_for_damage(abstype == ZT_FIRE ? "burn away" : pay_for_damage(abstype == ZT_FIRE ? "burn away" :
abstype == ZT_COLD ? "shatter" : abstype == ZT_COLD ? "shatter" :
abstype == ZT_DEATH ? "disintegrate" : "destroy"); abstype == ZT_DEATH ? "disintegrate" : "destroy", FALSE);
bhitpos = save_bhitpos; bhitpos = save_bhitpos;
} }
#endif /*OVLB*/ #endif /*OVLB*/