MCPcopy Create free account
hub / github.com/NetHack/NetHack / break_statue

Function break_statue

src/zap.c:5581–5605  ·  view source on GitHub ↗

handle statue hit by striking/force bolt/pick-axe */

Source from the content-addressed store, hash-verified

5579
5580/* handle statue hit by striking/force bolt/pick-axe */
5581boolean
5582break_statue(struct obj *obj)
5583{
5584 /* [obj is assumed to be on floor, so no get_obj_location() needed] */
5585 struct trap *trap = t_at(obj->ox, obj->oy);
5586 struct obj *item;
5587 boolean by_you = !svc.context.mon_moving;
5588
5589 if (trap && trap->ttyp == STATUE_TRAP
5590 && activate_statue_trap(trap, obj->ox, obj->oy, TRUE))
5591 return FALSE;
5592 /* drop any objects contained inside the statue */
5593 while ((item = obj->cobj) != 0) {
5594 obj_extract_self(item);
5595 place_object(item, obj->ox, obj->oy);
5596 }
5597 if (by_you && Role_if(PM_ARCHEOLOGIST)
5598 && (obj->spe & CORPSTAT_HISTORIC)) {
5599 You_feel("guilty about damaging such a historic statue.");
5600 adjalign(-1);
5601 }
5602 obj->spe = 0;
5603 fracture_rock(obj);
5604 return TRUE;
5605}
5606
5607/* Return TRUE if obj is eligible to pass to maybe_destroy_item given
5608 * the type of elemental damage it's being subjected to.

Callers 3

digFunction · 0.85
bhitoFunction · 0.85
scatterFunction · 0.85

Calls 7

t_atFunction · 0.85
activate_statue_trapFunction · 0.85
obj_extract_selfFunction · 0.85
place_objectFunction · 0.85
You_feelFunction · 0.85
adjalignFunction · 0.85
fracture_rockFunction · 0.85

Tested by

no test coverage detected