|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.planet_ink.coffee_mud.Common.DefaultFaction
public class DefaultFaction
Portions Copyright (c) 2003 Jeremy Vyska Portions Copyright (c) 2004-2008 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| Nested Class Summary | |
|---|---|
static class |
DefaultFaction.DefaultFactionAbilityUsage
|
static class |
DefaultFaction.DefaultFactionChangeEvent
|
static class |
DefaultFaction.DefaultFactionData
|
static class |
DefaultFaction.DefaultFactionRange
|
| Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Common.interfaces.Faction |
|---|
Faction.FactionAbilityUsage, Faction.FactionChangeEvent, Faction.FactionData, Faction.FactionRange |
| Field Summary | |
|---|---|
protected java.util.Vector |
abilityUsages
|
protected java.util.Hashtable |
affBehavs
|
protected java.util.Vector |
autoDefaults
|
protected java.util.Hashtable |
changes
|
protected java.lang.String |
choiceIntro
|
protected java.util.Vector |
choices
|
protected java.util.Vector |
defaults
|
protected int |
difference
|
protected java.lang.String |
experienceFlag
|
protected java.util.Vector |
factors
|
protected int |
highest
|
protected java.lang.String |
ID
|
protected long[] |
lastAffectBehaviorChange
|
protected int |
lowest
|
protected int |
maximum
|
protected int |
middle
|
protected int |
minimum
|
protected java.lang.String |
name
|
protected java.util.Hashtable |
ranges
|
protected double |
rateModifier
|
protected java.util.Hashtable |
relations
|
protected boolean |
showInEditor
|
protected boolean |
showInFactionsCommand
|
protected boolean |
showInScore
|
protected boolean |
showInSpecialReported
|
| Fields inherited from interface com.planet_ink.coffee_mud.Common.interfaces.Faction |
|---|
ALIGN_EVIL, ALIGN_GOOD, ALIGN_INDIFF, ALIGN_NAMES, ALIGN_NEUTRAL, EXPAFFECT_DESCS, EXPAFFECT_NAMES, TAG_ABILITY_, TAG_AFFBEHAV_, TAG_AUTOCHOICES, TAG_AUTODEFAULTS, TAG_CHANGE_, TAG_CHOICEINTRO, TAG_DEFAULT, TAG_EDITALONE, TAG_EXPERIENCE, TAG_FACTOR_, TAG_MAXIMUM, TAG_MINIMUM, TAG_NAME, TAG_NAMES, TAG_RANGE_, TAG_RATEMODIFIER, TAG_RELATION_, TAG_SCOREDISPLAY, TAG_SHOWINFACTIONSCMD, TAG_SPECIALREPORTED |
| Constructor Summary | |
|---|---|
DefaultFaction()
|
|
| 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. |
int |
compareTo(CMObject o)
|
CMObject |
copyOf()
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed. |
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 |
void |
executeMsg(Environmental myHost,
CMMsg msg)
The general message event handler for the object. |
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. |
int |
highest()
|
java.lang.String |
ID()
The CoffeeMud Java Class ID shared by all instances of this object. |
void |
initializeClass()
Called ONCE after all objects are loaded, but before the map is read in during initialization. |
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 |
int |
lowest()
|
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. |
CMObject |
newInstance()
Returns a new instance of this class. |
boolean |
okMessage(Environmental myHost,
CMMsg msg)
The general message event previewer for the object. |
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 class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String ID
protected java.lang.String name
protected java.lang.String choiceIntro
protected long[] lastAffectBehaviorChange
protected int minimum
protected int middle
protected int difference
protected int maximum
protected int highest
protected int lowest
protected java.lang.String experienceFlag
protected boolean showInScore
protected boolean showInSpecialReported
protected boolean showInEditor
protected boolean showInFactionsCommand
protected java.util.Hashtable ranges
protected java.util.Hashtable affBehavs
protected java.util.Vector defaults
protected java.util.Vector autoDefaults
protected double rateModifier
protected java.util.Hashtable changes
protected java.util.Vector factors
protected java.util.Hashtable relations
protected java.util.Vector abilityUsages
protected java.util.Vector choices
| Constructor Detail |
|---|
public DefaultFaction()
| Method Detail |
|---|
public java.lang.String ID()
CMObject
ID in interface CMObjectpublic CMObject newInstance()
CMObject
newInstance in interface CMObjectpublic void initializeClass()
CMObject
initializeClass in interface CMObjectpublic CMObject copyOf()
CMObject
copyOf in interface CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>public java.lang.String factionID()
Faction
factionID in interface FactionFaction.setFactionID(String)public java.lang.String name()
Faction
name in interface FactionFaction.setName(String)public java.lang.String choiceIntro()
Faction
choiceIntro in interface FactionFaction.findChoices(MOB)public int minimum()
Faction
minimum in interface Factionpublic int middle()
Faction
middle in interface Factionpublic int difference()
Faction
difference in interface Factionpublic int maximum()
Faction
maximum in interface Factionpublic int highest()
public int lowest()
public java.lang.String experienceFlag()
Faction
experienceFlag in interface FactionFaction.EXPAFFECT_NAMES,
Faction.EXPAFFECT_DESCSpublic boolean showInScore()
Faction
showInScore in interface Factionpublic boolean showInSpecialReported()
Faction
showInSpecialReported in interface Factionpublic boolean showInEditor()
Faction
showInEditor in interface Factionpublic boolean showInFactionsCommand()
Faction
showInFactionsCommand in interface Factionpublic java.util.Enumeration ranges()
Faction
ranges in interface FactionFaction.addRange(String),
Faction.delRange(com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionRange),
Faction.FactionRangepublic java.util.Enumeration defaults()
Faction
defaults in interface FactionFaction.changeEventKeys(),
Faction.setDefaults(Vector),
MaskingLibrarypublic java.util.Enumeration autoDefaults()
Faction
autoDefaults in interface FactionMaskingLibrary,
Faction.setAutoDefaults(Vector)public double rateModifier()
Faction
rateModifier in interface FactionFaction.setRateModifier(double)public java.util.Enumeration changeEventKeys()
Faction
changeEventKeys in interface FactionFaction.FactionChangeEvent,
Faction.addChangeEvent(String),
Faction.delChangeEvent(String),
Faction.ALL_CHANGE_EVENT_TYPES(),
Faction.executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent)public java.util.Enumeration factors()
Faction
factors in interface FactionFaction.addFactor(double, double, String),
Faction.delFactor(Object[]),
Faction.findFactor(MOB, boolean),
MaskingLibrarypublic java.util.Enumeration relationFactions()
Faction
relationFactions in interface FactionFaction.factionID(),
Faction.addRelation(String, double),
Faction.delRelation(String),
Faction.getRelation(String)public java.util.Enumeration abilityUsages()
Faction
abilityUsages in interface FactionFaction.FactionAbilityUsage,
Faction.addAbilityUsage(String),
Faction.delAbilityUsage(com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionAbilityUsage),
Faction.usageFactorRangeDescription(Ability),
Faction.hasUsage(Ability),
Faction.canUse(MOB, Ability)public java.util.Enumeration choices()
Faction
choices in interface FactionMaskingLibrary,
Faction.setChoices(Vector)public void setFactionID(java.lang.String newStr)
Faction
setFactionID in interface FactionnewStr - the new unique id of this factionFaction.factionID()public void setName(java.lang.String newStr)
Faction
setName in interface FactionnewStr - the new name of this factionFaction.name()public void setChoiceIntro(java.lang.String newStr)
Faction
setChoiceIntro in interface FactionnewStr - the new filename of the choice description fileFaction.findChoices(MOB)public void setExperienceFlag(java.lang.String newStr)
Faction
setExperienceFlag in interface FactionnewStr - the new string code for xp changes->faction changesFaction.EXPAFFECT_NAMES,
Faction.EXPAFFECT_DESCSpublic void setShowInScore(boolean truefalse)
Faction
setShowInScore in interface Factiontruefalse - true if displayed in Score, false otherwisepublic void setShowInSpecialReported(boolean truefalse)
Faction
setShowInSpecialReported in interface Factiontruefalse - true if displayed in special admin commands, false otherwisepublic void setShowInEditor(boolean truefalse)
Faction
setShowInEditor in interface Factiontruefalse - true if displayed in mob editors, false otherwisepublic void setShowInFactionsCommand(boolean truefalse)
Faction
setShowInFactionsCommand in interface Factiontruefalse - true if displayed in factions command, false otherwisepublic void setChoices(java.util.Vector v)
Faction
setChoices in interface Factionv - the list of choosable faction mask/valuesMaskingLibrary,
Faction.choices()public void setAutoDefaults(java.util.Vector v)
Faction
setAutoDefaults in interface Factionv - the new automatic default faction mask/value listFaction.defaults(),
MaskingLibrarypublic void setDefaults(java.util.Vector v)
Faction
setDefaults in interface Factionv - the new default faction mask/value listFaction.changeEventKeys(),
MaskingLibrary,
Faction.defaults()public void setRateModifier(double d)
Faction
setRateModifier in interface Factiond - the new modifier of the base amount of faction value changeFaction.rateModifier()public Faction.FactionAbilityUsage getAbilityUsage(int x)
Faction
getAbilityUsage in interface Factionx - the index of the Faction.FactionAbilityUsage object to return
Faction.FactionAbilityUsage,
Faction.abilityUsages()public boolean delFactor(java.lang.Object[] o)
Faction
delFactor in interface Factiono - the factor to remove
Faction.factors()public java.lang.Object[] getFactor(int x)
Faction
getFactor in interface Factionx - which factor (0-number) to return
Faction.factors()
public java.lang.Object[] addFactor(double gain,
double loss,
java.lang.String mask)
Faction
addFactor in interface Factiongain - 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
Faction.factors(),
MaskingLibrarypublic boolean delRelation(java.lang.String factionID)
Faction
delRelation in interface FactionfactionID - the faction id to remove
Faction.factionID(),
Faction.relationFactions()
public boolean addRelation(java.lang.String factionID,
double relation)
Faction
addRelation in interface FactionfactionID - the faction id of the other factionrelation - the relation factor to use as a multiplier
Faction.factionID(),
Faction.relationFactions()public double getRelation(java.lang.String factionID)
Faction
getRelation in interface FactionfactionID - the other factions faction id
Faction.factionID(),
Faction.relationFactions(),
Faction.addRelation(String, double)public void initializeFaction(java.lang.String aname)
Faction
initializeFaction in interface Factionaname - the factionID (and default name)Faction.initializeFaction(StringBuffer, String),
Faction.factionID()
public void initializeFaction(java.lang.StringBuffer file,
java.lang.String fID)