Skip to content

Commit

Permalink
Allow applying royal jelly on an egg
Browse files Browse the repository at this point in the history
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
  • Loading branch information
paxed committed Jan 31, 2020
1 parent fb05f30 commit d44c83d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/fixes37.0
Expand Up @@ -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
Expand Down
50 changes: 49 additions & 1 deletion src/apply.c
Expand Up @@ -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 *));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/invent.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/objnam.c
Expand Up @@ -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)");
}
}
Expand Down

0 comments on commit d44c83d

Please sign in to comment.