adjustStatsForWork (
stats,
unitsOfWork,
lastAdjustmentTime,
)
If appropriate, adjusts stats for gained progress, or lack thereof.
After a specific amount of time passes, each stat is compared to the
units of work performed during that period of time. Depending on how
much work has been done relative to the stat value, the stat may
increase by a point, stay the same, or decrease by a point. This
method takes care of performing the necessary calculations and
making any needed stat adjustments. The given unitsOfWork and
lastAdjustmentTime will also be reset appropriately if adjustments
are made.
Note that it's always safe to invoke this method. Adjustments will
be made only if appropriate.
arguments:
-
stats
- (hash) the stat hashmap to normalize. keys are stats
constants and values are ints
-
unitsOfWork
- (hash) same setup as the stats argument
-
lastAdjustedTime
- (int) the last adjusted time tick
|
normalizeStatValues ( stats )
Guarantees that each stat value in the given stat value is legal.
Each stat value must be between STAT_MIN and STAT_MAX, inclusive.
If any value is less than STAT_MIN, then it will be set to STAT_MIN.
Likewise, if any value is greater than STAT_MAX, then it will be
set to STAT_MAX. Both constants can be found in the mudlib.constants
module.
arguments:
-
stats
- (hash) the stat hashmap to normalize. keys are stats
constants and values are ints
|