package com.yaohun.demonskills.core;

import com.yaohun.demonskills.api.SkillComponent;
import org.bukkit.entity.Player;

import java.util.List;

public class Skill {

    public final String name;
    public final int needMagic;
    public final double cooldownTime;
    public final double coreCooldown;
    private final List<SkillComponent> skillComponents;

    public Skill(String name,int needMagic,double cooldownTime,double coreCooldown,List<SkillComponent> skillComponents) {
        this.name = name;
        this.needMagic = needMagic;
        this.cooldownTime = cooldownTime;
        this.coreCooldown = coreCooldown;
        this.skillComponents = skillComponents;
    }

    public void cast(Player caster){
        for (SkillComponent skillComponent : skillComponents) {
            skillComponent.execute(caster);
        }
    }
}
