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

Function acurrstr

src/attrib.c:1244–1262  ·  view source on GitHub ↗

condense clumsy ACURR(A_STR) value into value that fits into formulas */

Source from the content-addressed store, hash-verified

1242
1243/* condense clumsy ACURR(A_STR) value into value that fits into formulas */
1244schar
1245acurrstr(void)
1246{
1247 int str = ACURR(A_STR), /* 3..125 after massaging by acurr() */
1248 result; /* 3..25 */
1249
1250 if (str <= STR18(0)) /* <= 18; max(,3) here is redundant */
1251 result = max(str, 3); /* 3..18 */
1252 else if (str <= STR19(21)) /* <= 121 */
1253 /* this converts
1254 18/01..18/31 into 19,
1255 18/32..18/81 into 20,
1256 18/82..18/100 and 19..21 into 21 */
1257 result = 19 + str / 50; /* map to 19..21 */
1258 else /* convert 122..125; min(,125) here is redundant */
1259 result = min(str, 125) - 100; /* 22..25 */
1260
1261 return (schar) result;
1262}
1263
1264/* when wearing (or taking off) an unID'd item, this routine is used
1265 to distinguish between observable +0 result and no-visible-effect

Callers 2

domove_fight_webFunction · 0.85
hit_barsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected