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

Function m_break_boulder

src/monmove.c:142–173  ·  view source on GitHub ↗

monster mtmp breaks boulder at x,y */

Source from the content-addressed store, hash-verified

140
141/* monster mtmp breaks boulder at x,y */
142void
143m_break_boulder(struct monst *mtmp, coordxy x, coordxy y)
144{
145 struct obj *otmp;
146
147 if (m_can_break_boulder(mtmp) && ((otmp = sobj_at(BOULDER, x, y)) != 0)) {
148 if (!is_rider(mtmp->data)) {
149 if (!Deaf && (mdistu(mtmp) < 4*4)) {
150 if (canspotmon(mtmp))
151 set_msg_xy(mtmp->mx, mtmp->my);
152 pline("%s mutters %s.",
153 Monnam(mtmp),
154 mtmp->ispriest ? "a prayer" : "an incantation");
155 }
156 mtmp->mspec_used += rn1(20, 10);
157 }
158 if (cansee(x, y)) {
159 set_msg_xy(x, y);
160 pline_The("boulder falls apart.");
161 }
162
163 /* boulders pushed onto shop's boundary or free spot are cases where
164 an item not in hero's inventory can have its unpaid flag set;
165 if the boulder isn't already on the bill, don't charge for it */
166 if (otmp->unpaid) {
167 /* remove original from bill + add cloned copy to used-up bill */
168 bill_dummy_object(otmp);
169 }
170 /* fracturing keeps otmp, changing its otyp from BOULDER to ROCK */
171 fracture_rock(otmp);
172 }
173}
174
175staticfn void
176watch_on_duty(struct monst *mtmp)

Callers 2

m_moveFunction · 0.85
move_specialFunction · 0.85

Calls 8

m_can_break_boulderFunction · 0.85
sobj_atFunction · 0.85
set_msg_xyFunction · 0.85
MonnamFunction · 0.85
pline_TheFunction · 0.85
bill_dummy_objectFunction · 0.85
fracture_rockFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected