Skip to content

Commit

Permalink
Leprechauns bury their gold after teleporting
Browse files Browse the repository at this point in the history
  • Loading branch information
paxed committed Dec 31, 2021
1 parent 4f9e763 commit 2591a21
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/fixes37.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 24 additions & 1 deletion src/monmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2591a21

Please sign in to comment.