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

Function grease_protect

src/trap.c:359–386  ·  view source on GitHub ↗

Protect an item from erosion with grease. Returns TRUE if the grease * wears off. */

Source from the content-addressed store, hash-verified

357 * wears off.
358 */
359boolean
360grease_protect(
361 struct obj *otmp,
362 const char *ostr,
363 struct monst *victim)
364{
365 static const char txt[] = "protected by the layer of grease!";
366 boolean vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
367
368 if (ostr) {
369 if (victim == &gy.youmonst)
370 Your("%s %s %s", ostr, vtense(ostr, "are"), txt);
371 else if (vismon)
372 pline("%s's %s %s %s", Monnam(victim),
373 ostr, vtense(ostr, "are"), txt);
374 } else if (victim == &gy.youmonst || vismon) {
375 pline("%s %s", Yobjnam2(otmp, "are"), txt);
376 }
377 if (!rn2(2)) {
378 otmp->greased = 0;
379 if (carried(otmp)) {
380 pline_The("grease dissolves.");
381 update_inventory();
382 }
383 return TRUE;
384 }
385 return FALSE;
386}
387
388/* create a "living" statue at x,y */
389staticfn void

Callers 2

erode_objFunction · 0.85
acid_damageFunction · 0.85

Calls 9

canseemonFunction · 0.85
YourFunction · 0.85
vtenseFunction · 0.85
MonnamFunction · 0.85
Yobjnam2Function · 0.85
rn2Function · 0.85
pline_TheFunction · 0.85
update_inventoryFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected