Eating garlic makes some monsters flee

This commit is contained in:
Pasi Kallinen
2023-01-24 06:17:17 +02:00
parent c5aad9fe56
commit 1d8c944c5a
2 changed files with 11 additions and 0 deletions

View File

@@ -1097,6 +1097,7 @@ fix bug making random subrooms never touching the right or bottom
if a grave is created with the corpse lying on top (bones), don't find a
corpse or release a zombie or mummy when digging it up
kicking a headstone might summon a ghoul
eating garlic makes nearby monsters flee
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -28,6 +28,7 @@ static void consume_tin(const char *);
static void start_tin(struct obj *);
static int eatcorpse(struct obj *);
static void start_eating(struct obj *, boolean);
static void garlic_breath(struct monst *);
static void fprefx(struct obj *);
static void fpostfx(struct obj *);
static int bite(void);
@@ -1972,6 +1973,14 @@ eating_glob(struct obj *glob)
return (go.occupation == eatfood && glob == gc.context.victual.piece);
}
/* scare nearby monster when hero eats garlic */
static void
garlic_breath(struct monst *mtmp)
{
if (olfaction(mtmp->data) && distu(mtmp->mx, mtmp->my) < 7)
monflee(mtmp, 0, FALSE, FALSE);
}
/*
* Called on "first bite" of (non-corpse) food, after touchfood() has
* marked it 'partly eaten'. Used for non-rotten non-tin non-corpse food.
@@ -2030,6 +2039,7 @@ fprefx(struct obj *otmp)
make_vomiting((long) rn1(gc.context.victual.reqtime, 5), FALSE);
break;
}
iter_mons(garlic_breath);
/*FALLTHRU*/
default:
if (otmp->otyp == SLIME_MOLD && !otmp->cursed