-/* NetHack 3.6 eat.c $NHDT-Date: 1502754159 2017/08/14 23:42:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.179 $ */
+/* NetHack 3.6 eat.c $NHDT-Date: 1542765357 2018/11/21 01:55:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.197 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
return (boolean) (obj->oclass == FOOD_CLASS);
}
+/* used for hero init, life saving (if choking), and prayer results of fix
+ starving, fix weak from hunger, or golden glow boon (if u.uhunger < 900) */
void
init_uhunger()
{
context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0);
u.uhunger = 900;
u.uhs = NOT_HUNGRY;
- if (ATEMP(A_STR) < 0)
+ if (ATEMP(A_STR) < 0) {
ATEMP(A_STR) = 0;
+ (void) encumber_msg();
+ }
}
/* tin types [SPINACH_TIN = -1, overrides corpsenm, nut==600] */
free((genericptr_t) eatmbuf), eatmbuf = 0;
}
/* update display */
- if (youmonst.m_ap_type) {
+ if (U_AP_TYPE) {
youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
}
*/
pline("%s\82Í\90Î\82É\82È\82Á\82½\81I", Monnam(magr));
monstone(magr);
- if (magr->mhp > 0) {
+ if (!DEADMONSTER(magr)) {
/* life-saved; don't continue eating the brains */
return MM_MISS;
} else {
return MM_MISS;
} else if (is_rider(pd)) {
mondied(magr);
- if (magr->mhp <= 0)
+ if (DEADMONSTER(magr))
result = MM_AGR_DIED;
/* Rider takes extra damage regardless of whether attacker dies */
*dmg_p += xtra_dmg;
/* called after completely consuming a corpse */
STATIC_OVL void
cpostfx(pm)
-register int pm;
+int pm;
{
- register int tmp = 0;
+ int tmp = 0;
int catch_lycanthropy = NON_PM;
+ boolean check_intrinsics = FALSE;
/* in case `afternmv' didn't get called for previously mimicking
gold, clean up now to avoid `eatmbuf' memory leak */
/* MRKR: "eye of newt" may give small magical energy boost */
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
int old_uen = u.uen;
+
u.uen += rnd(3);
if (u.uen > u.uenmax) {
if (!rn2(3))
u.uhp = u.uhpmax;
make_blinded(0L, !u.ucreamed);
context.botl = 1;
+ check_intrinsics = TRUE; /* might also convey poison resistance */
break;
case PM_STALKER:
if (!Invis) {
if (ABASE(A_INT) < ATTRMAX(A_INT)) {
if (!rn2(2)) {
/*JP
- pline("Yum! That was real brain food!");
+ pline("Yum! That was real brain food!");
*/
pline("\82¤\82Ü\82¢\81I\82±\82ê\82±\82»\96{\93\96\82Ì\81u\93ª\82Ì\97Ç\82\82È\82é\90H\8e\96\81v\82¾\81I");
(void) adjattrib(A_INT, 1, FALSE);
pline("\82Ç\82¤\82µ\82½\82í\82¯\82©\81C\92W\94\92\82È\96¡\82¾\81D");
}
/*FALLTHRU*/
- default: {
+ default:
+ check_intrinsics = TRUE;
+ break;
+ }
+
+ /* possibly convey an intrinsic */
+ if (check_intrinsics) {
struct permonst *ptr = &mons[pm];
boolean conveys_STR = is_giant(ptr);
int i, count;
gainstr((struct obj *) 0, 0, TRUE);
else if (tmp > 0)
givit(tmp, ptr);
- break;
- } /* default case */
- } /* switch */
+ } /* check_intrinsics */
if (catch_lycanthropy >= LOW_PM) {
set_ulycn(catch_lycanthropy);
*/
u.uconduct.food++; /* don't need vegetarian checks for spinach */
if (!tin->cursed)
-#if 0 /*JP:T*/
+#if 0 /*JP*/
pline("This makes you feel like %s!",
- Hallucination ? "Swee'pea" : "Popeye");
+ /* "Swee'pea" is a character from the Popeye cartoons */
+ Hallucination ? "Swee'pea"
+ /* "feel like Popeye" unless sustain ability suppresses
+ any attribute change; this slightly oversimplifies
+ things: we want "Popeye" if no strength increase
+ occurs due to already being at maximum, but we won't
+ get it if at-maximum and fixed-abil both apply */
+ : !Fixed_abil ? "Popeye"
+ /* no gain, feel like another character from Popeye */
+ : (flags.female ? "Olive Oyl" : "Bluto"));
#else
pline("%s\82Ì\82æ\82¤\82È\8bC\95ª\82É\82È\82Á\82½\81I",
- Hallucination ? "\83X\83C\81[\83s\81[" : "\83|\83p\83C");
+ /* "Swee'pea" is a character from the Popeye cartoons */
+ Hallucination ? "\83X\83C\81[\83s\81["
+ /* "feel like Popeye" unless sustain ability suppresses
+ any attribute change; this slightly oversimplifies
+ things: we want "Popeye" if no strength increase
+ occurs due to already being at maximum, but we won't
+ get it if at-maximum and fixed-abil both apply */
+ : !Fixed_abil ? "\83|\83p\83C"
+ /* no gain, feel like another character from Popeye */
+ : (flags.female ? "\83I\83\8a\81[\83u" : "\83u\83\8b\81[\83g"));
#endif
gainstr(tin, 0, FALSE);
pline("\82±\82Ì\83\82\83c\93÷\82Í\82¨\82Ç\82ë\82\82Ù\82Ç\8e|\82¢\81I");
else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC)))
/*JP
- pline(Hallucination ? "Tastes great! Less filling!"
+ pline(Hallucination ? "Tastes great! Less filling!"
*/
pline(Hallucination ? "\82¤\82Ü\82¢\81I\82à\82Á\82Æ\82Ù\82µ\82\82È\82é\82Ë\81I"
/*JP
{
int absold, absinc, sgnold, sgninc;
- /* don't include any amount coming from worn rings */
- if (uright && uright->otyp == typ)
+ /* don't include any amount coming from worn rings (caller handles
+ 'protection' differently) */
+ if (uright && uright->otyp == typ && typ != RIN_PROTECTION)
old -= uright->spe;
- if (uleft && uleft->otyp == typ)
+ if (uleft && uleft->otyp == typ && typ != RIN_PROTECTION)
old -= uleft->spe;
absold = abs(old), absinc = abs(inc);
sgnold = sgn(old), sgninc = sgn(inc);
} else {
inc = 0; /* no further increase allowed via this method */
}
+ /* put amount from worn rings back */
+ if (uright && uright->otyp == typ && typ != RIN_PROTECTION)
+ old += uright->spe;
+ if (uleft && uleft->otyp == typ && typ != RIN_PROTECTION)
+ old += uleft->spe;
return old + inc;
}
accessory_has_effect(otmp)
struct obj *otmp;
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("Magic spreads through your body as you digest the %s.",
- otmp->oclass == RING_CLASS ? "ring" : "amulet");
+ (otmp->oclass == RING_CLASS) ? "ring" : "amulet");
#else
pline("\82 \82È\82½\82ª%s\82ð\8fÁ\89»\82·\82é\82Æ\81C\82»\82Ì\96\82\97Í\82ª\91Ì\82É\82µ\82Ý\82±\82ñ\82¾\81D",
otmp->oclass == RING_CLASS ? "\8ew\97Ö" : "\96\82\8f\9c\82¯");
}
}
if (!otmp->cursed)
- heal_legs();
+ heal_legs(0);
break;
case EGG:
if (flesh_petrifies(&mons[otmp->corpsenm])) {
*/
if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
/* Tainted meat */
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
eat_it_anyway);
#else
Sprintf(buf, "%s\82Í\89\98\90õ\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
return 2;
}
if (stoneorslime) {
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s could be something very dangerous! %s",
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s could be something very dangerous! %s",
foodsmell, it_or_they, eat_it_anyway);
#else
Sprintf(buf, "%s\82Í\82È\82ñ\82¾\82©\82·\82²\82\8aë\8c¯\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
}
if (otmp->orotten || (cadaver && rotted > 3L)) {
/* Rotten */
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
eat_it_anyway);
#else
- Sprintf(buf, "%s\82Í\95\85\82Á\82½\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
- foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s\82Í\95\85\82Á\82½\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s", foodsmell,
+ eat_it_anyway);
#endif
if (yn_function(buf, ynchars, 'n') == 'n')
return 1;
}
if (cadaver && poisonous(&mons[mnum]) && !Poison_resistance) {
/* poisonous */
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
it_or_they, eat_it_anyway);
#else
- Sprintf(buf, "%s\82Í\93Å\82ð\82à\82Á\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
- foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s\82Í\93Å\82ð\82à\82Á\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s", foodsmell,
+ eat_it_anyway);
#endif
if (yn_function(buf, ynchars, 'n') == 'n')
return 1;
}
if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
/* causes sleep, for long enough to be dangerous */
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
it_or_they, eat_it_anyway);
#else
- Sprintf(buf, "%s\82Í\93Å\82ª\93ü\82ê\82ç\82ê\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
- foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s\82Í\93Å\82ª\93ü\82ê\82ç\82ê\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s", foodsmell,
+ eat_it_anyway);
#endif
return (yn_function(buf, ynchars, 'n') == 'n') ? 1 : 2;
}
if (cadaver && !vegetarian(&mons[mnum]) && !u.uconduct.unvegetarian
&& Role_if(PM_MONK)) {
/*JP
- Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
*/
Sprintf(buf, "%s\82Í\8c\92\8dN\82É\88«\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell, eat_it_anyway);
if (yn_function(buf, ynchars, 'n') == 'n')
}
if (cadaver && acidic(&mons[mnum]) && !Acid_resistance) {
/*JP
- Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
*/
Sprintf(buf, "%s\82Í\8f\82µ\8e_\82Á\82Ï\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell, eat_it_anyway);
if (yn_function(buf, ynchars, 'n') == 'n')
}
if (Upolyd && u.umonnum == PM_RUST_MONSTER && is_metallic(otmp)
&& otmp->oerodeproof) {
-#if 0 /*JP*/
- Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
eat_it_anyway);
#else
Sprintf(buf, "%s\82Í\8bC\95ª\82ª\88«\82\82È\82é\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell,
&& ((material == LEATHER || material == BONE
|| material == DRAGON_HIDE || material == WAX)
|| (cadaver && !vegan(&mons[mnum])))) {
-#if 0 /*JP*/
- Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
eat_it_anyway);
#else
Sprintf(buf, "%s\82Í\89\98\82ê\82Ä\82¢\82Ä\81C\82 \82È\82½\82É\82È\82¶\82Ü\82È\82¢\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell,
|| material == DRAGON_HIDE)
|| (cadaver && !vegetarian(&mons[mnum])))) {
/*JP
- Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
+ Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
*/
Sprintf(buf, "%s\82Í\82 \82È\82½\82É\82È\82¶\82Ü\82È\82¢\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell, eat_it_anyway);
if (yn_function(buf, ynchars, 'n') == 'n')
if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && Sick_resistance) {
/* Tainted meat with Sick_resistance */
-#if 0 /*JP*/
- Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
- eat_it_anyway);
+#if 0 /*JP:T*/
+ Sprintf(buf, "%s like %s could be tainted! %s",
+ foodsmell, it_or_they, eat_it_anyway);
#else
- Sprintf(buf, "%s\82Í\89\98\90õ\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s", foodsmell,
- eat_it_anyway);
+ Sprintf(buf, "%s\82Í\89\98\90õ\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
+ foodsmell, eat_it_anyway);
#endif
if (yn_function(buf, ynchars, 'n') == 'n')
return 1;
struct trap *ttmp = t_at(u.ux, u.uy);
if (ttmp && ttmp->tseen && ttmp->ttyp == BEAR_TRAP) {
+ boolean u_in_beartrap = (u.utrap && u.utraptype == TT_BEARTRAP);
+
/* If not already stuck in the trap, perhaps there should
be a chance to becoming trapped? Probably not, because
then the trap would just get eaten on the _next_ turn... */
-/*JP
+#if 0 /*JP:T*/
Sprintf(qbuf, "There is a bear trap here (%s); eat it?",
-*/
+ u_in_beartrap ? "holding you" : "armed");
+#else
Sprintf(qbuf, "\82±\82±\82É\82Í\8cF\82Ìã©(%s)\82ª\82 \82é; \90H\82×\82Ü\82·\82©\81H",
-/*JP
- (u.utrap && u.utraptype == TT_BEARTRAP) ? "holding you"
-*/
- (u.utrap && u.utraptype == TT_BEARTRAP) ? "\82 \82È\82½\82ð\92Í\82Ü\82¦\82Ä\82¢\82é"
-/*JP
- : "armed");
-*/
- : "\89Ò\93®\92\86");
+ u_in_beartrap ? "\82 \82È\82½\82ð\92Í\82Ü\82¦\82Ä\82¢\82é" : "\89Ò\93®\92\86");
+#endif
if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
- u.utrap = u.utraptype = 0;
deltrap(ttmp);
+ if (u_in_beartrap)
+ reset_utrap(TRUE);
return mksobj(BEARTRAP, TRUE, FALSE);
} else if (c == 'q') {
return (struct obj *) 0;
*/
Your("\82 \82²\82Í\94\8dì\93I\82É\91å\82«\82\8aJ\82¢\82½\81D");
} else {
- make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
+ if (Sick && (u.usick_type & SICK_VOMITABLE) != 0)
+ make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
/* if not enough in stomach to actually vomit then dry heave;
vomiting_dialog() gives a vomit message when its countdown
reaches 0, but only if u.uhs < FAINTING (and !cantvomit()) */