using System;
using Cirno.Scripts.Enums;
using Godot;

namespace Cirno.Scripts.Resources;

[GlobalClass]
[Tool]
public partial class DamageResistance : Resource
{
    [Export]
    public DamageType DamageType { get; set; } = DamageType.Neutral;
    
    [Export]
    public DamageAttribute Attribute { get; set; } = DamageAttribute.Neutral;

    public float CalculateDamage(float damage, DamageType incomingDamageType)
    {
        if (DamageType != incomingDamageType) return 1;

        switch (Attribute)
        {
            case DamageAttribute.Neutral:
                return 1;
                break;
            case DamageAttribute.Resist:
                return 0.5f;
                break;
            case DamageAttribute.Weak:
                return 2;
                break;
            case DamageAttribute.Immune:
                return 0;
                break;
            case DamageAttribute.Skip:
                return 0;
        }
        return 1;
    }
}