MCPcopy Create free account
hub / github.com/NetHack/NetHack / leppie_stash

Function leppie_stash

src/monmove.c:1153–1171  ·  view source on GitHub ↗

unseen leprechaun with gold might stash it */

Source from the content-addressed store, hash-verified

1151
1152/* unseen leprechaun with gold might stash it */
1153staticfn void
1154leppie_stash(struct monst *mtmp)
1155{
1156 struct obj *gold;
1157
1158 if (mtmp->data == &mons[PM_LEPRECHAUN]
1159 && !DEADMONSTER(mtmp)
1160 && !m_canseeu(mtmp)
1161 && !*in_rooms(mtmp->mx, mtmp->my, SHOPBASE)
1162 && levl[mtmp->mx][mtmp->my].typ == ROOM
1163 && !t_at(mtmp->mx, mtmp->my)
1164 && rn2(4)
1165 && (gold = findgold(mtmp->minvent)) != 0) {
1166 mdrop_obj(mtmp, gold, FALSE);
1167 gold = g_at(mtmp->mx, mtmp->my);
1168 if (gold)
1169 (void) bury_an_obj(gold, (boolean *) 0);
1170 }
1171}
1172
1173/* does monster want to avoid you?
1174 * returns the original value of appr if not.

Callers 1

dochugFunction · 0.85

Calls 7

in_roomsFunction · 0.85
t_atFunction · 0.85
rn2Function · 0.85
findgoldFunction · 0.85
mdrop_objFunction · 0.85
g_atFunction · 0.85
bury_an_objFunction · 0.85

Tested by

no test coverage detected