]> granicus.if.org Git - nethack/commitdiff
Allow applying royal jelly on an egg
authorPasi Kallinen <paxed@alt.org>
Fri, 31 Jan 2020 08:39:37 +0000 (10:39 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 31 Jan 2020 08:39:40 +0000 (10:39 +0200)
Royal jelly applied on an egg will change a killer bee egg to
a queen bee egg. Cursed jelly will kill the egg, uncursed and blessed
will revive it. Blessed jelly will also make the creature think
you're the parent.

Original patch was by Kenneth Call

doc/fixes37.0
src/apply.c
src/invent.c
src/objnam.c

index 9c6631683400f07f70e10b69e028a250b2de1d5f..1752c8e958e2f5bb365daf35f1818351cab48921 100644 (file)
@@ -130,6 +130,7 @@ when 'color' if Off and 'use_inverse' is On, draw ice on the map in inverse
        video if it uses the same character as room floor or as dark floor
 new 'mention_decor' option; when On, describe dungeon features being stepped
        on or floated/flown over even when they're not covered by objects
+applying royal jelly on an egg kills, revives, or changes the egg
 
 
 Platform- and/or Interface-Specific New Features
index 8c6fe07c818dcba40c8cf6aa2b1b9f2af470d047..3f498a44ca85a7d2d53b75c809ab4d919ddefcc0 100644 (file)
@@ -29,6 +29,7 @@ static int FDECL(use_whip, (struct obj *));
 static void FDECL(display_polearm_positions, (int));
 static int FDECL(use_pole, (struct obj *));
 static int FDECL(use_cream_pie, (struct obj *));
+static int FDECL(use_royal_jelly, (struct obj *));
 static int FDECL(use_grapple, (struct obj *));
 static int FDECL(do_break_wand, (struct obj *));
 static int FDECL(flip_through_book, (struct obj *));
@@ -3130,6 +3131,49 @@ struct obj *obj;
     return 0;
 }
 
+static int
+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;
+
+    if (obj->quan > 1L)
+        obj = splitobj(obj, 1L);
+
+    You("smear royal jelly all over %s.", yname(eobj));
+
+    if (eobj->otyp != EGG) {
+        useup(obj);
+        return 0;
+    }
+
+    if (eobj->corpsenm == PM_KILLER_BEE)
+        eobj->corpsenm = PM_QUEEN_BEE;
+
+    if (obj->cursed) {
+        useup(obj);
+        kill_egg(eobj);
+        return 0;
+    }
+
+    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;
+}
+
 static int
 use_grapple(obj)
 struct obj *obj;
@@ -3544,7 +3588,8 @@ char class_list[];
                 && (!otmp->dknown
                     || (!knowtouchstone && !objects[otyp].oc_name_known))))
             addstones = TRUE;
-        if (otyp == CREAM_PIE || otyp == EUCALYPTUS_LEAF)
+        if (otyp == CREAM_PIE || otyp == EUCALYPTUS_LEAF
+            || otyp == LUMP_OF_ROYAL_JELLY)
             addfood = TRUE;
         if (otmp->oclass == SPBOOK_CLASS)
             addspellbooks = TRUE;
@@ -3609,6 +3654,9 @@ doapply()
     case CREAM_PIE:
         res = use_cream_pie(obj);
         break;
+    case LUMP_OF_ROYAL_JELLY:
+        res = use_royal_jelly(obj);
+        break;
     case BULLWHIP:
         res = use_whip(obj);
         break;
index e014e481b21b5242ebdcc2bb1e04355d6e6b34cd..64f7d222c0d20abeb3f63b1d774e11cf2af7f09f 100644 (file)
@@ -1543,7 +1543,8 @@ register const char *let, *word;
                          && (otyp != POT_OIL || !otmp->dknown
                              || !objects[POT_OIL].oc_name_known))
                      || (otmp->oclass == FOOD_CLASS
-                         && otyp != CREAM_PIE && otyp != EUCALYPTUS_LEAF)
+                         && otyp != CREAM_PIE && otyp != EUCALYPTUS_LEAF
+                         && otyp != LUMP_OF_ROYAL_JELLY)
                      || (otmp->oclass == GEM_CLASS && !is_graystone(otmp))))
              || (!strcmp(word, "invoke")
                  && !otmp->oartifact
index 7708294f6ebae1535aea062d548464a82218bba4..f1800e2b0a3789c96fd662f1a9a1e71dd008405d 100644 (file)
@@ -1157,7 +1157,7 @@ unsigned doname_flags;
                 && (known || (g.mvitals[omndx].mvflags & MV_KNOWS_EGG))) {
                 Strcat(prefix, mons[omndx].mname);
                 Strcat(prefix, " ");
-                if (obj->spe)
+                if (obj->spe == 1)
                     Strcat(bp, " (laid by you)");
             }
         }