com.planet_ink.coffee_mud.Behaviors
Class Conquerable

java.lang.Object
  extended by com.planet_ink.coffee_mud.Behaviors.StdBehavior
      extended by com.planet_ink.coffee_mud.Behaviors.Arrest
          extended by com.planet_ink.coffee_mud.Behaviors.Conquerable
All Implemented Interfaces:
Behavior, LegalBehavior, CMObject, Contingent, Modifiable, MsgListener, Tickable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class Conquerable
extends Arrest


Field Summary
protected  boolean allowLaw
           
protected  DVector assaults
           
protected  int checkDown
           
protected static int CHECKFREQ
           
protected  DVector clanControlPoints
           
protected  java.util.Vector<ClanItem> clanItems
           
protected  long conquestDate
           
protected static java.lang.String[] DEFAULT_WAR_CRYS
           
protected  int fightDown
           
protected static int FIGHTFREQ
           
protected  java.lang.String holdingClan
           
protected  java.lang.String journalName
           
protected  Area myArea
           
protected  java.util.Vector<MOB> noMultiFollows
           
protected  int pointDown
           
protected static int POINTFREQ
           
protected  java.lang.String prevHoldingClan
           
protected  int revoltDown
           
protected  int revoltFails
           
protected static int REVOLTFREQ
           
protected  java.lang.String savedHoldingClan
           
protected  boolean switchOwnership
           
protected  int totalControlPoints
           
protected  long waitToReload
           
 
Fields inherited from class com.planet_ink.coffee_mud.Behaviors.Arrest
finesAssessed, lastAreaName, lastBanishR, loadAttempt
 
Fields inherited from class com.planet_ink.coffee_mud.Behaviors.StdBehavior
CODES, isSavableBehavior, parms
 
Fields inherited from interface com.planet_ink.coffee_mud.Behaviors.interfaces.LegalBehavior
CONTROLTIME, EXPIRATION_MILLIS, ONE_REAL_DAY
 
Fields inherited from interface com.planet_ink.coffee_mud.Behaviors.interfaces.Behavior
CAN_AREAS, CAN_EXITS, CAN_ITEMS, CAN_MOBS, CAN_ROOMS, FLAG_LEGALBEHAVIOR, FLAG_MOBILITY, FLAG_POTENTIALLYAGGRESSIVE, FLAG_POTENTIALLYAUTODEATHING, FLAG_TROUBLEMAKING
 
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
 
Constructor Summary
Conquerable()
           
 
Method Summary
 java.lang.String accountForYourself()
          Returns a string describing what this behavior does.
protected  void announceToArea(Area area, java.lang.String clanID, int amount)
           
 int calcItemControlPoints(Area A)
           
 int calcRevoltChance(Area A)
           
protected  boolean changeControlPoints(java.lang.String clanID, int amount, Room notifyRoom)
           
 java.lang.String conquestInfo(Area myArea)
          If the legal behavior and area are conquerable by clans or foreign organizations, this method will return the name of the current controlling clan, and some information about the state of the conquest, such as control points achieved.
 int controlPoints()
          Returns the number of control points necessary to conquer the area governed by this legal behavior.
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
protected  void declareWinner(java.lang.String clanID)
           
protected  boolean defaultModifiableNames()
           
protected  void deRegisterClanItem(Item I)
           
protected  void endClanRule(java.lang.String reason)
           
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
protected  boolean flagFound(Area A, Clan C)
           
protected  boolean flagFound(Area A, java.lang.String clanID)
           
 int getControlPoints(java.lang.String clanID)
          Returns the number of control points earned by the given clanID.
protected  java.lang.String getLawParms()
           
protected  java.lang.String getManadatoryWorshipID()
           
protected  boolean hasItemSameAs(MOB M, Item I)
           
protected  boolean hasItemSameName(MOB M, java.lang.String name)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected  boolean isAnUltimateAuthorityHere(MOB M, Law laws)
           
 boolean isAnyKindOfOfficer(Law laws, MOB M)
           
 boolean isFullyControlled()
          Returns whether this legalbehavior governs an area that is presently legally stable.
 boolean isTheJudge(Law laws, MOB M)
           
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
 void recalculateControlPoints(Area A)
           
protected  void registerClanItem(ClanItem I)
           
 int revoltChance()
          The present chance (percent) that the area may collapse into revolt and remove itself from control.
 java.lang.String rulingOrganization()
          Get the name of the clan that currently rules this area, if applicable.
 void setControlPoints(java.lang.String clanID, int newControlPoints)
          Modify the number of control points earned by the given clanID.
 void setParms(java.lang.String newParms)
          Sets the raw parameter string for this behavior.
 void startBehavior(PhysicalAgent E)
          Called after a behavior is added to a Behavable object.
protected  boolean theLawIsEnabled()
           
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
protected static java.lang.String[] warCrys()
           
 
Methods inherited from class com.planet_ink.coffee_mud.Behaviors.Arrest
accuse, addWarrant, addWarrant, addWarrant, aquit, arrest, canFocusOn, canImproveCode, debugLogLostConvicts, deleteWarrant, dismissOfficer, externalFiles, fileAllWarrants, fileArrestResister, fillOutWarrant, findTheBanishingPoint, findTheDetentionCenter, findTheJail, findTheJudge, finesOwed, fixCharge, flags, frame, getAnyElligibleOfficer, getAWitnessHere, getBanishmentTicks, getBanishRoom, getCriminals, getDetainParm, getDetainRoom, getDetainTime, getElligibleOfficer, getElligibleOfficerHere, getExtraLawParms, getExtraLawString, getFine, getLaws, getReleaseRoom, getRelevantWarrants, getResourceKey, getRoom, getRoom, getRooms, getShameTicks, getTheJudgeHere, getWarrantsOf, getWitness, hasWarrant, haveMobReactToLaw, highestCrimeAction, isAnyOfficer, isBusyWithJustice, isElligibleOfficer, isElligibleOfficer, isJailRoom, isJudge, isStillACrime, isTroubleMaker, judgeMe, legalInfo, makePeace, modifyAssessedFines, processWarrant, release, restOfCharges, startTracking, testEntryLaw, trackingModifiers, unCuff, updateLaw
 
Methods inherited from class com.planet_ink.coffee_mud.Behaviors.StdBehavior
amDestroyed, canActAtAll, canFreelyBehaveNormal, canImprove, canImprove, compareTo, destroy, getBehaversMOB, getBehaversRoom, getCodeNum, getParms, getSaveStatIndex, getStat, getStatCodes, getTickStatus, grantsAggressivenessTo, initializeClass, isSavable, isStat, L, name, newInstance, parmsFormat, registerDefaultQuest, sameAs, setSavable, setStat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Behaviors.interfaces.Behavior
canImprove, canImprove, getParms, grantsAggressivenessTo, parmsFormat, registerDefaultQuest, setSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, name
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Contingent
amDestroyed, destroy, isSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Modifiable
getSaveStatIndex, getStat, getStatCodes, isStat, setStat
 

Field Detail

savedHoldingClan

protected java.lang.String savedHoldingClan

prevHoldingClan

protected java.lang.String prevHoldingClan

holdingClan

protected java.lang.String holdingClan

clanItems

protected java.util.Vector<ClanItem> clanItems

clanControlPoints

protected DVector clanControlPoints

assaults

protected DVector assaults

noMultiFollows

protected java.util.Vector<MOB> noMultiFollows

totalControlPoints

protected int totalControlPoints

myArea

protected Area myArea

journalName

protected java.lang.String journalName

allowLaw

protected boolean allowLaw

switchOwnership

protected boolean switchOwnership

revoltFails

protected int revoltFails

waitToReload

protected long waitToReload

conquestDate

protected long conquestDate

revoltDown

protected int revoltDown

REVOLTFREQ

protected static final int REVOLTFREQ

checkDown

protected int checkDown

CHECKFREQ

protected static final int CHECKFREQ
See Also:
Constant Field Values

pointDown

protected int pointDown

POINTFREQ

protected static final int POINTFREQ

fightDown

protected int fightDown

FIGHTFREQ

protected static final int FIGHTFREQ
See Also:
Constant Field Values

DEFAULT_WAR_CRYS

protected static final java.lang.String[] DEFAULT_WAR_CRYS
Constructor Detail

Conquerable

public Conquerable()
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
Overrides:
ID in class Arrest
Returns:
the name of this class

defaultModifiableNames

protected boolean defaultModifiableNames()
Overrides:
defaultModifiableNames in class Arrest

getLawParms

protected java.lang.String getLawParms()
Overrides:
getLawParms in class Arrest

isFullyControlled

public boolean isFullyControlled()
Description copied from interface: LegalBehavior
Returns whether this legalbehavior governs an area that is presently legally stable. Unconquerable areas are always stable, and areas conquered and controlled for a sufficient amount of time are also stable.

Specified by:
isFullyControlled in interface LegalBehavior
Overrides:
isFullyControlled in class Arrest
Returns:
Whether order has been restored.

accountForYourself

public java.lang.String accountForYourself()
Description copied from interface: Behavior
Returns a string describing what this behavior does. Mostly for thought and behavior reading systems.

Specified by:
accountForYourself in interface Behavior
Overrides:
accountForYourself in class Arrest
Returns:
a string describing what this behavior does.

rulingOrganization

public java.lang.String rulingOrganization()
Description copied from interface: LegalBehavior
Get the name of the clan that currently rules this area, if applicable.

Specified by:
rulingOrganization in interface LegalBehavior
Overrides:
rulingOrganization in class Arrest
Returns:
Empty string if the area is unruled, or ruled by the system. ClanID otherwise.
See Also:
Clan

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
Overrides:
copyOf in class StdBehavior
Returns:
a clone of this object

conquestInfo

public java.lang.String conquestInfo(Area myArea)
Description copied from interface: LegalBehavior
If the legal behavior and area are conquerable by clans or foreign organizations, this method will return the name of the current controlling clan, and some information about the state of the conquest, such as control points achieved.

Specified by:
conquestInfo in interface LegalBehavior
Overrides:
conquestInfo in class Arrest
Parameters:
myArea - the geographic legal area
Returns:
information about the conquest of this area, in readable form.

controlPoints

public int controlPoints()
Description copied from interface: LegalBehavior
Returns the number of control points necessary to conquer the area governed by this legal behavior. Not applicable if the legal behavior doesn't permit government changes or conquest.

Specified by:
controlPoints in interface LegalBehavior
Overrides:
controlPoints in class Arrest
Returns:
the number of control points needed to control this legal behavior
See Also:
LegalBehavior.setControlPoints(String, int), LegalBehavior.getControlPoints(String)

getControlPoints

public int getControlPoints(java.lang.String clanID)
Description copied from interface: LegalBehavior
Returns the number of control points earned by the given clanID. Not applicable if the legal behavior doesn't permit government changes or conquest.

Specified by:
getControlPoints in interface LegalBehavior
Overrides:
getControlPoints in class Arrest
Parameters:
clanID - the clan to assign the control points to
Returns:
The number of control points earned by this clan/organization
See Also:
LegalBehavior.controlPoints(), LegalBehavior.setControlPoints(String, int)

revoltChance

public int revoltChance()
Description copied from interface: LegalBehavior
The present chance (percent) that the area may collapse into revolt and remove itself from control. Not applicable if the legal behavior doesn't permit government changes or conquest.

Specified by:
revoltChance in interface LegalBehavior
Overrides:
revoltChance in class Arrest
Returns:
the percent chance of revolt

setParms

public void setParms(java.lang.String newParms)
Description copied from interface: Behavior
Sets the raw parameter string for this behavior. Parameters are meant to modify or specify specific behavior of this Behavior.

Specified by:
setParms in interface Behavior
Overrides:
setParms in class Arrest
Parameters:
newParms - the parameter string for this behavior
See Also:
Behavior.getParms()

startBehavior

public void startBehavior(PhysicalAgent E)
Description copied from interface: Behavior
Called after a behavior is added to a Behavable object. The point is to do any initializing. This method assumes setParms() has already been called as well.

Specified by:
startBehavior in interface Behavior
Overrides:
startBehavior in class StdBehavior
Parameters:
E - the object to which this behavior has been added
See Also:
Behavable.addBehavior(Behavior), Behavior.setParms(String)

isAnyKindOfOfficer

public boolean isAnyKindOfOfficer(Law laws,
                                  MOB M)
Overrides:
isAnyKindOfOfficer in class Arrest

isTheJudge

public boolean isTheJudge(Law laws,
                          MOB M)
Overrides:
isTheJudge in class Arrest

endClanRule

protected void endClanRule(java.lang.String reason)

calcItemControlPoints

public int calcItemControlPoints(Area A)

calcRevoltChance

public int calcRevoltChance(Area A)

announceToArea

protected void announceToArea(Area area,
                              java.lang.String clanID,
                              int amount)

hasItemSameAs

protected boolean hasItemSameAs(MOB M,
                                Item I)

hasItemSameName

protected boolean hasItemSameName(MOB M,
                                  java.lang.String name)

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
Overrides:
tick in class Arrest
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

getManadatoryWorshipID

protected java.lang.String getManadatoryWorshipID()

recalculateControlPoints

public void recalculateControlPoints(Area A)

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
Overrides:
okMessage in class StdBehavior
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()

declareWinner

protected void declareWinner(java.lang.String clanID)

registerClanItem

protected void registerClanItem(ClanItem I)

deRegisterClanItem

protected void deRegisterClanItem(Item I)

flagFound

protected boolean flagFound(Area A,
                            java.lang.String clanID)

flagFound

protected boolean flagFound(Area A,
                            Clan C)

setControlPoints

public void setControlPoints(java.lang.String clanID,
                             int newControlPoints)
Description copied from interface: LegalBehavior
Modify the number of control points earned by the given clanID. Not applicable if the legal behavior doesn't permit government changes or conquest.

Specified by:
setControlPoints in interface LegalBehavior
Overrides:
setControlPoints in class Arrest
Parameters:
clanID - the clan to assign the control points to
newControlPoints - the number of points to assign
See Also:
LegalBehavior.controlPoints(), LegalBehavior.getControlPoints(String)

changeControlPoints

protected boolean changeControlPoints(java.lang.String clanID,
                                      int amount,
                                      Room notifyRoom)

warCrys

protected static java.lang.String[] warCrys()

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
Overrides:
executeMsg in class Arrest
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

isAnUltimateAuthorityHere

protected boolean isAnUltimateAuthorityHere(MOB M,
                                            Law laws)
Overrides:
isAnUltimateAuthorityHere in class Arrest

theLawIsEnabled

protected boolean theLawIsEnabled()
Overrides:
theLawIsEnabled in class Arrest