MCPcopy Index your code
hub / github.com/NetHack/NetHack / exercise

Function exercise

src/attrib.c:488–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486#define AVAL 50 /* tune value for exercise gains */
487
488void
489exercise(int i, boolean inc_or_dec)
490{
491 debugpline0("Exercise:");
492 if (i == A_INT || i == A_CHA)
493 return; /* can't exercise these */
494
495 /* no physical exercise while polymorphed; the body's temporary */
496 if (Upolyd && i != A_WIS)
497 return;
498
499 if (abs(AEXE(i)) < AVAL) {
500 /*
501 * Law of diminishing returns (Part I):
502 *
503 * Gain is harder at higher attribute values.
504 * 79% at "3" --> 0% at "18"
505 * Loss is even at all levels (50%).
506 *
507 * Note: *YES* ACURR is the right one to use.
508 */
509 AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2);
510 debugpline3("%s, %s AEXE = %d",
511 (i == A_STR) ? "Str" : (i == A_WIS) ? "Wis" : (i == A_DEX)
512 ? "Dex"
513 : "Con",
514 (inc_or_dec) ? "inc" : "dec", AEXE(i));
515 }
516 if (svm.moves > 0 && (i == A_STR || i == A_CON))
517 encumber_msg();
518}
519
520staticfn void
521exerper(void)

Callers 15

chweponFunction · 0.85
artitouchFunction · 0.85
chat_with_leaderFunction · 0.85
throne_sit_effectFunction · 0.85
special_throne_effectFunction · 0.85
dositFunction · 0.85
discover_objectFunction · 0.85
make_sickFunction · 0.85
peffect_hallucinationFunction · 0.85
peffect_waterFunction · 0.85
peffect_boozeFunction · 0.85
peffect_enlightenmentFunction · 0.85

Calls 2

rn2Function · 0.85
encumber_msgFunction · 0.85

Tested by 1

test_moveFunction · 0.68