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

Function wormhitu

src/worm.c:343–362  ·  view source on GitHub ↗

* wormhitu() * * Check for mon->wormno before calling this function! * * If the hero is near any part of the worm, the worm will try to attack. * Returns 1 if the worm dies (poly'd hero with passive counter-attack) * or 0 if it doesn't. */

Source from the content-addressed store, hash-verified

341 * or 0 if it doesn't.
342 */
343int
344wormhitu(struct monst *worm)
345{
346 int wnum = worm->wormno;
347 struct wseg *seg;
348
349 /* This does not work right now because mattacku() thinks that the head
350 * is out of range of the player. We might try to kludge, and bring
351 * the head within range for a tiny moment, but this needs a bit more
352 * looking at before we decide to do this.
353 *
354 * Head has already had a chance to attack, so the dummy tail segment
355 * sharing its location should be skipped.
356 */
357 for (seg = wtails[wnum]; seg != wheads[wnum]; seg = seg->nseg)
358 if (distu(seg->wx, seg->wy) < 3)
359 if (mattacku(worm))
360 return 1; /* your passive ability killed the worm */
361 return 0;
362}
363
364/* cutworm()
365 *

Callers 1

dochugFunction · 0.85

Calls 1

mattackuFunction · 0.85

Tested by

no test coverage detected