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
  • Constructor Details

    • DynamicSkill

      public DynamicSkill(String name)
      Initializes a new dynamic skill
      Parameters:
      name - name of the skill
  • Method Details

    • getCastData

      public static CastData getCastData(org.bukkit.entity.LivingEntity caster)
      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
      Overrides:
      canCast in class Skill
      Returns:
      true if can cast, false otherwise
    • 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

      public void registerEvents(Fabled plugin)
      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 interface PassiveSkill
      Parameters:
      user - user to refresh the effect for
      prevLevel - previous skill level
      newLevel - 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 interface PassiveSkill
      Parameters:
      user - user to initialize the effects for
      level - skill level
    • stopEffects

      public void stopEffects(org.bukkit.entity.LivingEntity user)
      Removes active users from the map
      Specified by:
      stopEffects in interface PassiveSkill
      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
      Specified by:
      cast in interface SkillShot
      Parameters:
      user - user of the skill
      level - skill level
      force -
      Returns:
      true if cast successfully, false if conditions weren't met or no effects are using the cast trigger
    • cast

      public boolean cast(org.bukkit.entity.LivingEntity user, int level)
      Description copied from interface: SkillShot
      Casts the skill
      Specified by:
      cast in interface SkillShot
      Parameters:
      user - user of the skill
      level - skill level
      Returns:
      true if could cast, false otherwise
    • playPreview

      public void playPreview(PlayerData playerData, int level)
      Starts the skill's preview effects. Removal of any registered listeners, tasks, entities, or other temporary effects should be included in a Runnable passed to PlayerData.setOnPreviewStop(Runnable)
      Overrides:
      playPreview in class Skill
    • getAttrName

      protected String getAttrName(String key)
      Retrieves the formatted name of an attribute which ignores the dynamic path overhead.
      Overrides:
      getAttrName in class Skill
      Parameters:
      key - attribute key
      Returns:
      formatted attribute name
    • getAttr

      protected Object getAttr(org.bukkit.entity.LivingEntity caster, String key, int level)
      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.
      Overrides:
      getAttr in class Skill
      Parameters:
      caster - owner of the skill
      key - attribute key
      level - skill level
      Returns:
      attribute value or 0 if invalid dynamic path
    • load

      public void load(studio.magemonkey.codex.mccore.config.parse.DataSection config)
      Loads dynamic components in addition to the normal values
      Overrides:
      load in class Skill
      Parameters:
      config - config data to load from
    • 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
      Overrides:
      save in class Skill
      Parameters:
      config - config to save to