/* * 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. */ void wormhitu(struct monst *worm) { int wnum = worm->wormno; struct wseg *seg; /* if (!wnum) return; bullet proofing */ /* This does not work right now because mattacku() thinks that the head is * out of range of the player. We might try to kludge, and bring the head * within range for a tiny moment, but this needs a bit more looking at * before we decide to do this. */ for (seg = level->wtails[wnum]; seg; seg = seg->nseg) if (distu(seg->wx, seg->wy) < 3) mattacku(worm); }
/* * pri_move: return 1: moved 0: didn't -1: let m_move do it -2: died */ int pri_move(struct monst *priest) { xchar gx, gy, omx, omy; schar temple; boolean avoid = TRUE; omx = priest->mx; omy = priest->my; if (!histemple_at(priest, omx, omy)) return -1; temple = CONST_EPRI(priest)->shroom; gx = CONST_EPRI(priest)->shrpos.x; gy = CONST_EPRI(priest)->shrpos.y; gx += rn1(3, -1); /* mill around the altar */ gy += rn1(3, -1); if (!priest->mpeaceful || (Conflict && !resist(priest, RING_CLASS, 0, 0))) { if (monnear(priest, u.ux, u.uy)) { if (Displaced) pline("Your displaced image doesn't fool %s!", mon_nam(priest)); mattacku(priest); return 0; } else if (strchr(u.urooms, temple)) { /* chase player if inside temple & can sense him */ if (m_cansenseu(priest)) { gx = u.ux; gy = u.uy; } avoid = FALSE; } } else if (Invis) avoid = FALSE; return move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, gx, gy); }