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

Function seffect_taming

src/read.c:1678–1719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1676}
1677
1678staticfn void
1679seffect_taming(struct obj **sobjp)
1680{
1681 struct obj *sobj = *sobjp;
1682 boolean confused = (Confusion != 0);
1683 int candidates, res, results, vis_results;
1684
1685 if (u.uswallow) {
1686 candidates = 1;
1687 results = vis_results = maybe_tame(u.ustuck, sobj);
1688 } else {
1689 int i, j, bd = confused ? 5 : 1;
1690 struct monst *mtmp;
1691
1692 /* note: maybe_tame() can return either positive or
1693 negative values, but not both for the same scroll */
1694 candidates = results = vis_results = 0;
1695 for (i = -bd; i <= bd; i++)
1696 for (j = -bd; j <= bd; j++) {
1697 if (!isok(u.ux + i, u.uy + j))
1698 continue;
1699 if ((mtmp = m_at(u.ux + i, u.uy + j)) != 0
1700 || (!i && !j && (mtmp = u.usteed) != 0)) {
1701 ++candidates;
1702 res = maybe_tame(mtmp, sobj);
1703 results += res;
1704 if (canspotmon(mtmp))
1705 vis_results += res;
1706 }
1707 }
1708 }
1709 if (!results) {
1710 pline("Nothing interesting %s.",
1711 !candidates ? "happens" : "seems to happen");
1712 } else {
1713 pline_The("neighborhood %s %sfriendlier.",
1714 vis_results ? "is" : "seems",
1715 (results < 0) ? "un" : "");
1716 if (vis_results > 0)
1717 gk.known = TRUE;
1718 }
1719}
1720
1721staticfn void
1722seffect_genocide(struct obj **sobjp)

Callers 1

seffectsFunction · 0.85

Calls 4

maybe_tameFunction · 0.85
isokFunction · 0.85
pline_TheFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected