com.planet_ink.coffee_mud.Libraries.interfaces
Interface AbilityComponents

All Superinterfaces:
java.lang.Cloneable, CMLibrary, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
CMAbleComps

public interface AbilityComponents
extends CMLibrary

Library for configureing and managing the rules for what resource components (magic dust, tools, etc) are required every time a particular skill is used. Normally this would be part of the skill itself, but since this feature was added so late, it's separate. Also here are common skill limit utilities, for determining how many common skills a player can learn.


Nested Class Summary
static interface AbilityComponents.AbilityLimits
          Ability Limits object, denoting how many of different types of common skills and langs that a player can learn, including an entry for a specific skill.
 
Method Summary
 java.lang.String addAbilityComponent(java.lang.String s, java.util.Map<java.lang.String,java.util.List<AbilityComponent>> H)
          Adds a new coded ability component to the given component map.
 void alterAbilityComponentFile(java.lang.String compID, boolean delete)
          Alters and saved the ability components definition to on the filesystem (components.txt).
 java.util.List<java.lang.Object> componentCheck(MOB mob, java.util.List<AbilityComponent> req, boolean mithrilOK)
          Checks whether the given mob has the given components required to use a skill available to him/her, and if found, returns them as a FoundComponents list.
 java.util.List<Item> componentsSample(java.util.List<AbilityComponent> req, boolean mithrilOK)
          Returns a very dirty approximate of a sample of what components appear to be required.
 AbilityComponent createBlankAbilityComponent()
          Creates a new blank ability component object
 MaterialLibrary.DeadResourceRecord destroyAbilityComponents(java.util.List<java.lang.Object> found)
          If the ability component recipe used to build the list of found components needed to use a skill requires that any of the componenets are destroyed.
 PairList<java.lang.String,java.lang.String> getAbilityComponentCoded(AbilityComponent comp)
          Breaks an ability component decoded objects into a series of key/value pairs, where the first is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK.
 java.lang.String getAbilityComponentCodedString(java.util.List<AbilityComponent> comps)
          Reconstructs the coded ability component definition string (ID=parms) from the given cached decoded structures list.
 java.lang.String getAbilityComponentCodedString(java.lang.String AID)
          Reconstructs the coded ability component definition string (ID=parms) from the internal cached structures, given a particular Ability ID.
 java.lang.String getAbilityComponentDesc(MOB mob, AbilityComponent comp, boolean useConnector)
          Returns a friendly readable description of a specific component in the given decoded ability components definition list.
 java.lang.String getAbilityComponentDesc(MOB mob, java.util.List<AbilityComponent> req)
          Returns a friendly readable form of the component requirements of the given Ability/Skill Component List, or null if it has no requirements.
 java.lang.String getAbilityComponentDesc(MOB mob, java.lang.String AID)
          Returns a friendly readable form of the component requirements of the given Ability/Skill ID(), or null if that ability has no requirements.
 java.util.Map<java.lang.String,java.util.List<AbilityComponent>> getAbilityComponentMap()
          Returns the master ability component map, keyed by the Ability ID.
 java.util.List<AbilityComponent> getAbilityComponents(java.lang.String AID)
          Gets the decoded ability component definition for a given Ability ID().
 AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM)
          Returns the character-class based common skill ability limits object applicable to the given mob, or zeroes if there's a problem.
 AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM, Ability A)
          Returns the character-class based common skill ability limits object applicable to the given mob and the given ability.
 AbilityComponents.AbilityLimits getSpecialSkillRemainder(MOB studentM, Ability A)
          Returns the character-class based common skill ability limits object applicable to the given mob and the given ability, and then subtracts the number of each common skill already learned to derive a remaining number of each type.
 AbilityComponents.AbilityLimits getSpecialSkillRemainders(MOB studentM)
          Returns the character-class based common skill ability limits object applicable to the given mob, and then subtracts the number of each common skill already learned to derive a remaining number of each type.
 void setAbilityComponentCodedFromCodedPairs(PairList<java.lang.String,java.lang.String> decodedDV, AbilityComponent comp)
          Copies the key/value pairs from a PairList of specific abilitycomponent fields into the given AbilityComponent object.
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

componentCheck

java.util.List<java.lang.Object> componentCheck(MOB mob,
                                                java.util.List<AbilityComponent> req,
                                                boolean mithrilOK)
Checks whether the given mob has the given components required to use a skill available to him/her, and if found, returns them as a FoundComponents list.

Parameters:
mob - the mob whose inventory or room or both to check
req - the ability components rules definition
mithrilOK - true to allow mithril as a metal substitute
Returns:
null if missing components, or the list of found components
See Also:
getAbilityComponents(String)

componentsSample

java.util.List<Item> componentsSample(java.util.List<AbilityComponent> req,
                                      boolean mithrilOK)
Returns a very dirty approximate of a sample of what components appear to be required. Named items are not required, but raw material components are created, and most rules are ignored in order to generate as many as possible.

Parameters:
req - the ability components rules definition
mithrilOK - true to allow mithril as a metal substitute
Returns:
a list of sample items
See Also:
getAbilityComponents(String)

destroyAbilityComponents

MaterialLibrary.DeadResourceRecord destroyAbilityComponents(java.util.List<java.lang.Object> found)
If the ability component recipe used to build the list of found components needed to use a skill requires that any of the componenets are destroyed.

Parameters:
found - the components found with componentCheck
Returns:
the record of the components destroyed
See Also:
componentCheck(MOB, List, boolean), MaterialLibrary.DeadResourceRecord

getAbilityComponentDesc

java.lang.String getAbilityComponentDesc(MOB mob,
                                         java.lang.String AID)
Returns a friendly readable form of the component requirements of the given Ability/Skill ID(), or null if that ability has no requirements. Since requirements may differ by player mask, the player mob is also required.

Parameters:
mob - the player mob who wants to know
AID - the Ability ID() of the skill whose components to check
Returns:
a friendly readable form of the component requirements
See Also:
getAbilityComponentDesc(MOB, List), getAbilityComponentDesc(MOB, AbilityComponent, boolean)

getAbilityComponentDesc

java.lang.String getAbilityComponentDesc(MOB mob,
                                         java.util.List<AbilityComponent> req)
Returns a friendly readable form of the component requirements of the given Ability/Skill Component List, or null if it has no requirements. Since requirements may differ by player mask, the player mob is also required.

Parameters:
mob - the player mob who wants to know
req - the coded requirements list
Returns:
a friendly readable form of the component requirements
See Also:
getAbilityComponentDesc(MOB, AbilityComponent, boolean), getAbilityComponentDesc(MOB, String)

getAbilityComponentDesc

java.lang.String getAbilityComponentDesc(MOB mob,
                                         AbilityComponent comp,
                                         boolean useConnector)
Returns a friendly readable description of a specific component in the given decoded ability components definition list. If the component does not refer to the given mob, "" is returned.

Parameters:
mob - the mob to check this components applicability to.
comp - the complete ability component decoded
useConnector - true to use a connector AND/OR, false otherwise
Returns:
a friendly readable description of a specific component
See Also:
getAbilityComponentDesc(MOB, List), getAbilityComponentDesc(MOB, String)

getAbilityComponentMap

java.util.Map<java.lang.String,java.util.List<AbilityComponent>> getAbilityComponentMap()
Returns the master ability component map, keyed by the Ability ID.

Returns:
the master ability component map, keyed by the Ability ID.

addAbilityComponent

java.lang.String addAbilityComponent(java.lang.String s,
                                     java.util.Map<java.lang.String,java.util.List<AbilityComponent>> H)
Adds a new coded ability component to the given component map. The component is coded as found in components.txt, with ID=parms.

Parameters:
s - the new coded ability component string
H - the map to add the new component to
Returns:
an error string, or null if everything went well.

getAbilityComponents

java.util.List<AbilityComponent> getAbilityComponents(java.lang.String AID)
Gets the decoded ability component definition for a given Ability ID(). This is then used by other methods to determine whether a user has the necessary components, or for manipulation of the definition.

Parameters:
AID - the Ability ID()
Returns:
the decoded ability component definition for a given Ability ID()

getAbilityComponentCoded

PairList<java.lang.String,java.lang.String> getAbilityComponentCoded(AbilityComponent comp)
Breaks an ability component decoded objects into a series of key/value pairs, where the first is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK. In that order. This is primarily for simplifying editors.

Parameters:
comp - the decoded ability component to produce fields from
Returns:
the key/value pairs of the ability component values.
See Also:
setAbilityComponentCodedFromCodedPairs(PairList, AbilityComponent)

setAbilityComponentCodedFromCodedPairs

void setAbilityComponentCodedFromCodedPairs(PairList<java.lang.String,java.lang.String> decodedDV,
                                            AbilityComponent comp)
Copies the key/value pairs from a PairList of specific abilitycomponent fields into the given AbilityComponent object. The first pairlist entry is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK. In that order. This is primarily for simplifying editors.

Parameters:
decodedDV - the key/value pairs of the ability component values.
comp - the decoded ability component to copy field data into
See Also:
getAbilityComponentCoded(AbilityComponent)

getAbilityComponentCodedString

java.lang.String getAbilityComponentCodedString(java.lang.String AID)
Reconstructs the coded ability component definition string (ID=parms) from the internal cached structures, given a particular Ability ID.

Parameters:
AID - the Ability ID()
Returns:
the coded ability component definition string (ID=parms)
See Also:
getAbilityComponentCodedString(List)

getAbilityComponentCodedString

java.lang.String getAbilityComponentCodedString(java.util.List<AbilityComponent> comps)
Reconstructs the coded ability component definition string (ID=parms) from the given cached decoded structures list.

Parameters:
comps - the decoded ability components definition list
Returns:
the coded ability component definition string (ID=parms)
See Also:
getAbilityComponentCodedString(String)

createBlankAbilityComponent

AbilityComponent createBlankAbilityComponent()
Creates a new blank ability component object

Returns:
a new blank ability component object

alterAbilityComponentFile

void alterAbilityComponentFile(java.lang.String compID,
                               boolean delete)
Alters and saved the ability components definition to on the filesystem (components.txt).

Parameters:
compID - the ID of the component being altered
delete - true to delete, false to add or modify

getSpecialSkillLimit

AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM)
Returns the character-class based common skill ability limits object applicable to the given mob, or zeroes if there's a problem.

Parameters:
studentM - the mob to find limits for
Returns:
the character-class based common skill ability limits
See Also:
getSpecialSkillLimit(MOB, Ability), getSpecialSkillRemainder(MOB, Ability), getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits

getSpecialSkillLimit

AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM,
                                                     Ability A)
Returns the character-class based common skill ability limits object applicable to the given mob and the given ability.

Parameters:
studentM - the mob to find limits for
A - the ability object to find limits for
Returns:
the character-class based common skill ability limits
See Also:
getSpecialSkillLimit(MOB), getSpecialSkillRemainder(MOB, Ability), getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits, AbilityComponents.AbilityLimits.specificSkillLimit()

getSpecialSkillRemainder

AbilityComponents.AbilityLimits getSpecialSkillRemainder(MOB studentM,
                                                         Ability A)
Returns the character-class based common skill ability limits object applicable to the given mob and the given ability, and then subtracts the number of each common skill already learned to derive a remaining number of each type.

Parameters:
studentM - the mob to find limits for
A - the ability object to find limits for
Returns:
the character-class based common skill ability remainders
See Also:
getSpecialSkillLimit(MOB, Ability), getSpecialSkillLimit(MOB), getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits, AbilityComponents.AbilityLimits.specificSkillLimit()

getSpecialSkillRemainders

AbilityComponents.AbilityLimits getSpecialSkillRemainders(MOB studentM)
Returns the character-class based common skill ability limits object applicable to the given mob, and then subtracts the number of each common skill already learned to derive a remaining number of each type.

Parameters:
studentM - the mob to find limits for
Returns:
the character-class based common skill ability limits
See Also:
getSpecialSkillLimit(MOB, Ability), getSpecialSkillLimit(MOB), getSpecialSkillRemainder(MOB, Ability), AbilityComponents.AbilityLimits