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

Function wiz_mon_diff

src/wizcmds.c:1789–1828  ·  view source on GitHub ↗

the #wizmondiff command */

Source from the content-addressed store, hash-verified

1787
1788/* the #wizmondiff command */
1789int
1790wiz_mon_diff(void)
1791{
1792 static const char window_title[] = "Review of monster difficulty ratings"
1793 " [index:level]:";
1794 char buf[BUFSZ];
1795 winid win;
1796 int mhardcoded = 0, mcalculated = 0, trouble = 0, cnt = 0, mdiff = 0;
1797 int mlev;
1798 struct permonst *ptr;
1799
1800 /*
1801 * Possible extension: choose between showing discrepancies,
1802 * showing all monsters, or monsters within a particular class.
1803 */
1804
1805 win = create_nhwindow(NHW_TEXT);
1806 for (ptr = &mons[0]; ptr->mlet; ptr++, cnt++) {
1807 mcalculated = mstrength(ptr);
1808 mhardcoded = (int) ptr->difficulty;
1809 mdiff = mhardcoded - mcalculated;
1810 if (mdiff) {
1811 if (!trouble++)
1812 putstr(win, 0, window_title);
1813 mlev = (int) ptr->mlevel;
1814 if (mlev > 50) /* hack for named demons */
1815 mlev = 50;
1816 Snprintf(buf, sizeof buf,
1817 "%-18s [%3d:%2d]: calculated: %2d, hardcoded: %2d (%+d)",
1818 ptr->pmnames[NEUTRAL], cnt, mlev,
1819 mcalculated, mhardcoded, mdiff);
1820 putstr(win, 0, buf);
1821 }
1822 }
1823 if (!trouble)
1824 putstr(win, 0, "No monster difficulty discrepancies were detected.");
1825 display_nhwindow(win, FALSE);
1826 destroy_nhwindow(win);
1827 return ECMD_OK;
1828}
1829
1830/* the #wizobjprobs command */
1831int

Callers

nothing calls this directly

Calls 1

mstrengthFunction · 0.85

Tested by

no test coverage detected