Documentation
public class CreatureTemplate extends DataMap implements Cloneable, java.io.Serializable, CryptUtil.Encryptable
Bean containing all template information about a creature.
- Author: saethi & owlbear
@Deprecated @D20Field private byte _speed
- Deprecated
private byte _width
The width of the face of the creature in units (1 unit == 5 feet)
private byte _height
The height of the face of the creature in units (1 unit == 5 feet)
@D20Field private byte[] _saves
The creature's saving throw scores
public static final byte EMPTY = -128
Constant used when an ability has no value
@D20Field private byte[] _abilities
Holds the creature's stats
@D20Field private byte[] _AC
Holds the creature's ac mods
@D20Field private short _maxDexBonus
Holds the Max Dex Bonus due to armor
@D20Field private short _initOverride
Holds the Init Override value
@D20Field private ArrayList<CreatureAttack> _attacks
Holds the creature's attack information
@D20Field private int _fastHeal
Holds the value for fast healing/regeneration
@D20Field private boolean _regenerates
Whether or not the creature regens
private String _version
Read from {@link D20#VERSION} to indicate which version created the creature
@D20Field private Integer _overrideBAB
Typically null for no override or the int value of the object otherwise
@D20Field private int _facing
The facing of the mini in degrees
@Deprecated public void setStatus(ArrayList<String> list)
- Deprecated
@Deprecated public ArrayList<String> getStatus()
- Deprecated
@Deprecated public void setCustomDefense(short[] defense)
- Deprecated
public CreatureDamageReduction getDamageReduction()
for mappers reflection
public void setDamageReduction(CreatureDamageReduction damageReduction)
for mappers reflection
public void setElementalResistance(CreatureElementalResistance _elementalResistance)
for mappers reflection
public void setHPMax(short hpMax)
Sets the max HP of the creature. maxHP must be >= 1.
- Parameters:
hpMax
—
public byte getAbilityScoreBase(byte idAbility)
returns the currently stored base ability score for id
- Parameters:
idAbility
— - id of score to retrieve - Returns: byte score.
public void setAbilityScoreBase(byte idAbility, byte value, boolean refresh)
Sets the base Ability score for a creature. Changing this value should immediately prompt for a refresh. To ensure the calculation is correct, we put the new value in the creaturetemplate first.
- Parameters:
idAbility
— - id of ability to modifyvalue
— - new score valuerefresh
— - refresh after update
public byte getAbilityScore(byte idAbility)
pass through method to default getAbilityScore calls to always refresh
- Parameters:
idAbility
— - Returns:
public byte getAbilityScore(byte idAbility, boolean refresh)
Calculate and return the modified ability score for a creature. Flagging refresh will recalculate the ability with updated modifiers
- Parameters:
idAbility
— - Returns:
public void setAbilityScore(byte idAbility, byte value)
This method sets the modified ability score for a creature. it does not need to refresh or calculate as it sets an "override" value which is generally created by the refresh/calculate functions.
- Parameters:
idAbility
— - id of ability to overridevalue
— - score to inject
public void setAbilityScoreMods(byte idAbility, byte value)
Overrides the abilitiesmod[id] value such that it can be updated by effects, powers, or manual entry.
- Parameters:
idAbility
—value
—
public void refreshAbilityScore(byte id)
Method to recalculate the current ability
- Parameters:
id
— - id of score to recalculate ability value for
public void refreshAbilityScores()
Method to recalculate all ability scores
@Deprecated public void setSpeeds(CreatureSpeeds speeds)
- Deprecated
@Deprecated public CreatureSpeeds getSpeeds()
- Deprecated
@Deprecated public void setSpeed(byte speed)
- Deprecated
- Parameters:
speed
—
@Deprecated public byte getSpeed()
- Deprecated
- Returns:
public Dimension getFace()
The face of the creature in units (1 unit == 5 feet).
- Returns:
public byte getReach()
The reach of a creature is in units (1 unit == 5 feet)
- Returns:
public int hurt(int damage)
Apply the following damage to the creature and return the current HP of the creature.
- Parameters:
damage
— - Returns: total hp after damage
public int heal(int healing, boolean allowSurplus)
Apply the given healing to the creature.
- Parameters:
healing
—allowSurplus
— whether or not to allow more than 100% hitpoints.- Returns: total hp after heal
public int resolveBAB()
calculate the base attack bonus based on all classes
- Returns: * integer value for base attack bonus
public void mimic(CreatureTemplate template, CreatureClassBinder binder)
Causes this template to take on all the properties of the given template.
public CreatureTemplate makePublic(boolean revealDamageExtent)
Build a new template with only publicly available items filled in.
- Returns:
@Deprecated public int[] getCoins()
- Deprecated
@Deprecated public void setCoins(int[] money)
- Deprecated
@Deprecated public byte[] getMoney()
- Deprecated
@Deprecated public void setMoney(byte[] money)
- Deprecated
@Deprecated public void setAbilities(byte[] abilities)
- Deprecated
@Deprecated public void setAbilitiesBase(byte[] abilitiesBase)
- Deprecated
@Deprecated public byte[] getAbilitiesMods()
- Deprecated
@Deprecated public void setAbilitiesMods(byte[] abilitiesMods)
- Deprecated
public byte[] getSavesBase()
XML.
public byte[] getSavesMod()
XML.
public byte[] getSaves(boolean calculate)
XML.
public void setSavesBase(byte[] base)
XML.
public void setSaves(byte[] saves)
XML.
public void setSavesMod(byte[] mods)
XML.
public byte[] getAC()
XML.
public void setAC(byte[] acblock)
XML.
public String getNotes()
ENCODED description only! Should only be used by CreatureTemplateFactory.
- Returns:
public void restoreTransientReferences(CreatureClassBinder binderClasses)
When a template is serialized, certain references that are transient must be restored. Many subcomponents rely on the references for quick lookups.
public CreatureCapability_SpellCaster extractSpellCasting(String nameOfClass)
Access a spellcasting class by name.
- Parameters:
nameOfClass
— String - Returns: GenericCreatureClass
public void restSpells()
All spellcasting classes have their spells rested, including freeform and items.
return _encrypted
- To-do: saethi consider encrypted items