MCPcopy Index your code
hub / github.com/NetHack/NetHack / use_grease

Function use_grease

src/apply.c:2603–2654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2601}
2602
2603staticfn int
2604use_grease(struct obj *obj)
2605{
2606 struct obj *otmp;
2607
2608 if (Glib) {
2609 pline("%s from your %s.", Tobjnam(obj, "slip"),
2610 fingers_or_gloves(FALSE));
2611 dropx(obj);
2612 return ECMD_TIME;
2613 }
2614
2615 if (obj->spe > 0) {
2616 int oldglib;
2617
2618 if ((obj->cursed || Fumbling) && !rn2(2)) {
2619 consume_obj_charge(obj, TRUE);
2620
2621 pline("%s from your %s.", Tobjnam(obj, "slip"),
2622 fingers_or_gloves(FALSE));
2623 dropx(obj);
2624 return ECMD_TIME;
2625 }
2626 otmp = getobj("grease", grease_ok, GETOBJ_PROMPT);
2627 if (!otmp)
2628 return ECMD_CANCEL;
2629 if (inaccessible_equipment(otmp, "grease", FALSE))
2630 return ECMD_OK;
2631 consume_obj_charge(obj, TRUE);
2632
2633 oldglib = (int) (Glib & TIMEOUT);
2634 if (otmp != &hands_obj) {
2635 You("cover %s with a thick layer of grease.", yname(otmp));
2636 otmp->greased = 1;
2637 if (obj->cursed && !nohands(gy.youmonst.data)) {
2638 make_glib(oldglib + rn1(6, 10)); /* + 10..15 */
2639 pline("Some of the grease gets all over your %s.",
2640 fingers_or_gloves(TRUE));
2641 }
2642 } else {
2643 make_glib(oldglib + rn1(11, 5)); /* + 5..15 */
2644 You("coat your %s with grease.", fingers_or_gloves(TRUE));
2645 }
2646 } else {
2647 if (obj->known)
2648 pline("%s empty.", Tobjnam(obj, "are"));
2649 else
2650 pline("%s to be empty.", Tobjnam(obj, "seem"));
2651 }
2652 update_inventory();
2653 return ECMD_TIME;
2654}
2655
2656/* getobj callback for object to rub on a known touchstone */
2657staticfn int

Callers 1

doapplyFunction · 0.85

Calls 12

TobjnamFunction · 0.85
fingers_or_glovesFunction · 0.85
dropxFunction · 0.85
rn2Function · 0.85
consume_obj_chargeFunction · 0.85
getobjFunction · 0.85
inaccessible_equipmentFunction · 0.85
YouFunction · 0.85
ynameFunction · 0.85
make_glibFunction · 0.85
update_inventoryFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected