diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 1752c8e95..c5a6e715f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.81 $ $NHDT-Date: 1580322890 2020/01/29 18:34:50 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.83 $ $NHDT-Date: 1580476196 2020/01/31 13:09:56 $ General Fixes and Modified Features ----------------------------------- @@ -48,7 +48,8 @@ hero can no longer wear blindfold/towel/lenses when poly'd into headless form revamp achievement tracking for exploring Mine's End and Sokoban (by acquiring luckstone and bag of holding or amulet of reflection, respectively) throttle long worm growth rate and HP accumulation -poly'd hero was able to zap wands without any hands +poly'd hero was able to zap wands, apply tools, and #rub objects wands without + having any hands Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/apply.c b/src/apply.c index 3f498a44c..20128409a 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 apply.c $NHDT-Date: 1580244571 2020/01/28 20:49:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.314 $ */ +/* NetHack 3.6 apply.c $NHDT-Date: 1580476196 2020/01/31 13:09:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.316 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1468,24 +1468,36 @@ struct obj **optr; *optr = obj; } -static NEARDATA const char cuddly[] = { TOOL_CLASS, GEM_CLASS, 0 }; +static NEARDATA const char + cuddly[] = { TOOL_CLASS, GEM_CLASS, 0 }, + cuddlier[] = { TOOL_CLASS, GEM_CLASS, FOOD_CLASS, 0 }; int dorub() { - struct obj *obj = getobj(cuddly, "rub"); + struct obj *obj; - if (obj && obj->oclass == GEM_CLASS) { + if (nohands(g.youmonst.data)) { + You("aren't able to rub anything without hands."); + return 0; + } + obj = getobj(carrying(LUMP_OF_ROYAL_JELLY) ? cuddlier : cuddly, "rub"); + if (!obj) { + /* pline1(Never_mind); -- handled by getobj() */ + return 0; + } + if (obj->oclass == GEM_CLASS || obj->oclass == FOOD_CLASS) { if (is_graystone(obj)) { use_stone(obj); return 1; + } else if (obj->otyp == LUMP_OF_ROYAL_JELLY) { + return use_royal_jelly(obj); } else { pline("Sorry, I don't know how to use that."); return 0; } } - - if (!obj || !wield_tool(obj, "rub")) + if (!wield_tool(obj, "rub")) return 0; /* now uwep is obj */ @@ -3136,42 +3148,65 @@ use_royal_jelly(obj) struct obj *obj; { static const char allowall[2] = { ALL_CLASSES, 0 }; - struct obj *eobj = getobj(allowall, "rub the royal jelly on"); - - if (!eobj) - return 0; + int oldcorpsenm; + unsigned was_timed; + struct obj *eobj; if (obj->quan > 1L) obj = splitobj(obj, 1L); + /* remove from inventory so that it won't be offered as a choice + to rub on itself */ + freeinv(obj); - You("smear royal jelly all over %s.", yname(eobj)); - - if (eobj->otyp != EGG) { - useup(obj); + /* right now you can rub one royal jelly on an entire stack of eggs */ + eobj = getobj(allowall, "rub the royal jelly on"); + if (!eobj) { + addinv(obj); /* put the unused lump back; if it came from + * a split, it should merge back */ + /* pline1(Never_mind); -- getobj() took care of this */ return 0; } + You("smear royal jelly all over %s.", yname(eobj)); + if (eobj->otyp != EGG) { + pline1(nothing_happens); + goto useup_jelly; + } + + oldcorpsenm = eobj->corpsenm; if (eobj->corpsenm == PM_KILLER_BEE) eobj->corpsenm = PM_QUEEN_BEE; if (obj->cursed) { - useup(obj); + if (eobj->timed || eobj->corpsenm != oldcorpsenm) + pline("The %s %s feebly.", xname(eobj), otense(eobj, "quiver")); + else + pline("Nothing seems to happen."); kill_egg(eobj); - return 0; + goto useup_jelly; } + was_timed = eobj->timed; if (eobj->corpsenm != NON_PM) { if (!eobj->timed) attach_egg_hatch_timeout(eobj, 0L); - /* blessed royal jelly will make the hatched creature think you're the parent - but has no effect if you laid the egg */ if (obj->blessed && !eobj->spe) eobj->spe = 2; } - useup(obj); - return 0; + if ((eobj->timed && !was_timed) || eobj->spe == 2 + || eobj->corpsenm != oldcorpsenm) + pline("The %s %s briefly.", xname(eobj), otense(eobj, "quiver")); + else + pline("Nothing seems to happen."); + + useup_jelly: + /* not useup() because we've already done freeinv() */ + setnotworn(obj); + obfree(obj, (struct obj *) 0); + return 1; } static int @@ -3617,6 +3652,10 @@ doapply() register int res = 1; char class_list[MAXOCLASSES + 2]; + if (nohands(g.youmonst.data)) { + You("aren't able to use or apply tools in your current form."); + return 0; + } if (check_capacity((char *) 0)) return 0; diff --git a/src/invent.c b/src/invent.c index 64f7d222c..b64d1f87c 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 invent.c $NHDT-Date: 1579914042 2020/01/25 01:00:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.286 $ */ +/* NetHack 3.7 invent.c $NHDT-Date: 1580476196 2020/01/31 13:09:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.288 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1531,7 +1531,9 @@ register const char *let, *word; || (!strcmp(word, "rub") && ((otmp->oclass == TOOL_CLASS && otyp != OIL_LAMP && otyp != MAGIC_LAMP && otyp != BRASS_LANTERN) - || (otmp->oclass == GEM_CLASS && !is_graystone(otmp)))) + || (otmp->oclass == GEM_CLASS && !is_graystone(otmp)) + || (otmp->oclass == FOOD_CLASS + && otmp->otyp != LUMP_OF_ROYAL_JELLY))) || (!strcmp(word, "use or apply") /* Picks, axes, pole-weapons, bullwhips */ && ((otmp->oclass == WEAPON_CLASS @@ -1546,6 +1548,7 @@ register const char *let, *word; && otyp != CREAM_PIE && otyp != EUCALYPTUS_LEAF && otyp != LUMP_OF_ROYAL_JELLY) || (otmp->oclass == GEM_CLASS && !is_graystone(otmp)))) + || (!strcmp(word, "rub the royal jelly on") && otmp->otyp != EGG) || (!strcmp(word, "invoke") && !otmp->oartifact && !objects[otyp].oc_unique