From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Buff/XBuffDamageReflection.cs | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs new file mode 100644 index 00000000..f94e9fff --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs @@ -0,0 +1,60 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffDamageReflection : BuffEffect + { + public override XBuffEffectPrioriy Priority + { + get + { + return XBuffEffectPrioriy.BEP_DamageReflection; + } + } + + private float m_Ratio; + + private XBuff m_Buff; + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.DamageReflection == 0f; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffDamageReflection(rowData.DamageReflection, buff)); + result = true; + } + return result; + } + + public XBuffDamageReflection(float ratio, XBuff _Buff) + { + this.m_Ratio = ratio; + this.m_Buff = _Buff; + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + } + + public override void OnBuffEffect(HurtInfo rawInput, ProjectDamageResult result) + { + double num = (result.BasicDamage * result.DefOriginalRatio + result.TrueDamage) * (double)this.m_Ratio; + bool flag = num <= 0.0 || (result.Flag & XFastEnumIntEqualityComparer.ToInt(DamageFlag.DMGFLAG_REFLECTION)) != 0; + if (!flag) + { + XCombat.ProjectExternalDamage(num, rawInput.Target.ID, rawInput.Caster, !this.m_Buff.BuffInfo.DontShowText, XFastEnumIntEqualityComparer.ToInt(DamageFlag.DMGFLAG_REFLECTION)); + } + } + } +} -- cgit v1.1-26-g67d0