com.planet_ink.coffee_mud.Common
Class DefaultEnvStats

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.DefaultEnvStats
All Implemented Interfaces:
CMCommon, EnvStats, CMModifiable, CMObject, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class DefaultEnvStats
extends java.lang.Object
implements EnvStats


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.EnvStats
ALLMASK, CAN_NOT_BREATHE, CAN_NOT_HEAR, CAN_NOT_MOVE, CAN_NOT_SEE, CAN_NOT_SMELL, CAN_NOT_SPEAK, CAN_NOT_TASTE, CAN_SEE_BONUS, CAN_SEE_CODES, CAN_SEE_DARK, CAN_SEE_DESCS, CAN_SEE_EVIL, CAN_SEE_GOOD, CAN_SEE_HIDDEN, 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_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_UNSAVABLE, IS_VERBS, NUM_STATS, SENSE_CONTENTSUNSEEN, SENSE_ITEMNEVERSAVED, SENSE_ITEMNODROP, SENSE_ITEMNOMAXRANGE, SENSE_ITEMNOMINRANGE, SENSE_ITEMNOREMOVE, SENSE_ITEMNORUIN, SENSE_ITEMNOTGET, SENSE_ITEMREADABLE, SENSE_ROOMGRIDSYNC, SENSE_ROOMNOMOVEMENT, SENSE_ROOMUNEXPLORABLE, SENSE_ROOMUNMAPPABLE, SENSE_UNLOCATABLE, SENSE_UNUSEDMASK15, SENSE_UNUSEDMASK16, SENSE_UNUSEDMASK17, STAT_ABILITY, STAT_ARMOR, STAT_ATTACK, STAT_DAMAGE, STAT_DISPOSITION, STAT_HEIGHT, STAT_LEVEL, STAT_REJUV, STAT_SENSES, STAT_WEIGHT
 
Constructor Summary
DefaultEnvStats()
           
 
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 Environmental.
 java.lang.String[] ambiances()
          Returns a list of ambiances (extra words, visible fields) that are tacked onto the display text of this Environmental.
 int armor()
          Returns the defensive capability number of this Environmental.
 int attackAdjustment()
          Returns the rawcombat attack prowess of this Environmental Usually mobs or weapons
 int compareTo(CMObject o)
           
 void copyInto(EnvStats 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 Environmental
 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 Environmental.
 int disposition()
          Returns a bitmask for disposition related flags of Environmentals (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 Environmental, 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 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, Environmental.
 CMObject newInstance()
          Returns a new instance of this class.
 java.lang.String newName()
          Returns a modified name for this Environmental, usually null for no change.
 int rejuv()
          Returns the number of ticks before an Environmental removed from the game (due to death, destruction, or just removal from home) is restored.
 boolean sameAs(EnvStats 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 Environmentals (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 Environmental.
 void setAttackAdjustment(int newAdjustment)
          Sets the rawcombat attack prowess of this Environmental Usually mobs or weapons
 void setDamage(int newDamage)
          Sets the maximum damaging ability of this Environmental
 void setDisposition(int newDisposition)
          Sets a bitmask for disposition related flags of Environmentals (IS_ constants).
 void setHeight(int newHeight)
          Sets the height of this Environmental, in inches
 void setLevel(int newLevel)
          Sets the experience level of the mob, item, exit, Environmental.
 void setName(java.lang.String newName)
          Sets a modified name for this Environmental, usually null for no change.
 void setRejuv(int newRejuv)
          Sets the number of ticks before an Environmental 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 Environmentals (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 Environmental, in pounds.
 double speed()
          Returns the number of actions this mob can do per tick.
 int weight()
          Returns the weight of this Environmental, 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

DefaultEnvStats

public DefaultEnvStats()
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, MiscTech. The name is typically identical to the class name.

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

setAllValues

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

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

sensesMask

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

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

disposition

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

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

level

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

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

ability

public int ability()
Description copied from interface: EnvStats
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 EnvStats
Returns:
the ability level (or misc integer)
See Also:
EnvStats.setAbility(int)

rejuv

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

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

weight

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

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

height

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

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

armor

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

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

damage

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

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

speed

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

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

attackAdjustment

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

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

newName

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

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

ambiances

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

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

setRejuv

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

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

setLevel

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

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

setArmor

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

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

setDamage

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

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

setWeight

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

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

setSpeed

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

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

setAttackAdjustment

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

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

setAbility

public void setAbility(int newAdjustment)
Description copied from interface: EnvStats
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 EnvStats
Parameters:
newAdjustment - the new ability level (or misc integer)
See Also:
EnvStats.ability()

setDisposition

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

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

setSensesMask

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

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

setHeight

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

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

setName

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

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

getCombatStats

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

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

addAmbiance

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

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

delAmbiance

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

Specified by:
delAmbiance in interface EnvStats
Parameters:
ambiance - the old ambiance string

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(EnvStats intoStats)
Description copied from interface: EnvStats
Copies the internal data of this object into another of kind.

Specified by:
copyInto in interface EnvStats
Parameters:
intoStats - another EnvStats 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: CMModifiable
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 CMModifiable
Returns:
the index into getStatCodes()
See Also:
CMModifiable.getStatCodes(), CMModifiable.getStat(String), CMModifiable.setStat(String, String)

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: CMModifiable
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 CMModifiable
Returns:
list of the fields which may be set.
See Also:
CMModifiable.getStat(String), CMModifiable.setStat(String, String)

isStat

public boolean isStat(java.lang.String code)
Description copied from interface: CMModifiable
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 CMModifiable
Parameters:
code - the name of the field to read.
Returns:
true if the code is a real value, false otherwise
See Also:
CMModifiable.getStatCodes()

getCodeNum

protected int getCodeNum(java.lang.String code)

sameAs

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

Specified by:
sameAs in interface EnvStats
Parameters:
E - the EnvStats 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: CMModifiable
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 CMModifiable
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
CMModifiable.getStatCodes()

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: CMModifiable
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 CMModifiable
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
CMModifiable.getStatCodes()

compareTo

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