From d44c83d45ff65ad4cb4391276571e9d0ed06c22f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 31 Jan 2020 10:39:37 +0200 Subject: [PATCH] Allow applying royal jelly on an egg 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 | 1 + src/apply.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- src/invent.c | 3 ++- src/objnam.c | 2 +- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 9c6631683..1752c8e95 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/apply.c b/src/apply.c index 8c6fe07c8..3f498a44c 100644 --- a/src/apply.c +++ b/src/apply.c @@ -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; diff --git a/src/invent.c b/src/invent.c index e014e481b..64f7d222c 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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 diff --git a/src/objnam.c b/src/objnam.c index 7708294f6..f1800e2b0 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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)"); } }