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

Function dogaze

src/polyself.c:1641–1773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1639}
1640
1641int
1642dogaze(void)
1643{
1644 struct monst *mtmp;
1645 int looked = 0;
1646 char qbuf[QBUFSZ];
1647 int i;
1648 uchar adtyp = 0;
1649
1650 for (i = 0; i < NATTK; i++) {
1651 if (gy.youmonst.data->mattk[i].aatyp == AT_GAZE) {
1652 adtyp = gy.youmonst.data->mattk[i].adtyp;
1653 break;
1654 }
1655 }
1656 if (adtyp != AD_CONF && adtyp != AD_FIRE) {
1657 impossible("gaze attack %d?", adtyp);
1658 return ECMD_OK;
1659 }
1660
1661 if (Blind) {
1662 You_cant("see anything to gaze at.");
1663 return ECMD_OK;
1664 } else if (Hallucination) {
1665 You_cant("gaze at anything you can see.");
1666 return ECMD_OK;
1667 }
1668 if (u.uen < 15) {
1669 You("lack the energy to use your special gaze!");
1670 return ECMD_OK;
1671 }
1672 u.uen -= 15;
1673 disp.botl = TRUE;
1674
1675 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1676 if (DEADMONSTER(mtmp))
1677 continue;
1678 if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) {
1679 looked++;
1680 if (Invis && !perceives(mtmp->data)) {
1681 pline("%s seems not to notice your gaze.", Monnam(mtmp));
1682 } else if (mtmp->minvis && !See_invisible) {
1683 You_cant("see where to gaze at %s.", Monnam(mtmp));
1684 } else if (M_AP_TYPE(mtmp) == M_AP_FURNITURE
1685 || M_AP_TYPE(mtmp) == M_AP_OBJECT) {
1686 looked--;
1687 continue;
1688 } else if (flags.safe_dog && mtmp->mtame && !Confusion) {
1689 You("avoid gazing at %s.", y_monnam(mtmp));
1690 } else {
1691 if (flags.confirm && mtmp->mpeaceful && !Confusion) {
1692 Sprintf(qbuf, "Really %s %s?",
1693 (adtyp == AD_CONF) ? "confuse" : "attack",
1694 mon_nam(mtmp));
1695 if (y_n(qbuf) != 'y')
1696 continue;
1697 }
1698 setmangry(mtmp, TRUE);

Callers 1

domonabilityFunction · 0.85

Calls 15

You_cantFunction · 0.85
YouFunction · 0.85
canseemonFunction · 0.85
MonnamFunction · 0.85
y_monnamFunction · 0.85
mon_namFunction · 0.85
setmangryFunction · 0.85
YourFunction · 0.85
dFunction · 0.85
pline_TheFunction · 0.85
rn2Function · 0.85
destroy_itemsFunction · 0.85

Tested by

no test coverage detected