From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Buff/XBuffDamageDistanceScale.cs | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs new file mode 100644 index 00000000..97ce2e54 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs @@ -0,0 +1,70 @@ +using System; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffDamageDistanceScale : BuffEffect + { + public override XBuffEffectPrioriy Priority + { + get + { + return XBuffEffectPrioriy.BEP_TargetLifeAddAttack; + } + } + + private XBuff _buff = null; + + private XEntity _entity; + + private XPieceWiseDataMgr m_Data = new XPieceWiseDataMgr(); + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.ChangeCastDamageByDistance.Count == 0; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffDamageDistanceScale(buff)); + result = true; + } + return result; + } + + public XBuffDamageDistanceScale(XBuff buff) + { + this._buff = buff; + BuffTable.RowData buffInfo = buff.BuffInfo; + this.m_Data.SetRange(0.0, 0.0, 10000.0, 0.0); + this.m_Data.Init(ref buffInfo.ChangeCastDamageByDistance); + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + this._entity = entity; + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + } + + public override void OnCastDamage(HurtInfo rawInput, ProjectDamageResult result) + { + bool flag = rawInput.SkillID == 0u; + if (!flag) + { + bool flag2 = this._entity == null || rawInput.Target == null; + if (!flag2) + { + double x = (double)Vector3.Distance(this._entity.MoveObj.Position, rawInput.Target.MoveObj.Position); + result.Value *= 1.0 + this.m_Data.GetData(x); + } + } + } + } +} -- cgit v1.1-26-g67d0