Table of Contents

Module: stats mudlib/stats.py
Imported modules   
import time
Functions   
adjustStatsForWork
getDefaultStatValues
getDefaultWorkValues
getDescriptionForValue
getDescriptions
getNames
getProgressForValue
normalizeStatValues
  adjustStatsForWork 
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
  getDefaultStatValues 
getDefaultStatValues ()

  getDefaultWorkValues 
getDefaultWorkValues ()

  getDescriptionForValue 
getDescriptionForValue ( stat,  value )

  getDescriptions 
getDescriptions ( stat )

  getNames 
getNames ()

Public methods

  getProgressForValue 
getProgressForValue ( stat,  value )

  normalizeStatValues 
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

Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0