using UnityEngine;

public class AreaEffect : MonoBehaviour, ISkillEffect
{
    public void Execute(SkillInstance skill, Transform caster, float chargeRatio)
    {
        SkillLevelData levelData = skill.CurrentLevelData;
        float finalDamage = levelData.Damage * chargeRatio;

        Vector3 center = caster.position + caster.forward * levelData.Range;

        if (skill.Data.EffectPrefab != null)
        {
            Instantiate(skill.Data.EffectPrefab, center, Quaternion.identity);
        }

        Collider[] hits = Physics.OverlapSphere(center, levelData.Range);
        foreach (Collider hit in hits)
        {
            if (hit.transform == caster) continue;

            Debug.Log($"[범위] {hit.name}에게 {finalDamage} 데미지");
        }
    }
}
