Version 1.5APIs subject to change!

multiverse.mars.core
Class MarsAbility

java.lang.Object
  extended by multiverse.mars.core.MarsAbility
Direct Known Subclasses:
CombatAbility, CreateItemAbility, EffectAbility

public class MarsAbility
extends java.lang.Object

The MarsAbility object describes an action that a mob can perform.

When an ability is triggered, a MarsAbility.State object is generated that represents the current state of that instance of the ability. It progresses through a sequence of states, dependent on the configuration of the MarsAbility object.

As each state is entered or exitted, a method is called that can be overriden to create different types of abilities.


Nested Class Summary
static class MarsAbility.AbilityResult
           
static class MarsAbility.ActivationState
           
static class MarsAbility.Entry
           
 class MarsAbility.State
           
static class MarsAbility.TargetType
           
 
Field Summary
protected  int activationCost
           
protected  long activationTime
           
protected  int activeCost
           
protected  long activePulseTime
           
protected  int channelCost
           
protected  boolean channelled
           
protected  int channelPulses
           
protected  long channelPulseTime
           
protected  java.lang.String completeAnimation
           
protected  java.lang.String completeSound
           
protected  java.util.Map<java.lang.String,Cooldown> cooldownMap
           
protected  java.util.Map<MarsAbility.ActivationState,java.util.Set<CoordinatedEffect>> coordEffectMap
           
protected  java.lang.String costProp
           
protected  java.lang.String icon
           
protected  java.util.concurrent.locks.Lock lock
          MarsAbility lock
protected  int maxRange
           
protected  int minRange
           
protected  boolean persistent
           
protected  java.util.ArrayList<java.lang.String> reagentList
           
protected  boolean stationary
           
protected  MarsAbility.TargetType targetType
           
protected  java.util.ArrayList<java.lang.String> toolList
           
protected  boolean useGlobalCooldown
           
 
Constructor Summary
MarsAbility(java.lang.String name)
           
 
Method Summary
 void addCooldown(Cooldown cd)
          Adds a cooldown to this ability.
 boolean addCoordEffect(MarsAbility.ActivationState state, CoordinatedEffect effect)
           
 void addReagent(java.lang.String reagent)
          Adds a reagent requirement to this ability.
 void addTool(java.lang.String tool)
          Adds a tool requirement to this ability.
 void beginActivated(MarsAbility.State state)
           
 void beginActivation(MarsAbility.State state)
           
 void beginChannelling(MarsAbility.State state)
           
 MarsAbility.AbilityResult checkAbility(CombatInfo obj, CombatInfo target)
           
protected  MarsAbility.AbilityResult checkAbility(CombatInfo obj, CombatInfo target, MarsAbility.ActivationState state)
           
protected  MarsAbility.AbilityResult checkCost(CombatInfo obj, CombatInfo target, MarsAbility.ActivationState state)
           
protected  MarsAbility.AbilityResult checkRange(CombatInfo obj, CombatInfo target, float rangeTollerance)
           
protected  MarsAbility.AbilityResult checkReady(CombatInfo obj, CombatInfo target)
           
protected  MarsAbility.AbilityResult checkReagent(CombatInfo obj, CombatInfo target, MarsAbility.ActivationState state)
           
protected  MarsAbility.AbilityResult checkTarget(CombatInfo obj, CombatInfo target)
           
protected  MarsAbility.AbilityResult checkTool(CombatInfo obj, CombatInfo target, MarsAbility.ActivationState state)
           
 void completeActivation(MarsAbility.State state)
           
 void completeChannelling(MarsAbility.State state)
           
 void endActivated(MarsAbility.State state)
           
 boolean equals(java.lang.Object other)
          Returns if two objects are the same - tested by comparing the ability name.
protected  MarsAbility.State generateState(CombatInfo obj, CombatInfo target, MarsItem item)
           
 int getActivationCost()
          Returns the stat cost for successfully activating the ability.
 long getActivationTime()
          Returns the time the ability takes to activate.
 int getActiveCost()
          Returns the stat cost charged for each pulse of the active phase.
 long getActivePulseTime()
          Returns the time in ms for each pulse of the active phase.
 int getBaseExpThreshold()
          -Experience system component- Returns the default max experience that will be needed before the ability gains a level.
 int getChannelCost()
          Returns the stat cost charged for each channelling pulse.
 boolean getChannelled()
           
 int getChannelPulses()
          Returns the number of pulses during the channelled phase.
 long getChannelPulseTime()
          Returns the time in ms for each pulse of a channelled ability.
 java.lang.String getCompleteAnimation()
           
 java.lang.String getCompleteSound()
           
 java.util.Map<java.lang.String,Cooldown> getCooldownMap()
           
 java.util.Collection<CoordinatedEffect> getCoordEffects(MarsAbility.ActivationState state)
           
 java.lang.String getCostProperty()
          Returns the name of the property that stat costs are deducted from.
 int getExperiencePerUse()
          -Experience system component- Returns the amount of experience should be gained by successful use of this ability.
 java.lang.String getIcon()
          Returns the icon name for this ability.
 LevelingMap getLevelingMap()
           
 int getMaxRange()
          Returns the maximum range in mm for this ability.
 int getMaxRank()
          -Experience system component- Returns the max rank that an ability may achieve.
 int getMinRange()
          Returns the minimum range in mm for this ability.
 java.lang.String getName()
          Returns the name of the ability.
 boolean getPersistent()
           
 java.util.ArrayList<java.lang.String> getReagentList()
           
 MarsSkill getRequiredSkill()
           
 int getRequiredSkillLevel()
           
 java.lang.String getSlashCommand()
           
 boolean getStationary()
           
 MarsAbility.TargetType getTargetType()
          Returns the target type for this ability.
 java.util.ArrayList<java.lang.String> getToolList()
           
 boolean getUseGlobalCooldown()
           
 int hashCode()
          Returns a hash of the ability name
 void interrupt(MarsAbility.State state)
           
static void interruptAbility(MarsAbility.State state, MarsAbility.AbilityResult reason)
           
 boolean isInstant()
          Returns if the ability has 0 activation time.
 void pulseActivated(MarsAbility.State state)
           
 void pulseChannelling(MarsAbility.State state)
           
 void removeCooldown(java.lang.String id)
          Removes a cooldown from this ability.
 boolean removeCoordEffect(MarsAbility.ActivationState state, CoordinatedEffect effect)
           
 void setActivationCost(int cost)
          Sets the stat cost for successfully activating the ability.
 void setActivationTime(long time)
          Sets the time the ability takes to activate.
 void setActiveCost(int cost)
          Sets the stat cost charged for each pulse of the active phase.
 void setActivePulseTime(long time)
          Set the time in ms for each pulse of the active phase.
 void setBaseExpThreshold(int max)
          -Experience system component- Sets the default max experience that will be needed before the ability gains a level.
 void setChannelCost(int cost)
          Sets the stat cost charged for each channelling pulse.
 void setChannelled(boolean val)
           
 void setChannelPulses(int pulses)
          Sets the number of pulses during the channelled phase.
 void setChannelPulseTime(long time)
          Sets the time in ms for each pulse of a channelled ability.
 void setCompleteAnimation(java.lang.String anim)
           
 void setCompleteSound(java.lang.String sound)
           
 void setCooldownMap(java.util.Map<java.lang.String,Cooldown> cooldownMap)
           
 void setCostProperty(java.lang.String name)
          Sets the name of the property that stat costs are deducted from.
 void setExperiencePerUse(int xp)
          -Experience system component- Sets the amount of experience should be gained by successsful use of this ability.
 void setIcon(java.lang.String icon)
          Sets the icon name for this ability.
 void setLevelingMap(LevelingMap lm)
           
 void setMaxRange(int range)
          Sets the maximum range in mm for this ability.
 void setMaxRank(int rank)
          -Experience system component- Sets the max rank that an ability may achieve.
 void setMinRange(int range)
          Sets the minimum range in mm for this ability.
 void setName(java.lang.String name)
          Sets the name of the ability.
 void setPersistent(boolean val)
           
 void setReagentList(java.util.ArrayList<java.lang.String> reagentList)
           
 void setRequiredSkill(MarsSkill skill, int level)
           
 void setSlashCommand(java.lang.String slashCommand)
          exposes a way for the client to execute ability with a slash command
 void setStationary(boolean val)
           
 void setTargetType(MarsAbility.TargetType type)
          Sets the target type for this ability.
 void setToolList(java.util.ArrayList<java.lang.String> toolList)
           
 void setUseGlobalCooldown(boolean val)
           
static void startAbility(MarsAbility ability, CombatInfo obj, CombatInfo target, MarsItem item)
           
 java.lang.String toString()
          Returns the string describing this ability, useful for logging.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

lock

protected transient java.util.concurrent.locks.Lock lock
MarsAbility lock


activationTime

protected long activationTime

activationCost

protected int activationCost

costProp

protected java.lang.String costProp

channelPulseTime

protected long channelPulseTime

channelPulses

protected int channelPulses

channelCost

protected int channelCost

activePulseTime

protected long activePulseTime

activeCost

protected int activeCost

icon

protected java.lang.String icon

minRange

protected int minRange

maxRange

protected int maxRange

cooldownMap

protected java.util.Map<java.lang.String,Cooldown> cooldownMap

reagentList

protected java.util.ArrayList<java.lang.String> reagentList

toolList

protected java.util.ArrayList<java.lang.String> toolList

targetType

protected MarsAbility.TargetType targetType

useGlobalCooldown

protected boolean useGlobalCooldown

stationary

protected boolean stationary

channelled

protected boolean channelled

persistent

protected boolean persistent

coordEffectMap

protected java.util.Map<MarsAbility.ActivationState,java.util.Set<CoordinatedEffect>> coordEffectMap

completeAnimation

protected java.lang.String completeAnimation

completeSound

protected java.lang.String completeSound
Constructor Detail

MarsAbility

public MarsAbility(java.lang.String name)
Method Detail

toString

public java.lang.String toString()
Returns the string describing this ability, useful for logging.

Overrides:
toString in class java.lang.Object
Returns:
string describing ability

equals

public boolean equals(java.lang.Object other)
Returns if two objects are the same - tested by comparing the ability name. null objects are never equal to any other object including other null objects.

Overrides:
equals in class java.lang.Object
Returns:
true if abilities match

hashCode

public int hashCode()
Returns a hash of the ability name

Overrides:
hashCode in class java.lang.Object
Returns:
hash value of the object's ability name

setName

public void setName(java.lang.String name)
Sets the name of the ability. This is used to identify the ability, so it should be unique.

Parameters:
name - name for this ability.

getName

public java.lang.String getName()
Returns the name of the ability.

Returns:
name for this ability.

getActivationTime

public long getActivationTime()
Returns the time the ability takes to activate.

Returns:
time in ms to activate the ability.

setActivationTime

public void setActivationTime(long time)
Sets the time the ability takes to activate.

Parameters:
time - time in ms that the ability takes to activate.

isInstant

public boolean isInstant()
Returns if the ability has 0 activation time.

Returns:
true if activate time is 0.

getActivationCost

public int getActivationCost()
Returns the stat cost for successfully activating the ability.

Returns:
stat cost for activating the ability.

setActivationCost

public void setActivationCost(int cost)
Sets the stat cost for successfully activating the ability.

Parameters:
cost - stat cost for activating the ability.

getCostProperty

public java.lang.String getCostProperty()
Returns the name of the property that stat costs are deducted from.

Returns:
name of the property that stat costs are deducted from.

setCostProperty

public void setCostProperty(java.lang.String name)
Sets the name of the property that stat costs are deducted from.

Parameters:
name - name of the property that stat costs are deducted from.

getChannelPulseTime

public long getChannelPulseTime()
Returns the time in ms for each pulse of a channelled ability.

Returns:
time in ms for each pulse of a channelled ability.

setChannelPulseTime

public void setChannelPulseTime(long time)
Sets the time in ms for each pulse of a channelled ability.

Parameters:
time - time in ms for each pulse of a channelled ability.

getChannelPulses

public int getChannelPulses()
Returns the number of pulses during the channelled phase.

Returns:
number of pulses during the channelled phase for the ability.

setChannelPulses

public void setChannelPulses(int pulses)
Sets the number of pulses during the channelled phase.

Parameters:
pulses - number of pulses during the channelled phase for the ability.

getChannelCost

public int getChannelCost()
Returns the stat cost charged for each channelling pulse.

Returns:
stat cost charged for each channelling pulse.

setChannelCost

public void setChannelCost(int cost)
Sets the stat cost charged for each channelling pulse.

Parameters:
cost - stat cost charged for each channelling pulse.

getActivePulseTime

public long getActivePulseTime()
Returns the time in ms for each pulse of the active phase.

Returns:
time in ms for each pulse of the active phase.

setActivePulseTime

public void setActivePulseTime(long time)
Set the time in ms for each pulse of the active phase.

Parameters:
time - time in ms for each pulse of the active phase.

getActiveCost

public int getActiveCost()
Returns the stat cost charged for each pulse of the active phase.

Returns:
stat cost charged for each pulse of the active phase.

setActiveCost

public void setActiveCost(int cost)
Sets the stat cost charged for each pulse of the active phase.

Parameters:
cost - stat cost charged for each pulse of hte active phase.

getIcon

public java.lang.String getIcon()
Returns the icon name for this ability.

Returns:
icon name for this ability.

setIcon

public void setIcon(java.lang.String icon)
Sets the icon name for this ability.

Parameters:
icon - icon name for this ability.

getMinRange

public int getMinRange()
Returns the minimum range in mm for this ability.

Returns:
minimum range in mm for this ability.

setMinRange

public void setMinRange(int range)
Sets the minimum range in mm for this ability.

Parameters:
range - minimum range in mm for this ability.

getMaxRange

public int getMaxRange()
Returns the maximum range in mm for this ability.

Returns:
maximum range in mm for this ability.

setMaxRange

public void setMaxRange(int range)
Sets the maximum range in mm for this ability.

Parameters:
range - Maximum range in mm for this ability.

addCooldown

public void addCooldown(Cooldown cd)
Adds a cooldown to this ability. If any of the ability's cooldowns are activate on the mob attempting to activate the ability, it will not be able to activate.

Parameters:
cd - Cooldown to add to this ability.

removeCooldown

public void removeCooldown(java.lang.String id)
Removes a cooldown from this ability.

Parameters:
id - id of the cooldown to remove.

getCooldownMap

public java.util.Map<java.lang.String,Cooldown> getCooldownMap()

setCooldownMap

public void setCooldownMap(java.util.Map<java.lang.String,Cooldown> cooldownMap)

addReagent

public void addReagent(java.lang.String reagent)
Adds a reagent requirement to this ability. Reagents are items that are required to be present in inventory, and are consumed when the ability completes the ACTIVATING phase.

Parameters:
reagent - name of the template the reagent was created from.

getReagentList

public java.util.ArrayList<java.lang.String> getReagentList()

setReagentList

public void setReagentList(java.util.ArrayList<java.lang.String> reagentList)

addTool

public void addTool(java.lang.String tool)
Adds a tool requirement to this ability. Tools are items that are required to be present in inventory. They are not consumed.

Parameters:
tool - name of the template the tool was created from.

getToolList

public java.util.ArrayList<java.lang.String> getToolList()

setToolList

public void setToolList(java.util.ArrayList<java.lang.String> toolList)

getTargetType

public MarsAbility.TargetType getTargetType()
Returns the target type for this ability.

Returns:
target type for this ability.

setTargetType

public void setTargetType(MarsAbility.TargetType type)
Sets the target type for this ability.

Parameters:
type - target type for this ability.

getUseGlobalCooldown

public boolean getUseGlobalCooldown()

setUseGlobalCooldown

public void setUseGlobalCooldown(boolean val)

getStationary

public boolean getStationary()

setStationary

public void setStationary(boolean val)

getChannelled

public boolean getChannelled()

setChannelled

public void setChannelled(boolean val)

getPersistent

public boolean getPersistent()

setPersistent

public void setPersistent(boolean val)

addCoordEffect

public boolean addCoordEffect(MarsAbility.ActivationState state,
                              CoordinatedEffect effect)

removeCoordEffect

public boolean removeCoordEffect(MarsAbility.ActivationState state,
                                 CoordinatedEffect effect)

getCoordEffects

public java.util.Collection<CoordinatedEffect> getCoordEffects(MarsAbility.ActivationState state)

getCompleteAnimation

public java.lang.String getCompleteAnimation()

setCompleteAnimation

public void setCompleteAnimation(java.lang.String anim)

getCompleteSound

public java.lang.String getCompleteSound()

setCompleteSound

public void setCompleteSound(java.lang.String sound)

beginActivation

public void beginActivation(MarsAbility.State state)

completeActivation

public void completeActivation(MarsAbility.State state)

beginChannelling

public void beginChannelling(MarsAbility.State state)

pulseChannelling

public void pulseChannelling(MarsAbility.State state)

completeChannelling

public void completeChannelling(MarsAbility.State state)

beginActivated

public void beginActivated(MarsAbility.State state)

pulseActivated

public void pulseActivated(MarsAbility.State state)

endActivated

public void endActivated(MarsAbility.State state)

interrupt

public void interrupt(MarsAbility.State state)

setSlashCommand

public void setSlashCommand(java.lang.String slashCommand)
exposes a way for the client to execute ability with a slash command


getSlashCommand

public java.lang.String getSlashCommand()

setRequiredSkill

public void setRequiredSkill(MarsSkill skill,
                             int level)

getRequiredSkill

public MarsSkill getRequiredSkill()

getRequiredSkillLevel

public int getRequiredSkillLevel()

checkTarget

protected MarsAbility.AbilityResult checkTarget(CombatInfo obj,
                                                CombatInfo target)

checkRange

protected MarsAbility.AbilityResult checkRange(CombatInfo obj,
                                               CombatInfo target,
                                               float rangeTollerance)

checkReady

protected MarsAbility.AbilityResult checkReady(CombatInfo obj,
                                               CombatInfo target)

checkCost

protected MarsAbility.AbilityResult checkCost(CombatInfo obj,
                                              CombatInfo target,
                                              MarsAbility.ActivationState state)

checkReagent

protected MarsAbility.AbilityResult checkReagent(CombatInfo obj,
                                                 CombatInfo target,
                                                 MarsAbility.ActivationState state)

checkTool

protected MarsAbility.AbilityResult checkTool(CombatInfo obj,
                                              CombatInfo target,
                                              MarsAbility.ActivationState state)

checkAbility

public MarsAbility.AbilityResult checkAbility(CombatInfo obj,
                                              CombatInfo target)

checkAbility

protected MarsAbility.AbilityResult checkAbility(CombatInfo obj,
                                                 CombatInfo target,
                                                 MarsAbility.ActivationState state)

generateState

protected MarsAbility.State generateState(CombatInfo obj,
                                          CombatInfo target,
                                          MarsItem item)

startAbility

public static void startAbility(MarsAbility ability,
                                CombatInfo obj,
                                CombatInfo target,
                                MarsItem item)

interruptAbility

public static void interruptAbility(MarsAbility.State state,
                                    MarsAbility.AbilityResult reason)

getExperiencePerUse

public int getExperiencePerUse()
-Experience system component- Returns the amount of experience should be gained by successful use of this ability.


setExperiencePerUse

public void setExperiencePerUse(int xp)
-Experience system component- Sets the amount of experience should be gained by successsful use of this ability.


setLevelingMap

public void setLevelingMap(LevelingMap lm)

getLevelingMap

public LevelingMap getLevelingMap()

getBaseExpThreshold

public int getBaseExpThreshold()
-Experience system component- Returns the default max experience that will be needed before the ability gains a level.


setBaseExpThreshold

public void setBaseExpThreshold(int max)
-Experience system component- Sets the default max experience that will be needed before the ability gains a level.


getMaxRank

public int getMaxRank()
-Experience system component- Returns the max rank that an ability may achieve.


setMaxRank

public void setMaxRank(int rank)
-Experience system component- Sets the max rank that an ability may achieve.



Copyright © 2008 The Multiverse Network, Inc.