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

Function drop_throw

src/mthrowu.c:161–196  ·  view source on GitHub ↗

Be sure this corresponds with what happens to player-thrown objects in * dothrow.c (for consistency). --KAA * Returns FALSE if object still exists (not destroyed). */

Source from the content-addressed store, hash-verified

159 * Returns FALSE if object still exists (not destroyed).
160 */
161staticfn boolean
162drop_throw(
163 struct obj *obj,
164 boolean ohit,
165 coordxy x,
166 coordxy y)
167{
168 boolean broken;
169
170 if (obj->otyp == CREAM_PIE || obj->oclass == VENOM_CLASS
171 || (ohit && obj->otyp == EGG)) {
172 broken = TRUE;
173 } else {
174 broken = (ohit && should_mulch_missile(obj));
175 }
176
177 if (broken) {
178 delobj(obj);
179 } else {
180 if (down_gate(x, y) != -1)
181 broken = ship_object(obj, x, y, FALSE);
182 if (!broken) {
183 struct monst *mtmp = m_at(x, y);
184 if (!(broken = flooreffects(obj, x, y, "fall"))) {
185 place_object(obj, x, y);
186 if (!mtmp && u_at(x, y))
187 mtmp = &gy.youmonst;
188 if (mtmp && ohit)
189 passive_obj(mtmp, obj, (struct attack *) 0);
190 stackobj(obj);
191 }
192 }
193 }
194 gt.thrownobj = 0;
195 return broken;
196}
197
198/* calculate multishot volley count for mtmp throwing otmp (if not ammo) or
199 shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */

Callers 2

ohitmonFunction · 0.85
mthrowu.cFile · 0.85

Calls 8

should_mulch_missileFunction · 0.85
delobjFunction · 0.85
down_gateFunction · 0.85
ship_objectFunction · 0.85
flooreffectsFunction · 0.85
place_objectFunction · 0.85
passive_objFunction · 0.85
stackobjFunction · 0.85

Tested by

no test coverage detected