using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
using GameLogic.Combat.Buff;
using GameLogic.Combat.CombatTool;
using GameLogic.Combat.Hero;
using UnityEngine;
using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
namespace GameLogic.Combat.Skill
{
    /// 
    /// 导电(被动)
    /// 每隔{0},敌人受到感电层数*{1}%的伤害
    /// 
    public class S9054 : SkillBasic
    {
        protected float _currTime;
        protected override void ProUseSkill()
        {
        }
        protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
            ITimelineFxLogic timelineFxLogic,
            TriggerData triggerData, ISkillFeatures skillFeatures)
        {
            // float harmBl = 0;
            // b_1018 b1018 = targetEntity.combatHeroEntity.BuffControl.GetBuffBasicForType();
            // if (b1018 != null) //消耗一层感电,额外照成伤害
            // {
            //     harmBl += b1018.buffCount * effectValue[1];
            // }
            //
            // long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
            //     harmBl);
            //
            // HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity, targetEntity, v,
            //     AttType.Skill, triggerData,
            //     wuXingType, skillFeatures,
            //     HarmType.Default);
        }
        protected override void ProCombatUpdate(float time)
        {
            _currTime += time;
            if (_currTime >= effectValue[0])
            {
                _currTime = 0;
                // CombatHeroEntity[] allHero =
                //     CombatController.currActiveCombat.CombatHeroController.GetHero(!CombatHeroEntity.IsEnemy);
                CombatHeroEntity targetHeroEntity = CombatHeroEntity.CombatAIBasic.currFocusTarget;
                if (targetHeroEntity != null)
                {
                    b_1018 b1018 = targetHeroEntity.BuffControl.GetBuffBasicForType();
                    if (b1018 != null)
                    {
                        Vector3 targetPos = targetHeroEntity.dotPos;
                        ActivationTimeLineData("9054", customizePos: new Vector3[] { targetPos });
                        int count = b1018.buffCount;
                        float harmBl = count * effectValue[1];
                        long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(
                            CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
                            harmBl);
                        HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity,
                            targetHeroEntity, v,
                            AttType.Skill, triggerData,
                            wuXingType, null,
                            HarmType.Default);
                    }
                }
            }
        }
    }
}