diff --git a/doc/fixes37.0 b/doc/fixes37.0 index b5f68c492..beb2dc6d9 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -727,6 +727,7 @@ if a giant carrying a boulder was on ice that melted, it could be killed when it dropped inventory before being removed from the map allow fire-command to automatically use a polearm, if wielding it make '$' command also count gold carried inside containers +fleeing leprechauns bury their gold after teleporting Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/monmove.c b/src/monmove.c index 2cb5825e0..e4c340d5e 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -16,6 +16,7 @@ static boolean holds_up_web(xchar, xchar); static int count_webbing_walls(xchar, xchar); static boolean soko_allow_web(struct monst *); static boolean leppie_avoidance(struct monst *); +static void leppie_stash(struct monst *); static boolean m_balks_at_approaching(struct monst *); static boolean stuff_prevents_passage(struct monst *); static int vamp_shift(struct monst *, struct permonst *, boolean); @@ -488,7 +489,8 @@ dochug(register struct monst* mtmp) /* some monsters teleport */ if (mtmp->mflee && !rn2(40) && can_teleport(mdat) && !mtmp->iswiz && !noteleport_level(mtmp)) { - (void) rloc(mtmp, RLOC_MSG); + if (rloc(mtmp, RLOC_MSG)) + leppie_stash(mtmp); return 0; } if (mdat->msound == MS_SHRIEK && !um_dist(mtmp->mx, mtmp->my, 1)) @@ -872,6 +874,27 @@ leppie_avoidance(struct monst *mtmp) return FALSE; } +/* unseen leprechaun with gold might stash it */ +static void +leppie_stash(struct monst *mtmp) +{ + struct obj *gold; + + if (mtmp->data == &mons[PM_LEPRECHAUN] + && !DEADMONSTER(mtmp) + && !m_canseeu(mtmp) + && !*in_rooms(mtmp->mx, mtmp->my, SHOPBASE) + && levl[mtmp->mx][mtmp->my].typ == ROOM + && !t_at(mtmp->mx, mtmp->my) + && rn2(4) + && (gold = findgold(mtmp->minvent)) != 0) { + mdrop_obj(mtmp, gold, FALSE); + gold = g_at(mtmp->mx, mtmp->my); + if (gold) + (void) bury_an_obj(gold, (boolean *) 0); + } +} + /* does monster want to avoid you? */ static boolean m_balks_at_approaching(struct monst* mtmp)