Package studio.magemonkey.fabled.dynamic
Class DynamicSkill
java.lang.Object
studio.magemonkey.fabled.api.skills.Skill
studio.magemonkey.fabled.dynamic.DynamicSkill
- All Implemented Interfaces:
org.bukkit.event.Listener
,PassiveSkill
,SkillShot
,IconHolder
public class DynamicSkill
extends Skill
implements SkillShot, PassiveSkill, org.bukkit.event.Listener
A skill implementation for the Dynamic system
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
applyImmediateBuff
(double damage) boolean
canCast()
Checks whether the dynamic skill can be castvoid
Cancels the event causing a trigger to go offboolean
cast
(org.bukkit.entity.LivingEntity user, int level) Casts the skillboolean
cast
(org.bukkit.entity.LivingEntity user, int level, boolean force) Casts the skill if applicableboolean
static void
clearCastData
(org.bukkit.entity.LivingEntity entity) Clears any stored cast data for the entityint
getActiveLevel
(org.bukkit.entity.LivingEntity caster) Retrieves the active level of the caster for the skillprotected Object
Retrieves an attribute while supporting dynamic skill attribute paths.protected String
getAttrName
(String key) Retrieves the formatted name of an attribute which ignores the dynamic path overhead.static CastData
getCastData
(org.bukkit.entity.LivingEntity caster) Retrieves the cast data for the castervoid
initialize
(org.bukkit.entity.LivingEntity user, int level) Initializes any corresponding effects when the skill is unlocked/enabledboolean
isActive
(org.bukkit.entity.LivingEntity caster) Checks whether the caster's passives are currently activeboolean
isForced
(org.bukkit.entity.LivingEntity user) void
load
(studio.magemonkey.codex.mccore.config.parse.DataSection config) Loads dynamic components in addition to the normal valuesvoid
playPreview
(PlayerData playerData, int level) Starts the skill's preview effects.void
registerEvents
(Fabled plugin) Registers needed events for the skill, ignoring any unused events for efficiencyvoid
save
(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves the skill back to the config, appending component data on top of the normal skill datavoid
setImmediateBuff
(double value, boolean flat) void
stopEffects
(org.bukkit.entity.LivingEntity user) Removes active users from the mapvoid
update
(org.bukkit.entity.LivingEntity user, int prevLevel, int newLevel) Updates the skill effectsMethods inherited from class studio.magemonkey.fabled.api.skills.Skill
canAutoLevel, checkSingleAttribute, clearCombo, cooldownMessage, damage, damage, damage, damage, format, getCombo, getCooldown, getCost, getDescription, getIcon, getIndicator, getIndicator, getKey, getLevelReq, getManaCost, getMaxLevel, getMessage, getName, getRange, getSettings, getSkillReq, getSkillReqLevel, getToolIndicator, getType, hasCombo, hasDependency, hasEnoughAttributes, hasInvestedEnough, hasMessage, hasSkillReq, isAllowed, isCompatible, isSkillDamage, needsPermission, sendMessage, setCombo, softSave, trueDamage
-
Constructor Details
-
DynamicSkill
Initializes a new dynamic skill- Parameters:
name
- name of the skill
-
-
Method Details
-
getCastData
Retrieves the cast data for the caster- Parameters:
caster
- caster to get the data for- Returns:
- cast data for the caster
-
clearCastData
public static void clearCastData(org.bukkit.entity.LivingEntity entity) Clears any stored cast data for the entity- Parameters:
entity
- entity to clear cast data for
-
canCast
public boolean canCast()Checks whether the dynamic skill can be cast -
isActive
public boolean isActive(org.bukkit.entity.LivingEntity caster) Checks whether the caster's passives are currently active- Parameters:
caster
- caster to check for- Returns:
- true if active, false otherwise
-
getActiveLevel
public int getActiveLevel(org.bukkit.entity.LivingEntity caster) Retrieves the active level of the caster for the skill- Parameters:
caster
- caster of the skill- Returns:
- active level of the skill
-
cancelTrigger
public void cancelTrigger()Cancels the event causing a trigger to go off -
checkCancelled
public boolean checkCancelled() -
setImmediateBuff
public void setImmediateBuff(double value, boolean flat) -
applyImmediateBuff
public double applyImmediateBuff(double damage) -
registerEvents
Registers needed events for the skill, ignoring any unused events for efficiency- Parameters:
plugin
- plugin reference
-
update
public void update(org.bukkit.entity.LivingEntity user, int prevLevel, int newLevel) Updates the skill effects- Specified by:
update
in interfacePassiveSkill
- Parameters:
user
- user to refresh the effect forprevLevel
- previous skill levelnewLevel
- new skill level
-
initialize
public void initialize(org.bukkit.entity.LivingEntity user, int level) Initializes any corresponding effects when the skill is unlocked/enabled- Specified by:
initialize
in interfacePassiveSkill
- Parameters:
user
- user to initialize the effects forlevel
- skill level
-
stopEffects
public void stopEffects(org.bukkit.entity.LivingEntity user) Removes active users from the map- Specified by:
stopEffects
in interfacePassiveSkill
- Parameters:
user
- user to stop the effects for
-
isForced
public boolean isForced(org.bukkit.entity.LivingEntity user) -
cast
public boolean cast(org.bukkit.entity.LivingEntity user, int level, boolean force) Casts the skill if applicable -
cast
public boolean cast(org.bukkit.entity.LivingEntity user, int level) Description copied from interface:SkillShot
Casts the skill -
playPreview
Starts the skill's preview effects. Removal of any registered listeners, tasks, entities, or other temporary effects should be included in aRunnable
passed toPlayerData.setOnPreviewStop(Runnable)
- Overrides:
playPreview
in classSkill
-
getAttrName
Retrieves the formatted name of an attribute which ignores the dynamic path overhead.- Overrides:
getAttrName
in classSkill
- Parameters:
key
- attribute key- Returns:
- formatted attribute name
-
getAttr
Retrieves an attribute while supporting dynamic skill attribute paths. Paths are set up by the "icon-key" setting in components. An invalid path will instead return a value of 0. If a path is not provided, this returns a normal attribute on the skill. -
load
public void load(studio.magemonkey.codex.mccore.config.parse.DataSection config) Loads dynamic components in addition to the normal values -
save
public void save(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves the skill back to the config, appending component data on top of the normal skill data
-