|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Faction
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.
MOB.fetchFaction(String),
MOB.addFaction(String, int)| Nested Class Summary | |
|---|---|
static interface |
Faction.FactionAbilityUsage
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.FactionData
A FactionData object is stored inside other objects that keep track of their own faction. |
static interface |
Faction.FactionRange
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. |
| Field Summary | |
|---|---|
static int |
ALIGN_EVIL
legacy constant for Faction.FactionRange.alignEquiv() denoting that the range reflects evil alignment |
static int |
ALIGN_GOOD
legacy constant for Faction.FactionRange.alignEquiv() denoting that the range reflects good alignment |
static int |
ALIGN_INDIFF
legacy constant for Faction.FactionRange.alignEquiv() denoting that the range does not reflect alignment |
static java.lang.String[] |
ALIGN_NAMES
String list for the ALIGN_EVIL constants |
static int |
ALIGN_NEUTRAL
legacy constant for Faction.FactionRange.alignEquiv() denoting that the range reflects neutral alignment |
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 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_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 |
| Method Summary | |
|---|---|
java.util.Enumeration |
abilityUsages()
Returns an enumeration of Faction.FactionAbilityUsage objects for this Faction. |
Faction.FactionAbilityUsage |
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.FactionChangeEvent |
addChangeEvent(java.lang.String key)
Adds a new FactionChangeEvent object to this faction using the given event code name, or fully encoded event string. |
java.lang.Object[] |
addFactor(double gain,
double loss,
java.lang.String mask)
Adds a new change factor to this Faction. |
Faction.FactionRange |
addRange(java.lang.String key)
Adds a new Faction.FactionRange object to this faction using an encoded key. |
boolean |
addRelation(java.lang.String factionID,
double relation)
Adds a new faction relation factor to this faction. |
java.util.Enumeration |
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 |
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 |
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 |
choices()
Returns the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character. |
java.util.Enumeration |
defaults()
Returns the default faction mask/value list, which is applied whenever a Faction Change Event applies a Faction Add command. |
boolean |
delAbilityUsage(Faction.FactionAbilityUsage 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(java.lang.String eventKey)
Removes a FactionChangeEvent of the given event (trigger) id. |
boolean |
delFactor(java.lang.Object[] o)
Removes the given change factor from this faction. |
boolean |
delRange(Faction.FactionRange FR)
Removes the given FactionRange object from the 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 |
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 |
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.FactionRange |
fetchRange(int faction)
Returns the Faction.FactionRange object that applies to the given faction value. |
Faction.FactionRange |
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. |
int |
findAutoDefault(MOB mob)
Returns the automatic default faction value that applies to the given mob. |
Faction.FactionChangeEvent |
findChangeEvent(Ability key)
Returns a FactionChangeEvent that applies when the given Ability is used |
java.util.Vector |
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.FactionAbilityUsage |
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 |
getChangeEvent(java.lang.String key)
Returns a FactionChangeEvent that applies when the given event name (a trigger code) occurs in the game. |
java.lang.Object[] |
getFactor(int x)
Returns the given enumerated change factor |
java.lang.String |
getINIDef(java.lang.String tag,
java.lang.String delimeter)
Retreives an entry for an ini properties definition document that describes 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 |
Faction.FactionData |
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 |
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 |
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.Vector 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.Vector v)
Sets the player choosable faction mask/value list, which is possibly presented whenever a player creates a new character. |
void |
setDefaults(java.util.Vector 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 |
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. |
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. |
| 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.MsgListener |
|---|
executeMsg, okMessage |
| Field Detail |
|---|
static final int ALIGN_INDIFF
Faction.FactionRange.alignEquiv() denoting that the range does not reflect alignment
static final int ALIGN_EVIL
Faction.FactionRange.alignEquiv() denoting that the range reflects evil alignment
static final int ALIGN_NEUTRAL
Faction.FactionRange.alignEquiv() denoting that the range reflects neutral alignment
static final int ALIGN_GOOD
Faction.FactionRange.alignEquiv() denoting that the range reflects good alignment
static final java.lang.String[] ALIGN_NAMES
ALIGN_EVIL constants
static final java.lang.String[] EXPAFFECT_NAMES
experienceFlag() constants
static final java.lang.String[] EXPAFFECT_DESCS
experienceFlag() constants
static final int TAG_NAME
TAG_NAMES denoting the NAME tag
static final int TAG_MINIMUM
TAG_NAMES denoting the MINIMUM tag
static final int TAG_MAXIMUM
TAG_NAMES denoting the MAXIMUM tag
static final int TAG_SCOREDISPLAY
TAG_NAMES denoting the SCOREDISPLAY tag
static final int TAG_SPECIALREPORTED
TAG_NAMES denoting the SPECIALREPORTED tag
static final int TAG_EDITALONE
TAG_NAMES denoting the EDITALONE tag
static final int TAG_DEFAULT
TAG_NAMES denoting the DEFAULT tag
static final int TAG_AUTODEFAULTS
TAG_NAMES denoting the AUTODEFAULTS tag
static final int TAG_AUTOCHOICES
TAG_NAMES denoting the AUTOCHOICES tag
static final int TAG_CHOICEINTRO
TAG_NAMES denoting the CHOICEINTRO tag
static final int TAG_RATEMODIFIER
TAG_NAMES denoting the RATEMODIFIER tag
static final int TAG_EXPERIENCE
TAG_NAMES denoting the EXPERIENCE tag
static final int TAG_RANGE_
TAG_NAMES denoting the RANGE tag
static final int TAG_CHANGE_
TAG_NAMES denoting the CHANGE tag
static final int TAG_ABILITY_
TAG_NAMES denoting the ABILITY tag
static final int TAG_FACTOR_
TAG_NAMES denoting the FACTOR tag
static final int TAG_RELATION_
TAG_NAMES denoting the RELATION tag
static final int TAG_SHOWINFACTIONSCMD
TAG_NAMES denoting the SHOWINFACTIONSCMD tag
static final int TAG_AFFBEHAV_
TAG_NAMES denoting the AFFBEHAV tag
static final java.lang.String[] TAG_NAMES
getTagValue(String)
| Method Detail |
|---|
void initializeFaction(java.lang.String aname)
aname - the factionID (and default name)initializeFaction(StringBuffer, String),
factionID()
void initializeFaction(java.lang.StringBuffer file,
java.lang.String fID)
file - the ini properties style documentfID - the new factionIDinitializeFaction(String),
factionID(),
getINIDef(String, String)java.lang.String getTagValue(java.lang.String tag)
tag - the tag to get the value of
TAG_NAMES
java.lang.String getINIDef(java.lang.String tag,
java.lang.String delimeter)
tag - the tag to retreive a properties definition fordelimeter - if the tag represents a list, this is the delimiter for entries.
getINIDef(String, String),
initializeFaction(StringBuffer, String),
TAG_NAMESFaction.FactionData makeFactionData(MOB mob)
mob - the mob to generate affects and behaviors for
Faction.FactionDataboolean hasFaction(MOB mob)
mob - the mob to check
int asPercent(int faction)
faction - the faction value to convert to a percent
int asPercentFromAvg(int faction)
faction - the faction value to convert to a percent
int randomFaction()
java.lang.String factionID()
setFactionID(String)void setFactionID(java.lang.String newStr)
newStr - the new unique id of this factionfactionID()java.lang.String name()
setName(String)void setName(java.lang.String newStr)
newStr - the new name of this factionname()java.lang.String choiceIntro()
findChoices(MOB)void setChoiceIntro(java.lang.String newStr)
newStr - the new filename of the choice description filefindChoices(MOB)int minimum()
int middle()
int difference()
int maximum()
java.lang.String experienceFlag()
EXPAFFECT_NAMES,
EXPAFFECT_DESCSvoid setExperienceFlag(java.lang.String newStr)
newStr - the new string code for xp changes->faction changesEXPAFFECT_NAMES,
EXPAFFECT_DESCSboolean showInScore()
void setShowInScore(boolean truefalse)
truefalse - true if displayed in Score, false otherwiseboolean showInSpecialReported()
void setShowInSpecialReported(boolean truefalse)
truefalse - true if displayed in special admin commands, false otherwiseboolean showInEditor()
void setShowInEditor(boolean truefalse)
truefalse - true if displayed in mob editors, false otherwiseboolean showInFactionsCommand()
void setShowInFactionsCommand(boolean truefalse)
truefalse - true if displayed in factions command, false otherwisejava.util.Enumeration defaults()
changeEventKeys(),
setDefaults(Vector),
MaskingLibraryint findDefault(MOB mob)
mob - the mob to find a default faction value for
defaults()void setDefaults(java.util.Vector v)
v - the new default faction mask/value listchangeEventKeys(),
MaskingLibrary,
defaults()java.util.Enumeration autoDefaults()
MaskingLibrary,
setAutoDefaults(Vector)int findAutoDefault(MOB mob)
mob - the mob to find a default value of this faction for.
defaults()void setAutoDefaults(java.util.Vector v)
v - the new automatic default faction mask/value listdefaults(),
MaskingLibrarydouble rateModifier()
setRateModifier(double)void setRateModifier(double d)
d - the new modifier of the base amount of faction value changerateModifier()java.util.Enumeration choices()
MaskingLibrary,
setChoices(Vector)java.util.Vector findChoices(MOB mob)
mob - the player mob to evaluate
choices()void setChoices(java.util.Vector v)
v - the list of choosable faction mask/valuesMaskingLibrary,
choices()java.util.Enumeration ranges()
addRange(String),
delRange(com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionRange),
Faction.FactionRangeFaction.FactionRange fetchRange(int faction)
faction - the value to find a matching range object for
Faction.FactionRange,
ranges()java.lang.String fetchRangeName(int faction)
faction - the value to find a matching range object for
ranges()Faction.FactionRange addRange(java.lang.String key)
key - the encoded values for the new faction range
Faction.FactionRange,
ranges()boolean delRange(Faction.FactionRange FR)
FR - the faction range object to remove
Faction.FactionRange,
ranges()Faction.FactionRange fetchRange(java.lang.String codeName)
codeName - the code name to find a matching range object for
ranges(),
Faction.FactionRange.codeName()java.util.Enumeration changeEventKeys()
Faction.FactionChangeEvent,
addChangeEvent(String),
delChangeEvent(String),
ALL_CHANGE_EVENT_TYPES(),
executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent)Faction.FactionChangeEvent findChangeEvent(Ability key)
key - the Ability to find a change event for.
Faction.FactionChangeEvent,
changeEventKeys(),
executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent),
ALL_CHANGE_EVENT_TYPES()Faction.FactionChangeEvent getChangeEvent(java.lang.String key)
key - the code name of the event that occurred
Faction.FactionChangeEvent,
changeEventKeys(),
Faction.FactionChangeEvent.MISC_TRIGGERS,
executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent),
ALL_CHANGE_EVENT_TYPES()Faction.FactionChangeEvent addChangeEvent(java.lang.String key)
key - the field used to create the new FactionChangeEvent
Faction.FactionChangeEvent,
changeEventKeys(),
Faction.FactionChangeEvent.MISC_TRIGGERS,
ALL_CHANGE_EVENT_TYPES()boolean delChangeEvent(java.lang.String eventKey)
eventKey - the event id to remove from the list of change events
Faction.FactionChangeEvent,
changeEventKeys(),
Faction.FactionChangeEvent.MISC_TRIGGERS,
ALL_CHANGE_EVENT_TYPES()
void executeChange(MOB source,
MOB target,
Faction.FactionChangeEvent event)
source - the source of the eventtarget - the target of the eventevent - the applicable event object for this factionFaction.FactionChangeEvent,
changeEventKeys(),
ALL_CHANGE_EVENT_TYPES()java.lang.String ALL_CHANGE_EVENT_TYPES()
Faction.FactionChangeEvent,
changeEventKeys()java.util.Enumeration factors()
addFactor(double, double, String),
delFactor(Object[]),
findFactor(MOB, boolean),
MaskingLibraryboolean delFactor(java.lang.Object[] o)
o - the factor to remove
factors()java.lang.Object[] getFactor(int x)
x - which factor (0-number) to return
factors()
java.lang.Object[] addFactor(double gain,
double loss,
java.lang.String mask)
gain - the factor to apply on gains in factionloss - the factor to apply on losses of factionmask - the zapper mask to use to determine if this factor applies to a mob
factors(),
MaskingLibrary
double findFactor(MOB mob,
boolean gain)
mob - the mob to compare against the zapper masks of the various factorsgain - return the gain factor if true, or the loss factor if false
factors(),
MaskingLibraryjava.util.Enumeration relationFactions()
factionID(),
addRelation(String, double),
delRelation(String),
getRelation(String)boolean delRelation(java.lang.String factionID)
factionID - the faction id to remove
factionID(),
relationFactions()
boolean addRelation(java.lang.String factionID,
double relation)
factionID - the faction id of the other factionrelation - the relation factor to use as a multiplier
factionID(),
relationFactions()double getRelation(java.lang.String factionID)
factionID - the other factions faction id