com.planet_ink.coffee_mud.Common.interfaces
Interface Faction

All Superinterfaces:
java.lang.Cloneable, CMCommon, CMObject, java.lang.Comparable<CMObject>, Contingent, MsgListener
All Known Implementing Classes:
DefaultFaction

public interface Faction
extends CMCommon, MsgListener, Contingent

A Faction is an arbitrary numeric range, where different mobs/players can be within that range, if they have the faction at all. Factions can be programmatically set to change due to events that occur to/around the mob, and adjust themselves relative to other factions. Subsets of the faction can be given readable names for display to the user.

See Also:
FactionMember.fetchFaction(String), FactionMember.addFaction(String, int)

Nested Class Summary
static class Faction.Align
          legacy enumerator constant for Faction.FRange.alignEquiv() denoting that the range does not reflect alignment
static interface Faction.FAbilityUsage
          A Faction Ability Usage object represents a set of criterium that can be used to determine whether this faction allows a mob or player to use a particular ability, or class of abilities.
static interface Faction.FactionChangeEvent
          A Faction Change Event is an event that triggers an automatic change in a mob or players faction value.
static interface Faction.FData
          A FactionData object is stored inside other objects that keep track of their own faction.
static interface Faction.FRange
          The foundation of any Faction, the Faction Range represents a range of values that constitutes a single named group of numeric values for the faction.
static interface Faction.FReactionItem
          Adds very temporary affects and behaviors to mobs who match the reaction zapper mask, and who are in the same room as someone with standing in this faction.
static interface Faction.FZapFactor
          A factor defines how modifications of faction value, up or down, are modified on a mob by mob basis.
 
Field Summary
static java.lang.String[] EXPAFFECT_DESCS
          String descriptions for the valid experienceFlag() constants
static java.lang.String[] EXPAFFECT_NAMES
          String list for the valid experienceFlag() constants
static long IFLAG_CUSTOMTICK
          internal flag masks meaning to skip normal ticking, retrieved by getInternalFlags()
static long IFLAG_IGNOREAUTO
          internal flag masks meaning to skip standard auto system, retrieved by getInternalFlags()
static long IFLAG_NEVERSAVE
          internal flag masks meaning to never save to a file, retrieved by getInternalFlags()
static int TAG_ABILITY_
          index constant for tag names in TAG_NAMES denoting the ABILITY tag
static int TAG_AFFBEHAV_
          index constant for tag names in TAG_NAMES denoting the AFFBEHAV tag
static int TAG_AUTOCHOICES
          index constant for tag names in TAG_NAMES denoting the AUTOCHOICES tag
static int TAG_AUTODEFAULTS
          index constant for tag names in TAG_NAMES denoting the AUTODEFAULTS tag
static int TAG_CHANGE_
          index constant for tag names in TAG_NAMES denoting the CHANGE tag
static int TAG_CHOICEINTRO
          index constant for tag names in TAG_NAMES denoting the CHOICEINTRO tag
static int TAG_DEFAULT
          index constant for tag names in TAG_NAMES denoting the DEFAULT tag
static int TAG_EDITALONE
          index constant for tag names in TAG_NAMES denoting the EDITALONE tag
static int TAG_EXPERIENCE
          index constant for tag names in TAG_NAMES denoting the EXPERIENCE tag
static int TAG_FACTOR_
          index constant for tag names in TAG_NAMES denoting the FACTOR tag
static int TAG_MAXIMUM
          index constant for tag names in TAG_NAMES denoting the MAXIMUM tag
static int TAG_MINIMUM
          index constant for tag names in TAG_NAMES denoting the MINIMUM tag
static int TAG_NAME
          index constant for tag names in TAG_NAMES denoting the NAME tag
static java.lang.String[] TAG_NAMES
          list of valid tag names for internal faction data, retrieved by getTagValue(String)
static int TAG_RANGE_
          index constant for tag names in TAG_NAMES denoting the RANGE tag
static int TAG_RATEMODIFIER
          index constant for tag names in TAG_NAMES denoting the RATEMODIFIER tag
static int TAG_REACTION_
          index constant for tag names in TAG_NAMES denoting the RELATION tag
static int TAG_RELATION_
          index constant for tag names in TAG_NAMES denoting the RELATION tag
static int TAG_SCOREDISPLAY
          index constant for tag names in TAG_NAMES denoting the SCOREDISPLAY tag
static int TAG_SHOWINFACTIONSCMD
          index constant for tag names in TAG_NAMES denoting the SHOWINFACTIONSCMD tag
static int TAG_SPECIALREPORTED
          index constant for tag names in TAG_NAMES denoting the SPECIALREPORTED tag
static int TAG_USELIGHTREACTIONS
          index constant for tag names in TAG_NAMES denoting the SCOREDISPLAY tag
 
Method Summary
 java.util.Enumeration<Faction.FAbilityUsage> abilityUsages()
          Returns an enumeration of Faction.FactionAbilityUsage objects for this Faction.
 Faction.FAbilityUsage addAbilityUsage(java.lang.String key)
          Adds a new Faction.FactionAbilityUsage object to this Faction based on the given definitional key.
 boolean addAffectBehav(java.lang.String ID, java.lang.String parms, java.lang.String gainMask)
          Adds a new Ability or Behavior to this Faction.
 Faction.FZapFactor addFactor(double gain, double loss, java.lang.String mask)
          Adds a new change factor to this Faction.
 Faction.FRange addRange(java.lang.String key)
          Adds a new Faction.FactionRange object to this faction using an encoded key.
 boolean addReaction(java.lang.String range, java.lang.String mask, java.lang.String abilityID, java.lang.String parms)
          Adds a new reaction to this faction.
 boolean addRelation(java.lang.String factionID, double relation)
          Adds a new faction relation factor to this faction.
 java.util.Enumeration<java.lang.String> affectsBehavs()
          Returns an enumeration of Abilities or Behavior IDs that are automatically but conditionally added to mobs (not players) with this faction.
 java.lang.String ALL_CHANGE_EVENT_TYPES()
          Computed completed at runtime, this method returns all possible valid FactionChangeEvent event ids that can be used to define triggers.
 int asPercent(int faction)
          Returns the given faction value, as a percent from minimum of the range of this faction
 int asPercentFromAvg(int faction)
          Returns the given value faction value, as a percent from average of the range values of this faction.
 java.util.Enumeration<java.lang.String> autoDefaults()
          Returns the automatic default faction mask/value list, which is possibly applied whenever a mob or player is brought to life for the first time.
 boolean canUse(MOB mob, Ability A)
          Returns whether the given player/mob is prevented from using the given Ability based on any of the Faction.FactionAbilityUsage (faction ability usage) criterium defined for this Faction.
 java.util.Enumeration<java.lang.String> changeEventKeys()
          Returns an enumeration of change event keys, which are the code names of the triggers that cause faction values to change automatically.
 java.lang.String choiceIntro()
          Gets the filename of a file, from the resources directory, that is displayed to users when they are given the choice of a starting value to this faction.
 java.util.Enumeration<java.lang.String> choices()
          Returns the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character.
 void clearChangeEvents()
          Removes all FactionChangeEvents
 Faction.FactionChangeEvent createChangeEvent(java.lang.String key)
          Adds a new FactionChangeEvent object to this faction using the given event code name, or fully encoded event string.
 java.util.Enumeration<java.lang.String> defaults()
          Returns the default faction mask/value list, which is applied whenever a Faction Change Event applies a Faction Add command.
 boolean delAbilityUsage(Faction.FAbilityUsage usage)
          Removes the given Faction.FactionAbilityUsage object from this faction
 boolean delAffectBehav(java.lang.String ID)
          Removes the given ability or behavior from this Faction.
 boolean delChangeEvent(Faction.FactionChangeEvent event)
          Removes a FactionChangeEvent of the given event (trigger) id.
 boolean delFactor(Faction.FZapFactor f)
          Removes the given change factor from this faction.
 boolean delRange(Faction.FRange FR)
          Removes the given FactionRange object from the faction.
 boolean delReaction(Faction.FReactionItem item)
          Removes the given reaction from this Faction.
 boolean delRelation(java.lang.String factionID)
          Removes the give faction relation from this faction.
 int difference()
          Returns the difference between the highest and lowest range value
 void disable(boolean truefalse)
          Disables this faction, as if it had been added to the DISABLE= entry in the coffeemud.ini file.
 void executeChange(MOB source, MOB target, Faction.FactionChangeEvent event)
          Executes a Faction change event for the given event source and target, and the applicable FactionChangeEvent event object for this faction
 java.lang.String experienceFlag()
          Returns the string code describing how a faction-holders experience changes from killing another faction holder affect his own faction value.
 java.lang.String factionID()
          The official, unique faction id of this faction.
 java.util.Enumeration<Faction.FZapFactor> factors()
          Returns an enumeration of Object arrays referring to the a factor to multiply times the base amount (100) of faction change (up or down) for particular mobs who match a given Zapper mask.
 Faction.FRange fetchRange(int faction)
          Returns the Faction.FactionRange object that applies to the given faction value.
 Faction.FRange fetchRange(java.lang.String codeName)
          Returns the Faction.FactionRange object that applies to the given faction range code name.
 java.lang.String fetchRangeName(int faction)
          Returns the name of the Faction.FactionRange object that applies to the given faction value.
 Faction.FactionChangeEvent[] findAbilityChangeEvents(Ability key)
          Returns a FactionChangeEvent that applies when the given Ability is used
 int findAutoDefault(MOB mob)
          Returns the automatic default faction value that applies to the given mob.
 java.util.List<java.lang.Integer> findChoices(MOB mob)
          Returns a vector of Integer objects representing the choosable faction values available to the given mob when they create a new character.
 int findDefault(MOB mob)
          Returns the default faction value that applies to the given mob.
 double findFactor(MOB mob, boolean gain)
          Returns the applicable change factor for the given mob, and the whether the faction change was a gain or loss (not a gain).
 Faction.FAbilityUsage getAbilityUsage(int x)
          Returns the enumerated Faction.FactionAbilityUsage object at the given index.
 java.lang.String[] getAffectBehav(java.lang.String ID)
          Returns a string array containing the parms at index 0, and the gainMask at 1.
 Faction.FactionChangeEvent[] getChangeEvents(java.lang.String key)
          Returns a FactionChangeEvent that applies when the given event name (a trigger code) occurs in the game.
 Faction.FZapFactor getFactor(int x)
          Returns the given enumerated change factor
 java.lang.String getINIDef(java.lang.String tag, java.lang.String delimeter)
          Retrieves an entry for an ini properties definition document that describes this faction.
 long getInternalFlags()
          Return the bitmap of internal-use flags for this faction.
 double getRelation(java.lang.String factionID)
          Returns the relation factor of the given faction id.
 java.lang.String getTagValue(java.lang.String tag)
          Returns the value of a given internal faction variable.
 boolean hasFaction(MOB mob)
          Checks to see if the given mob has this faction.
 boolean hasUsage(Ability A)
          Returns whether any of the Faction.FactionAbilityUsage objects for this Faction apply to the given ability.
 void initializeFaction(java.lang.String aname)
          Initializes a new faction with default values
 void initializeFaction(java.lang.StringBuffer file, java.lang.String fID)
          Initializes a new faction from a faction.ini properties formatted document, and a given new faction ID
 boolean isDisabled()
          Returns true if this faction is presently specified in the coffeemud ini file entry "DISABLE", thereby designating that this faction is currently disabled.
 boolean isPreLoaded()
          Returns true if this faction is presently specified in the coffeemud ini file entry "FACTIONS", thereby designating that this faction is loaded at boot-time, as opposed to run-time.
 Faction.FData makeFactionData(MOB mob)
          Returns a FactionData object for the given mob to store his faction information in.
 int maximum()
          Returns the highest absolute range value
 int middle()
          Gets the median absolute range value
 int minimum()
          Gets the lowest absolute range value
 java.lang.String name()
          The friendly, displayable name of this faction.
 int randomFaction()
          Returns a random value within the valid range of this faction
 java.util.Enumeration<Faction.FRange> ranges()
          Returns an enumeration of all available Faction.FactionRange objects, representing the entire score of available values valid for this faction.
 double rateModifier()
          A modifier of the base amount of faction value change, namely 100.
 java.util.Enumeration<Faction.FReactionItem> reactions()
          Returns an enumeration of Faction.FactionReaction items associated with this faction.
 java.util.Enumeration<Faction.FReactionItem> reactions(java.lang.String rangeCode)
          Returns an enumeration of Faction.FactionReaction items associated with this faction and the given range code.
 java.util.Enumeration<java.lang.String> relationFactions()
          Returns an enumeration of faction ids (of other factions) that are automatically changed, up or down, when this faction changes.
 void setAutoDefaults(java.util.List<java.lang.String> v)
          Sets the automatic default faction mask/value list, which is possibly applied whenever a mob or player is brought to life for the first time.
 void setChoiceIntro(java.lang.String newStr)
          Sets the filename of a file, from the resources directory, that is displayed to users when they are given the choice of a starting value to this faction.
 void setChoices(java.util.List<java.lang.String> v)
          Sets the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character.
 void setDefaults(java.util.List<java.lang.String> v)
          Sets the default faction mask/value list, which is applied whenever a Faction Change Event applies a Faction Add command.
 void setExperienceFlag(java.lang.String newStr)
          Sets the string code describing how a faction-holders experience changes from killing another faction holder affect his own faction value.
 void setFactionID(java.lang.String newStr)
          Sets the official, unique faction id of this faction.
 void setInternalFlags(long bitmap)
          Set the bitmap of internal-use flags for this faction.
 void setLightReactions(boolean truefalse)
          Set this faction to use the light-reaction system, which is easier on resources, but not as powerful.
 void setName(java.lang.String newStr)
          Sets the friendly, displayable name of this faction.
 void setRateModifier(double d)
          Sets the modifier of the base amount of faction value change, namely 100.
 void setShowInEditor(boolean truefalse)
          Sets whether this factions value is shown as a line item in mob editors
 void setShowInFactionsCommand(boolean truefalse)
          Sets whether this factions value is shown in player Factions command
 void setShowInScore(boolean truefalse)
          Sets whether this faction is displayed in the player Score command.
 void setShowInSpecialReported(boolean truefalse)
          Sets whether this factions value is shown in certain special admins commands.
 boolean showInEditor()
          Returns whether this factions value is shown as a line item in mob editors
 boolean showInFactionsCommand()
          Returns whether this factions value is shown in player Factions command
 boolean showInScore()
          Returns whether this faction is displayed in the player Score command.
 boolean showInSpecialReported()
          Returns whether this factions value is shown in certain special admins commands.
 void updateFactionData(MOB mob, Faction.FData data)
          Updates the given FactionData object that the given mob to store his faction information in.
 java.lang.String usageFactorRangeDescription(Ability A)
          Returns the list of faction ranges that apply based on Faction.FactionAbilityUsage usage factor that apply to the given ability.
 boolean useLightReactions()
          Return whether this faction uses the light-reaction system, which is easier on resources, but not as powerful.
 
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, setSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

IFLAG_IGNOREAUTO

static final long IFLAG_IGNOREAUTO
internal flag masks meaning to skip standard auto system, retrieved by getInternalFlags()

See Also:
Constant Field Values

IFLAG_NEVERSAVE

static final long IFLAG_NEVERSAVE
internal flag masks meaning to never save to a file, retrieved by getInternalFlags()

See Also:
Constant Field Values

IFLAG_CUSTOMTICK

static final long IFLAG_CUSTOMTICK
internal flag masks meaning to skip normal ticking, retrieved by getInternalFlags()

See Also:
Constant Field Values

EXPAFFECT_NAMES

static final java.lang.String[] EXPAFFECT_NAMES
String list for the valid experienceFlag() constants


EXPAFFECT_DESCS

static final java.lang.String[] EXPAFFECT_DESCS
String descriptions for the valid experienceFlag() constants


TAG_NAME

static final int TAG_NAME
index constant for tag names in TAG_NAMES denoting the NAME tag

See Also:
Constant Field Values

TAG_MINIMUM

static final int TAG_MINIMUM
index constant for tag names in TAG_NAMES denoting the MINIMUM tag

See Also:
Constant Field Values

TAG_MAXIMUM

static final int TAG_MAXIMUM
index constant for tag names in TAG_NAMES denoting the MAXIMUM tag

See Also:
Constant Field Values

TAG_SCOREDISPLAY

static final int TAG_SCOREDISPLAY
index constant for tag names in TAG_NAMES denoting the SCOREDISPLAY tag

See Also:
Constant Field Values

TAG_SPECIALREPORTED

static final int TAG_SPECIALREPORTED
index constant for tag names in TAG_NAMES denoting the SPECIALREPORTED tag

See Also:
Constant Field Values

TAG_EDITALONE

static final int TAG_EDITALONE
index constant for tag names in TAG_NAMES denoting the EDITALONE tag

See Also:
Constant Field Values

TAG_DEFAULT

static final int TAG_DEFAULT
index constant for tag names in TAG_NAMES denoting the DEFAULT tag

See Also:
Constant Field Values

TAG_AUTODEFAULTS

static final int TAG_AUTODEFAULTS
index constant for tag names in TAG_NAMES denoting the AUTODEFAULTS tag

See Also:
Constant Field Values

TAG_AUTOCHOICES

static final int TAG_AUTOCHOICES
index constant for tag names in TAG_NAMES denoting the AUTOCHOICES tag

See Also:
Constant Field Values

TAG_CHOICEINTRO

static final int TAG_CHOICEINTRO
index constant for tag names in TAG_NAMES denoting the CHOICEINTRO tag

See Also:
Constant Field Values

TAG_RATEMODIFIER

static final int TAG_RATEMODIFIER
index constant for tag names in TAG_NAMES denoting the RATEMODIFIER tag

See Also:
Constant Field Values

TAG_EXPERIENCE

static final int TAG_EXPERIENCE
index constant for tag names in TAG_NAMES denoting the EXPERIENCE tag

See Also:
Constant Field Values

TAG_RANGE_

static final int TAG_RANGE_
index constant for tag names in TAG_NAMES denoting the RANGE tag

See Also:
Constant Field Values

TAG_CHANGE_

static final int TAG_CHANGE_
index constant for tag names in TAG_NAMES denoting the CHANGE tag

See Also:
Constant Field Values

TAG_ABILITY_

static final int TAG_ABILITY_
index constant for tag names in TAG_NAMES denoting the ABILITY tag

See Also:
Constant Field Values

TAG_FACTOR_

static final int TAG_FACTOR_
index constant for tag names in TAG_NAMES denoting the FACTOR tag

See Also:
Constant Field Values

TAG_RELATION_

static final int TAG_RELATION_
index constant for tag names in TAG_NAMES denoting the RELATION tag

See Also:
Constant Field Values

TAG_SHOWINFACTIONSCMD

static final int TAG_SHOWINFACTIONSCMD
index constant for tag names in TAG_NAMES denoting the SHOWINFACTIONSCMD tag

See Also:
Constant Field Values

TAG_AFFBEHAV_

static final int TAG_AFFBEHAV_
index constant for tag names in TAG_NAMES denoting the AFFBEHAV tag

See Also:
Constant Field Values

TAG_REACTION_

static final int TAG_REACTION_
index constant for tag names in TAG_NAMES denoting the RELATION tag

See Also:
Constant Field Values

TAG_USELIGHTREACTIONS

static final int TAG_USELIGHTREACTIONS
index constant for tag names in TAG_NAMES denoting the SCOREDISPLAY tag

See Also:
Constant Field Values

TAG_NAMES

static final java.lang.String[] TAG_NAMES
list of valid tag names for internal faction data, retrieved by getTagValue(String)

Method Detail

initializeFaction

void initializeFaction(java.lang.String aname)
Initializes a new faction with default values

Parameters:
aname - the factionID (and default name)
See Also:
initializeFaction(StringBuffer, String), factionID()

initializeFaction

void initializeFaction(java.lang.StringBuffer file,
                       java.lang.String fID)
Initializes a new faction from a faction.ini properties formatted document, and a given new faction ID

Parameters:
file - the ini properties style document
fID - the new factionID
See Also:
initializeFaction(String), factionID(), getINIDef(String, String)

getTagValue

java.lang.String getTagValue(java.lang.String tag)
Returns the value of a given internal faction variable.

Parameters:
tag - the tag to get the value of
Returns:
the value of the given tag
See Also:
TAG_NAMES

getINIDef

java.lang.String getINIDef(java.lang.String tag,
                           java.lang.String delimeter)
Retrieves an entry for an ini properties definition document that describes this faction.

Parameters:
tag - the tag to retrieve a properties definition for
delimeter - if the tag represents a list, this is the delimiter for entries.
Returns:
the ini properties definition entry for the tag
See Also:
getINIDef(String, String), initializeFaction(StringBuffer, String), TAG_NAMES

makeFactionData

Faction.FData makeFactionData(MOB mob)
Returns a FactionData object for the given mob to store his faction information in. It will contain all the affects and behaviors, and other information necessary to maintain a relationship between the given mob and this faction. Any parameters should be set on the affects or behaviors before returning them.

Parameters:
mob - the mob to generate affects and behaviors for
Returns:
a FactionData object with all the appropriate affects and behaviors
See Also:
Faction.FData

updateFactionData

void updateFactionData(MOB mob,
                       Faction.FData data)
Updates the given FactionData object that the given mob to store his faction information in. It will contain all the affects and behaviors, and other information necessary to maintain a relationship between the given mob and this faction. Any parameters should be set on the affects or behaviors before returning them.

Parameters:
mob - the mob to generate affects and behaviors for
data - the old faction data object
See Also:
Faction.FData

hasFaction

boolean hasFaction(MOB mob)
Checks to see if the given mob has this faction. Same as checking if mob.fetchFaction(this.factionID())!=Integer.MAX_VALUE.

Parameters:
mob - the mob to check
Returns:
true if the mob has this faction, false otherwise

asPercent

int asPercent(int faction)
Returns the given faction value, as a percent from minimum of the range of this faction

Parameters:
faction - the faction value to convert to a percent
Returns:
the percentage value (0-100)

isPreLoaded

boolean isPreLoaded()
Returns true if this faction is presently specified in the coffeemud ini file entry "FACTIONS", thereby designating that this faction is loaded at boot-time, as opposed to run-time.

Returns:
true if its pre-loaded, false otherwise.

isDisabled

boolean isDisabled()
Returns true if this faction is presently specified in the coffeemud ini file entry "DISABLE", thereby designating that this faction is currently disabled. See also disable(boolean)

Returns:
true if its disabled, false otherwise.

disable

void disable(boolean truefalse)
Disables this faction, as if it had been added to the DISABLE= entry in the coffeemud.ini file. See also isDisabled()

Parameters:
truefalse - disable true to disable, false otherwise

asPercentFromAvg

int asPercentFromAvg(int faction)
Returns the given value faction value, as a percent from average of the range values of this faction.

Parameters:
faction - the faction value to convert to a percent
Returns:
the percentage value (0-100)

randomFaction

int randomFaction()
Returns a random value within the valid range of this faction

Returns:
a random valid value

factionID

java.lang.String factionID()
The official, unique faction id of this faction. FactionIDs are usually the CoffeeMud VFS path from the resources directory, of the properties ini file that defines the faction. The ID (and therefore the properties file location) should not be changed once a faction is "deployed".

Returns:
the unique id of this faction
See Also:
setFactionID(String)

setFactionID

void setFactionID(java.lang.String newStr)
Sets the official, unique faction id of this faction. FactionIDs are usually the CoffeeMud VFS path from the resources directory, of the properties ini file that defines the faction. The ID (and therefore the properties file location) should not be changed once a faction is "deployed".

Parameters:
newStr - the new unique id of this faction
See Also:
factionID()

name

java.lang.String name()
The friendly, displayable name of this faction.

Specified by:
name in interface CMObject
Returns:
the name of this faction
See Also:
setName(String)

setName

void setName(java.lang.String newStr)
Sets the friendly, displayable name of this faction.

Parameters:
newStr - the new name of this faction
See Also:
name()

choiceIntro

java.lang.String choiceIntro()
Gets the filename of a file, from the resources directory, that is displayed to users when they are given the choice of a starting value to this faction. Requires more than one choice range be available.

Returns:
the filename of the choice description file
See Also:
findChoices(MOB)

setChoiceIntro

void setChoiceIntro(java.lang.String newStr)
Sets the filename of a file, from the resources directory, that is displayed to users when they are given the choice of a starting value to this faction. Requires more than one choice range be available.

Parameters:
newStr - the new filename of the choice description file
See Also:
findChoices(MOB)

minimum

int minimum()
Gets the lowest absolute range value

Returns:
the lowest absolute range value

middle

int middle()
Gets the median absolute range value

Returns:
the median absolute range value

difference

int difference()
Returns the difference between the highest and lowest range value

Returns:
the difference between the highest and lowest range value

maximum

int maximum()
Returns the highest absolute range value

Returns:
the highest absolute range value

experienceFlag

java.lang.String experienceFlag()
Returns the string code describing how a faction-holders experience changes from killing another faction holder affect his own faction value.

Returns:
the string code for xp changes to faction changes
See Also:
EXPAFFECT_NAMES, EXPAFFECT_DESCS

setExperienceFlag

void setExperienceFlag(java.lang.String newStr)
Sets the string code describing how a faction-holders experience changes from killing another faction holder affect his own faction value.

Parameters:
newStr - the new string code for xp changes to faction changes
See Also:
EXPAFFECT_NAMES, EXPAFFECT_DESCS

showInScore

boolean showInScore()
Returns whether this faction is displayed in the player Score command.

Returns:
true if displayed in Score, false otherwise

setShowInScore

void setShowInScore(boolean truefalse)
Sets whether this faction is displayed in the player Score command.

Parameters:
truefalse - true if displayed in Score, false otherwise

showInSpecialReported

boolean showInSpecialReported()
Returns whether this factions value is shown in certain special admins commands.

Returns:
true if displayed in special admin commands, false otherwise

setShowInSpecialReported

void setShowInSpecialReported(boolean truefalse)
Sets whether this factions value is shown in certain special admins commands.

Parameters:
truefalse - true if displayed in special admin commands, false otherwise

showInEditor

boolean showInEditor()
Returns whether this factions value is shown as a line item in mob editors

Returns:
true if displayed in mob editors, false otherwise

setShowInEditor

void setShowInEditor(boolean truefalse)
Sets whether this factions value is shown as a line item in mob editors

Parameters:
truefalse - true if displayed in mob editors, false otherwise

showInFactionsCommand

boolean showInFactionsCommand()
Returns whether this factions value is shown in player Factions command

Returns:
true if displayed in factions command, false otherwise

setShowInFactionsCommand

void setShowInFactionsCommand(boolean truefalse)
Sets whether this factions value is shown in player Factions command

Parameters:
truefalse - true if displayed in factions command, false otherwise

defaults

java.util.Enumeration<java.lang.String> defaults()
Returns the default faction mask/value list, which is applied whenever a Faction Change Event applies a Faction Add command. A default faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied.

Returns:
the default faction mask/value list
See Also:
changeEventKeys(), setDefaults(List), MaskingLibrary

findDefault

int findDefault(MOB mob)
Returns the default faction value that applies to the given mob. This method is called when a Faction Change event applies a Faction Add command. Returns Integer.MAX_VALUE if no default value applies to this mob. Each list item is a string.

Parameters:
mob - the mob to find a default faction value for
Returns:
the faction value that applies, or Integer.MAX_VALUE
See Also:
defaults()

setDefaults

void setDefaults(java.util.List<java.lang.String> v)
Sets the default faction mask/value list, which is applied whenever a Faction Change Event applies a Faction Add command. A default faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied. Each list item is a string.

Parameters:
v - the new default faction mask/value list
See Also:
changeEventKeys(), MaskingLibrary, defaults()

autoDefaults

java.util.Enumeration<java.lang.String> autoDefaults()
Returns the automatic default faction mask/value list, which is possibly applied whenever a mob or player is brought to life for the first time. An automatic default faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied. Each list item is a string.

Returns:
the automatic default faction mask/value list
See Also:
MaskingLibrary, setAutoDefaults(List)

findAutoDefault

int findAutoDefault(MOB mob)
Returns the automatic default faction value that applies to the given mob. This method is called when a mob is brought into the world. Returns Integer.MAX_VALUE if no default value applies to this mob.

Parameters:
mob - the mob to find a default value of this faction for.
Returns:
the value to give to the given mob, or Integer.MAX_VALUE
See Also:
defaults()

setAutoDefaults

void setAutoDefaults(java.util.List<java.lang.String> v)
Sets the automatic default faction mask/value list, which is possibly applied whenever a mob or player is brought to life for the first time. An automatic default faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied. Each list item is a string.

Parameters:
v - the new automatic default faction mask/value list
See Also:
defaults(), MaskingLibrary

rateModifier

double rateModifier()
A modifier of the base amount of faction value change, namely 100.

Returns:
a modifier of the base amount of faction change
See Also:
setRateModifier(double)

setRateModifier

void setRateModifier(double d)
Sets the modifier of the base amount of faction value change, namely 100.

Parameters:
d - the new modifier of the base amount of faction value change
See Also:
rateModifier()

choices

java.util.Enumeration<java.lang.String> choices()
Returns the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character. An faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied. Each list item is a string.

Returns:
the choosable faction mask/value list
See Also:
MaskingLibrary, setChoices(List)

findChoices

java.util.List<java.lang.Integer> findChoices(MOB mob)
Returns a vector of Integer objects representing the choosable faction values available to the given mob when they create a new character.

Parameters:
mob - the player mob to evaluate
Returns:
a vector of integer faction values that applies
See Also:
choices()

setChoices

void setChoices(java.util.List<java.lang.String> v)
Sets the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character. An faction mask/value is defined as a number, along with an optional Zapper mask describing to whom the value is applied. Each list item is a string.

Parameters:
v - the list of choosable faction mask/values
See Also:
MaskingLibrary, choices()

ranges

java.util.Enumeration<Faction.FRange> ranges()
Returns an enumeration of all available Faction.FactionRange objects, representing the entire score of available values valid for this faction.

Returns:
an enumeration of all available ranges
See Also:
addRange(String), delRange(com.planet_ink.coffee_mud.Common.interfaces.Faction.FRange), Faction.FRange

fetchRange

Faction.FRange fetchRange(int faction)
Returns the Faction.FactionRange object that applies to the given faction value.

Parameters:
faction - the value to find a matching range object for
Returns:
the range object that matches the given faction value
See Also:
Faction.FRange, ranges()

fetchRangeName

java.lang.String fetchRangeName(int faction)
Returns the name of the Faction.FactionRange object that applies to the given faction value.

Parameters:
faction - the value to find a matching range object for
Returns:
the name of the given faction object
See Also:
ranges()

addRange

Faction.FRange addRange(java.lang.String key)
Adds a new Faction.FactionRange object to this faction using an encoded key. The key is encoded as semicolon separated values of low, high, name, code name, and alignment flag.

Parameters:
key - the encoded values for the new faction range
Returns:
the faction range object created and added.
See Also:
Faction.FRange, ranges()

delRange

boolean delRange(Faction.FRange FR)
Removes the given FactionRange object from the faction.

Parameters:
FR - the faction range object to remove
Returns:
whether a removal was necessary
See Also:
Faction.FRange, ranges()

fetchRange

Faction.FRange fetchRange(java.lang.String codeName)
Returns the Faction.FactionRange object that applies to the given faction range code name.

Parameters:
codeName - the code name to find a matching range object for
Returns:
the correct faction range object, or null
See Also:
ranges(), Faction.FRange.codeName()

changeEventKeys

java.util.Enumeration<java.lang.String> changeEventKeys()
Returns an enumeration of change event keys, which are the code names of the triggers that cause faction values to change automatically.

Returns:
an enumeration of the event keys (triggers)
See Also:
Faction.FactionChangeEvent, createChangeEvent(String eventID), delChangeEvent(Faction.FactionChangeEvent event), ALL_CHANGE_EVENT_TYPES(), executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent)

findAbilityChangeEvents

Faction.FactionChangeEvent[] findAbilityChangeEvents(Ability key)
Returns a FactionChangeEvent that applies when the given Ability is used

Parameters:
key - the Ability to find a change event for.
Returns:
the FactionChangeEvent that applies, or null.
See Also:
Faction.FactionChangeEvent, changeEventKeys(), executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent), ALL_CHANGE_EVENT_TYPES()

getChangeEvents

Faction.FactionChangeEvent[] getChangeEvents(java.lang.String key)
Returns a FactionChangeEvent that applies when the given event name (a trigger code) occurs in the game.

Parameters:
key - the code name of the event that occurred
Returns:
the FactionChangeEvent triggered by that event
See Also:
Faction.FactionChangeEvent, changeEventKeys(), Faction.FactionChangeEvent.MISC_TRIGGERS, executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent), ALL_CHANGE_EVENT_TYPES()

createChangeEvent

Faction.FactionChangeEvent createChangeEvent(java.lang.String key)
Adds a new FactionChangeEvent object to this faction using the given event code name, or fully encoded event string. The key must be either a single event trigger code (an ability name, event code name), or a fully encoded string which is a semicolon delimited field consisting of event (trigger) id, direction code, and amount

Parameters:
key - the field used to create the new FactionChangeEvent
Returns:
the FactionChangeEvent object created and added to this faction, or null
See Also:
Faction.FactionChangeEvent, changeEventKeys(), Faction.FactionChangeEvent.MISC_TRIGGERS, ALL_CHANGE_EVENT_TYPES()

delChangeEvent

boolean delChangeEvent(Faction.FactionChangeEvent event)
Removes a FactionChangeEvent of the given event (trigger) id.

Parameters:
event - the event object to remove from the list of change events
Returns:
whether the event id was found to remove
See Also:
Faction.FactionChangeEvent, changeEventKeys(), Faction.FactionChangeEvent.MISC_TRIGGERS, ALL_CHANGE_EVENT_TYPES()

clearChangeEvents

void clearChangeEvents()
Removes all FactionChangeEvents

See Also:
Faction.FactionChangeEvent, changeEventKeys(), Faction.FactionChangeEvent.MISC_TRIGGERS, ALL_CHANGE_EVENT_TYPES()

executeChange

void executeChange(MOB source,
                   MOB target,
                   Faction.FactionChangeEvent event)
Executes a Faction change event for the given event source and target, and the applicable FactionChangeEvent event object for this faction

Parameters:
source - the source of the event
target - the target of the event
event - the applicable event object for this faction
See Also:
Faction.FactionChangeEvent, changeEventKeys(), ALL_CHANGE_EVENT_TYPES()

ALL_CHANGE_EVENT_TYPES

java.lang.String ALL_CHANGE_EVENT_TYPES()
Computed completed at runtime, this method returns all possible valid FactionChangeEvent event ids that can be used to define triggers.

Returns:
a list of all valid event trigger ids.
See Also:
Faction.FactionChangeEvent, changeEventKeys()

factors

java.util.Enumeration<Faction.FZapFactor> factors()
Returns an enumeration of Object arrays referring to the a factor to multiply times the base amount (100) of faction change (up or down) for particular mobs who match a given Zapper mask. Each Object array consists of a factor to apply on faction gains, a factor to apply on factor drops, and the zapper mask to decide which mobs it applies to (or mob states).

Returns:
the enumeration of change factor object arrays
See Also:
addFactor(double, double, String), delFactor(Faction.FZapFactor), findFactor(MOB, boolean), MaskingLibrary

delFactor

boolean delFactor(Faction.FZapFactor f)
Removes the given change factor from this faction.

Parameters:
f - the factor to remove
Returns:
whether the given factor was found to remove
See Also:
factors()

getFactor

Faction.FZapFactor getFactor(int x)
Returns the given enumerated change factor

Parameters:
x - which factor (0-number) to return
Returns:
the given factor, or null.
See Also:
factors()

addFactor

Faction.FZapFactor addFactor(double gain,
                             double loss,
                             java.lang.String mask)
Adds a new change factor to this Faction. A change factor is a state dependent multiplier by a change in faction. It consists of a Zapper mask to determine whether the factor applies to the given mob/player state, and a factor to apply on gains in faction or losses in faction.

Parameters:
gain - the factor to apply on gains in faction
loss - the factor to apply on losses of faction
mask - the zapper mask to use to determine if this factor applies to a mob
Returns:
the newly created factor Object[] array
See Also:
factors(), MaskingLibrary

findFactor

double findFactor(MOB mob,
                  boolean gain)
Returns the applicable change factor for the given mob, and the whether the faction change was a gain or loss (not a gain).

Parameters:
mob - the mob to compare against the zapper masks of the various factors
gain - return the gain factor if true, or the loss factor if false
Returns:
the factor value that applies, or 1.0 (meaning no change).
See Also:
factors(), MaskingLibrary

relationFactions

java.util.Enumeration<java.lang.String> relationFactions()
Returns an enumeration of faction ids (of other factions) that are automatically changed, up or down, when this faction changes. A relation factor is a number multiplied by the change in this faction to determine the amount that another faction on the same mob is changed by. The factor can be positive or negative to cause the other faction to rise or fall.

Returns:
an enumeration of faction ids
See Also:
factionID(), addRelation(String, double), delRelation(String), getRelation(String)

delRelation

boolean delRelation(java.lang.String factionID)
Removes the give faction relation from this faction. Requires a faction id of another faction.

Parameters:
factionID - the faction id to remove
Returns:
whether the faction id was found and removed
See Also:
factionID(), relationFactions()

addRelation

boolean addRelation(java.lang.String factionID,
                    double relation)
Adds a new faction relation factor to this faction. The faction id is the id of another complementary or rival faction, and the relation is a number multiplied by thge change in this faction to determine the amount the given faction id faction is changed by. The relation factor can be positive or negative to cause the faction id faction to rise or fall.

Parameters:
factionID - the faction id of the other faction
relation - the relation factor to use as a multiplier
Returns:
whether the new faction id was successfully added
See Also:
factionID(), relationFactions()

getRelation

double getRelation(java.lang.String factionID)
Returns the relation factor of the given faction id. See addRelation for more information.

Parameters:
factionID - the other factions faction id
Returns:
the factor to multiply a change in the other faction by
See Also:
factionID(), relationFactions(), addRelation(String, double)

affectsBehavs

java.util.Enumeration<java.lang.String> affectsBehavs()
Returns an enumeration of Abilities or Behavior IDs that are automatically but conditionally added to mobs (not players) with this faction.

Returns:
an enumeration of Abilities or Behavior ID
See Also:
Ability, Behavior, addAffectBehav(String, String, String), delAffectBehav(String), getAffectBehav(String)

delAffectBehav

boolean delAffectBehav(java.lang.String ID)
Removes the given ability or behavior from this Faction. It will require the mob be reset or rejuved in order for this to take affect.

Parameters:
ID - the Abilities or Behavior ID to remove
Returns:
whether the Abilities or Behavior ID was found and removed
See Also:
Ability, Behavior, affectsBehavs()

addAffectBehav

boolean addAffectBehav(java.lang.String ID,
                       java.lang.String parms,
                       java.lang.String gainMask)
Adds a new Ability or Behavior to this Faction. The ID must match a Behavior or, if one is not found, an Ability. The parms are any parameters required by the Behavior or Ability. The gainMask is a simple mask to further narrow what kind of mobs receive the given Ability or Behavior when first receiving this Faction. It will require the mob be reset or rejuved in order for this to take affect.

Parameters:
ID - the Abilities or Behavior ID to add
parms - the parameters for the new affect or behavior
gainMask - the zapper mask to check to see who qualifies
Returns:
whether the new Abilities or Behavior ID was successfully added
See Also:
Ability, Behavior, affectsBehavs(), delAffectBehav(String)

getAffectBehav

java.lang.String[] getAffectBehav(java.lang.String ID)
Returns a string array containing the parms at index 0, and the gainMask at 1. See addAffectBehav for more information.

Parameters:
ID - the Abilities or Behavior ID
Returns:
a string array containing the parms at index 0, and the gainMask at 1
See Also:
Ability, Behavior, affectsBehavs(), addAffectBehav(String, String, String)

reactions

java.util.Enumeration<Faction.FReactionItem> reactions()
Returns an enumeration of Faction.FactionReaction items associated with this faction. These are automatically added to mobs in the presence of one with this faction.

Returns:
an enumeration of Faction.FactionReaction items
See Also:
addReaction(String, String, String, String), delReaction(Faction.FReactionItem)

reactions

java.util.Enumeration<Faction.FReactionItem> reactions(java.lang.String rangeCode)
Returns an enumeration of Faction.FactionReaction items associated with this faction and the given range code. These are automatically added to mobs in the presence of one with this faction.

Parameters:
rangeCode - the range code to filter by
Returns:
an enumeration of Faction.FactionReaction items
See Also:
addReaction(String, String, String, String), delReaction(Faction.FReactionItem)

delReaction

boolean delReaction(Faction.FReactionItem item)
Removes the given reaction from this Faction.

Parameters:
item - the faction reaction item to remove
Returns:
whether the reaction was found and removed
See Also:
addReaction(String, String, String, String), reactions()

addReaction

boolean addReaction(java.lang.String range,
                    java.lang.String mask,
                    java.lang.String abilityID,
                    java.lang.String parms)
Adds a new reaction to this faction.

Parameters:
range - the faction range to use as a determinate
abilityID - the ability/Behavior/or command ID
parms - the parameters for the new affect or behavior or command
mask - the zapper mask to check to see which mob qualifies
Returns:
whether the new reaction was successfully added
See Also:
delReaction(Faction.FReactionItem), reactions(), Ability, Command, Behavior

setLightReactions

void setLightReactions(boolean truefalse)
Set this faction to use the light-reaction system, which is easier on resources, but not as powerful.

Parameters:
truefalse - true to use the light reaction system, false otherwise
See Also:
useLightReactions()

useLightReactions

boolean useLightReactions()
Return whether this faction uses the light-reaction system, which is easier on resources, but not as powerful.

Returns:
true if this faction to use the light-reaction system
See Also:
setLightReactions(boolean)

abilityUsages

java.util.Enumeration<Faction.FAbilityUsage> abilityUsages()
Returns an enumeration of Faction.FactionAbilityUsage objects for this Faction. A FactionAbilityUsage object defines restrictions on the use of a mob or players abilities based on values in this faction and other variables.

Returns:
an enumeration of Faction.FactionAbilityUsage objects for this Faction
See Also:
Faction.FAbilityUsage, addAbilityUsage(String), delAbilityUsage(com.planet_ink.coffee_mud.Common.interfaces.Faction.FAbilityUsage), usageFactorRangeDescription(Ability), hasUsage(Ability), canUse(MOB, Ability)

usageFactorRangeDescription

java.lang.String usageFactorRangeDescription(Ability A)
Returns the list of faction ranges that apply based on Faction.FactionAbilityUsage usage factor that apply to the given ability. An empty string means it does not apply.

Parameters:
A - the ability to find a usage factor for, and then use to find applicable ranges
Returns:
the list of faction range names that apply to this ability from usage factors
See Also:
Faction.FAbilityUsage, abilityUsages(), Faction.FRange

hasUsage

boolean hasUsage(Ability A)
Returns whether any of the Faction.FactionAbilityUsage objects for this Faction apply to the given ability.

Parameters:
A - the ability to find a usage criterium for
Returns:
true if a criterium exists, false otherwise.
See Also:
Faction.FAbilityUsage, abilityUsages()

canUse

boolean canUse(MOB mob,
               Ability A)
Returns whether the given player/mob is prevented from using the given Ability based on any of the Faction.FactionAbilityUsage (faction ability usage) criterium defined for this Faction.

Parameters:
mob - the mob/player to evaluate
A - the ability to evaluate
Returns:
true if the player can use the ability, false otherwise
See Also:
Faction.FAbilityUsage, abilityUsages()

addAbilityUsage

Faction.FAbilityUsage addAbilityUsage(java.lang.String key)
Adds a new Faction.FactionAbilityUsage object to this Faction based on the given definitional key. The key is NULL to create an empty usage, or a definitional string that consists of one or more ability names, domains, flags, etc followed by a semicolon and a minimum faction value, and another semicolon and a maximum faction value.

Parameters:
key - the definitional key, or null
Returns:
the new Faction.FactionAbilityUsage added
See Also:
Faction.FAbilityUsage, abilityUsages(), delAbilityUsage(com.planet_ink.coffee_mud.Common.interfaces.Faction.FAbilityUsage)

getAbilityUsage

Faction.FAbilityUsage getAbilityUsage(int x)
Returns the enumerated Faction.FactionAbilityUsage object at the given index.

Parameters:
x - the index of the Faction.FactionAbilityUsage object to return
Returns:
the Faction.FactionAbilityUsage object at that index
See Also:
Faction.FAbilityUsage, abilityUsages()

delAbilityUsage

boolean delAbilityUsage(Faction.FAbilityUsage usage)
Removes the given Faction.FactionAbilityUsage object from this faction

Parameters:
usage - the Faction.FactionAbilityUsage object to remove
Returns:
true if the object was found and removed
See Also:
Faction.FAbilityUsage, abilityUsages(), addAbilityUsage(String)

getInternalFlags

long getInternalFlags()
Return the bitmap of internal-use flags for this faction.

Returns:
the bitmap of internal-use flags for this faction.
See Also:
setInternalFlags(long)

setInternalFlags

void setInternalFlags(long bitmap)
Set the bitmap of internal-use flags for this faction.

Parameters:
bitmap - the bitmap of internal-use flags for this faction.
See Also:
getInternalFlags()