com.planet_ink.coffee_mud.Common
Class DefaultPhyStats

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.DefaultPhyStats
All Implemented Interfaces:
CMCommon, PhyStats, CMObject, Modifiable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class DefaultPhyStats
extends java.lang.Object
implements PhyStats


Field Summary
protected  java.lang.String[] ambiances
           
protected  java.lang.String replacementName
           
protected  double speed
           
protected  int[] stats
           
 
Fields inherited from interface com.planet_ink.coffee_mud.Common.interfaces.PhyStats
ALLMASK, CAN_GRUNT_WHEN_STUPID, CAN_NOT_AUTO_ATTACK, CAN_NOT_BE_CAMPED, CAN_NOT_BREATHE, CAN_NOT_HEAR, CAN_NOT_MOVE, CAN_NOT_SEE, CAN_NOT_SMELL, CAN_NOT_SPEAK, CAN_NOT_TASTE, CAN_NOT_THINK, CAN_NOT_TRACK, CAN_SEE_BONUS, CAN_SEE_CODES, CAN_SEE_DARK, CAN_SEE_DESCS, CAN_SEE_EVIL, CAN_SEE_GOOD, CAN_SEE_HIDDEN, CAN_SEE_HIDDEN_ITEMS, CAN_SEE_INFRARED, CAN_SEE_INVISIBLE, CAN_SEE_METAL, CAN_SEE_SNEAKERS, CAN_SEE_VERBS, CAN_SEE_VICTIM, IS_BONUS, IS_BOUND, IS_CATALOGED, IS_CLIMBING, IS_CLOAKED, IS_CODES, IS_CUSTOM, IS_DARK, IS_DESCS, IS_EVIL, IS_FALLING, IS_FLYING, IS_GLOWING, IS_GOLEM, IS_GOOD, IS_HIDDEN, IS_INVISIBLE, IS_LIGHTSOURCE, IS_NOT_SEEN, IS_SITTING, IS_SLEEPING, IS_SNEAKING, IS_SWIMMING, IS_UNATTACKABLE, IS_UNSAVABLE, IS_VERBS, NO_REJUV, NUM_STATS, SENSE_ALWAYSCOMPRESSED, SENSE_CODES, SENSE_CONTENTSUNSEEN, SENSE_INSIDEACCESSIBLE, SENSE_ITEMNOAUTOWEAR, SENSE_ITEMNODROP, SENSE_ITEMNOMAXRANGE, SENSE_ITEMNOMINRANGE, SENSE_ITEMNOREMOVE, SENSE_ITEMNORUIN, SENSE_ITEMNOTGET, SENSE_ITEMNOWISH, SENSE_ITEMREADABLE, SENSE_ROOMCRUNCHEDIN, SENSE_ROOMGRIDSYNC, SENSE_ROOMNOMOVEMENT, SENSE_ROOMUNEXPLORABLE, SENSE_ROOMUNMAPPABLE, SENSE_UNCAMPABLE, SENSE_UNDESTROYABLE, SENSE_UNLOCATABLE, STAT_ABILITY, STAT_ARMOR, STAT_ATTACK, STAT_DAMAGE, STAT_DESCS, STAT_DISPOSITION, STAT_HEIGHT, STAT_LEVEL, STAT_REJUV, STAT_SENSES, STAT_WEIGHT
 
Constructor Summary
DefaultPhyStats()
           
 
Method Summary
 int ability()
          Returns the ability level (a secondary level, e.g.
 void addAmbiance(java.lang.String ambiance)
          Adds an ambiance (extra word, visible field) to the list that are tacked onto the display text of this Physical.
 java.lang.String[] ambiances()
          Returns a list of ambiances (extra words, visible fields) that are tacked onto the display text of this Physical.
 int armor()
          Returns the defensive capability number of this Physical.
 int attackAdjustment()
          Returns the rawcombat attack prowess of this Physical Usually mobs or weapons
 int compareTo(CMObject o)
           
 void copyInto(PhyStats intoStats)
          Copies the internal data of this object into another of kind.
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 int damage()
          Returns the maximum damaging ability of this Physical
 void delAmbiance(java.lang.String ambiance)
          Removes an ambiance (extra word, visible field) from the list that are tacked onto the display text of this Physical.
 int disposition()
          Returns a bitmask for disposition related flags of Physicals (IS_ constants).
protected  int getCodeNum(java.lang.String code)
           
 java.lang.String getCombatStats()
          Returns a single string summary of several important stats from this object.
 int getSaveStatIndex()
          Returns the index into the stat codes array where extra savable fields begins.
 java.lang.String getStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 java.lang.String[] getStatCodes()
          Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.
 int height()
          Returns the height of this Physical, in inches
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 boolean isAmbiance(java.lang.String ambiance)
          Check to see if the given ambiance exists in the list.
 boolean isStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 int level()
          Returns the experience level of the mob, item, exit, Physical.
 int movesReqToPull()
          Returns the number of move points required to pull It is derived from the weight.
 int movesReqToPush()
          Returns the number of move points required to push It is derived from the weight.
 java.lang.String name()
          The displayable name of this object.
 CMObject newInstance()
          Returns a new instance of this class.
 java.lang.String newName()
          Returns a modified name for this Physical, usually null for no change.
 int rejuv()
          Returns the number of ticks before a Physical removed from the game (due to death, destruction, or just removal from home) is restored.
 void reset()
          Resets all the stats in this object to their factory defaults.
 boolean sameAs(PhyStats E)
          Returns whether the given object is substantially the same as this one
 int sensesMask()
          Returns a bitmask for sense related flags of mobs (CAN_ constants), or miscellaneous runtime flags for items and other Physicals (SENSE_ constants).
 void setAbility(int newAdjustment)
          Sets the ability level (a secondary level, e.g.
 void setAllValues(int def)
          Sets all the stats in this object to the given value
 void setArmor(int newArmor)
          Sets the defensive capability number of this Physical.
 void setAttackAdjustment(int newAdjustment)
          Sets the rawcombat attack prowess of this Physical Usually mobs or weapons
 void setDamage(int newDamage)
          Sets the maximum damaging ability of this Physical
 void setDisposition(int newDisposition)
          Sets a bitmask for disposition related flags of Physicals (IS_ constants).
 void setHeight(int newHeight)
          Sets the height of this Physical, in inches
 void setLevel(int newLevel)
          Sets the experience level of the mob, item, exit, Physical.
 void setName(java.lang.String newName)
          Sets a modified name for this Physical, usually null for no change.
 void setRejuv(int newRejuv)
          Sets the number of ticks before a Physical removed from the game (due to death, destruction, or just removal from home) is restored.
 void setSensesMask(int newMask)
          Sets a bitmask for sense related flags of mobs (CAN_ constants), or miscellaneous runtime flags for items and other Physicals (SENSE_ constants).
 void setSpeed(double newSpeed)
          Sets the number of actions this mob can do per tick
 void setStat(java.lang.String code, java.lang.String val)
          An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders.
 void setWeight(int newWeight)
          Sets the weight of this Physical, in pounds.
 double speed()
          Returns the number of actions this mob can do per tick.
 int weight()
          Returns the weight of this Physical, in pounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stats

protected int[] stats

speed

protected double speed

replacementName

protected java.lang.String replacementName

ambiances

protected java.lang.String[] ambiances
Constructor Detail

DefaultPhyStats

public DefaultPhyStats()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

name

public java.lang.String name()
Description copied from interface: CMObject
The displayable name of this object. May be modified by phyStats() object. Is derived from the Name().

Specified by:
name in interface CMObject
Returns:
the modified final name of this object on the map.
See Also:
Environmental.Name()

setAllValues

public void setAllValues(int def)
Description copied from interface: PhyStats
Sets all the stats in this object to the given value

Specified by:
setAllValues in interface PhyStats
Parameters:
def - a value to set all the stats to

reset

public void reset()
Description copied from interface: PhyStats
Resets all the stats in this object to their factory defaults.

Specified by:
reset in interface PhyStats

sensesMask

public int sensesMask()
Description copied from interface: PhyStats
Returns a bitmask for sense related flags of mobs (CAN_ constants), or miscellaneous runtime flags for items and other Physicals (SENSE_ constants).

Specified by:
sensesMask in interface PhyStats
Returns:
a bitmask made up of SENSE_ constants or CAN_ constants
See Also:
PhyStats.SENSE_ITEMNOREMOVE, PhyStats.CAN_NOT_SEE, PhyStats.setSensesMask(int)

disposition

public int disposition()
Description copied from interface: PhyStats
Returns a bitmask for disposition related flags of Physicals (IS_ constants).

Specified by:
disposition in interface PhyStats
Returns:
a bitmask of disposition related flags
See Also:
PhyStats.IS_BONUS, PhyStats.setDisposition(int)

level

public int level()
Description copied from interface: PhyStats
Returns the experience level of the mob, item, exit, Physical.

Specified by:
level in interface PhyStats
Returns:
the experience level
See Also:
PhyStats.setLevel(int)

ability

public int ability()
Description copied from interface: PhyStats
Returns the ability level (a secondary level, e.g. if magical, how much?) Also acts as a random flag for various purposes. For instance, on mobs, it designates a hit point multiplier.

Specified by:
ability in interface PhyStats
Returns:
the ability level (or misc integer)
See Also:
PhyStats.setAbility(int)

rejuv

public int rejuv()
Description copied from interface: PhyStats
Returns the number of ticks before a Physical removed from the game (due to death, destruction, or just removal from home) is restored.

Specified by:
rejuv in interface PhyStats
Returns:
the number of ticks before rejuv (0==never)
See Also:
PhyStats.setRejuv(int)

weight

public int weight()
Description copied from interface: PhyStats
Returns the weight of this Physical, in pounds.

Specified by:
weight in interface PhyStats
Returns:
the weight of this Physical
See Also:
PhyStats.setWeight(int)

height

public int height()
Description copied from interface: PhyStats
Returns the height of this Physical, in inches

Specified by:
height in interface PhyStats
Returns:
the height of this Physical, in inches (0=indeterminate)
See Also:
PhyStats.setHeight(int)

armor

public int armor()
Description copied from interface: PhyStats
Returns the defensive capability number of this Physical.

Specified by:
armor in interface PhyStats
Returns:
the raw defensive capability of this Physical
See Also:
PhyStats.setArmor(int)

damage

public int damage()
Description copied from interface: PhyStats
Returns the maximum damaging ability of this Physical

Specified by:
damage in interface PhyStats
Returns:
the maxiumu damaging ability of this Physical
See Also:
PhyStats.setDamage(int)

speed

public double speed()
Description copied from interface: PhyStats
Returns the number of actions this mob can do per tick.

Specified by:
speed in interface PhyStats
Returns:
the number of actions per tick.
See Also:
PhyStats.setSpeed(double)

attackAdjustment

public int attackAdjustment()
Description copied from interface: PhyStats
Returns the rawcombat attack prowess of this Physical Usually mobs or weapons

Specified by:
attackAdjustment in interface PhyStats
Returns:
the raw combat attack prowess of this Physical
See Also:
PhyStats.setAttackAdjustment(int)

newName

public java.lang.String newName()
Description copied from interface: PhyStats
Returns a modified name for this Physical, usually null for no change.

Specified by:
newName in interface PhyStats
Returns:
the modified name, or null
See Also:
PhyStats.setName(String)

ambiances

public java.lang.String[] ambiances()
Description copied from interface: PhyStats
Returns a list of ambiances (extra words, visible fields) that are tacked onto the display text of this Physical.

Specified by:
ambiances in interface PhyStats
Returns:
a list of ambiances
See Also:
PhyStats.addAmbiance(String), PhyStats.delAmbiance(String), PhyStats.isAmbiance(String)

setRejuv

public void setRejuv(int newRejuv)
Description copied from interface: PhyStats
Sets the number of ticks before a Physical removed from the game (due to death, destruction, or just removal from home) is restored.

Specified by:
setRejuv in interface PhyStats
Parameters:
newRejuv - the new number of ticks before rejuv (0==never)
See Also:
PhyStats.rejuv()

setLevel

public void setLevel(int newLevel)
Description copied from interface: PhyStats
Sets the experience level of the mob, item, exit, Physical.

Specified by:
setLevel in interface PhyStats
Parameters:
newLevel - the new experience level
See Also:
PhyStats.level()

setArmor

public void setArmor(int newArmor)
Description copied from interface: PhyStats
Sets the defensive capability number of this Physical.

Specified by:
setArmor in interface PhyStats
Parameters:
newArmor - the defensive capability number of this Physical
See Also:
PhyStats.armor()

setDamage

public void setDamage(int newDamage)
Description copied from interface: PhyStats
Sets the maximum damaging ability of this Physical

Specified by:
setDamage in interface PhyStats
Parameters:
newDamage - the new maximum damaging ability of this Physical
See Also:
PhyStats.damage()

setWeight

public void setWeight(int newWeight)
Description copied from interface: PhyStats
Sets the weight of this Physical, in pounds.

Specified by:
setWeight in interface PhyStats
Parameters:
newWeight - the new weight of this Physical
See Also:
PhyStats.weight()

setSpeed

public void setSpeed(double newSpeed)
Description copied from interface: PhyStats
Sets the number of actions this mob can do per tick

Specified by:
setSpeed in interface PhyStats
Parameters:
newSpeed - the new number of actions this mob can do per tick
See Also:
PhyStats.speed()

setAttackAdjustment

public void setAttackAdjustment(int newAdjustment)
Description copied from interface: PhyStats
Sets the rawcombat attack prowess of this Physical Usually mobs or weapons

Specified by:
setAttackAdjustment in interface PhyStats
Parameters:
newAdjustment - the new raw combat attack prowess of this Physical
See Also:
PhyStats.attackAdjustment()

setAbility

public void setAbility(int newAdjustment)
Description copied from interface: PhyStats
Sets the ability level (a secondary level, e.g. if magical, how much?) Also acts as a random flag for various purposes. For instance, on mobs, it designates a hit point multiplier.

Specified by:
setAbility in interface PhyStats
Parameters:
newAdjustment - the new ability level (or misc integer)
See Also:
PhyStats.ability()

setDisposition

public void setDisposition(int newDisposition)
Description copied from interface: PhyStats
Sets a bitmask for disposition related flags of Physicals (IS_ constants).

Specified by:
setDisposition in interface PhyStats
Parameters:
newDisposition - a bitmask of disposition flags
See Also:
PhyStats.IS_BONUS, PhyStats.disposition()

setSensesMask

public void setSensesMask(int newMask)
Description copied from interface: PhyStats
Sets a bitmask for sense related flags of mobs (CAN_ constants), or miscellaneous runtime flags for items and other Physicals (SENSE_ constants).

Specified by:
setSensesMask in interface PhyStats
Parameters:
newMask - a bitmask made up of SENSE_ constants or CAN_ constants
See Also:
PhyStats.SENSE_ITEMNOREMOVE, PhyStats.CAN_NOT_SEE, PhyStats.setSensesMask(int)

setHeight

public void setHeight(int newHeight)
Description copied from interface: PhyStats
Sets the height of this Physical, in inches

Specified by:
setHeight in interface PhyStats
Parameters:
newHeight - the new height of this Physical, in inches (0=indeterminate)
See Also:
PhyStats.height()

setName

public void setName(java.lang.String newName)
Description copied from interface: PhyStats
Sets a modified name for this Physical, usually null for no change.

Specified by:
setName in interface PhyStats
Parameters:
newName - the modified name, or null
See Also:
PhyStats.newName()

getCombatStats

public java.lang.String getCombatStats()
Description copied from interface: PhyStats
Returns a single string summary of several important stats from this object.

Specified by:
getCombatStats in interface PhyStats
Returns:
a single string summary of several important stats from this object.

addAmbiance

public void addAmbiance(java.lang.String ambiance)
Description copied from interface: PhyStats
Adds an ambiance (extra word, visible field) to the list that are tacked onto the display text of this Physical.

Specified by:
addAmbiance in interface PhyStats
Parameters:
ambiance - a new ambiance string
See Also:
PhyStats.ambiances(), PhyStats.delAmbiance(String), PhyStats.isAmbiance(String)

delAmbiance

public void delAmbiance(java.lang.String ambiance)
Description copied from interface: PhyStats
Removes an ambiance (extra word, visible field) from the list that are tacked onto the display text of this Physical.

Specified by:
delAmbiance in interface PhyStats
Parameters:
ambiance - the old ambiance string
See Also:
PhyStats.ambiances(), PhyStats.addAmbiance(String), PhyStats.isAmbiance(String)

isAmbiance

public boolean isAmbiance(java.lang.String ambiance)
Description copied from interface: PhyStats
Check to see if the given ambiance exists in the list.

Specified by:
isAmbiance in interface PhyStats
Parameters:
ambiance - the ambiance to look for
Returns:
true if its in there, false otherwise
See Also:
PhyStats.addAmbiance(String), PhyStats.delAmbiance(String), PhyStats.ambiances()

movesReqToPull

public int movesReqToPull()
Description copied from interface: PhyStats
Returns the number of move points required to pull It is derived from the weight.

Specified by:
movesReqToPull in interface PhyStats
Returns:
the weight of this Physical

movesReqToPush

public int movesReqToPush()
Description copied from interface: PhyStats
Returns the number of move points required to push It is derived from the weight.

Specified by:
movesReqToPush in interface PhyStats
Returns:
the weight of this Physical

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

copyInto

public void copyInto(PhyStats intoStats)
Description copied from interface: PhyStats
Copies the internal data of this object into another of kind.

Specified by:
copyInto in interface PhyStats
Parameters:
intoStats - another PhyStats object.

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

getSaveStatIndex

public int getSaveStatIndex()
Description copied from interface: Modifiable
Returns the index into the stat codes array where extra savable fields begins. This number is always the same as getStatCodes().length unless there are extra fields which need to be saved in xml for generic objects. This method is used by editors for post-build user-defined fields.

Specified by:
getSaveStatIndex in interface Modifiable
Returns:
the index into getStatCodes()
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String), Modifiable.setStat(String, String)

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: Modifiable
Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.

Specified by:
getStatCodes in interface Modifiable
Returns:
list of the fields which may be set.
See Also:
Modifiable.getStat(String), Modifiable.setStat(String, String)

isStat

public boolean isStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
isStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
true if the code is a real value, false otherwise
See Also:
Modifiable.getStatCodes()

getCodeNum

protected int getCodeNum(java.lang.String code)

sameAs

public boolean sameAs(PhyStats E)
Description copied from interface: PhyStats
Returns whether the given object is substantially the same as this one

Specified by:
sameAs in interface PhyStats
Parameters:
E - the PhyStats to compare to
Returns:
whether or not they are the same

setStat

public void setStat(java.lang.String code,
                    java.lang.String val)
Description copied from interface: Modifiable
An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. The value passed in is always a string, even if the field itself is numeric or a list.

Specified by:
setStat in interface Modifiable
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
Modifiable.getStatCodes()

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
getStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
Modifiable.getStatCodes()

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>