using System.Collections.Generic;
using XGame.Database;

namespace FL.Battle
{
    public class EntityAttributes
    {
        public string Name { get; set; }
        public long Hp { get => GetVaule(EAttributeType.Hp); set => SetValue(EAttributeType.Hp, value); }
        public long HpLimit { get => GetVaule(EAttributeType.Hplimit); set => SetValue(EAttributeType.Hplimit, value); }
        public long Mp { get; set; }
        public long MpLimit { get; set; }
        public float Radius { get; set; }
        public float MoveSpeed { get; set; }
        public int Attack { get; set; }
        public float AtkRange { get; set; }
        public int AttackCD { get; set; }

        private Dictionary<EAttributeType, long> _attributeMap = new Dictionary<EAttributeType, long>();
        public long GetVaule(EAttributeType type)
        {
            if (_attributeMap.TryGetValue(type, out var val))
            {
                return val;
            }
            return 0;
        }
        public void SetValue(EAttributeType type, long value)
        {
            _attributeMap[type] = value;
        }
        public bool IsContains(EAttributeType type)
        {
            return _attributeMap.ContainsKey(type);
        }
    }
}
