using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
using GameLogic.Combat.Buff;
using GameLogic.Combat.CombatTool;
using GameLogic.Combat.Hero;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using UnityEngine;
using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
namespace GameLogic.Combat.Skill
{
    /// 
    /// 吸收自身灵气凝聚{0}丙大剑,大剑旋转快速穿透敌人,对敌人照成伤害
    /// 敌人如果在流血或放血状态对敌人照成的伤害+10%
    /// 重伤敌人后,如果目标没在放血状态,直接放血,并不会消耗流血层数
    /// 
    public class S1102 : SkillBasic
    {
        protected override void ProUseSkill()
        {
            ActivationTimeLineData("1102");
            CombatHeroHitPoint combatHeroHitPoint = CombatHeroEntity.CombatAIBasic.currFocusTarget
                .GetThis()
                .GetMainHotPoin();
            BetterList currTarget = new BetterList();
            currTarget.Add(combatHeroHitPoint);
            ballisticsCount = 1;
            for (int i = 0; i < 1; i++)
            {
                // float x=CombatCalculateTool.Instance.GetOdd(-100, 100)/100f*3;
                // float y=CombatCalculateTool.Instance.GetOdd(50, 100)/100f*2;
                Vector3 off = new Vector3(0, 1,1.5f);
                off = CombatHeroEntity.GameObject.transform.TransformPoint(off);
                // SpecialDotInfo specialDotInfo = CombatHeroEntity.GetSpecialDotInfo("zdpos" + (i + 2));
                ActivationTimeLineData("1102_fashe", currTarget: currTarget,
                    customizePos: new Vector3[] { off }, indexCount: i);
            }
        }
        protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
            ITimelineFxLogic timelineFxLogic,
            TriggerData triggerData,ISkillFeatures skillFeatures)
        {
            float addHarm = effectValue[1];
            if (SelfSkillConfig.level > 1)
            {
                b_1012 b1012 = targetEntity.combatHeroEntity.BuffControl.GetBuffBasicForType();
                b_1011 b1011 = targetEntity.combatHeroEntity.BuffControl.GetBuffBasicForType();
                if (b1011 != null || b1012 != null)
                {
                    addHarm += SelfSkillConfig.effectValue[2];
                }
             
            }
            long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
                addHarm);
            CombatCalculateTool.Instance.Harm(CombatHeroEntity, targetEntity, v, AttType.Skill, triggerData,
                wuXingType,skillFeatures,
                HarmType.Default);
            // int odds = CombatCalculateTool.Instance.GetOdd(0, 100);
            // if (odds <= effectValue[2])
            // {
            //     BuffInfo buffInfo = BuffInfo.GetBuffInfo(10111, 1);
            //     targetEntity.combatHeroEntity.BuffControl.AddBuff(CombatHeroEntity, buffInfo);
            // }
            if (SelfSkillConfig.level > 3)
            {
                b_1012 b1012 = targetEntity.combatHeroEntity.BuffControl.GetBuffBasicForType();
                if (b1012 == null)
                {
                    BuffInfo buffInfo = BuffInfo.GetBuffInfo(10121, 1,this);
                    targetEntity.combatHeroEntity.BuffControl.AddBuff(CombatHeroEntity, buffInfo);
                }
            }
        }
    }
}