#include <Handicap.h>
Public Types | |
| enum | HandicapType { BUILDCOST , BUILDTIME , HANDICAP_TYPE_COUNT } |
Public Member Functions | |
| Handicap () | |
| void | init () |
| reset all handicaps to a default value. | |
| void | readFromDict (const Dict *d) |
| Real | getHandicap (HandicapType t, const ThingTemplate *tmpl) const |
Handicap encapsulates the sets of modifiers to abilities used to balance the game and give different abilities to different Players. Conceptually, it's a large set of coefficients (typically, but not necessarily, in the range of 0.0...1.0).
Usage example (conceptual):
Real armorCoef = this->m_handicap->getHandicap(ARMOR, this); Real actualArmor = this->getArmorValue() * armorCoef;
Definition at line 69 of file Handicap.h.
| Enumerator | |
|---|---|
| BUILDCOST | |
| BUILDTIME | |
| HANDICAP_TYPE_COUNT | |
Definition at line 75 of file Handicap.h.
| Handicap::Handicap | ( | ) |
Definition at line 53 of file Handicap.cpp.
| Real Handicap::getHandicap | ( | HandicapType | t, |
| const ThingTemplate * | tmpl ) const |
return the multiplier for the given Handicap type on the given Object. The Object's type (unit, building, etc.) will generally be examined to determine what value to return.
Definition at line 122 of file Handicap.cpp.
| void Handicap::init | ( | ) |
reset all handicaps to a default value.
Definition at line 59 of file Handicap.cpp.
| void Handicap::readFromDict | ( | const Dict * | d | ) |
initialize from the fields in the Dict. Note that this does NOT call init() internally, so only those fields that are present in the dict will be set. if you want to ensure all fields are something reasonable, you should call init() prior to calling this.
Definition at line 67 of file Handicap.cpp.