-/* NetHack 3.6 eat.c $NHDT-Date: 1452660191 2016/01/13 04:43:11 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.161 $ */
+/* NetHack 3.6 eat.c $NHDT-Date: 1454061992 2016/01/29 10:06:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.162 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (!otmp->oeaten) {
costly_alteration(otmp, COST_BITE);
- otmp->oeaten =
- (otmp->otyp == CORPSE ? mons[otmp->corpsenm].cnutrit
- : objects[otmp->otyp].oc_nutrition);
+ otmp->oeaten = (otmp->otyp == CORPSE) ? mons[otmp->corpsenm].cnutrit
+ : otmp->globby ? otmp->owt
+ : objects[otmp->otyp].oc_nutrition;
}
if (carried(otmp)) {
done_eating(message)
boolean message;
{
- context.victual.piece->in_use = TRUE;
+ struct obj *piece = context.victual.piece;
+
+ piece->in_use = TRUE;
occupation = 0; /* do this early, so newuhs() knows we're done */
newuhs(FALSE);
if (nomovemsg) {
pline1(nomovemsg);
nomovemsg = 0;
} else if (message)
- You("finish eating %s.", food_xname(context.victual.piece, TRUE));
+ You("finish eating %s.", food_xname(piece, TRUE));
- if (context.victual.piece->otyp == CORPSE)
- cpostfx(context.victual.piece->corpsenm);
+ if (piece->otyp == CORPSE || piece->globby)
+ cpostfx(piece->corpsenm);
else
- fpostfx(context.victual.piece);
+ fpostfx(piece);
- if (carried(context.victual.piece))
- useup(context.victual.piece);
+ if (carried(piece))
+ useup(piece);
else
- useupf(context.victual.piece, 1L);
+ useupf(piece, 1L);
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
context.victual.fullwarn = context.victual.eating =
eatcorpse(otmp)
struct obj *otmp;
{
- int tp = 0, mnum = otmp->corpsenm;
+ int retcode = 0, tp = 0, mnum = otmp->corpsenm;
long rotted = 0L;
- int retcode = 0;
boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
- && !poly_when_stoned(youmonst.data));
+ && !poly_when_stoned(youmonst.data)),
+ slimeable = (mnum == PM_GREEN_SLIME && !Slimed && !Unchanging
+ && !slimeproof(youmonst.data)),
+ glob = otmp->globby ? TRUE : FALSE;
/* KMH, conduct */
if (!vegan(&mons[mnum]))
rotted -= 2L;
}
- if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
+ if (mnum != PM_ACID_BLOB && !stoneable && !slimeable && rotted > 5L) {
boolean cannibal = maybe_cannibal(mnum, FALSE);
pline("Ulch - that %s was tainted%s!",
- mons[mnum].mlet == S_FUNGUS
- ? "fungoid vegetation"
- : !vegetarian(&mons[mnum]) ? "meat" : "protoplasm",
+ (mons[mnum].mlet == S_FUNGUS) ? "fungoid vegetation"
+ : glob ? "glob"
+ : vegetarian(&mons[mnum]) ? "protoplasm"
+ : "meat",
cannibal ? ", you cannibal" : "");
if (Sick_resistance) {
pline("It doesn't seem at all sickening, though...");
} else if (acidic(&mons[mnum]) && !Acid_resistance) {
tp++;
You("have a very bad case of stomach acid."); /* not body_part() */
- losehp(rnd(15), "acidic corpse", KILLED_BY_AN); /* acid damage */
+ losehp(rnd(15), !glob ? "acidic corpse" : "acidic glob",
+ KILLED_BY_AN); /* acid damage */
} else if (poisonous(&mons[mnum]) && rn2(5)) {
tp++;
pline("Ecch - that must have been poisonous!");
if (!Poison_resistance) {
losestr(rnd(4));
- losehp(rnd(15), "poisonous corpse", KILLED_BY_AN);
+ losehp(rnd(15), !glob ? "poisonous corpse" : "posionous glob",
+ KILLED_BY_AN);
} else
You("seem unaffected by the poison.");
- /* now any corpse left too long will make you mildly ill */
+ /* now any corpse left too long will make you mildly ill */
} else if ((rotted > 5L || (rotted > 3L && rn2(5))) && !Sick_resistance) {
tp++;
You_feel("%ssick.", (Sick) ? "very " : "");
- losehp(rnd(8), "cadaver", KILLED_BY_AN);
+ losehp(rnd(8), !glob ? "cadaver" : "rotted glob", KILLED_BY_AN);
}
/* delay is weight dependent */
- context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
+ context.victual.reqtime = 3 + ((!glob ? mons[mnum].cwt : otmp->owt) >> 6);
if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
if (rottenfood(otmp)) {
*/
char buf[BUFSZ], foodsmell[BUFSZ],
it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
- boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
+ boolean cadaver = (otmp->otyp == CORPSE || otmp->globby),
+ stoneorslime = FALSE;
int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
long rotted = 0L;
if (cadaver && !nonrotting_corpse(mnum)) {
long age = peek_at_iced_corpse_age(otmp);
+
/* worst case rather than random
in this calculation to force prompt */
rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */);
}
/* re-calc the nutrition */
- if (otmp->otyp == CORPSE)
- basenutrit = mons[otmp->corpsenm].cnutrit;
- else
- basenutrit = objects[otmp->otyp].oc_nutrition;
+ basenutrit = (otmp->otyp == CORPSE) ? mons[otmp->corpsenm].cnutrit
+ : otmp->globby ? otmp->owt
+ : objects[otmp->otyp].oc_nutrition;
- debugpline1("before rounddiv: context.victual.reqtime == %d",
- context.victual.reqtime);
- debugpline2("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
- context.victual.reqtime = (basenutrit == 0)
- ? 0
- : rounddiv(context.victual.reqtime
- * (long) otmp->oeaten,
- basenutrit);
- debugpline1("after rounddiv: context.victual.reqtime == %d",
+ debugpline3(
+ "before rounddiv: victual.reqtime == %d, oeaten == %d, basenutrit == %d",
+ context.victual.reqtime, otmp->oeaten, basenutrit);
+
+ context.victual.reqtime = (basenutrit == 0) ? 0
+ : rounddiv(context.victual.reqtime * (long) otmp->oeaten, basenutrit);
+
+ debugpline1("after rounddiv: victual.reqtime == %d",
context.victual.reqtime);
/*
* calculate the modulo value (nutrit. units per round eating)
long uneaten_amt, full_amount;
uneaten_amt = (long) obj->oeaten;
- full_amount = (obj->otyp == CORPSE)
- ? (long) mons[obj->corpsenm].cnutrit
- : (long) objects[obj->otyp].oc_nutrition;
+ full_amount = (obj->otyp == CORPSE) ? (long) mons[obj->corpsenm].cnutrit
+ : obj->globby ? obj->owt
+ : (long) objects[obj->otyp].oc_nutrition;
if (uneaten_amt > full_amount) {
impossible(
"partly eaten food (%ld) more nutritious than untouched food (%ld)",