/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.eat.c - version 1.0.3 */
char POISONOUS
[] = "ADKSVabhks";
extern int (*afternmv
)();
extern int (*occupation
)();
extern struct obj
*splitobj(), *addinv();
/* hunger texts used on bottom line (each 8 chars long) */
#define TTSZ SIZE(tintxts)
struct { char *txt
; int nut
; } tintxts
[] = {
"It contains first quality peaches - what a surprise!", 40,
"It contains salmon - not bad!", 60,
"It contains apple juice - perhaps not what you hoped for.", 20,
"It contains some nondescript substance, tasting awfully.", 500,
"It contains rotten meat. You vomit.", -50,
"It turns out to be empty.", 0
if(!carried(tin
.tin
)) /* perhaps it was stolen? */
return(0); /* %% probably we should use tinoid */
if(tin
.usedtime
++ >= 50) {
pline("You give up your attempt to open the tin.");
if(tin
.usedtime
< tin
.reqtime
)
return(1); /* still busy */
pline("You succeed in opening the tin.");
lesshungry(tintxts
[r
].nut
);
if(r
== 1) /* SALMON */ {
pline("Eating salmon made your fingers very slippery.");
pline("It contains spinach - this makes you feel like Popeye!");
u
.ustr
+= rnd( ((u
.ustr
< 17) ? 19 : 118) - u
.ustr
);
if(u
.ustr
> u
.ustrmax
) u
.ustrmax
= u
.ustr
;
register struct obj
*otmp
;
register struct objclass
*ftmp
;
/* Is there some food (probably a heavy corpse) here on the ground? */
for(otmp
= fobj
; otmp
; otmp
= otmp
->nobj
) {
if(otmp
->ox
== u
.ux
&& otmp
->oy
== u
.uy
&&
otmp
->olet
== FOOD_SYM
) {
pline("There %s %s here; eat %s? [ny] ",
(otmp
->quan
== 1) ? "is" : "are",
(otmp
->quan
== 1) ? "it" : "one");
(void) splitobj(otmp
, 1);
otmp
= getobj("%", "eat");
pline("Using your %s you try to open the tin.",
aobjnam(uwep
, (char *) 0));
pline("It is not so easy to open this tin.");
pline("The tin slips out of your hands.");
register struct obj
*obj
;
extern struct obj
*splitobj();
if(otmp
== uwep
) setuwep(obj
);
tmp
= 10 + rn2(1 + 500/((int)(u
.ulevel
+ u
.ustr
)));
occtxt
= "opening the tin";
ftmp
= &objects
[otmp
->otyp
];
if(otmp
->otyp
>= CORPSE
&& eatcorpse(otmp
)) goto eatx
;
if(!rn2(7) && otmp
->otyp
!= FORTUNE_COOKIE
) {
pline("Blecch! Rotten food!");
pline("You feel rather light headed.");
} else if(!rn2(4)&& !Blind
) {
pline("Everything suddenly goes dark.");
pline("The world spins and you slap against the floor.");
pline("The world spins and goes dark.");
nomovemsg
= "You are conscious again.";
lesshungry(ftmp
->nutrition
/ 4);
pline("You choke over your food.");
pline("That food really hit the spot!");
else if(u
.uhunger
<= 700)
pline("That satiated your stomach!");
pline("You're having a hard time getting all that food down.");
lesshungry(ftmp
->nutrition
);
if(multi
< 0) nomovemsg
= "You finished your meal.";
pline("Yak - dog food!");
Sick
= 0; /* David Neves */
} else lesshungry(ftmp
->nutrition
);
pline("That %s tasted terrible!",ftmp
->oc_name
);
pline("That %s was delicious!",ftmp
->oc_name
);
lesshungry(ftmp
->nutrition
);
if(otmp
->otyp
== DEAD_LIZARD
&& (Confusion
> 2))
if(otmp
->otyp
== CARROT
&& !Blind
){
pline("Your vision improves.");
if(otmp
->otyp
== FORTUNE_COOKIE
) {
pline("This cookie has a scrap of paper inside!");
pline("What a pity, that you cannot read it!");
if(otmp
->otyp
== LUMP_OF_ROYAL_JELLY
) {
/* This stuff seems to be VERY healthy! */
if(u
.ustrmax
< 118) u
.ustrmax
++;
if(u
.ustr
< u
.ustrmax
) u
.ustr
++;
if(multi
<0 && !nomovemsg
){
static char msgbuf
[BUFSZ
];
(void) sprintf(msgbuf
, "You finished eating the %s.",
/* called in hack.main.c */
if(Regeneration
) u
.uhunger
--;
/* a3: if(Hunger & LEFT_RING) u.uhunger--;
if(Hunger & RIGHT_RING) u.uhunger--;
if(moves
% 20 == 0) { /* jimt@asgb */
/* called after vomiting and after performing feats of magic */
morehungry(num
) register num
; {
/* called after eating something (and after drinking fruit juice) */
lesshungry(num
) register num
; {
newuhs(incr
) boolean incr
; {
register int newhs
, h
= u
.uhunger
;
newhs
= (h
> 1000) ? SATIATED
:
(h
> 0) ? WEAK
: FAINTING
;
if(u
.uhs
<= WEAK
|| rn2(20-u
.uhunger
/10) >= 19) {
if(u
.uhs
!= FAINTED
&& multi
>= 0 /* %% */) {
pline("You faint from lack of food.");
nomul(-10+(u
.uhunger
/10));
nomovemsg
= "You regain consciousness.";
if(u
.uhunger
< -(int)(200 + 25*u
.ulevel
)) {
pline("You die from starvation.");
if(newhs
>= WEAK
&& u
.uhs
< WEAK
)
losestr(1); /* this may kill you -- see below */
if(newhs
< WEAK
&& u
.uhs
>= WEAK
&& u
.ustr
< u
.ustrmax
)
pline((!incr
) ? "You only feel hungry now." :
(u
.uhunger
< 145) ? "You feel hungry." :
"You are beginning to feel hungry.");
pline((!incr
) ? "You feel weak now." :
(u
.uhunger
< 45) ? "You feel weak." :
"You are beginning to feel weak.");
pline("You die from hunger and exhaustion.");
#define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\
? 'a' + (otyp - DEAD_ACID_BLOB)\
: '@' + (otyp - DEAD_HUMAN))
register struct obj
*otmp
;
return(index(POISONOUS
, CORPSE_I_TO_C(otmp
->otyp
)) != 0);
/* returns 1 if some text was printed */
eatcorpse(otmp
) register struct obj
*otmp
; {
register char let
= CORPSE_I_TO_C(otmp
->otyp
);
if(let
!= 'a' && moves
> otmp
->age
+ 50 + rn2(100)) {
pline("Ulch -- that meat was tainted!");
pline("You get very sick.");
u
.usick_cause
= objects
[otmp
->otyp
].oc_name
;
} else if(index(POISONOUS
, let
) && rn2(5)){
pline("Ecch -- that must have been poisonous!");
losehp(rnd(15), "poisonous corpse");
pline("You don't seem affected by the poison.");
} else if(index("ELNOPQRUuxz", let
) && rn2(5)){
losehp(rnd(8), "cadaver");
Teleportation
|= INTRINSIC
;
/* fall into next case */
pline("You cannibal! You will be sorry for this!");
/* fall into next case */
Aggravate_monster
|= INTRINSIC
;
See_invisible
|= INTRINSIC
;
/* fall into next case */
/* fall into next case */
Fire_resistance
|= INTRINSIC
;
Cold_resistance
|= INTRINSIC
;
Poison_resistance
|= INTRINSIC
;
pline("You turn to stone.");
killer
= "dead cockatrice";
pline("What a pity - you just destroyed a future piece of art!");
pline("You cannot resist the temptation to mimic a treasure chest.");
nomovemsg
= "You now again prefer mimicking a human.";