Behavior
, CMObject
, Contingent
, Modifiable
, MsgListener
, Tickable
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
ActiveTicker
, Aggressive
, AlignHelper
, Arrest
, Beggar
, BribeGateGuard
, BrotherHelper
, ClanHelper
, CombatAssister
, CommonSpeaker
, Concierge
, CorpseLooter
, DoorwayGuardian
, Drowness
, EvilExecutioner
, FaithHelper
, FasterRecovery
, GateGuard
, GoldLooter
, GoodExecutioner
, GoodGuardian
, Guard
, Hireling
, ItemIdentifier
, ItemMender
, ItemRefitter
, LinkedWeather
, MOBHelper
, MoneyChanger
, MudChat
, Nanny
, NoCombatAssist
, ObjectGuardian
, PlayerHelper
, PokerDealer
, PuddleMaker
, RaceHelper
, ResetWhole
, ROMGangMember
, ROMPatrolman
, Sailor
, Scriptable
, ScriptableEverymob
, Sounder
, TaxCollector
, Vagrant
, Wimpy
public class StdBehavior extends java.lang.Object implements Behavior
Modifier and Type | Field | Description |
---|---|---|
protected static java.lang.String[] |
CODES |
|
protected boolean |
isSavableBehavior |
|
protected java.lang.String |
parms |
CAN_AREAS, CAN_EXITS, CAN_ITEMS, CAN_MOBS, CAN_ROOMS, FLAG_LEGALBEHAVIOR, FLAG_MOBILITY, FLAG_POTENTIALLYAGGRESSIVE, FLAG_POTENTIALLYAUTODEATHING, FLAG_TROUBLEMAKING
idConverter
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_BALLISTICK, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EVENT, 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_SHORTERMASK, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
Constructor | Description |
---|---|
StdBehavior() |
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
accountForYourself() |
Returns a string describing what this behavior does.
|
boolean |
amDestroyed() |
Whether the destroy() method has been previousy called on this object.
|
static boolean |
canActAtAll(Tickable affecting) |
|
static boolean |
canFreelyBehaveNormal(Tickable affecting) |
|
boolean |
canImprove(int can_code) |
Returns whether this behavior is capable of enhancing the given type
of object designated by the can_code.
|
boolean |
canImprove(PhysicalAgent E) |
Returns whether this behavior is capable of enhancing the given type
of object designated by E.
|
protected int |
canImproveCode() |
|
int |
compareTo(CMObject o) |
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
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.
|
void |
endBehavior(PhysicalAgent forMe) |
Called when a behavior is cleanly removed from a mob,
such as when a quest does so.
|
void |
executeMsg(Environmental host,
CMMsg msg) |
The general message event handler for the object.
|
java.util.List<java.lang.String> |
externalFiles() |
Returns a string list of any external files which
may be required to make this ability work.
|
long |
flags() |
Returns a bitmap made of up Behavior.FLAG_* constant masks which
designates certain aspects about this behavior the rest of the
system may need to know.
|
protected MOB |
getBehaversMOB(Tickable ticking) |
|
protected Room |
getBehaversRoom(Tickable ticking) |
|
protected int |
getCodeNum(java.lang.String code) |
|
protected int |
getInternalCodeNum(java.lang.String code) |
|
java.lang.String |
getParms() |
Returns the raw parameter string for this behavior.
|
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.
|
boolean |
grantsAggressivenessTo(MOB M) |
Returns the result of a very specific test, namely whether this
behavior would be the direct cause of a malicious act against
the given MOB object.
|
protected static java.lang.String |
I(java.lang.String str) |
|
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 |
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.
|
java.lang.String |
name() |
The nice displayable name of this instance of this object
|
CMObject |
newInstance() |
return a new instance of the object
|
boolean |
okMessage(Environmental host,
CMMsg msg) |
The general message event previewer for the object.
|
java.lang.String |
parmsFormat() |
Unimplemented as of yet, but will hold a string telling the system what
the proper format of any parms data.
|
void |
registerDefaultQuest(java.lang.Object questName) |
Called after a behavior is added to an Environmental object.
|
boolean |
sameAs(Behavior E) |
|
void |
setParms(java.lang.String parameters) |
Sets the raw parameter string for this behavior.
|
void |
setSavable(boolean truefalse) |
Sets whether this behavior can be saved as a permanent aspect of
its host.
|
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 |
startBehavior(PhysicalAgent forMe) |
Called after a behavior is added to a Behavable object.
|
boolean |
tick(Tickable ticking,
int tickID) |
this is the method which is called periodically by the threading engine.
|
protected java.lang.String parms
protected boolean isSavableBehavior
protected static final java.lang.String[] CODES
public java.lang.String ID()
CMObject
public java.lang.String name()
Tickable
name
in interface CMObject
name
in interface Tickable
Environmental.Name()
protected int canImproveCode()
public long flags()
Behavior
public boolean grantsAggressivenessTo(MOB M)
Behavior
grantsAggressivenessTo
in interface Behavior
M
- the target to test for maliciousness topublic int getTickStatus()
Tickable
getTickStatus
in interface Tickable
Tickable.tick(Tickable, int)
public void initializeClass()
CMObject
initializeClass
in interface CMObject
public java.lang.String accountForYourself()
Behavior
accountForYourself
in interface Behavior
public CMObject newInstance()
newInstance
in interface CMObject
public CMObject copyOf()
CMObject
public void registerDefaultQuest(java.lang.Object questName)
Behavior
registerDefaultQuest
in interface Behavior
questName
- the Quest nameQuest
public void startBehavior(PhysicalAgent forMe)
Behavior
startBehavior
in interface Behavior
forMe
- the object to which this behavior has been addedBehavable.addBehavior(Behavior)
,
Behavior.setParms(String)
public void endBehavior(PhysicalAgent forMe)
Behavior
endBehavior
in interface Behavior
forMe
- the object to which this behavior has been removedBehavable.delBehavior(Behavior)
,
Behavior.setParms(String)
public void setSavable(boolean truefalse)
Behavior
setSavable
in interface Behavior
setSavable
in interface Contingent
truefalse
- whether this behavior can be saved as part of its host.Contingent.isSavable()
public boolean isSavable()
Contingent
isSavable
in interface Contingent
public boolean amDestroyed()
Contingent
amDestroyed
in interface Contingent
public void destroy()
Contingent
destroy
in interface Contingent
public java.lang.String getParms()
Behavior
getParms
in interface Behavior
Behavior.setParms(String)
public void setParms(java.lang.String parameters)
Behavior
setParms
in interface Behavior
parameters
- the parameter string for this behaviorBehavior.getParms()
public java.lang.String parmsFormat()
Behavior
parmsFormat
in interface Behavior
CMParms
,
Behavior.getParms()
,
Behavior.setParms(String)
public int compareTo(CMObject o)
compareTo
in interface java.lang.Comparable<CMObject>
public java.util.List<java.lang.String> externalFiles()
Behavior
externalFiles
in interface Behavior
Behavior.setParms(String)
public void executeMsg(Environmental host, CMMsg msg)
MsgListener
executeMsg
in interface MsgListener
host
- either the initiator of the event, or the host of this objectmsg
- the CMMsg that needs to be executedCMMsg
public boolean okMessage(Environmental host, CMMsg msg)
MsgListener
okMessage
in interface MsgListener
host
- either the initiator of the event, or the host of this objectmsg
- the CMMsg that wants to be executedCMMsg
,
CMMsg.source()
public boolean canImprove(int can_code)
Behavior
canImprove
in interface Behavior
can_code
- the Behavior.CAN_* mask to evaluate for this behaviorcanImproveCode()
,
Behavior
public boolean canImprove(PhysicalAgent E)
Behavior
canImprove
in interface Behavior
E
- the object to evaluate for this behaviorcanImproveCode()
protected static java.lang.String I(java.lang.String str)
public static boolean canActAtAll(Tickable affecting)
public static boolean canFreelyBehaveNormal(Tickable affecting)
public boolean tick(Tickable ticking, int tickID)
Tickable
tick
in interface Tickable
ticking
- a reference to this Tickable objecttickID
- the TICKID_ constant describing this periodic call, as defined in TickableTickable
,
ServiceEngine
,
TickableGroup
public java.lang.String L(java.lang.String str, java.lang.String... xs)
str
- the string to translatexs
- the array of variables to replaceCall 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.
public java.lang.String[] getStatCodes()
Modifiable
getStatCodes
in interface Modifiable
Modifiable.getStat(String)
,
Modifiable.setStat(String, String)
protected int getCodeNum(java.lang.String code)
protected int getInternalCodeNum(java.lang.String code)
public java.lang.String getStat(java.lang.String code)
Modifiable
getStat
in interface Modifiable
code
- the name of the field to read.Modifiable.getStatCodes()
public void setStat(java.lang.String code, java.lang.String val)
Modifiable
setStat
in interface Modifiable
code
- the name of the field to setval
- the value to set the field toModifiable.getStatCodes()
public int getSaveStatIndex()
Modifiable
getSaveStatIndex
in interface Modifiable
Modifiable.getStatCodes()
,
Modifiable.getStat(String)
,
Modifiable.setStat(String, String)
public boolean isStat(java.lang.String code)
Modifiable
isStat
in interface Modifiable
code
- the name of the field to read.Modifiable.getStatCodes()
public boolean sameAs(Behavior E)