summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs
blob: f94e9fff7c0c5970f77f3875b642a2e6add8e76d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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<DamageFlag>.ToInt(DamageFlag.DMGFLAG_REFLECTION)) != 0;
			if (!flag)
			{
				XCombat.ProjectExternalDamage(num, rawInput.Target.ID, rawInput.Caster, !this.m_Buff.BuffInfo.DontShowText, XFastEnumIntEqualityComparer<DamageFlag>.ToInt(DamageFlag.DMGFLAG_REFLECTION));
			}
		}
	}
}