Package com.sucy.skill.dynamic
Class EffectComponent
java.lang.Object
com.sucy.skill.dynamic.EffectComponent
- Direct Known Subclasses:
ConditionComponent,CustomEffectComponent,MechanicComponent,TargetComponent,TriggerComponent
A component for dynamic skills which takes care of one effect
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ArrayList<EffectComponent>Child componentsbooleanWhether the component has preview effectsprotected PreviewTypeType of indicators to showprotected final SettingsThe settings for the componentprotected DynamicSkillParent class of the component -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp(org.bukkit.entity.LivingEntity caster) protected voiddoCleanUp(org.bukkit.entity.LivingEntity caster) booleanexecute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets) abstract booleanexecute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force) Executes the component (to be implemented)protected booleanexecuteChildren(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force) Executes the children of the component using the given targetsprotected StringRetrieves the config key for the componentabstract StringgetKey()protected doubleRetrieves a numerical value while using non-numerical values as keys for the cast data.Retrieves the settings of the dynamic componentprotected PlayerSkillgetSkillData(org.bukkit.entity.LivingEntity caster) Gets the skill data for the casterabstract ComponentTypegetType()Retrieves the type of the componentbooleanWhether the component or its children have a preview effectprotected booleanChecks whether the last component passed or notvoidload(DynamicSkill skill, mc.promcteam.engine.mccore.config.parse.DataSection config) Loads component data from the configurationprotected doubleparseValues(org.bukkit.entity.LivingEntity caster, String key, int level, double fallback) Retrieves an attribute value while applying attribute data if enabled and a player is using the skillvoidplayPreview(org.bukkit.entity.Player caster, int level, List<org.bukkit.entity.LivingEntity> targets, int step) Creates the list of indicators for the skillvoidsave(mc.promcteam.engine.mccore.config.parse.DataSection config) Saves the component and its children to the config
-
Field Details
-
children
Child components -
settings
The settings for the component -
hasPreview
public boolean hasPreviewWhether the component has preview effects -
skill
Parent class of the component -
previewType
Type of indicators to show
-
-
Constructor Details
-
EffectComponent
public EffectComponent()
-
-
Method Details
-
getInstanceKey
Retrieves the config key for the component- Returns:
- config key of the component
-
getKey
-
getType
Retrieves the type of the component- Returns:
- component type
-
getSettings
Retrieves the settings of the dynamic component- Returns:
- settings of the dynamic component
-
hasPreview
public boolean hasPreview()Whether the component or its children have a preview effect- Returns:
- true if has a preview, false otherwise
-
parseValues
protected double parseValues(org.bukkit.entity.LivingEntity caster, String key, int level, double fallback) Retrieves an attribute value while applying attribute data if enabled and a player is using the skill- Parameters:
caster- caster of the skillkey- key of the value to grablevel- level of the skillfallback- default value for the attribute- Returns:
- the value with attribute modifications if applicable
-
getNum
Retrieves a numerical value while using non-numerical values as keys for the cast data. If the value doesn't exist, this will return the default value. If it is a key that doesn't have an attached value, it will return 0. Otherwise, it will return the appropriate value.- Parameters:
caster- the caster of the skillkey- key of the valuefallback- fallback value in case the settings don't have it- Returns:
- the settings value or, if not a number, the cast data value
-
lastPassed
protected boolean lastPassed()Checks whether the last component passed or not- Returns:
- true if passed, false otherwise
-
executeChildren
protected boolean executeChildren(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force) Executes the children of the component using the given targets- Parameters:
caster- caster of the skilllevel- level of the skilltargets- targets to execute onforce-- Returns:
- true if executed, false if conditions not met
-
cleanUp
public void cleanUp(org.bukkit.entity.LivingEntity caster) -
doCleanUp
protected void doCleanUp(org.bukkit.entity.LivingEntity caster) -
getSkillData
Gets the skill data for the caster- Parameters:
caster- caster of the skill- Returns:
- skill data for the caster or null if not found
-
filter
-
execute
public boolean execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets) -
execute
public abstract boolean execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force) Executes the component (to be implemented)- Parameters:
caster- caster of the skilllevel- level of the skilltargets- targets to execute onforce- whether skill should be forced- Returns:
- true if executed, false if conditions not met
-
playPreview
public void playPreview(org.bukkit.entity.Player caster, int level, List<org.bukkit.entity.LivingEntity> targets, int step) Creates the list of indicators for the skill- Parameters:
caster- caster referencetargets- location to base location onlevel- the level of the skill to create forstep- the current progress of the indicator
-
save
public void save(mc.promcteam.engine.mccore.config.parse.DataSection config) Saves the component and its children to the config- Parameters:
config- config to save to
-
load
Loads component data from the configuration- Parameters:
skill- owning skill of the componentconfig- config data to load from
-