Report was for a blinded horse which ate a carrot but remained blind.
This fixes that, and also lets blinded carnivorous pets eat carrots.
Gelatinous cubes now handle carrots too, but since they lack eyses
there won't be any noticeable effect for them.
-/* NetHack 3.6 extern.h $NHDT-Date: 1501725402 2017/08/03 01:56:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.598 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1502753404 2017/08/14 23:30:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.600 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E boolean FDECL(searches_for_item, (struct monst *, struct obj *));
E boolean FDECL(mon_reflects, (struct monst *, const char *));
E boolean FDECL(ureflects, (const char *, const char *));
+E void FDECL(mcureblindness, (struct monst *, BOOLEAN_P));
E boolean FDECL(munstone, (struct monst *, BOOLEAN_P));
E boolean FDECL(munslime, (struct monst *, BOOLEAN_P));
-/* NetHack 3.6 dog.c $NHDT-Date: 1446808440 2015/11/06 11:14:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.52 $ */
+/* NetHack 3.6 dog.c $NHDT-Date: 1502753406 2017/08/14 23:30:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.60 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
register struct obj *obj;
{
struct permonst *mptr = mon->data, *fptr = 0;
- boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), starving;
+ boolean carni = carnivorous(mptr), herbi = herbivorous(mptr),
+ starving, mblind;
if (is_quest_artifact(obj) || obj_resists(obj, 0, 95))
return obj->cursed ? TABU : APPORT;
return obj->cursed ? UNDEF : APPORT;
/* a starving pet will eat almost anything */
- starving =
- (mon->mtame && !mon->isminion && EDOG(mon)->mhpmax_penalty);
+ starving = (mon->mtame && !mon->isminion
+ && EDOG(mon)->mhpmax_penalty);
+ /* even carnivores will eat carrots if they're temporarily blind */
+ mblind = (!mon->mcansee && haseyes(mon->data));
/* ghouls prefer old corpses and unhatchable eggs, yum!
they'll eat fresh non-veggy corpses and hatchable eggs
case TIN:
return metallivorous(mptr) ? ACCFOOD : MANFOOD;
case APPLE:
- case CARROT:
return herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD;
+ case CARROT:
+ return (herbi || mblind) ? DOGFOOD : starving ? ACCFOOD : MANFOOD;
case BANANA:
return (mptr->mlet == S_YETI && herbi)
? DOGFOOD /* for monkey and ape (tameable), sasquatch */
-/* NetHack 3.6 dogmove.c $NHDT-Date: 1463704424 2016/05/20 00:33:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.60 $ */
+/* NetHack 3.6 dogmove.c $NHDT-Date: 1502753407 2017/08/14 23:30:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
boolean devour;
{
register struct edog *edog = EDOG(mtmp);
- boolean poly, grow, heal, slimer, deadmimic;
+ boolean poly, grow, heal, eyes, slimer, deadmimic;
int nutrit;
long oprice;
char objnambuf[BUFSZ];
poly = polyfodder(obj);
grow = mlevelgain(obj);
heal = mhealup(obj);
+ eyes = (obj->otyp == CARROT);
if (devour) {
if (mtmp->meating > 1)
}
if (heal)
mtmp->mhp = mtmp->mhpmax;
+ if ((eyes || heal) && !mtmp->mcansee)
+ mcureblindness(mtmp, canseemon(mtmp));
if (deadmimic)
quickmimic(mtmp);
return 1;
-/* NetHack 3.6 mon.c $NHDT-Date: 1496531114 2017/06/03 23:05:14 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.240 $ */
+/* NetHack 3.6 mon.c $NHDT-Date: 1502753408 2017/08/14 23:30:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.242 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
meatobj(mtmp) /* for gelatinous cubes */
struct monst *mtmp;
{
- register struct obj *otmp, *otmp2;
+ struct obj *otmp, *otmp2;
struct permonst *ptr, *original_ptr = mtmp->data;
- int poly, grow, heal, count = 0, ecount = 0;
+ int poly, grow, heal, eyes, count = 0, ecount = 0;
char buf[BUFSZ];
buf[0] = '\0';
poly = polyfodder(otmp);
grow = mlevelgain(otmp);
heal = mhealup(otmp);
+ eyes = (otmp->otyp == CARROT);
delobj(otmp); /* munch */
ptr = mtmp->data;
if (poly) {
} else if (heal) {
mtmp->mhp = mtmp->mhpmax;
}
+ if ((eyes || heal) && !mtmp->mcansee)
+ mcureblindness(mtmp, canseemon(mtmp));
/* in case it polymorphed or died */
if (ptr != original_ptr)
return !ptr ? 2 : 1;
-/* NetHack 3.6 muse.c $NHDT-Date: 1469840918 2016/07/30 01:08:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.78 $ */
+/* NetHack 3.6 muse.c $NHDT-Date: 1502753408 2017/08/14 23:30:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.79 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
int i, fleetim, how = 0;
struct obj *otmp = m.defensive;
boolean vis, vismon, oseen;
- const char *Mnam, *mcsa = "%s can see again.";
+ const char *Mnam;
if ((i = precheck(mtmp, otmp)) != 0)
return i;
pline_The("tip of %s's horn glows!", mon_nam(mtmp));
}
if (!mtmp->mcansee) {
- mtmp->mcansee = 1;
- mtmp->mblinded = 0;
- if (vismon)
- pline(mcsa, Monnam(mtmp));
+ mcureblindness(mtmp, vismon);
} else if (mtmp->mconf || mtmp->mstun) {
mtmp->mconf = mtmp->mstun = 0;
if (vismon)
mtmp->mhp += i;
if (mtmp->mhp > mtmp->mhpmax)
mtmp->mhp = ++mtmp->mhpmax;
- if (!otmp->cursed && !mtmp->mcansee) {
- mtmp->mcansee = 1;
- mtmp->mblinded = 0;
- if (vismon)
- pline(mcsa, Monnam(mtmp));
- }
+ if (!otmp->cursed && !mtmp->mcansee)
+ mcureblindness(mtmp, vismon);
if (vismon)
pline("%s looks better.", Monnam(mtmp));
if (oseen)
mtmp->mhp += i;
if (mtmp->mhp > mtmp->mhpmax)
mtmp->mhp = (mtmp->mhpmax += (otmp->blessed ? 5 : 2));
- if (!mtmp->mcansee) {
- mtmp->mcansee = 1;
- mtmp->mblinded = 0;
- if (vismon)
- pline(mcsa, Monnam(mtmp));
- }
+ if (!mtmp->mcansee)
+ mcureblindness(mtmp, vismon);
if (vismon)
pline("%s looks much better.", Monnam(mtmp));
if (oseen)
if (otmp->otyp == POT_SICKNESS)
unbless(otmp); /* Pestilence */
mtmp->mhp = (mtmp->mhpmax += (otmp->blessed ? 8 : 4));
- if (!mtmp->mcansee && otmp->otyp != POT_SICKNESS) {
- mtmp->mcansee = 1;
- mtmp->mblinded = 0;
- if (vismon)
- pline(mcsa, Monnam(mtmp));
- }
+ if (!mtmp->mcansee && otmp->otyp != POT_SICKNESS)
+ mcureblindness(mtmp, vismon);
if (vismon)
pline("%s looks completely healed.", Monnam(mtmp));
if (oseen)
return FALSE;
}
+/* cure mon's blindness (use_defensive, dog_eat, meatobj) */
+void
+mcureblindness(mon, verbos)
+struct monst *mon;
+boolean verbos;
+{
+ if (!mon->mcansee) {
+ mon->mcansee = 1;
+ mon->mblinded = 0;
+ if (verbos && haseyes(mon->data))
+ pline("%s can see again.", Monnam(mon));
+ }
+}
+
/* TRUE if the monster ate something */
boolean
munstone(mon, by_you)