com.planet_ink.coffee_mud.Behaviors.interfaces
Interface LegalBehavior

All Superinterfaces:
Behavior, java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>, Contingent, Modifiable, MsgListener, Tickable
All Known Implementing Classes:
Arrest, Conquerable

public interface LegalBehavior
extends Behavior

A LegalBehavior is a Behavior that provides functionality related to law and order within a given geographic sphere, which is usually an Area with a LegalBehavior behavior. A LegalBehavior keeps track of Warrants against players and mobs which persist only in memory. It also controls the behavior of arresting officers and judges, and dispenses justice by taking mobs and players to jail, putting them on parole, or issuing warnings or other punishments.

See Also:
Behavior, LegalWarrant, Law

Field Summary
static long CONTROLTIME
          constant for the number of miliseconds before an area is under legal control
static long EXPIRATION_MILLIS
          constant for the number of miliseconds before a warrant expires
static long ONE_REAL_DAY
          constant for the number of miliseconds in a real-life 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
 
Method Summary
 boolean accuse(Area myArea, MOB accused, MOB victim, java.lang.String[] accusableLaws)
          Issues a LegalWarrant against the accused on behalf of the given victim, for a crime listed in the list of crime keys.
 boolean addWarrant(Area myArea, LegalWarrant W)
          Puts a warrant on the official docket so that officers can act on them.
 boolean addWarrant(Area myArea, MOB accused, MOB victim, java.lang.String crimeLocs, java.lang.String crimeFlags, java.lang.String crime, java.lang.String sentence, java.lang.String warnMsg)
          Fills out and, if possible, issues a warrant for arrest using the given crime data.
 boolean aquit(Area myArea, MOB accused, java.lang.String[] acquittableLaws)
          Removes the first warrant for the given accused criminal, for any one of the given list of official crime KEYS.
 boolean arrest(Area myArea, MOB officer, MOB mob)
          Assigns an officer and begins the automated arresting procedure.
 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.
 boolean deleteWarrant(Area myArea, LegalWarrant W)
          Removes the given warrants from the list of issued warrants.
 boolean fillOutWarrant(MOB mob, Law laws, Area myArea, Environmental target, java.lang.String crimeLocs, java.lang.String crimeFlags, java.lang.String crime, java.lang.String sentence, java.lang.String warnMsg)
          Inspects the circumstances of, and if necessary, assigns a warrant to be handled by local law enforcement and judges.
 double finesOwed(MOB mob)
          Returns the amount of base currency owed by the given mob, if any.
 boolean frame(Area myArea, MOB accused, MOB framed)
          A method that transfers a warrant out on the accused to a different framed individual
 int getControlPoints(java.lang.String clanID)
          Returns the number of control points earned by the given clanID.
 java.util.List<MOB> getCriminals(Area myArea, java.lang.String searchStr)
          Searches the list of warrants, returning those criminal mobs whose names match the search string, and still have legal warrants available for them.
 java.util.List<LegalWarrant> getWarrantsOf(Area myArea, MOB accused)
          Returns a list of all active legal warrants available on the given mob.
 boolean hasWarrant(Area myArea, MOB accused)
          Returns whether the given mob has a valid warrant out for his/her arrest.
 boolean isAnyOfficer(Area myArea, MOB mob)
          Returns whether the given mob qualifies as an arresting officer of any sort in the given legal area.
 boolean isElligibleOfficer(Area myArea, MOB mob)
          Returns whether the given mob is both an officer of the law, and not otherwise engaged in an arrest, and so is available to make one
 boolean isFullyControlled()
          Returns whether this legalbehavior governs an area that is presently legally stable.
 boolean isJailRoom(Area myArea, java.util.List<Room> jails)
          Returns whether any of the given Room objects in the jails Vector is indeed an official Jail room as defined by this legal behavior.
 boolean isJudge(Area myArea, MOB mob)
          Returns whether the given mob qualifies as the judge in the given legal area.
 boolean isStillACrime(LegalWarrant W, boolean debugging)
          Returns whether or not the given legal warrant is still a valid, timely warrant that can be acted upon by law enforcement.
 Law legalInfo(Area myArea)
          Returns the set of laws governing the given geographic legal area, assuming that this LegalBehavior is the behavior governing the same.
 void modifyAssessedFines(double d, MOB mob)
          A method to change the amount of base currency currently listed as fines owed by the given mob.
 void release(Area myArea, LegalWarrant warrant)
          If the warrant reflects someone in prison, it releases them.
 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.
 boolean updateLaw(Area myArea)
          This method notifies the legal behavior that its laws have changed and need to be updated.
 
Methods inherited from interface com.planet_ink.coffee_mud.Behaviors.interfaces.Behavior
accountForYourself, canImprove, canImprove, externalFiles, flags, getParms, grantsAggressivenessTo, parmsFormat, registerDefaultQuest, setParms, setSavable, startBehavior
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, name, tick
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.MsgListener
executeMsg, okMessage
 
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
copyOf, ID, 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

ONE_REAL_DAY

static final long ONE_REAL_DAY
constant for the number of miliseconds in a real-life day

See Also:
Constant Field Values

EXPIRATION_MILLIS

static final long EXPIRATION_MILLIS
constant for the number of miliseconds before a warrant expires

See Also:
Constant Field Values

CONTROLTIME

static final long CONTROLTIME
constant for the number of miliseconds before an area is under legal control

See Also:
Constant Field Values
Method Detail

isStillACrime

boolean isStillACrime(LegalWarrant W,
                      boolean debugging)
Returns whether or not the given legal warrant is still a valid, timely warrant that can be acted upon by law enforcement.

Parameters:
W - the legal warrant to inspect
debugging - whether debug information should be sent to the log
Returns:
whether the given warrant is still a valid, timely crime.
See Also:
LegalWarrant

fillOutWarrant

boolean fillOutWarrant(MOB mob,
                       Law laws,
                       Area myArea,
                       Environmental target,
                       java.lang.String crimeLocs,
                       java.lang.String crimeFlags,
                       java.lang.String crime,
                       java.lang.String sentence,
                       java.lang.String warnMsg)
Inspects the circumstances of, and if necessary, assigns a warrant to be handled by local law enforcement and judges. Call this method if you want to add a warrant for a custom crime with your own qualifying flags. For recognized crimes with crime keys, however, use the accuse command.

Parameters:
mob - the accused character
laws - the system of laws to use as a basis
myArea - the geographical domain that the laws apply to
target - the victim of a crime, if any
crimeLocs - string of location flags, e.g. !indoors !home keyword !keyword
crimeFlags - string of crime situation flags, e.g. !recently !combat
crime - string description of the crime, e.g. robbing T-NAME
sentence - string sentence action, e.g. warn, parole1, jail1, death
warnMsg - string the officer will say to explain the seriousness of the crime
Returns:
whether or not the warrant was successfully issued
See Also:
accuse(Area, MOB, MOB, String[]), Law, Law.PUNISHMENTMASK_DESCS

frame

boolean frame(Area myArea,
              MOB accused,
              MOB framed)
A method that transfers a warrant out on the accused to a different framed individual

Parameters:
myArea - the geographical legal area
accused - the mob with actual warrants out on him/her
framed - the person to transfer the first warrant to.
Returns:
whether warrants were actually transferred from the accused to the framed

arrest

boolean arrest(Area myArea,
               MOB officer,
               MOB mob)
Assigns an officer and begins the automated arresting procedure. The target criminal must have a warrant out for this to end well for the state.

Parameters:
myArea - the geographic legal area
officer - the mob to assign as the arresting officer
mob - the mob to arrest
Returns:
whether the arrest began successfully.

legalInfo

Law legalInfo(Area myArea)
Returns the set of laws governing the given geographic legal area, assuming that this LegalBehavior is the behavior governing the same.

Parameters:
myArea - the geographic legal area
Returns:
the Law object that governs the area and behavior
See Also:
Law

isElligibleOfficer

boolean isElligibleOfficer(Area myArea,
                           MOB mob)
Returns whether the given mob is both an officer of the law, and not otherwise engaged in an arrest, and so is available to make one

Parameters:
myArea - the geographic legal area
mob - the pc/npc to test
Returns:
whether the mob is an officer of the law

hasWarrant

boolean hasWarrant(Area myArea,
                   MOB accused)
Returns whether the given mob has a valid warrant out for his/her arrest.

Parameters:
myArea - the geographic legal area
accused - the mob to test
Returns:
whether a warrant is available for the accused

isAnyOfficer

boolean isAnyOfficer(Area myArea,
                     MOB mob)
Returns whether the given mob qualifies as an arresting officer of any sort in the given legal area.

Parameters:
myArea - the geographic legal area
mob - the mob to test for officerhood
Returns:
true if the mob is an officer, false otherwise

isJudge

boolean isJudge(Area myArea,
                MOB mob)
Returns whether the given mob qualifies as the judge in the given legal area.

Parameters:
myArea - the geographic legal area
mob - the mob to test for judgehood
Returns:
true if the mob is a judge, false otherwise

modifyAssessedFines

void modifyAssessedFines(double d,
                         MOB mob)
A method to change the amount of base currency currently listed as fines owed by the given mob. A value of 0 erases.

Parameters:
d - the amount of base currency the mob owes
mob - the mob who owes money to the state

finesOwed

double finesOwed(MOB mob)
Returns the amount of base currency owed by the given mob, if any.

Parameters:
mob - the mob who might owe money
Returns:
the amount owed, or 0 if none.

updateLaw

boolean updateLaw(Area myArea)
This method notifies the legal behavior that its laws have changed and need to be updated. Call this method whenever the behaviors/ areas laws have changed.

Parameters:
myArea - the geographic legal area
Returns:
Whether the update was necessary due to the legal parameters

rulingOrganization

java.lang.String rulingOrganization()
Get the name of the clan that currently rules this area, if applicable.

Returns:
Empty string if the area is unruled, or ruled by the system. ClanID otherwise.
See Also:
Clan

conquestInfo

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.

Parameters:
myArea - the geographic legal area
Returns:
information about the conquest of this area, in readable form.

isFullyControlled

boolean isFullyControlled()
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.

Returns:
Whether order has been restored.

controlPoints

int controlPoints()
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.

Returns:
the number of control points needed to control this legal behavior
See Also:
setControlPoints(String, int), getControlPoints(String)

revoltChance

int revoltChance()
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.

Returns:
the percent chance of revolt

setControlPoints

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

Parameters:
clanID - the clan to assign the control points to
newControlPoints - the number of points to assign
See Also:
controlPoints(), getControlPoints(String)

getControlPoints

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

Parameters:
clanID - the clan to assign the control points to
Returns:
The number of control points earned by this clan/organization
See Also:
controlPoints(), setControlPoints(String, int)

getCriminals

java.util.List<MOB> getCriminals(Area myArea,
                                 java.lang.String searchStr)
Searches the list of warrants, returning those criminal mobs whose names match the search string, and still have legal warrants available for them. Use a search name of NULL to return all criminals.

Parameters:
myArea - the geographic legal area
searchStr - the name/search string to use
Returns:
a list of MOB objects
See Also:
MOB

getWarrantsOf

java.util.List<LegalWarrant> getWarrantsOf(Area myArea,
                                           MOB accused)
Returns a list of all active legal warrants available on the given mob.

Parameters:
myArea - the geographic legal area
accused - the mob to look for warrants for
Returns:
a list of LegalWarrant objects
See Also:
LegalWarrant

addWarrant

boolean addWarrant(Area myArea,
                   LegalWarrant W)
Puts a warrant on the official docket so that officers can act on them. This method is called by other methods to finish off their work. Any WARRANTS channels are also notified.

Parameters:
myArea - the geographic legal area
W - the LegalWarrant to put on the docket
Returns:
whether the warrant was successfully added
See Also:
fillOutWarrant(MOB, Law, Area, Environmental, String, String, String, String, String), addWarrant(Area, MOB, MOB, String, String, String, String, String), LegalWarrant

addWarrant

boolean addWarrant(Area myArea,
                   MOB accused,
                   MOB victim,
                   java.lang.String crimeLocs,
                   java.lang.String crimeFlags,
                   java.lang.String crime,
                   java.lang.String sentence,
                   java.lang.String warnMsg)
Fills out and, if possible, issues a warrant for arrest using the given crime data. Calls fillOutWarrant to do its work.

Parameters:
myArea - the geographic legal area
accused - the accused character
victim - the victim of a crime, if any
crimeLocs - string of location flags, e.g. !indoors !home keyword !keyword
crimeFlags - string of crime situation flags, e.g. !recently !combat
crime - string description of the crime, e.g. robbing T-NAME
sentence - string sentence action, e.g. warn, parole1, jail1, death
warnMsg - string the officer will say to explain the seriousness of the crime
Returns:
whether or not the warrant was successfully issued
See Also:
fillOutWarrant(MOB, Law, Area, Environmental, String, String, String, String, String)

deleteWarrant

boolean deleteWarrant(Area myArea,
                      LegalWarrant W)
Removes the given warrants from the list of issued warrants. Does not update the old-warrants (prior convictions) record, but erases the warrant completely.

Parameters:
myArea - the geographic legal area
W - the legal warrant to remove
Returns:
true if the warrant was found to remove, false otherwise
See Also:
LegalWarrant

aquit

boolean aquit(Area myArea,
              MOB accused,
              java.lang.String[] acquittableLaws)
Removes the first warrant for the given accused criminal, for any one of the given list of official crime KEYS. Crime KEYS are the key names of crimed, such as TAXEVASION.

Parameters:
myArea - the geographic legal area
accused - the mob possible accused of one of the crimes
acquittableLaws - the list of crime keys.
Returns:
whether an acquittable crime was found, and removed

isJailRoom

boolean isJailRoom(Area myArea,
                   java.util.List<Room> jails)
Returns whether any of the given Room objects in the jails Vector is indeed an official Jail room as defined by this legal behavior.

Parameters:
myArea - the geographic legal area
jails - a list of Room objects to inspect
Returns:
whether any one of the room objects is, in fact, a jail
See Also:
Room

accuse

boolean accuse(Area myArea,
               MOB accused,
               MOB victim,
               java.lang.String[] accusableLaws)
Issues a LegalWarrant against the accused on behalf of the given victim, for a crime listed in the list of crime keys. Calls fillOutWarrant after retreiving the remaining information about the crime key described by the parameter accusableLaws.

Parameters:
myArea - the geographic legal area
accused - the accused mob
victim - the victim of the crime
accusableLaws - a crime key, such as TAXEVASION
Returns:
whether one of the laws was found, and a warrant successfully filled out
See Also:
fillOutWarrant(MOB, Law, Area, Environmental, String, String, String, String, String)

release

void release(Area myArea,
             LegalWarrant warrant)
If the warrant reflects someone in prison, it releases them. If the warrant reflects someone being arrested, it releases the arrest and temporarily ignores the warrant.

Parameters:
myArea - the legal area
warrant - the warrant to excuse