void exercise(int i, boolean inc_or_dec) { if (i == A_INT || i == A_CHA) return; /* can't exercise these */ /* no physical exercise while polymorphed; the body's temporary */ if (Upolyd && i != A_WIS) return; if (abs(AEXE(i)) < AVAL) { /* * Law of diminishing returns (Part I): * * Gain is harder at higher attribute values. * 79% at "3" --> 0% at "18" * Loss is even at all levels (50%). * * Note: *YES* ACURR is the right one to use. */ AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2); } if (moves > 0 && (i == A_STR || i == A_CON)) encumber_msg(); }
void exerchk (void) { int i, mod_val; /* Check out the periodic accumulations */ exerper(); /* Are we ready for a test? */ if(moves >= next_check && !multi) { /* * Law of diminishing returns (Part II): * * The effects of "exercise" and "abuse" wear * off over time. Even if you *don't* get an * increase/decrease, you lose some of the * accumulated effects. */ for(i = 0; i < A_MAX; AEXE(i++) /= 2) { if(ABASE(i) >= 18 || !AEXE(i)) continue; if(i == A_INT || i == A_CHA) continue;/* can't exercise these */ /* * Law of diminishing returns (Part III): * * You don't *always* gain by exercising. * [MRS 92/10/28 - Treat Wisdom specially for balance.] */ if(rn2(AVAL) > ((i != A_WIS) ? abs(AEXE(i)*2/3) : abs(AEXE(i)))) continue; mod_val = sgn(AEXE(i)); if(adjattrib(i, mod_val, -1)) { /* if you actually changed an attrib - zero accumulation */ AEXE(i) = 0; /* then print an explanation */ switch(i) { case A_STR: You((mod_val >0) ? "must have been exercising." : "must have been abusing your body."); break; case A_WIS: You((mod_val >0) ? "must have been very observant." : "haven't been paying attention."); break; case A_DEX: You((mod_val >0) ? "must have been working on your reflexes." : "haven't been working on reflexes lately."); break; case A_CON: You((mod_val >0) ? "must be leading a healthy life-style." : "haven't been watching your health."); break; } } } next_check += rn1(200,800); } }