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

Function extremeattr

src/attrib.c:1267–1293  ·  view source on GitHub ↗

when wearing (or taking off) an unID'd item, this routine is used to distinguish between observable +0 result and no-visible-effect due to an attribute not being able to exceed maximum or minimum */

Source from the content-addressed store, hash-verified

1265 to distinguish between observable +0 result and no-visible-effect
1266 due to an attribute not being able to exceed maximum or minimum */
1267boolean
1268extremeattr(
1269 int attrindx) /* does attrindx's value match its max or min? */
1270{
1271 /* Fixed_abil and racial MINATTR/MAXATTR aren't relevant here */
1272 int lolimit = 3, hilimit = 25, curval = ACURR(attrindx);
1273
1274 /* upper limit for Str is 25 but its value is encoded differently */
1275 if (attrindx == A_STR) {
1276 hilimit = STR19(25); /* 125 */
1277 /* lower limit for Str can also be 25 */
1278 if (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER)
1279 lolimit = hilimit;
1280 } else if (attrindx == A_CON) {
1281 if (u_wield_art(ART_OGRESMASHER))
1282 lolimit = hilimit;
1283 }
1284 /* this exception is hypothetical; the only other worn item affecting
1285 Int or Wis is another helmet so can't be in use at the same time */
1286 if (attrindx == A_INT || attrindx == A_WIS) {
1287 if (uarmh && uarmh->otyp == DUNCE_CAP)
1288 hilimit = lolimit = 6;
1289 }
1290
1291 /* are we currently at either limit? */
1292 return (curval == lolimit || curval == hilimit) ? TRUE : FALSE;
1293}
1294
1295/* avoid possible problems with alignment overflow, and provide a centralized
1296 location for any future alignment limits */

Callers 1

adjust_attribFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected