com.planet_ink.coffee_mud.Items.Basic
Class StdItem

java.lang.Object
  extended by com.planet_ink.coffee_mud.Items.Basic.StdItem
All Implemented Interfaces:
Affectable, Behavable, CMObject, Contingent, DBIdentifiable, Environmental, Modifiable, MsgListener, Physical, PhysicalAgent, Readable, Rider, StatsAffecting, Tickable, Item, Wearable, java.lang.Cloneable, java.lang.Comparable<CMObject>
Direct Known Subclasses:
DruidicMonument, Gem, GenAmmunition, GenItem, LightSource, ManualAdvancement, ManualArchon, ManualClasses, PracticePoint, QuestPoint, Ring, StdBook, StdClanFlag, StdClanItem, StdCoins, StdContainer, StdDice, StdDissertation, StdElecItem, StdFood, StdJournal, StdKey, StdLawBook, StdLimb, StdMap, StdPaper, StdPlayingCard, StdPowder, StdProgram, StdScroll, StdSpaceBody, StdTechItem, StdThinArmor, StdTitle, StdWand, StdWeapon, TrainingSession

public class StdItem
extends java.lang.Object
implements Item


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
Wearable.CODES
 
Field Summary
protected  EachApplicable.ApplyAffectPhyStats affectPhyStats
           
protected  SVector<Ability> affects
           
protected  int baseGoldValue
           
protected  PhyStats basePhyStats
           
protected  SVector<Behavior> behaviors
           
protected  java.lang.String cachedImageName
           
protected static java.lang.String[] CODES
           
protected  java.lang.String databaseID
           
protected  java.lang.Object description
           
protected  boolean destroyed
           
protected  java.lang.String displayText
           
protected  long dispossessionTime
           
protected  int material
           
protected  Item me
           
protected  java.lang.String miscText
           
protected  Container myContainer
           
protected  int myUses
           
protected  long myWornCode
           
protected  java.lang.String name
           
protected  ItemPossessor owner
           
protected  PhyStats phyStats
           
protected  long properWornBitmap
           
protected  java.lang.String rawImageName
           
protected  Rideable riding
           
protected  SVector<ScriptingEngine> scripts
           
protected  java.lang.String secretIdentity
           
protected  short tickCtr
           
protected  int tickStatus
           
protected  boolean wornLogicalAnd
           
protected  java.lang.String[] xtraValues
           
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
DEFAULT_WORN_CODES, DEFAULT_WORN_DEPENDENCYGRID, DEFAULT_WORN_DESCS, DEFAULT_WORN_ORDER, DEFAULT_WORN_USUAL_NAMES, DEFAULT_WORN_WEIGHT_POINTS, DEFAULT_WORN_WEIGHTS, FILTER_ANY, FILTER_MOBINVONLY, FILTER_ROOMONLY, FILTER_UNWORNONLY, FILTER_WORNONLY, HIGHEST_WORN_CODE, IN_INVENTORY, WORN_ABOUT_BODY, WORN_ARMS, WORN_BACK, WORN_EARS, WORN_EYES, WORN_FEET, WORN_FLOATING_NEARBY, WORN_HANDS, WORN_HEAD, WORN_HELD, WORN_LEFT_FINGER, WORN_LEFT_WRIST, WORN_LEGS, WORN_MOUTH, WORN_NECK, WORN_RIGHT_FINGER, WORN_RIGHT_WRIST, WORN_TORSO, WORN_WAIST, WORN_WIELD
 
Constructor Summary
StdItem()
           
 
Method Summary
protected  boolean abilityImbuesMagic()
           
 void addBehavior(Behavior to)
          Manipulation of Behavior objects, which includes movement, speech, spellcasting, etc, etc.
 void addEffect(Ability to)
          Add a new effect to this object, whether permanent or temporary.
 void addNonUninvokableEffect(Ability to)
          Same as addEffect(Ability), but will set the Ability object as never being able to be uninvoked.
 void addScript(ScriptingEngine S)
          Manipulation of the scripts list
 void affectCharState(MOB affectedMob, CharState affectableMaxState)
          This method is called by the recoverCharState() method on other MOB objects.
 void affectCharStats(MOB affectedMob, CharStats affectableStats)
          This method is called by the recoverCharStats() method on other MOB objects.
 void affectPhyStats(Physical affected, PhyStats affectableStats)
          This method is called by the recoverPhyStats() method on other Environmental objects.
protected  boolean alreadyWornMsg(MOB mob, Item thisItem)
           
 boolean amBeingWornProperly()
          Returns whether this item is being worn properly, regardless of layering or multi-restrictions.
 boolean amDestroyed()
          Whether the destroy() method has been previousy called on this object.
 boolean amWearingAt(long wornCode)
          Can test where, if anywhere, an item is being worn.
 int baseGoldValue()
          The user/builder-entered value of the item, represented in base CoffeeMud currency.
 PhyStats basePhyStats()
          Object containing a set of base, unmodified, mostly numeric fields.
 java.util.Enumeration<Behavior> behaviors()
          Returns an enumerator of all the behaviors on this object.
 boolean canSaveDatabaseID()
          Returns true if this object can safely store and retrieve a database ID, and false if the TYPE of object can, but this particular instance can not.
 boolean canWear(MOB mob, long where)
          Returns whether it is practical for the given mob to wear this Item on the given worn location as given by the wornCode.
protected  boolean canWearComplete(MOB mob, long wearWhere)
           
protected  void cloneFix(Item I)
           
 boolean compareProperLocations(Item toThis)
          compares whether this item is allowed to be worn on the same locations as the given item.
 int compareTo(CMObject o)
           
 Container container()
          Where the item is located.
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 java.lang.String databaseID()
          Retrieve the unique contextual database ID for this object.
 void delAllBehaviors()
          Removes all behaviors from this object.
 void delAllEffects(boolean unInvoke)
          Optionally uninvokes and then certainly removes all effects from this object.
 void delAllScripts()
          Removes all executing scripts from this object.
 void delBehavior(Behavior to)
          Delete a behavior from this object.
 void delEffect(Ability to)
          Delete an effect from this object, whether permanent or temporary.
 void delScript(ScriptingEngine S)
          Remove a running script from this object.
 java.lang.String description()
          The basic description of this object, as shown when the item is directly LOOKed at.
 java.lang.String description(MOB viewerMob)
          Returns the description, but as seen by the given viewer.
 void destroy()
          Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java.
 java.lang.String displayText()
          Gets the raw string used to show what this object looks like in the room.
 java.lang.String displayText(MOB viewerMob)
          Returns the displayText, but as seen by the given viewer.
 void eachBehavior(EachApplicable<Behavior> applier)
          Applies the given code to each behavior on this object
 void eachEffect(EachApplicable<Ability> applier)
          Applies the given code to each effect on this object
 void eachScript(EachApplicable<ScriptingEngine> applier)
          Applies the given code to each scripting engine on this object
 java.util.Enumeration<Ability> effects()
          Returns an enumerator of abilities listed as effects on this object.
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
 long expirationDate()
          If this object expires, it should have a timestamp saying when it expires, in real time.
 Behavior fetchBehavior(int index)
          Returns a behavior object on this object.
 Behavior fetchBehavior(java.lang.String ID)
          Returns a behavior object listed on this object.
 Ability fetchEffect(int index)
          Returns an ability object listed as an effect on this object.
 Ability fetchEffect(java.lang.String ID)
          Returns an ability object listed as an effect on this object.
 ScriptingEngine fetchScript(int x)
          Retrieve one of the enumerated scripts running on this object
 boolean fitsOn(long wornCode)
          Whether this item is designated as being wearable on the given worn codes defined in the Item interface.
protected  int getCodeNum(java.lang.String code)
           
 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 getTickStatus()
          A coded status for this object during the period where its tick method is being called.
protected  java.lang.String I(java.lang.String str)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 java.lang.String image()
          Returns the fully qualified and determined name of the image file displayed for this object when MXP is used.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 boolean isGeneric()
          Whether the fields of this item are set in code, or set by builders.
 boolean isReadable()
          Returns whether this thing is readable when the player uses the READ command and targets it.
 boolean isSavable()
          Whether, if this object is in a room, whether it is appropriate to save this object to the database as a permanent feature of its container.
 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.
 java.lang.String L(java.lang.String str, java.lang.String... xs)
          Localize an internal string -- shortcut.
 int material()
          The resource code representing the material out of which this item is principally made.
 int maxRange()
          the maximum range of this object, if applicable.
 int minRange()
          the minimum range of this object, if applicable.
 java.lang.String miscTextFormat()
          Unimplemented as of yet, but will hold a string telling the system what the proper format of any miscText data.
 java.lang.String name()
          The nice displayable name of this instance of this object
 java.lang.String Name()
          The raw unmodified name of this object as stored in the database.
 java.lang.String name(MOB viewerMob)
          Returns the name, but as seen by the given viewer.
 CMObject newInstance()
          Returns a new instance of this class.
 int numBehaviors()
          The number of behaviors this object has.
 int numberOfItems()
          How many items this Item object represents.
 int numEffects()
          Returns the number of ability objects listed as effects on this object.
 int numScripts()
          Return the number of scripts running on this object
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
 ItemPossessor owner()
          The Room or MOB representing where this item is located.
 PhyStats phyStats()
          Object containing a set of current, modified, usable, mostly numeric fields.
 java.lang.String rawImage()
          Returns the raw name of the image file to display for this object when MXP is used.
 boolean rawLogicalAnd()
          Flag which determines whether the rawProperLocationBitmap represents the fact that it is worn on ALL locations (value of true) or worn on any of the locations.
 long rawProperLocationBitmap()
          Returns the builder-defined bitmap made from a logical combination of the worn location constants from the Item interface.
 java.lang.String rawSecretIdentity()
          This method returns those secret properties of the item which are entered directly by the builder when the item is designed.
 long rawWornCode()
          Returns the bitmap representing where this item is presently being worn by the mob or player who has the item in his or inventory.
 java.lang.String readableText()
          For things that are readable, this returns the readable string for this thing.
 void recoverPhyStats()
          This method copies the basePhyStats() object into the phyStats() object, then makes repeated calls to all surrounding objects with affectPhyStats(Environmental,PhyStats) method.
 int recursiveWeight()
          For a normal item, this method returns the same as phyStats().weight().
 void removeFromOwnerContainer()
          This method basically calls setContainer(null), and then removes this item from its owner().
 Rideable riding()
          Returns the Rideable upon which this Rider is Riding.
 boolean sameAs(Environmental E)
          Whether this object instance is functionally identical to the object passed in.
 java.util.Enumeration<ScriptingEngine> scripts()
          Returns an enumerator of all the scripts on this object.
 java.lang.String secretIdentity()
          This method returns the calculated and expanded description of the properties of the item as would be discovered through the Identify spell.
 void setBasePhyStats(PhyStats newStats)
          Re-sets the object containing a set of base, unmodified, mostly numeric fields.
 void setBaseValue(int newValue)
          Changes the base value of the item, represented in base CoffeeMud currency.
 void setContainer(Container newContainer)
          Change the container where the item is located.
 void setDatabaseID(java.lang.String id)
          Set the unique contextual database ID for this object.
 void setDescription(java.lang.String newDescription)
          Sets the basic description of this object, as shown when the item is directly LOOKed at.
 void setDisplayText(java.lang.String newDisplayText)
          Sets the raw string used to show what this object looks like in the room.
 void setExpirationDate(long time)
          If this object expires, it should have a timestamp saying when it expires, in real time.
 void setImage(java.lang.String newImage)
          Sets the raw name of the image file to display for this object when MXP is used.
 void setMaterial(int newValue)
          Sets the resource code representing the material out of which this item is principally made.
 void setMiscText(java.lang.String newText)
          For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object.
 void setName(java.lang.String newName)
          Sets the raw unmodified name of this object as stored in the database.
 void setOwner(ItemPossessor E)
          Sets the Room or MOB representing where this item is located.
 void setRawLogicalAnd(boolean newAnd)
          Sets flag which determines whether the rawProperLocationBitmap represents the fact that it is worn on ALL locations (value of true) or worn on any of the locations.
 void setRawProperLocationBitmap(long newValue)
          Sets the builder-defined bitmap made from a logical combination of the worn location constants from the Item interface.
 void setRawWornCode(long newValue)
          Sets the bitmap representing where this item is presently being worn by the mob or player who has the item in his or inventory.
 void setReadable(boolean truefalse)
          Returns whether this thing is readable when the player uses the READ command and targets it.
 void setReadableText(java.lang.String text)
          For things that are readable, this set the readable string for this thing.
 void setRiding(Rideable ride)
          Sets the Rideable upon which this Rider is Riding.
 void setSavable(boolean truefalse)
          Sets whether this object can be saved as a permanent aspect of its host.
 void setSecretIdentity(java.lang.String newIdentity)
          This method is used to change the string returned by rawSecretIdentity.
 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 setUsesRemaining(int newUses)
          Sets the uses remaining field, which is a general numeric value whose meaning differs for different Item types.
 void stopTicking()
          If this Item is current Ticking due to its having Behaviors or other properties which might grant it the ability to Tick, this method will cause that ticking to cease and desist.
 boolean subjectToWearAndTear()
          Whether the usesRemaining() number above is used to determine the percentage health of the item.
protected  java.lang.String tackOns()
           
 java.lang.String text()
          For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object.
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 Item ultimateContainer(Physical stopAtC)
          If an item is in a container, which is in a container, etc, this will return the "highest" or ultimate container in which this item is located.
 void unWear()
          Removes this item from a state of being worn, and puts it back into the mob or player inventory.
 int usesRemaining()
          Uses remaining is a general use numeric value whose meaning differs for different Item types.
 int value()
          The default value of the item, represented in the base CoffeeMud currency.
 void wearAt(long wornCode)
          This method is similar to the wearEvenIfImpossible method method above, except that it does not inspect this item for allowed wearable locations, but always puts the item on the wear location represented by the given wornCode bitmap.
 void wearEvenIfImpossible(MOB mob)
          Puts this item into a state of being worn regardless of whether it is practical for the given mob to wear it -- for instance, even if an item is already being worn where this item wants to be worn, or if the player has no such limbs to wear this item.
 boolean wearIfPossible(MOB mob)
          Using the canWear method, this method will put the item into a state of being worn only if it is practical for the given mob or player to wear this Item.
 boolean wearIfPossible(MOB mob, long wearCode)
          Using the canWear method, this method will put the item into a state of being worn on the given location only if it is practical for the given mob or player to wear this Item at the given location.
 long whereCantWear(MOB mob)
          Returns a bitmap of all the locations where the given mob is practically unable to wear an item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

displayText

protected java.lang.String displayText

description

protected java.lang.Object description

myUses

protected int myUses

myWornCode

protected long myWornCode

miscText

protected java.lang.String miscText

riding

protected Rideable riding

rawImageName

protected java.lang.String rawImageName

cachedImageName

protected java.lang.String cachedImageName

secretIdentity

protected java.lang.String secretIdentity

wornLogicalAnd

protected boolean wornLogicalAnd

properWornBitmap

protected long properWornBitmap

baseGoldValue

protected int baseGoldValue

material

protected int material

xtraValues

protected java.lang.String[] xtraValues

dispossessionTime

protected long dispossessionTime

tickCtr

protected short tickCtr

tickStatus

protected int tickStatus

databaseID

protected java.lang.String databaseID

destroyed

protected boolean destroyed

me

protected Item me

phyStats

protected PhyStats phyStats

basePhyStats

protected PhyStats basePhyStats

myContainer

protected volatile Container myContainer

owner

protected volatile ItemPossessor owner

affects

protected SVector<Ability> affects

behaviors

protected SVector<Behavior> behaviors

scripts

protected SVector<ScriptingEngine> scripts

affectPhyStats

protected EachApplicable.ApplyAffectPhyStats affectPhyStats

CODES

protected static java.lang.String[] CODES
Constructor Detail

StdItem

public StdItem()
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

abilityImbuesMagic

protected boolean abilityImbuesMagic()

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

isGeneric

public boolean isGeneric()
Description copied from interface: Environmental
Whether the fields of this item are set in code, or set by builders. Generic means that they are set by builders, in which case XML is returned by the text() method containing all of the values for all the fields.

Specified by:
isGeneric in interface Environmental
Returns:
whether this item is modifiable by builders
See Also:
Environmental.text()

Name

public java.lang.String Name()
Description copied from interface: Environmental
The raw unmodified name of this object as stored in the database. This is the name set by builders and used as a basis for the name() method.

Specified by:
Name in interface Environmental
Returns:
the raw base name of this object on the map.
See Also:
Tickable.name()

setName

public void setName(java.lang.String newName)
Description copied from interface: Environmental
Sets the raw unmodified name of this object as stored in the database. This is the name set by builders and used as a basis for the name() method.

Specified by:
setName in interface Environmental
Parameters:
newName - the raw base name of this object on the map.
See Also:
Environmental.Name()

name

public java.lang.String name()
Description copied from interface: Tickable
The nice displayable name of this instance of this object

Specified by:
name in interface CMObject
Specified by:
name in interface Tickable
Returns:
the displayable name of this object instance
See Also:
Environmental.Name()

displayText

public java.lang.String displayText(MOB viewerMob)
Description copied from interface: Physical
Returns the displayText, but as seen by the given viewer. Can differ from displayText() without being saved to the DB. Display Texts are normally the way something appears in a room, or is the roomTitle of rooms.

Specified by:
displayText in interface Physical
Parameters:
viewerMob - the mob viewing the physical thing
Returns:
the displayText as seen by the viewer
See Also:
Environmental.displayText()

name

public java.lang.String name(MOB viewerMob)
Description copied from interface: Physical
Returns the name, but as seen by the given viewer. Can differ from name() without being saved to the DB.

Specified by:
name in interface Physical
Parameters:
viewerMob - the mob viewing the physical thing
Returns:
the name as seen by the viewer
See Also:
Tickable.name()

setDatabaseID

public void setDatabaseID(java.lang.String id)
Description copied from interface: DBIdentifiable
Set the unique contextual database ID for this object.

Specified by:
setDatabaseID in interface DBIdentifiable
Parameters:
id - the unique contextual database ID for this object.
See Also:
DBIdentifiable.canSaveDatabaseID(), DBIdentifiable.databaseID()

canSaveDatabaseID

public boolean canSaveDatabaseID()
Description copied from interface: DBIdentifiable
Returns true if this object can safely store and retrieve a database ID, and false if the TYPE of object can, but this particular instance can not.

Specified by:
canSaveDatabaseID in interface DBIdentifiable
Returns:
true if setDatabaseID can be called, false otherwise
See Also:
DBIdentifiable.databaseID(), DBIdentifiable.setDatabaseID(String)

databaseID

public java.lang.String databaseID()
Description copied from interface: DBIdentifiable
Retrieve the unique contextual database ID for this object.

Specified by:
databaseID in interface DBIdentifiable
Returns:
the unique contextual database ID for this object.
See Also:
DBIdentifiable.canSaveDatabaseID(), DBIdentifiable.setDatabaseID(String)

image

public java.lang.String image()
Description copied from interface: Environmental
Returns the fully qualified and determined name of the image file displayed for this object when MXP is used. If rawImage() is non-empty, it will return rawImage, and otherwise use the mxp default data file.

Specified by:
image in interface Environmental
Returns:
the name of the mxp image to display for this object.

rawImage

public java.lang.String rawImage()
Description copied from interface: Environmental
Returns the raw name of the image file to display for this object when MXP is used. This is the value set by the builder, and may be returned by image() if it is non-empty.

Specified by:
rawImage in interface Environmental
Returns:
the raw name of the mxp image file

setImage

public void setImage(java.lang.String newImage)
Description copied from interface: Environmental
Sets the raw name of the image file to display for this object when MXP is used. This is the value set by the builder, and may be returned by image() if it is non-empty.

Specified by:
setImage in interface Environmental
Parameters:
newImage - the raw name of the mxp image file

phyStats

public PhyStats phyStats()
Description copied from interface: Affectable
Object containing a set of current, modified, usable, mostly numeric fields. This object is based on the object from basePhyStats() and then updated and modified by the recoverPhyStats() method. See the PhyStats interface for information on the fields herein.

Specified by:
phyStats in interface Affectable
Returns:
the current set of state fields
See Also:
Affectable.basePhyStats(), Affectable.recoverPhyStats(), PhyStats

basePhyStats

public PhyStats basePhyStats()
Description copied from interface: Affectable
Object containing a set of base, unmodified, mostly numeric fields. The values on the fields in this object will be as they were set by the builder. This object is used as a basis for the recoverPhyStats() method. See the PhyStats interface for information on the fields herein.

Specified by:
basePhyStats in interface Affectable
Returns:
a set of state fields
See Also:
Affectable.phyStats(), Affectable.recoverPhyStats(), PhyStats

recoverPhyStats

public void recoverPhyStats()
Description copied from interface: Affectable
This method copies the basePhyStats() object into the phyStats() object, then makes repeated calls to all surrounding objects with affectPhyStats(Environmental,PhyStats) method. Surrounding objects include the room where the object is located, the Ability objects in the Effects list, the Behaviors in the behaviors list, and race/charclass/area if applicable. Those methods will then make all necessary adjustments to the values in the new phyStats() object. When it returns, phyStats() will have a totally updated object. This method must be called in code whenever the object is placed on the map, or when anything changes in its environment, such as location, effects, or other states.

Specified by:
recoverPhyStats in interface Affectable
See Also:
Affectable.basePhyStats(), Affectable.phyStats(), Affectable.addEffect(Ability), Behavable.addBehavior(Behavior), PhyStats

setBasePhyStats

public void setBasePhyStats(PhyStats newStats)
Description copied from interface: Affectable
Re-sets the object containing a set of base, unmodified, mostly numeric fields. The values on the fields in this object will be as they were set by the builder. This object is used as a basis for the recoverPhyStats() method. See the PhyStats interface for information on the fields herein. This method is rarely called -- the fields therein are usually set using setter methods from the PhyStats interface on the object itself.

Specified by:
setBasePhyStats in interface Affectable
Parameters:
newStats - a set of state fields
See Also:
Affectable.phyStats(), Affectable.recoverPhyStats(), PhyStats

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

subjectToWearAndTear

public boolean subjectToWearAndTear()
Description copied from interface: Item
Whether the usesRemaining() number above is used to determine the percentage health of the item. If this method returns false, then health or condition is irrelevant to this Item. If true is returned, then usesRemaining is a number from 100 to 0, where 100 means perfect condition, and 0 means imminent disintegration.

Specified by:
subjectToWearAndTear in interface Item
Returns:
whether this item has a valid condition

cloneFix

protected void cloneFix(Item I)

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

riding

public Rideable riding()
Description copied from interface: Rider
Returns the Rideable upon which this Rider is Riding.

Specified by:
riding in interface Rider
Returns:
the Rideable upon which this Rider is Riding.
See Also:
Rideable

setRiding

public void setRiding(Rideable ride)
Description copied from interface: Rider
Sets the Rideable upon which this Rider is Riding.

Specified by:
setRiding in interface Rider
Parameters:
ride - the Rideable to ride upon
See Also:
Rideable

owner

public ItemPossessor owner()
Description copied from interface: Item
The Room or MOB representing where this item is located. Containers are handled by another pointer, container(), so those two methods be used together to determine where a given item is.

Specified by:
owner in interface Item
Returns:
the mob or room where the item is located
See Also:
MOB, Item

setOwner

public void setOwner(ItemPossessor E)
Description copied from interface: Item
Sets the Room or MOB representing where this item is located. Containers are handled by another pointer, container(), so those two methods be used together to determine where a given item is. This method is called by the addItem method on mobs and the addItem interface on Rooms. Alone, this method is insufficient to properly determine an items location, so one of the two above should be called instead.

Specified by:
setOwner in interface Item
Parameters:
E - the mob or room where the item is located
See Also:
ItemCollection.addItem(Item)

expirationDate

public long expirationDate()
Description copied from interface: Environmental
If this object expires, it should have a timestamp saying when it expires, in real time. When it expires, a MSG_EXPIRE message will be sent to it.

Specified by:
expirationDate in interface Environmental
Returns:
the time stamp when this thing expires
See Also:
Environmental.setExpirationDate(long)

setExpirationDate

public void setExpirationDate(long time)
Description copied from interface: Environmental
If this object expires, it should have a timestamp saying when it expires, in real time. When it expires, a MSG_EXPIRE message will be sent to it.

Specified by:
setExpirationDate in interface Environmental
Parameters:
time - the time stamp when this thing expires
See Also:
Environmental.expirationDate()

amDestroyed

public boolean amDestroyed()
Description copied from interface: Contingent
Whether the destroy() method has been previousy called on this object.

Specified by:
amDestroyed in interface Contingent
Returns:
whether the object is destroy()ed.

amWearingAt

public boolean amWearingAt(long wornCode)
Description copied from interface: Wearable
Can test where, if anywhere, an item is being worn. The value may be 0 to see if the item is not being worn (since 0 means inventory) or a combination of 1 or more of the worn codes listed in the Item interface.

Specified by:
amWearingAt in interface Wearable
Parameters:
wornCode - either 0, or one or more worn codes
Returns:
whether this item is being worn on the wornCode location
See Also:
Item

amBeingWornProperly

public boolean amBeingWornProperly()
Description copied from interface: Wearable
Returns whether this item is being worn properly, regardless of layering or multi-restrictions. If the item is unworn, or floating via magic, it will return false. Otherwise true.

Specified by:
amBeingWornProperly in interface Wearable
Returns:
true if its being properly worn.

fitsOn

public boolean fitsOn(long wornCode)
Description copied from interface: Wearable
Whether this item is designated as being wearable on the given worn codes defined in the Item interface. This method does not care about the practicality of wearing for a given mob (in other words, whether an item is already being worn on the location is not checked).

Specified by:
fitsOn in interface Wearable
Parameters:
wornCode - the worn code to check, as defined in the Item interface
Returns:
whether this item is allowed to be worn on that location
See Also:
Item

wearEvenIfImpossible

public void wearEvenIfImpossible(MOB mob)
Description copied from interface: Wearable
Puts this item into a state of being worn regardless of whether it is practical for the given mob to wear it -- for instance, even if an item is already being worn where this item wants to be worn, or if the player has no such limbs to wear this item. None of that matter to this method. The item must be in the mobs inventory first.

Specified by:
wearEvenIfImpossible in interface Wearable
Parameters:
mob - the player or mob

wearIfPossible

public boolean wearIfPossible(MOB mob,
                              long wearCode)
Description copied from interface: Wearable
Using the canWear method, this method will put the item into a state of being worn on the given location only if it is practical for the given mob or player to wear this Item at the given location. The mob or player must have the item in his or her inventory first.

Specified by:
wearIfPossible in interface Wearable
Parameters:
mob - the player or mob to put this item on.
wearCode - the bitmap wear code for the location to attempt
Returns:
true if the item was wearable at the location

wearIfPossible

public boolean wearIfPossible(MOB mob)
Description copied from interface: Wearable
Using the canWear method, this method will put the item into a state of being worn only if it is practical for the given mob or player to wear this Item. The mob or player must have the item in his or her inventory first.

Specified by:
wearIfPossible in interface Wearable
Parameters:
mob - the player or mob to put this item on.
Returns:
true if the item was wearable

wearAt

public void wearAt(long wornCode)
Description copied from interface: Wearable
This method is similar to the wearEvenIfImpossible method method above, except that it does not inspect this item for allowed wearable locations, but always puts the item on the wear location represented by the given wornCode bitmap. This bitmap is made up of constants from the Item interface.

Specified by:
wearAt in interface Wearable
Parameters:
wornCode - the bitmap from Item interface constants used
See Also:
Item, Wearable.wearEvenIfImpossible(MOB)

rawProperLocationBitmap

public long rawProperLocationBitmap()
Description copied from interface: Wearable
Returns the builder-defined bitmap made from a logical combination of the worn location constants from the Item interface. When combined with the rawLogicalAnd() method, it says whether this item is wearable on all of the locations defined by this bitmap at the same time or whether this item is wearable on any of the locations defined by this bitmap.

Specified by:
rawProperLocationBitmap in interface Wearable
Returns:
the worn location bitmap defined by the Item interface.
See Also:
Item

rawLogicalAnd

public boolean rawLogicalAnd()
Description copied from interface: Wearable
Flag which determines whether the rawProperLocationBitmap represents the fact that it is worn on ALL locations (value of true) or worn on any of the locations.

Specified by:
rawLogicalAnd in interface Wearable
Returns:
whether this item is worn on all locations or any of the locations
See Also:
Wearable.rawProperLocationBitmap()

setRawProperLocationBitmap

public void setRawProperLocationBitmap(long newValue)
Description copied from interface: Wearable
Sets the builder-defined bitmap made from a logical combination of the worn location constants from the Item interface. When combined with the rawLogicalAnd() method, it says whether this item is wearable on all of the locations defined by this bitmap at the same time or whether this item is wearable on any of the locations defined by this bitmap.

Specified by:
setRawProperLocationBitmap in interface Wearable
Parameters:
newValue - the worn location bitmap defined by the Item interface.
See Also:
Item

setRawLogicalAnd

public void setRawLogicalAnd(boolean newAnd)
Description copied from interface: Wearable
Sets flag which determines whether the rawProperLocationBitmap represents the fact that it is worn on ALL locations (value of true) or worn on any of the locations.

Specified by:
setRawLogicalAnd in interface Wearable
Parameters:
newAnd - whether this item is worn on all locations or any of the locations
See Also:
Wearable.rawProperLocationBitmap()

compareProperLocations

public boolean compareProperLocations(Item toThis)
Description copied from interface: Wearable
compares whether this item is allowed to be worn on the same locations as the given item.

Specified by:
compareProperLocations in interface Wearable
Parameters:
toThis - the item to compare this items allowed worn locations to
Returns:
whether this item is allowed to be worn on the same place as the param

whereCantWear

public long whereCantWear(MOB mob)
Description copied from interface: Wearable
Returns a bitmap of all the locations where the given mob is practically unable to wear an item. The method compares items the mob is currently wearing to all possible wear locations, including locations where the mob can't wear things, and returns a bitmap representing all of those unwearable locations. The bitmap is constructed using the bitmap constants defined in the Item interface.

Specified by:
whereCantWear in interface Wearable
Parameters:
mob - the player or mob to evaluate for unwearable locations
Returns:
a bitmap made up of unwearable location bitmaps, from constants in Item interface
See Also:
Item

canWear

public boolean canWear(MOB mob,
                       long where)
Description copied from interface: Wearable
Returns whether it is practical for the given mob to wear this Item on the given worn location as given by the wornCode. The method checks for existing limbs and wear locations, and for items already being worn by the mob, and finally determines if the worn location given by the wornCode is among the available slots.

Specified by:
canWear in interface Wearable
Parameters:
mob - the player or mob being evaluated
where - the worn location to check and see if this Item can be worn there.
Returns:
whether this item can be worn by the given player at the given wornCode
See Also:
Item

rawWornCode

public long rawWornCode()
Description copied from interface: Wearable
Returns the bitmap representing where this item is presently being worn by the mob or player who has the item in his or inventory. The value returned by this method is set by the wear* methods defined above. The bitmap is made up of a combination of the wear location constants from the Item interface.

Specified by:
rawWornCode in interface Wearable
Returns:
the current worn code for this item
See Also:
Item, Wearable.wearAt(long), Wearable.wearIfPossible(MOB), Wearable.wearEvenIfImpossible(MOB)

setRawWornCode

public void setRawWornCode(long newValue)
Description copied from interface: Wearable
Sets the bitmap representing where this item is presently being worn by the mob or player who has the item in his or inventory. The value set by this method is set by the wear* methods defined above. The bitmap is made up of a combination of the wear location constants from the Item interface.

Specified by:
setRawWornCode in interface Wearable
Parameters:
newValue - the current worn code for this item
See Also:
Item, Wearable.wearAt(long), Wearable.wearIfPossible(MOB), Wearable.wearEvenIfImpossible(MOB)

unWear

public void unWear()
Description copied from interface: Wearable
Removes this item from a state of being worn, and puts it back into the mob or player inventory. setContainer(null) may still need be called to make the item visible to the players inventory.

Specified by:
unWear in interface Wearable

material

public int material()
Description copied from interface: Item
The resource code representing the material out of which this item is principally made. The resource codes are composed of an integer where the highest order bits represent the basic material type, and the lower order bits represent the specific material type. These codes are defined in RawMaterial.

Specified by:
material in interface Item
Returns:
the RawMaterial code describing what this item is made of.
See Also:
RawMaterial

setMaterial

public void setMaterial(int newValue)
Description copied from interface: Item
Sets the resource code representing the material out of which this item is principally made. The resource codes are composed of an integer where the highest order bits represent the basic material type, and the lower order bits represent the specific material type. These codes are defined in RawMaterial interface.

Specified by:
setMaterial in interface Item
Parameters:
newValue - the resource code
See Also:
RawMaterial

value

public int value()
Description copied from interface: Item
The default value of the item, represented in the base CoffeeMud currency. This method starts with baseGoldValue, which is a user-entered value, and adjusts according to magical enhancements and the condition of the item.

Specified by:
value in interface Item
Returns:
the adjusted value of the item in the base currency.

baseGoldValue

public int baseGoldValue()
Description copied from interface: Item
The user/builder-entered value of the item, represented in base CoffeeMud currency. It is used as a basis for the value returned by the value() method.

Specified by:
baseGoldValue in interface Item
Returns:
the raw user-entered value of item.

setBaseValue

public void setBaseValue(int newValue)
Description copied from interface: Item
Changes the base value of the item, represented in base CoffeeMud currency. The value is saved to the database, and is used by the value() method as a basis.

Specified by:
setBaseValue in interface Item
Parameters:
newValue - the new raw value of the item

readableText

public java.lang.String readableText()
Description copied from interface: Readable
For things that are readable, this returns the readable string for this thing. That is to say, what the player sees when they read the door.

Specified by:
readableText in interface Readable
Returns:
the readable string
See Also:
Readable.isReadable(), Readable.setReadable(boolean), Readable.setReadableText(String)

setReadableText

public void setReadableText(java.lang.String text)
Description copied from interface: Readable
For things that are readable, this set the readable string for this thing. That is to say, what the player sees when they read the door.

Specified by:
setReadableText in interface Readable
Parameters:
text - the readable text
See Also:
Readable.isReadable(), Readable.setReadable(boolean), Readable.readableText()

isReadable

public boolean isReadable()
Description copied from interface: Readable
Returns whether this thing is readable when the player uses the READ command and targets it.

Specified by:
isReadable in interface Readable
Returns:
true if the thing is readable.
See Also:
Readable.readableText(), Readable.setReadable(boolean), Readable.setReadableText(String)

setReadable

public void setReadable(boolean truefalse)
Description copied from interface: Readable
Returns whether this thing is readable when the player uses the READ command and targets it. Readable text should also be set or unset.

Specified by:
setReadable in interface Readable
Parameters:
truefalse - true if the thing is readable, and false otherwise
See Also:
Readable.readableText(), Readable.isReadable(), Readable.setReadableText(String)

affectPhyStats

public void affectPhyStats(Physical affected,
                           PhyStats affectableStats)
Description copied from interface: StatsAffecting
This method is called by the recoverPhyStats() method on other Environmental objects. It is used to transform the Environmental basePhyStats() object into a finished phyStats() object, both of which are objects implementing the PhyStats interface. See those methods for more information.

Specified by:
affectPhyStats in interface StatsAffecting
Parameters:
affected - the host of the PhyStats object being affected
affectableStats - the particular PhyStats object being affected
See Also:
PhyStats, Environmental, Affectable.basePhyStats(), Affectable.phyStats(), Affectable.recoverPhyStats()

affectCharStats

public void affectCharStats(MOB affectedMob,
                            CharStats affectableStats)
Description copied from interface: StatsAffecting
This method is called by the recoverCharStats() method on other MOB objects. It is used to transform the MOB baseCharStats() object into a finished charStats() object, both of which are objects implementing the CharStats interface. See those methods for more information.

Specified by:
affectCharStats in interface StatsAffecting
Parameters:
affectedMob - the host of the CharStats object being affected
affectableStats - the particular CharStats object being affected
See Also:
CharStats, MOB, MOB.baseCharStats(), MOB.charStats(), MOB.recoverCharStats()

affectCharState

public void affectCharState(MOB affectedMob,
                            CharState affectableMaxState)
Description copied from interface: StatsAffecting
This method is called by the recoverCharState() method on other MOB objects. It is used to transform the MOB baseCharState() object into a finished charState() object, both of which are objects implementing the CharState interface. See those methods for more information.

Specified by:
affectCharState in interface StatsAffecting
Parameters:
affectedMob - the host of the CharState object being affected
affectableMaxState - the particular CharState object being affected
See Also:
CharState, MOB, MOB.baseState(), MOB.curState(), MOB.recoverMaxState()

setMiscText

public void setMiscText(java.lang.String newText)
Description copied from interface: Environmental
For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object. For objects which have true for their isGeneric method, this is used to set and parse the XML which will be used to fill out the fields in this object. Since Ability objects are never Generic, this will always be where parameters are read from an Ability instance.

Specified by:
setMiscText in interface Environmental
Parameters:
newText - either an open internal text string, or XML

text

public java.lang.String text()
Description copied from interface: Environmental
For objects which have false for their isGeneric method, this is used to set any internally coded strings to change the nature or behavior of the object. For objects which have true for their isGeneric method, this is used to set and parse the XML which will be used to fill out the fields in this object. Since Ability objects are never Generic, this will always be where parameters are read from an Ability instance.

Specified by:
text in interface Environmental
Returns:
either an open internal text string, or XML

miscTextFormat

public java.lang.String miscTextFormat()
Description copied from interface: Environmental
Unimplemented as of yet, but will hold a string telling the system what the proper format of any miscText data. Will use the CMParms.MTFORMAT_* constants for definition.

Specified by:
miscTextFormat in interface Environmental
Returns:
the format expected for the miscText field
See Also:
CMParms, Environmental.text(), Environmental.setMiscText(String)

compareTo

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

getTickStatus

public int getTickStatus()
Description copied from interface: Tickable
A coded status for this object during the period where its tick method is being called. The statis is defined, at least in part, by constants in this interface STATUS_*. STATUS_NOT should be returned when the objects tick method is not currently in execution. It should never return STATUS_NOT when the objects tick method is in execution.

Specified by:
getTickStatus in interface Tickable
Returns:
the numeric status of this object
See Also:
Tickable.tick(Tickable, int)

tick

public boolean tick(Tickable ticking,
                    int tickID)
Description copied from interface: Tickable
this is the method which is called periodically by the threading engine. How often it is called depends on the parameters passed to the threadding engine when it is submitted for thread access. Typically the period is once per TIME_TICK period, but that is determined when the object is submitted to the thread engine.

Specified by:
tick in interface Tickable
Parameters:
ticking - a reference to this Tickable object
tickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Returns:
true always, unless this object no longer wishes to ever tick again, in which case false
See Also:
Tickable, ServiceEngine, TickableGroup

ultimateContainer

public Item ultimateContainer(Physical stopAtC)
Description copied from interface: Item
If an item is in a container, which is in a container, etc, this will return the "highest" or ultimate container in which this item is located. If an item is in a container which is in plain view, it will simply return container(). If the item is not in a container, it will return itself.

Specified by:
ultimateContainer in interface Item
Parameters:
stopAtC - if contained in this object, it will return this object.. default null.
Returns:
the highest level container in which this item is found, or itself
See Also:
Container

container

public Container container()
Description copied from interface: Item
Where the item is located. Either null for plain site (or contained on person), or will point to the container object

Specified by:
container in interface Item
Returns:
The item in which it is contained, or null.

rawSecretIdentity

public java.lang.String rawSecretIdentity()
Description copied from interface: Item
This method returns those secret properties of the item which are entered directly by the builder when the item is designed. It is the string saved to the database, and is used by the secretIdentity() method to construct a full secret description of the Item.

Specified by:
rawSecretIdentity in interface Item
Returns:
the string entered by the builder as the item secret properties or name.

secretIdentity

public java.lang.String secretIdentity()
Description copied from interface: Item
This method returns the calculated and expanded description of the properties of the item as would be discovered through the Identify spell. It starts with its rawSecretIdentity() and adds to it any strings which the Ability objects contained in the Items effects list would generate. An empty string means the item has no secret properties per se.

Specified by:
secretIdentity in interface Item
Returns:
a displayable string describing the secret properties of the item.

setSecretIdentity

public void setSecretIdentity(java.lang.String newIdentity)
Description copied from interface: Item
This method is used to change the string returned by rawSecretIdentity. This string is saved to the database as the items secret properties desctiption. The secretIdentity method uses this string to construct its full description.

Specified by:
setSecretIdentity in interface Item
Parameters:
newIdentity - the secret properties of this item. Empty string means it has none.

displayText

public java.lang.String displayText()
Description copied from interface: Environmental
Gets the raw string used to show what this object looks like in the room. May be used as a basis for other methods, such as the title of rooms, and what an exit looks like when open. The value for Items may be null if the item is not displayed when the room is seen.

Specified by:
displayText in interface Environmental
Returns:
the string describing how this object looks in the room

setDisplayText

public void setDisplayText(java.lang.String newDisplayText)
Description copied from interface: Environmental
Sets the raw string used to show what this object looks like in the room. May be used as a basis for other methods, such as the title of rooms, and what an exit looks like when open. The value for Items may be null if the item is not displayed when the room is seen.

Specified by:
setDisplayText in interface Environmental
Parameters:
newDisplayText - the string describing how this object looks in the room

description

public java.lang.String description()
Description copied from interface: Environmental
The basic description of this object, as shown when the item is directly LOOKed at.

Specified by:
description in interface Environmental
Returns:
the basic detail description of this object

description

public java.lang.String description(MOB viewerMob)
Description copied from interface: Physical
Returns the description, but as seen by the given viewer. Can differ from description() without being saved to the DB. Descriptions are normally the way something appears when looked at, or is the long description of rooms.

Specified by:
description in interface Physical
Parameters:
viewerMob - the mob viewing the physical thing
Returns:
the description as seen by the viewer
See Also:
Environmental.description()

setDescription

public void setDescription(java.lang.String newDescription)
Description copied from interface: Environmental
Sets the basic description of this object, as shown when the item is directly LOOKed at.

Specified by:
setDescription in interface Environmental
Parameters:
newDescription - the basic detail description of this object

setContainer

public void setContainer(Container newContainer)
Description copied from interface: Item
Change the container where the item is located. Either null for plain site (or contained on person), or will point to the Container item.

Specified by:
setContainer in interface Item
Parameters:
newContainer - Container item in which this item is contained.
See Also:
Container

numberOfItems

public int numberOfItems()
Description copied from interface: Item
How many items this Item object represents. When an item is Packaged, this method will return a number greater than 1, otherwise it always returns 1.

Specified by:
numberOfItems in interface Item
Returns:
the number of items represented by this object.

usesRemaining

public int usesRemaining()
Description copied from interface: Item
Uses remaining is a general use numeric value whose meaning differs for different Item types. For instance, Wands use it to represent charges, Weapons and Armor use it to represent Condition, Ammunition uses it to represent quantity, etc.

Specified by:
usesRemaining in interface Item
Returns:
the general numeric value of this field.

setUsesRemaining

public void setUsesRemaining(int newUses)
Description copied from interface: Item
Sets the uses remaining field, which is a general numeric value whose meaning differs for different Item types. See usesRemaining() method above for more information.

Specified by:
setUsesRemaining in interface Item
Parameters:
newUses - a new general numeric value for this field.

isSavable

public boolean isSavable()
Description copied from interface: Contingent
Whether, if this object is in a room, whether it is appropriate to save this object to the database as a permanent feature of its container. It always returns true except under unique circumstances.

Specified by:
isSavable in interface Contingent
Returns:
true, usually.

setSavable

public void setSavable(boolean truefalse)
Description copied from interface: Contingent
Sets whether this object can be saved as a permanent aspect of its host.

Specified by:
setSavable in interface Contingent
Parameters:
truefalse - whether this behavior can be saved as part of its host.
See Also:
Contingent.isSavable()

canWearComplete

protected boolean canWearComplete(MOB mob,
                                  long wearWhere)

alreadyWornMsg

protected boolean alreadyWornMsg(MOB mob,
                                 Item thisItem)

okMessage

public boolean okMessage(Environmental myHost,
                         CMMsg msg)
Description copied from interface: MsgListener
The general message event previewer for the object. Messages passed herein are in a pending state, and may be safely modified or rejected without fear that they might be in the middle of being executed. Messages passed herein may not necessarily be FOR or FROM this object, but will almost always represent events which want to happen in the same rom. This method should always always return true UNLESS this message needs to be canceled, in which case it is necessary to tell the mob initiating the event (CMMsg.source()) why it is being cancelled. Every game event goes through these methods.

Specified by:
okMessage in interface MsgListener
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that wants to be executed
Returns:
whether this message is allowed to execute
See Also:
CMMsg, CMMsg.source()

executeMsg

public void executeMsg(Environmental myHost,
                       CMMsg msg)
Description copied from interface: MsgListener
The general message event handler for the object. Messages passed herein may not necessarily be FOR this object, or from it, but will almost always represent events happening in the same room. The messages have already been through an approval process, so this method is called only to affect the final execution of the meaning of the message. Every game event goes through these methods.

Specified by:
executeMsg in interface MsgListener
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg

recursiveWeight

public int recursiveWeight()
Description copied from interface: Item
For a normal item, this method returns the same as phyStats().weight(). For a Container, it returns the weight of the container plus the recursive weight of all items in the container.

Specified by:
recursiveWeight in interface Item
Returns:
the total weight of the item and any possible contents.
See Also:
Container

stopTicking

public void stopTicking()
Description copied from interface: Item
If this Item is current Ticking due to its having Behaviors or other properties which might grant it the ability to Tick, this method will cause that ticking to cease and desist. This means that it will lose its periodic thread calls to its tick() method. This method also makes the item appear destroyed without actually being destroyed. The whole idea is to make the item 'dormant' for storage.

Specified by:
stopTicking in interface Item

destroy

public void destroy()
Description copied from interface: Contingent
Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java. Containers, rooms. and mobs who have their destroy() method called will also call the destroy() methods on all items and other objects listed as content, recursively.

Specified by:
destroy in interface Contingent

removeFromOwnerContainer

public void removeFromOwnerContainer()
Description copied from interface: Item
This method basically calls setContainer(null), and then removes this item from its owner(). It effectively removes the item from the map. This is generally assumed to be a temporary condition. To really destroy the item permanently, the destroy() method is used. The unWear() method is also called.

Specified by:
removeFromOwnerContainer in interface Item
See Also:
Container

addNonUninvokableEffect

public void addNonUninvokableEffect(Ability to)
Description copied from interface: Affectable
Same as addEffect(Ability), but will set the Ability object as never being able to be uninvoked. recoverPhyStats() method should be called next. An Ability with a given ID() can only be added once per object.

Specified by:
addNonUninvokableEffect in interface Affectable
Parameters:
to - The ability object to add as an effect.
See Also:
Ability, Affectable.recoverPhyStats()

addEffect

public void addEffect(Ability to)
Description copied from interface: Affectable
Add a new effect to this object, whether permanent or temporary. After calling this method, recoverPhyStats() should be called next in case this ability object modifies the stats. An Ability with a given ID() can only be added once per object.

Specified by:
addEffect in interface Affectable
Parameters:
to - The ability object to add as an effect.
See Also:
Ability, Affectable.recoverPhyStats()

delEffect

public void delEffect(Ability to)
Description copied from interface: Affectable
Delete an effect from this object, whether permanent or temporary. After calling this method, recoverPhyStats() should be called next in case this ability object modified the stats.

Specified by:
delEffect in interface Affectable
Parameters:
to - The ability object to remove as an effect on this object
See Also:
Ability, Affectable.recoverPhyStats()

eachEffect

public void eachEffect(EachApplicable<Ability> applier)
Description copied from interface: Affectable
Applies the given code to each effect on this object

Specified by:
eachEffect in interface Affectable
Parameters:
applier - code to execute against each object

delAllEffects

public void delAllEffects(boolean unInvoke)
Description copied from interface: Affectable
Optionally uninvokes and then certainly removes all effects from this object.

Specified by:
delAllEffects in interface Affectable
Parameters:
unInvoke - send true to uninvoke before deleting

effects

public java.util.Enumeration<Ability> effects()
Description copied from interface: Affectable
Returns an enumerator of abilities listed as effects on this object.

Specified by:
effects in interface Affectable
Returns:
the enumerator of ability objects effecting this object
See Also:
Ability

numEffects

public int numEffects()
Description copied from interface: Affectable
Returns the number of ability objects listed as effects on this object.

Specified by:
numEffects in interface Affectable
Returns:
the number of effects this object has
See Also:
Ability

fetchEffect

public Ability fetchEffect(int index)
Description copied from interface: Affectable
Returns an ability object listed as an effect on this object. May return null even if the index is correct to mark a race condition.

Specified by:
fetchEffect in interface Affectable
Parameters:
index - which object to return
Returns:
the ability object effecting this object
See Also:
Ability, Affectable.numEffects()

fetchEffect

public Ability fetchEffect(java.lang.String ID)
Description copied from interface: Affectable
Returns an ability object listed as an effect on this object. The object will be the one with the same ID() string as passed in.

Specified by:
fetchEffect in interface Affectable
Parameters:
ID - the Ability ID to look for in effects
Returns:
the ability object effecting this object
See Also:
Ability, CMObject.ID()

addBehavior

public void addBehavior(Behavior to)
Manipulation of Behavior objects, which includes movement, speech, spellcasting, etc, etc.

Specified by:
addBehavior in interface Behavable
Parameters:
to - The behavior object to add.
See Also:
Behavior, Affectable.recoverPhyStats()

delAllBehaviors

public void delAllBehaviors()
Description copied from interface: Behavable
Removes all behaviors from this object.

Specified by:
delAllBehaviors in interface Behavable

delBehavior

public void delBehavior(Behavior to)
Description copied from interface: Behavable
Delete a behavior from this object. After calling this method, recoverPhyStats() should be called next in case this behavior object modified the stats.

Specified by:
delBehavior in interface Behavable
Parameters:
to - The behavior object to remove.
See Also:
Behavior, Affectable.recoverPhyStats()

numBehaviors

public int numBehaviors()
Description copied from interface: Behavable
The number of behaviors this object has.

Specified by:
numBehaviors in interface Behavable
Returns:
the number of behaviors
See Also:
Behavior

behaviors

public java.util.Enumeration<Behavior> behaviors()
Description copied from interface: Behavable
Returns an enumerator of all the behaviors on this object.

Specified by:
behaviors in interface Behavable
Returns:
an enumerator of all the behaviors on this object.
See Also:
Behavior

fetchBehavior

public Behavior fetchBehavior(int index)
Description copied from interface: Behavable
Returns a behavior object on this object. May return null even if the index is correct to mark a race condition.

Specified by:
fetchBehavior in interface Behavable
Parameters:
index - which object to return
Returns:
the behavior object
See Also:
Behavior, Behavable.numBehaviors()

fetchBehavior

public Behavior fetchBehavior(java.lang.String ID)
Description copied from interface: Behavable
Returns a behavior object listed on this object. The object will be the one with the same ID() string as passed in.

Specified by:
fetchBehavior in interface Behavable
Parameters:
ID - the Behavior ID to look for
Returns:
the behavior object
See Also:
Behavior, CMObject.ID()

eachBehavior

public void eachBehavior(EachApplicable<Behavior> applier)
Description copied from interface: Behavable
Applies the given code to each behavior on this object

Specified by:
eachBehavior in interface Behavable
Parameters:
applier - code to execute against each object

addScript

public void addScript(ScriptingEngine S)
Manipulation of the scripts list

Specified by:
addScript in interface Behavable
Parameters:
S - the scripting engine, fully populated, to add
See Also:
ScriptingEngine

delScript

public void delScript(ScriptingEngine S)
Description copied from interface: Behavable
Remove a running script from this object.

Specified by:
delScript in interface Behavable
Parameters:
S - the specific scripting engine to remove
See Also:
ScriptingEngine

delAllScripts

public void delAllScripts()
Description copied from interface: Behavable
Removes all executing scripts from this object.

Specified by:
delAllScripts in interface Behavable

numScripts

public int numScripts()
Description copied from interface: Behavable
Return the number of scripts running on this object

Specified by:
numScripts in interface Behavable
Returns:
number of scripts

scripts

public java.util.Enumeration<ScriptingEngine> scripts()
Description copied from interface: Behavable
Returns an enumerator of all the scripts on this object.

Specified by:
scripts in interface Behavable
Returns:
an enumerator of all the scripts on this object.
See Also:
ScriptingEngine

fetchScript

public ScriptingEngine fetchScript(int x)
Description copied from interface: Behavable
Retrieve one of the enumerated scripts running on this object

Specified by:
fetchScript in interface Behavable
Parameters:
x - which script to return
Returns:
the scripting engine
See Also:
ScriptingEngine

eachScript

public void eachScript(EachApplicable<ScriptingEngine> applier)
Description copied from interface: Behavable
Applies the given code to each scripting engine on this object

Specified by:
eachScript in interface Behavable
Parameters:
applier - code to execute against each object

tackOns

protected java.lang.String tackOns()

maxRange

public int maxRange()
Description copied from interface: Environmental
the maximum range of this object, if applicable. Can refer to the size of a room, the range of a weapon, or the calculated range of a mob in combat.

Specified by:
maxRange in interface Environmental
Returns:
the maximum range

minRange

public int minRange()
Description copied from interface: Environmental
the minimum range of this object, if applicable. Can refer to the size of a room, the range of a weapon, or the calculated range of a mob in combat. Usually 0.

Specified by:
minRange in interface Environmental
Returns:
the minimum range

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()

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()

L

public java.lang.String L(java.lang.String str,
                          java.lang.String... xs)
Description copied from interface: Environmental
Localize an internal string -- shortcut. Same as calling:

Specified by:
L in interface Environmental
Parameters:
str - the string to translate
xs - the array of variables to replace
Returns:
the translated string, with all variables in place
See Also:
Call with the string to translate, which may contain variables of the form @x1, @x2, etc. The array in xs is then used to replace the variables AFTER the string is translated.

I

protected java.lang.String I(java.lang.String str)

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(Environmental E)
Description copied from interface: Environmental
Whether this object instance is functionally identical to the object passed in. Works by repeatedly calling getStat on both objects and comparing the values.

Specified by:
sameAs in interface Environmental
Parameters:
E - the object to compare this one to
Returns:
whether this object is the same as the one passed in
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String)