E int FDECL(thitmonst, (struct monst *,struct obj *));
E int FDECL(hero_breaks, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P));
E int FDECL(breaks, (struct obj *,XCHAR_P,XCHAR_P));
+E void FDECL(breakobj, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P,BOOLEAN_P));
E boolean FDECL(breaktest, (struct obj *));
E boolean FDECL(walk_path, (coord *, coord *, boolean (*)(genericptr_t,int,int), genericptr_t));
E boolean FDECL(hurtle_step, (genericptr_t, int, int));
E long FDECL(contained_gold, (struct obj *));
E void FDECL(picked_container, (struct obj *));
E long FDECL(unpaid_cost, (struct obj *));
+E boolean FDECL(billable, (struct monst **,struct obj *,CHAR_P,BOOLEAN_P));
E void FDECL(addtobill, (struct obj *,BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
E void FDECL(splitbill, (struct obj *,struct obj *));
E void FDECL(subfrombill, (struct obj *,struct monst *));
-/* SCCS Id: @(#)dothrow.c 3.5 2004/12/21 */
+/* SCCS Id: @(#)dothrow.c 3.5 2005/03/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL void FDECL(tmiss, (struct obj *, struct monst *));
STATIC_DCL int FDECL(throw_gold, (struct obj *));
STATIC_DCL void FDECL(check_shop_obj, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P));
-STATIC_DCL void FDECL(breakobj, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P,BOOLEAN_P));
STATIC_DCL void FDECL(breakmsg, (struct obj *,BOOLEAN_P));
STATIC_DCL boolean FDECL(toss_up,(struct obj *, BOOLEAN_P));
STATIC_DCL boolean FDECL(throwing_weapon, (struct obj *));
* Unconditionally break an object. Assumes all resistance checks
* and break messages have been delivered prior to getting here.
*/
-STATIC_OVL void
+void
breakobj(obj, x, y, hero_caused, from_invent)
struct obj *obj;
xchar x, y; /* object location (ox, oy may not be right) */
boolean hero_caused; /* is this the hero's fault? */
boolean from_invent;
{
+ boolean fracture = FALSE;
+
switch (obj->oclass == POTION_CLASS ? POT_WATER : obj->otyp) {
case MIRROR:
if (hero_caused)
if (hero_caused && obj->spe && obj->corpsenm >= LOW_PM)
change_luck((schar) -min(obj->quan, 5L));
break;
+ case BOULDER:
+ case STATUE:
+ /* caller will handle object disposition;
+ we're just doing the shop theft handling */
+ fracture = TRUE;
+ break;
+ default:
+ break;
}
+
if (hero_caused) {
if (from_invent) {
if (*u.ushops)
}
}
}
- delobj(obj);
+ if (!fracture) delobj(obj);
}
/*
STATIC_DCL void FDECL(remove_damage, (struct monst *, BOOLEAN_P));
STATIC_DCL void FDECL(sub_one_frombill, (struct obj *, struct monst *));
STATIC_DCL void FDECL(add_one_tobill, (struct obj *, BOOLEAN_P));
-STATIC_DCL boolean FDECL(billable, (struct monst **,struct obj *,
- CHAR_P,BOOLEAN_P));
STATIC_DCL void FDECL(dropped_container, (struct obj *, struct monst *,
BOOLEAN_P));
STATIC_DCL void FDECL(add_to_billobjs, (struct obj *));
}
/* decide whether a shopkeeper thinks an item belongs to her */
-STATIC_OVL boolean
+boolean
billable(shkpp, obj, roomno, reset_nocharge)
struct monst **shkpp; /* in: non-null if shk has been validated; out: shk */
struct obj *obj;
-/* SCCS Id: @(#)zap.c 3.5 2004/12/21 */
+/* SCCS Id: @(#)zap.c 3.5 2005/03/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
fracture_rock(obj) /* fractured by pick-axe or wand of striking */
register struct obj *obj; /* no texts here! */
{
+ xchar x, y;
+ boolean by_you = !context.mon_moving;
+
+ if (by_you && get_obj_location(obj, &x, &y, 0) && costly_spot(x, y)) {
+ struct monst *shkp = 0;
+ char objroom = *in_rooms(x, y, SHOPBASE);
+
+ if (billable(&shkp, obj, objroom, FALSE)) {
+ /* shop message says "you owe <shk> <$> for it!" so we need
+ to precede that with a message explaining what "it" is */
+ You("fracture %s %s.", s_suffix(shkname(shkp)), xname(obj));
+ breakobj(obj, x, y, TRUE, FALSE); /* charges for shop goods */
+ }
+ }
+
/* A little Sokoban guilt... */
- if (obj->otyp == BOULDER && In_sokoban(&u.uz) && !context.mon_moving)
+ if (by_you && obj->otyp == BOULDER && In_sokoban(&u.uz))
change_luck(-1);
obj->otyp = ROCK;
/* [obj is assumed to be on floor, so no get_obj_location() needed] */
struct trap *trap = t_at(obj->ox, obj->oy);
struct obj *item;
+ boolean by_you = !context.mon_moving;
if (trap && trap->ttyp == STATUE_TRAP &&
activate_statue_trap(trap, obj->ox, obj->oy, TRUE))
obj_extract_self(item);
place_object(item, obj->ox, obj->oy);
}
- if (Role_if(PM_ARCHEOLOGIST) && !context.mon_moving && (obj->spe & STATUE_HISTORIC)) {
+ if (by_you && Role_if(PM_ARCHEOLOGIST) && (obj->spe & STATUE_HISTORIC)) {
You_feel("guilty about damaging such a historic statue.");
adjalign(-1);
}