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 TypeMethodDescriptiondoubleapplyImmediateBuff(double damage) booleancanCast()Checks whether the dynamic skill can be castvoidCancels the event causing a trigger to go offbooleancast(org.bukkit.entity.LivingEntity user, int level) Casts the skillbooleancast(org.bukkit.entity.LivingEntity user, int level, boolean force) Casts the skill if applicablebooleanstatic voidclearCastData(org.bukkit.entity.LivingEntity entity) Clears any stored cast data for the entityintgetActiveLevel(org.bukkit.entity.LivingEntity caster) Retrieves the active level of the caster for the skillprotected ObjectRetrieves an attribute while supporting dynamic skill attribute paths.protected StringgetAttrName(String key) Retrieves the formatted name of an attribute which ignores the dynamic path overhead.static CastDatagetCastData(org.bukkit.entity.LivingEntity caster) Retrieves the cast data for the castervoidinitialize(org.bukkit.entity.LivingEntity user, int level) Initializes any corresponding effects when the skill is unlocked/enabledbooleanisActive(org.bukkit.entity.LivingEntity caster) Checks whether the caster's passives are currently activebooleanisForced(org.bukkit.entity.LivingEntity user) voidload(studio.magemonkey.codex.mccore.config.parse.DataSection config) Loads dynamic components in addition to the normal valuesvoidplayPreview(PlayerData playerData, int level) Starts the skill's preview effects.voidregisterEvents(Fabled plugin) Registers needed events for the skill, ignoring any unused events for efficiencyvoidsave(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves the skill back to the config, appending component data on top of the normal skill datavoidsetImmediateBuff(double value, boolean flat) voidstopEffects(org.bukkit.entity.LivingEntity user) Removes active users from the mapvoidupdate(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:
updatein 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:
initializein 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:
stopEffectsin 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:SkillShotCasts the skill -
playPreview
Starts the skill's preview effects. Removal of any registered listeners, tasks, entities, or other temporary effects should be included in aRunnablepassed toPlayerData.setOnPreviewStop(Runnable)- Overrides:
playPreviewin classSkill
-
getAttrName
Retrieves the formatted name of an attribute which ignores the dynamic path overhead.- Overrides:
getAttrNamein 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
-