com.planet_ink.coffee_mud.Common.interfaces
Interface Faction.FactionChangeEvent

All Known Implementing Classes:
DefaultFaction.DefaultFactionChangeEvent
Enclosing interface:
Faction

public static interface Faction.FactionChangeEvent

A Faction Change Event is an event that triggers an automatic change in a mob or players faction value. Triggers can be the use of abilities, or certain specific coded events (such as killing another mob).

See Also:
Faction.ALL_CHANGE_EVENT_TYPES(), Faction.executeChange(MOB, MOB, com.planet_ink.coffee_mud.Common.interfaces.Faction.FactionChangeEvent)

Field Summary
static int CHANGE_DIRECTION_ADD
          a direction constant meaning this event adds the faction with a default value
static int CHANGE_DIRECTION_AWAY
          a direction constant meaning this event changes the factions value away from targets value
static java.lang.String[] CHANGE_DIRECTION_DESCS
          the code words for the various direction flags that describe the direction and amount of faction change
static int CHANGE_DIRECTION_DOWN
          a direction constant meaning this event changes the factions value downward
static int CHANGE_DIRECTION_MAXIMUM
          a direction constant meaning this event changes the factions value directly to highest value
static int CHANGE_DIRECTION_MINIMUM
          a direction constant meaning this event changes the factions value directly to lowest value
static int CHANGE_DIRECTION_OPPOSITE
          a direction constant meaning this event changes the factions value opposite of targets faction leanings
static int CHANGE_DIRECTION_REMOVE
          a direction constant meaning this event removes the faction altogether
static int CHANGE_DIRECTION_TOWARD
          a direction constant meaning this event changes the factions value towards the targets value
static int CHANGE_DIRECTION_UP
          a direction constant meaning this event changes the factions value upward
static java.lang.String[] FLAG_DESCS
          the code words for the various evaluation flags to decide if this event applies and other things
static java.lang.String[] FLAG_KEYVALS
          the code words for the various flags to set miscellaneous change event values, such as xp grants
static java.lang.String[] MISC_TRIGGERS
          some non-ability-related event trigger ids
 
Method Summary
 boolean applies(MOB source, MOB target)
          Returns whether the given mob is a valid source and target of this event.
 MaskingLibrary.CompiledZMask compiledSourceZapper()
          Returns the zapper mask that is used to see if the source of the event qualifies in order to trigger a faction change by this defined event.
 MaskingLibrary.CompiledZMask compiledTargetZapper()
          Returns the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.
 int direction()
          Returns a code for a description of how an event, if applicable, will affect this factions value.
 java.lang.String eventID()
          Returns the event trigger id
 double factor()
          Returns the factor to multiply the base faction change amount (100) by, to determine the amount of this faction changed by this event, in accordance with the given direction.
 java.lang.String flagCache()
          Returns the list of flags that apply to this event.
 int getBonusRoleplayXP()
          Returns any bonus roleplay xp granted by this change event in addition to faction changes.
 int getBonusXP()
          Returns any bonus xp granted by this change event in addition to faction changes.
 Faction getFaction()
          Return the parent faction for which this data stands.
 java.lang.String getFlagValue(java.lang.String key)
          Returns one of the raw key=value pairs from the flag cache.
 java.lang.String getTriggerParm(java.lang.String parmName)
          Returns the named trigger parameters defined
 int IDclassFilter()
          A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability ACODE_.
 int IDdomainFilter()
          A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability DOMAIN_.
 int IDflagFilter()
          A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability FLAG_.
 boolean just100()
          A derivative of the flag cache, this method returns whether the flag was set that causes the determination of the amount of faction move to apply to NOT take the difference between the source and targets levels into account.
 boolean outsiderTargetOK()
          A derivative of the flag cache, this method returns whether the flag was set that allows this event to trigger when the target of the event does not have any value with this faction
 boolean selfTargetOK()
          A derivative of the flag cache, this method returns whether the flag was set that allows this event to trigger when the target and source of the event are the same.
 void setDirection(int newVal)
          Sets a code for a description of how an event, if applicable, will affect this factions value.
 boolean setEventID(java.lang.String newID)
          Sets the event trigger id
 void setFactor(double newVal)
          Sets the factor to multiply the base faction change amount (100) by, to determine the amount of this faction changed by this event, in accordance with the given direction.
 void setFlags(java.lang.String newFlagCache)
          Sets the list of flags that apply to this event.
 void setStateVariable(int x, java.lang.Object newVal)
          Sets an internal state variable stored for this change event.
 void setTargetZapper(java.lang.String newVal)
          Sets the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.
 void setTriggerParameters(java.lang.String newVal)
          Sets any trigger parameters defined that modify the way the trigger behaves.
 java.lang.Object stateVariable(int x)
          Returns the internal state variable stored for this change event.
 java.lang.String targetZapper()
          Returns the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.
 java.lang.String toString()
          Returns a semicolon delimited list of all the settings in this change event
 java.lang.String triggerParameters()
          Returns any trigger parameters defined that modify the way the trigger behaves.
 

Field Detail

CHANGE_DIRECTION_UP

static final int CHANGE_DIRECTION_UP
a direction constant meaning this event changes the factions value upward

See Also:
Constant Field Values

CHANGE_DIRECTION_DOWN

static final int CHANGE_DIRECTION_DOWN
a direction constant meaning this event changes the factions value downward

See Also:
Constant Field Values

CHANGE_DIRECTION_OPPOSITE

static final int CHANGE_DIRECTION_OPPOSITE
a direction constant meaning this event changes the factions value opposite of targets faction leanings

See Also:
Constant Field Values

CHANGE_DIRECTION_MINIMUM

static final int CHANGE_DIRECTION_MINIMUM
a direction constant meaning this event changes the factions value directly to lowest value

See Also:
Constant Field Values

CHANGE_DIRECTION_MAXIMUM

static final int CHANGE_DIRECTION_MAXIMUM
a direction constant meaning this event changes the factions value directly to highest value

See Also:
Constant Field Values

CHANGE_DIRECTION_REMOVE

static final int CHANGE_DIRECTION_REMOVE
a direction constant meaning this event removes the faction altogether

See Also:
Constant Field Values

CHANGE_DIRECTION_ADD

static final int CHANGE_DIRECTION_ADD
a direction constant meaning this event adds the faction with a default value

See Also:
Constant Field Values

CHANGE_DIRECTION_AWAY

static final int CHANGE_DIRECTION_AWAY
a direction constant meaning this event changes the factions value away from targets value

See Also:
Constant Field Values

CHANGE_DIRECTION_TOWARD

static final int CHANGE_DIRECTION_TOWARD
a direction constant meaning this event changes the factions value towards the targets value

See Also:
Constant Field Values

CHANGE_DIRECTION_DESCS

static final java.lang.String[] CHANGE_DIRECTION_DESCS
the code words for the various direction flags that describe the direction and amount of faction change


FLAG_DESCS

static final java.lang.String[] FLAG_DESCS
the code words for the various evaluation flags to decide if this event applies and other things


FLAG_KEYVALS

static final java.lang.String[] FLAG_KEYVALS
the code words for the various flags to set miscellaneous change event values, such as xp grants


MISC_TRIGGERS

static final java.lang.String[] MISC_TRIGGERS
some non-ability-related event trigger ids

Method Detail

eventID

java.lang.String eventID()
Returns the event trigger id

Returns:
the event trigger id
See Also:
Faction.ALL_CHANGE_EVENT_TYPES(), setEventID(String), IDclassFilter(), IDdomainFilter(), IDflagFilter()

setEventID

boolean setEventID(java.lang.String newID)
Sets the event trigger id

Parameters:
newID - the new event trigger id
Returns:
true if the event id is valid
See Also:
Faction.ALL_CHANGE_EVENT_TYPES(), eventID(), IDclassFilter(), IDdomainFilter(), IDflagFilter()

IDclassFilter

int IDclassFilter()
A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability ACODE_. Returns -1 if this value does not apply, or an index into ACODE_DESCS.

Returns:
-1, or an index into an Ability ACODE
See Also:
Ability.ACODE_DESCS, eventID(), IDdomainFilter(), IDflagFilter()

IDflagFilter

int IDflagFilter()
A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability FLAG_. Returns -1 if this value does not apply, or an index into FLAG_DESCS.

Returns:
-1, or an index into an Ability FLAG
See Also:
Ability.FLAG_DESCS, eventID(), IDclassFilter(), IDdomainFilter()

IDdomainFilter

int IDdomainFilter()
A derivative of the event id, this will return a value of 0 or above if the event id was of a particular Ability DOMAIN_. Returns -1 if this value does not apply, or an index into DOMAIN_DESCS.

Returns:
-1, or an index into an Ability ACODE
See Also:
Ability.DOMAIN_DESCS, eventID(), IDclassFilter(), IDflagFilter()

flagCache

java.lang.String flagCache()
Returns the list of flags that apply to this event.

Returns:
the list of applicable flags
See Also:
FLAG_DESCS, FLAG_KEYVALS, setFlags(String), outsiderTargetOK(), selfTargetOK(), just100(), getBonusRoleplayXP(), getBonusXP(), getFlagValue(String)

setFlags

void setFlags(java.lang.String newFlagCache)
Sets the list of flags that apply to this event.

Parameters:
newFlagCache - the new list of applicable flags
See Also:
FLAG_DESCS, FLAG_KEYVALS, flagCache(), outsiderTargetOK(), selfTargetOK(), just100(), getBonusRoleplayXP(), getBonusXP(), getFlagValue(String)

outsiderTargetOK

boolean outsiderTargetOK()
A derivative of the flag cache, this method returns whether the flag was set that allows this event to trigger when the target of the event does not have any value with this faction

Returns:
true if the target does not have to have this faction, false otherwise
See Also:
flagCache(), selfTargetOK(), just100(), getBonusRoleplayXP(), getBonusXP(), getFlagValue(String)

selfTargetOK

boolean selfTargetOK()
A derivative of the flag cache, this method returns whether the flag was set that allows this event to trigger when the target and source of the event are the same.

Returns:
true if src and target are the same, false otherwise
See Also:
flagCache(), outsiderTargetOK(), just100(), getBonusRoleplayXP(), getBonusXP(), getFlagValue(String)

just100

boolean just100()
A derivative of the flag cache, this method returns whether the flag was set that causes the determination of the amount of faction move to apply to NOT take the difference between the source and targets levels into account.

Returns:
true to NOT take level into account when determining amount of faction change
See Also:
flagCache(), outsiderTargetOK(), selfTargetOK(), getBonusRoleplayXP(), getBonusXP(), getFlagValue(String)

getBonusXP

int getBonusXP()
Returns any bonus xp granted by this change event in addition to faction changes. This XP is given to the source of the event, and normal level and alignment based checks apply to the target.

Returns:
the bonus xp
See Also:
flagCache(), outsiderTargetOK(), selfTargetOK(), just100(), getBonusRoleplayXP(), getFlagValue(String)

getBonusRoleplayXP

int getBonusRoleplayXP()
Returns any bonus roleplay xp granted by this change event in addition to faction changes. This roleplay XP is given to the source of the event.

Returns:
the bonus roleplay xp
See Also:
flagCache(), outsiderTargetOK(), selfTargetOK(), just100(), getBonusXP(), getFlagValue(String)

getFlagValue

java.lang.String getFlagValue(java.lang.String key)
Returns one of the raw key=value pairs from the flag cache.

Parameters:
key - the key to look up
Returns:
the value of the key, if available, or ""

direction

int direction()
Returns a code for a description of how an event, if applicable, will affect this factions value. The direction is an index into CHANGE_DIRECTION_DESCS, or one of the CHANGE_DIRECTION_ constants.

Returns:
a FactionChangeEvent#CHANGE_DIRECTION_ constant
See Also:
CHANGE_DIRECTION_DESCS, setDirection(int)

setDirection

void setDirection(int newVal)
Sets a code for a description of how an event, if applicable, will affect this factions value. The direction is an index into CHANGE_DIRECTION_DESCS, or one of the CHANGE_DIRECTION_ constants.

Parameters:
newVal - a new FactionChangeEvent#CHANGE_DIRECTION_ constant
See Also:
CHANGE_DIRECTION_DESCS, direction()

factor

double factor()
Returns the factor to multiply the base faction change amount (100) by, to determine the amount of this faction changed by this event, in accordance with the given direction.

Returns:
the factor to multiply the base amount of the faction by
See Also:
direction(), setFactor(double)

setFactor

void setFactor(double newVal)
Sets the factor to multiply the base faction change amount (100) by, to determine the amount of this faction changed by this event, in accordance with the given direction.

Parameters:
newVal - the new faction change factor amount
See Also:
direction(), factor()

targetZapper

java.lang.String targetZapper()
Returns the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.

Returns:
the zapper mask string
See Also:
setTargetZapper(String), MaskingLibrary

compiledTargetZapper

MaskingLibrary.CompiledZMask compiledTargetZapper()
Returns the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.

Returns:
the zapper mask compiled
See Also:
setTargetZapper(String), MaskingLibrary

compiledSourceZapper

MaskingLibrary.CompiledZMask compiledSourceZapper()
Returns the zapper mask that is used to see if the source of the event qualifies in order to trigger a faction change by this defined event.

Returns:
the zapper mask compiled
See Also:
setTriggerParameters(String), MaskingLibrary

setTargetZapper

void setTargetZapper(java.lang.String newVal)
Sets the zapper mask that is used to see if the target of the event qualifies in order to trigger a faction change by this defined event.

Parameters:
newVal - the new zapper mask string
See Also:
targetZapper(), MaskingLibrary

triggerParameters

java.lang.String triggerParameters()
Returns any trigger parameters defined that modify the way the trigger behaves.

Returns:
the trigger parameters
See Also:
setTriggerParameters(String)

getTriggerParm

java.lang.String getTriggerParm(java.lang.String parmName)
Returns the named trigger parameters defined

Parameters:
parmName - the name of the trigger parm to look for
Returns:
the specific named trigger parameter
See Also:
setTriggerParameters(String)

setTriggerParameters

void setTriggerParameters(java.lang.String newVal)
Sets any trigger parameters defined that modify the way the trigger behaves.

Parameters:
newVal - the trigger parameters
See Also:
triggerParameters()

stateVariable

java.lang.Object stateVariable(int x)
Returns the internal state variable stored for this change event.

Parameters:
x - which internal state variable to get
Returns:
the state variable
See Also:
setStateVariable(int,Object)

setStateVariable

void setStateVariable(int x,
                      java.lang.Object newVal)
Sets an internal state variable stored for this change event.

Parameters:
x - which internal state variable to set
newVal - the state variable
See Also:
stateVariable(int)

toString

java.lang.String toString()
Returns a semicolon delimited list of all the settings in this change event

Overrides:
toString in class java.lang.Object
Returns:
a semicolon delimited list of all the settings in this change event
See Also:
Faction.createChangeEvent(String)

applies

boolean applies(MOB source,
                MOB target)
Returns whether the given mob is a valid source and target of this event.

Parameters:
source - the source to evaluate
target - the target to evaluate
Returns:
true if this event applies to the mobs, false otherwise

getFaction

Faction getFaction()
Return the parent faction for which this data stands.

Returns:
this data objects parent faction.