summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs
blob: 97ce2e54a875f5e3e088399cc9a005fb23be72b8 (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
61
62
63
64
65
66
67
68
69
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);
				}
			}
		}
	}
}