Unify food-related conducts when eating a monster

This commit is contained in:
Pasi Kallinen
2015-04-22 09:16:49 +03:00
parent 6d4aa312e6
commit 75e7d837e6
3 changed files with 16 additions and 19 deletions

View File

@@ -607,6 +607,7 @@ E void NDECL(vomit);
E int FDECL(eaten_stat, (int,struct obj *));
E void FDECL(food_disappears, (struct obj *));
E void FDECL(food_substitution, (struct obj *,struct obj *));
E void FDECL(eating_conducts, (struct permonst *));
E int FDECL(eat_brains, (struct monst *,struct monst *,BOOLEAN_P,int *));
E void NDECL(fix_petrification);
E void FDECL(consume_oeaten, (struct obj *,int));

View File

@@ -431,6 +431,17 @@ boolean message;
context.victual.fullwarn = context.victual.eating = context.victual.doreset = FALSE;
}
void
eating_conducts(pd)
struct permonst *pd;
{
u.uconduct.food++;
if (!vegan(pd))
u.uconduct.unvegan++;
if (!vegetarian(pd))
violated_vegetarian();
}
/* handle side-effects of mind flayer's tentacle attack */
int
eat_brains(magr, mdef, visflag, dmg_p)
@@ -483,11 +494,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
/*
* player mind flayer is eating something's brain
*/
u.uconduct.food++;
if (!vegan(pd))
u.uconduct.unvegan++;
if (!vegetarian(pd))
violated_vegetarian();
eating_conducts(pd);
if (mindless(pd)) { /* (cannibalism not possible here) */
pline("%s doesn't notice.", Monnam(mdef));
/* all done; no extra harm inflicted upon target */
@@ -1270,12 +1277,7 @@ const char *mesg;
You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
/* KMH, conduct */
u.uconduct.food++;
if (!vegan(&mons[mnum]))
u.uconduct.unvegan++;
if (!vegetarian(&mons[mnum]))
violated_vegetarian();
eating_conducts(&mons[mnum]);
tin->dknown = tin->known = 1;
cprefx(mnum);

View File

@@ -1809,14 +1809,8 @@ register struct attack *mattk;
(mattk->adtyp == AD_DGST && (is_rider(pd) ||
(pd == &mons[PM_MEDUSA] && !Stone_resistance)));
if ((mattk->adtyp == AD_DGST && !Slow_digestion) || fatal_gulp) {
/* KMH, conduct */
u.uconduct.food++;
if (!vegan(pd))
u.uconduct.unvegan++;
if (!vegetarian(pd))
violated_vegetarian();
}
if ((mattk->adtyp == AD_DGST && !Slow_digestion) || fatal_gulp)
eating_conducts(pd);
if (fatal_gulp && !is_rider(pd)) { /* petrification */
char kbuf[BUFSZ];