Digestion attack can grant hero intrinsics

Monster purple worms can now gain intrinsics from swallowing foes whole,
so maybe the hero should be able to do so too.  Intrinsics aren't
granted immediately upon swallowing (that would probably have been
easier), but only once a corpse is created and then entirely digested.

I'm not sure if this is too powerful and was being avoided deliberately
for that reason, since it includes potential level gain from wraith
corpses in addition to other intrinsics.  That's consistent with monster
purple worms but may be a bit too much in the hands of the hero, though
it is limited by needing the corpse creation roll to succeed.
This commit is contained in:
Michael Meyer
2022-09-26 21:22:49 -04:00
committed by PatR
parent 769e154546
commit c78e7af013
5 changed files with 20 additions and 1 deletions

View File

@@ -674,6 +674,7 @@ const struct instance_globals g_init = {
/* uhitm.c */
FALSE, /* override_confirmation */
NON_PM, /* corpsenm_digested */
/* vision.c */
UNDEFINED_PTR, /* viz_array */

View File

@@ -3791,4 +3791,16 @@ Popeye(int threat)
return FALSE;
}
/* the hero has swallowed a monster whole as a purple worm or similar, and has
finished digesting its corpse (called via g.afternmv) */
int
Finish_digestion(void)
{
if (g.corpsenm_digested != NON_PM) {
cpostfx(g.corpsenm_digested);
g.corpsenm_digested = NON_PM;
}
return 0;
}
/*eat.c*/

View File

@@ -4462,8 +4462,9 @@ gulpum(struct monst *mdef, struct attack *mattk)
&& !(g.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
/* nutrition only if there can be a corpse */
u.uhunger += (pd->cnutrit + 1) / 2;
} else
} else {
tmp = 0;
}
Sprintf(msgbuf, "You totally digest %s.", mon_nam(mdef));
if (tmp != 0) {
/* setting afternmv = end_engulf is tempting,
@@ -4477,6 +4478,9 @@ gulpum(struct monst *mdef, struct attack *mattk)
nomul(-tmp);
g.multi_reason = "digesting something";
g.nomovemsg = msgbuf;
/* possible intrinsic once totally digested */
g.corpsenm_digested = monsndx(pd);
g.afternmv = Finish_digestion;
} else
pline1(msgbuf);
if (pd == &mons[PM_GREEN_SLIME]) {