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

Function hmon_hitmon_msg_silver

src/uhitm.c:1662–1699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1660}
1661
1662staticfn void
1663hmon_hitmon_msg_silver(
1664 struct _hitmon_data *hmd,
1665 struct monst *mon,
1666 struct obj *obj UNUSED)
1667{
1668 const char *fmt;
1669 char *whom = mon_nam(mon);
1670 char silverobjbuf[BUFSZ];
1671
1672 if (canspotmon(mon)) {
1673 if (hmd->barehand_silver_rings == 1)
1674 fmt = "Your silver ring sears %s!";
1675 else if (hmd->barehand_silver_rings == 2)
1676 fmt = "Your silver rings sear %s!";
1677 else if (hmd->silverobj && hmd->saved_oname[0]) {
1678 /* guard constructed format string against '%' in
1679 saved_oname[] from xname(via cxname()) */
1680 Snprintf(silverobjbuf, sizeof(silverobjbuf), "Your %s%s %s",
1681 strstri(hmd->saved_oname, "silver") ? "" : "silver ",
1682 hmd->saved_oname, vtense(hmd->saved_oname, "sear"));
1683 (void) strNsubst(silverobjbuf, "%", "%%", 0);
1684 strncat(silverobjbuf, " %s!",
1685 sizeof(silverobjbuf) - (strlen(silverobjbuf) + 1));
1686 fmt = silverobjbuf;
1687 } else
1688 fmt = "The silver sears %s!";
1689 } else {
1690 *whom = highc(*whom); /* "it" -> "It" */
1691 fmt = "%s is seared!";
1692 }
1693 /* note: s_suffix returns a modifiable buffer */
1694 if (!noncorporeal(hmd->mdat) && !amorphous(hmd->mdat))
1695 whom = strcat(s_suffix(whom), " flesh");
1696 DISABLE_WARNING_FORMAT_NONLITERAL
1697 pline(fmt, whom);
1698 RESTORE_WARNING_FORMAT_NONLITERAL
1699}
1700
1701staticfn void
1702hmon_hitmon_msg_lightobj(

Callers 1

hmon_hitmonFunction · 0.85

Calls 6

mon_namFunction · 0.85
strstriFunction · 0.85
vtenseFunction · 0.85
strNsubstFunction · 0.85
highcFunction · 0.85
s_suffixFunction · 0.85

Tested by

no test coverage detected