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

Function use_royal_jelly

src/apply.c:3615–3683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3613}
3614
3615staticfn int
3616use_royal_jelly(struct obj **optr)
3617{
3618 int oldcorpsenm;
3619 unsigned was_timed;
3620 struct obj *eobj, *obj = *optr;
3621 boolean splitit = (obj->quan > 1L);
3622
3623 if (splitit)
3624 obj = splitobj(obj, 1L);
3625 /* remove from inventory so that it won't be offered as a choice
3626 to rub on itself */
3627 freeinv(obj);
3628
3629 /* right now you can rub one royal jelly on an entire stack of eggs */
3630 eobj = getobj("rub the royal jelly on", jelly_ok, GETOBJ_PROMPT);
3631 if (!eobj) {
3632 if (splitit) {
3633 (void) unsplitobj(obj);
3634 update_inventory(); /* freeinv() updated perminv w/ obj omitted */
3635 } else {
3636 /* this lump was already separate; pervent merge */
3637 addinv_nomerge(obj); /* put unused lump back; updates perminv */
3638 }
3639 return ECMD_CANCEL;
3640 }
3641
3642 You("smear royal jelly all over %s.", yname(eobj));
3643 if (eobj->otyp != EGG) {
3644 pline1(nothing_happens);
3645 goto useup_jelly;
3646 }
3647
3648 oldcorpsenm = eobj->corpsenm;
3649 if (eobj->corpsenm == PM_KILLER_BEE)
3650 eobj->corpsenm = PM_QUEEN_BEE;
3651
3652 if (obj->cursed) {
3653 if (eobj->timed || eobj->corpsenm != oldcorpsenm)
3654 pline("The %s %s feebly.", xname(eobj), otense(eobj, "quiver"));
3655 else
3656 pline("%s", nothing_seems_to_happen);
3657 kill_egg(eobj);
3658 goto useup_jelly;
3659 }
3660
3661 was_timed = eobj->timed;
3662 if (eobj->corpsenm != NON_PM) {
3663 if (!eobj->timed)
3664 attach_egg_hatch_timeout(eobj, 0L);
3665 /* blessed royal jelly will make the hatched creature think
3666 you're the parent - but has no effect if you laid the egg */
3667 if (obj->blessed && !eobj->spe)
3668 eobj->spe = 2;
3669 }
3670
3671 if ((eobj->timed && !was_timed) || eobj->spe == 2
3672 || eobj->corpsenm != oldcorpsenm)

Callers 2

dorubFunction · 0.85
doapplyFunction · 0.85

Calls 15

splitobjFunction · 0.85
freeinvFunction · 0.85
getobjFunction · 0.85
unsplitobjFunction · 0.85
update_inventoryFunction · 0.85
addinv_nomergeFunction · 0.85
YouFunction · 0.85
ynameFunction · 0.85
xnameFunction · 0.85
otenseFunction · 0.85
kill_eggFunction · 0.85
attach_egg_hatch_timeoutFunction · 0.85

Tested by

no test coverage detected