using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
using Common.Utility.CombatEvent;
using Fort23.Core;
using GameLogic.Combat.CombatTool;
using GameLogic.Combat.Hero;
using UnityEngine;
using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
namespace GameLogic.Combat.Skill
{
///
/// 玄甲护体(防御型技能)
/// 从四周飞来类似龟甲的碎片,乌龟龟甲上形成一个新的龟甲,防御+{0}%,敌人对其照成伤害时会收到{1}%反伤,
/// 反伤为真实伤害。持续{2}秒
///
public class S9022 : SkillBasic
{
private long currAddV;
private bool isUpdate;
private float currTime;
protected override void ProActiveSkill()
{
CombatEventManager.Instance.AddEventListener(CombatEventType.HeroInjured, HeroInjured);
}
private void HeroInjured(IEventData data)
{
if (!isUpdate)
{
return;
}
HeroInjuredEventData heroInjuredEventData = data as HeroInjuredEventData;
if (heroInjuredEventData.HarmReturnInfo.target.combatHeroEntity == CombatHeroEntity)
{
long harm = heroInjuredEventData.HarmReturnInfo.att;
long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(harm, effectValue[1]);
HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity,
heroInjuredEventData.HarmReturnInfo.source, v,
AttType.Skill | AttType.FanJi, triggerData,
wuXingType, null,
HarmType.Default);
}
}
protected override void ProUseSkill()
{
}
protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
ITimelineFxLogic timelineFxLogic,
TriggerData triggerData, ISkillFeatures skillFeatures)
{
long def = CombatHeroEntity.MaxCombatHeroInfo.defense.Value;
currAddV = CombatCalculateTool.Instance.GetVlaueRatioForLong(def, effectValue[0]);
CombatHeroEntity.CurrCombatHeroInfo.defense += currAddV;
isUpdate = true;
currTime = 0;
// HarmReturnInfo harmReturnInfo = CObjectPool.Instance.Fetch();
// harmReturnInfo.ArmorPiercing = effectValue[2];
// float harmBl = effectValue[1];
// long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
// harmBl);
//
// harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity, targetEntity, v,
// AttType.Skill, triggerData,
// wuXingType, skillFeatures,
// HarmType.Default, harmReturnInfo: harmReturnInfo);
}
protected override void ProCombatUpdate(float time)
{
if (!isUpdate)
{
return;
}
currTime += time;
if (currTime > effectValue[2])
{
isUpdate = false;
}
}
protected override void ProDispose()
{
CombatEventManager.Instance.RemoveEventListener(CombatEventType.HeroInjured, HeroInjured);
}
}
}