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

Function m_lined_up

src/mthrowu.c:1375–1393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1373}
1374
1375staticfn int
1376m_lined_up(struct monst *mtarg, struct monst *mtmp)
1377{
1378 boolean utarget = (mtarg == &gy.youmonst);
1379 coordxy tx = utarget ? mtmp->mux : mtarg->mx;
1380 coordxy ty = utarget ? mtmp->muy : mtarg->my;
1381 boolean ignore_boulders = utarget && (throws_rocks(mtmp->data)
1382 || m_carrying(mtmp, WAN_STRIKING));
1383
1384 /* hero concealment usually trumps monst awareness of being lined up */
1385 if (utarget && Upolyd && rn2(25)
1386 && (u.uundetected || (U_AP_TYPE != M_AP_NOTHING
1387 && U_AP_TYPE != M_AP_MONSTER)))
1388 return FALSE;
1389
1390 /* [no callers care about the 1 vs 2 situation any more] */
1391 return linedup(tx, ty, mtmp->mx, mtmp->my,
1392 utarget ? (ignore_boulders ? 1 : 2) : 0);
1393}
1394
1395
1396/* is mtmp in position to use ranged attack on hero? */

Callers 4

thrwmmFunction · 0.85
spitmmFunction · 0.85
breammFunction · 0.85
lined_upFunction · 0.85

Calls 3

m_carryingFunction · 0.85
rn2Function · 0.85
linedupFunction · 0.85

Tested by

no test coverage detected