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

Function uleftvault

src/vault.c:255–278  ·  view source on GitHub ↗

hero has teleported out of vault while a guard is active */

Source from the content-addressed store, hash-verified

253
254/* hero has teleported out of vault while a guard is active */
255void
256uleftvault(struct monst *grd)
257{
258 /* only called if caller has checked vault_occupied() and findgd() */
259 if (!grd || !grd->isgd || DEADMONSTER(grd)) {
260 impossible("escaping vault without guard?");
261 return;
262 }
263 /* if carrying gold and arriving anywhere other than next to the guard,
264 set the guard loose */
265 if ((money_cnt(gi.invent) || hidden_gold(TRUE))
266 && um_dist(grd->mx, grd->my, 1)) {
267 if (grd->mpeaceful) {
268 if (canspotmon(grd)) /* see or sense via telepathy */
269 pline("%s becomes irate.", Monnam(grd));
270 grd->mpeaceful = 0; /* bypass setmangry() */
271 }
272 /* if arriving outside guard's temporary corridor, give the
273 guard an extra move to deliver message(s) and to teleport
274 out of and remove that corridor */
275 if (!in_fcorridor(grd, u.ux, u.uy))
276 (void) gd_move(grd);
277 }
278}
279
280staticfn boolean
281find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry)

Callers 1

teledsFunction · 0.85

Calls 8

money_cntFunction · 0.85
hidden_goldFunction · 0.85
um_distFunction · 0.85
MonnamFunction · 0.85
in_fcorridorFunction · 0.85
gd_moveFunction · 0.85
impossibleFunction · 0.70
plineFunction · 0.70

Tested by

no test coverage detected