summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/ProjectDamageResult.cs
blob: 19b1e5e57782f7d171c3e01caffa3083c528cbc9 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System;
using XUtliPoolLib;

namespace XMainClient
{
	internal class ProjectDamageResult : XDataBase
	{
		public double DefOriginalRatio { get; set; }

		public CombatEffectHelper EffectHelper
		{
			get
			{
				return this._EffectHelper;
			}
		}

		public double TrueDamage
		{
			get
			{
				return this.m_TrueDamage;
			}
			set
			{
				this.m_Value -= this.m_TrueDamage;
				this.m_TrueDamage = value;
				bool flag = this.m_TrueDamage < 0.0;
				if (flag)
				{
					this.m_TrueDamage = 0.0;
				}
				this.m_Value += this.m_TrueDamage;
			}
		}

		public double AbsorbDamage
		{
			get
			{
				return this.m_AbsorbDamage;
			}
			set
			{
				this.m_Value += this.m_AbsorbDamage;
				this.m_AbsorbDamage = value;
				bool flag = this.Value > this.m_AbsorbDamage;
				if (flag)
				{
					this.Value -= this.m_AbsorbDamage;
				}
				else
				{
					this.Value = 0.0;
				}
			}
		}

		public double Value
		{
			get
			{
				return this.m_Value;
			}
			set
			{
				bool flag = value < this.m_Value && this.TrueDamage > 0.0;
				if (flag)
				{
					this.TrueDamage -= this.m_Value - value;
				}
				this.m_Value = value;
			}
		}

		public double BasicDamage
		{
			get
			{
				return this.Value - this.TrueDamage;
			}
		}

		public int Flag { get; set; }

		public DamageType Type { get; set; }

		public DamageElement ElementType { get; set; }

		public bool IsTargetDead { get; set; }

		public ulong Caster { get; set; }

		public int ComboCount { get; set; }

		public bool Accept;

		public ProjectResultType Result;

		private CombatEffectHelper _EffectHelper;

		private double m_TrueDamage;

		private double m_AbsorbDamage;

		private double m_Value;

		public bool IsCritical()
		{
			int num = XFastEnumIntEqualityComparer<DamageFlag>.ToInt(DamageFlag.DMGFLAG_CRITICAL);
			return (this.Flag & num) != 0;
		}

		public ProjectDamageResult()
		{
			this.Init();
		}

		public void SetResult(ProjectResultType r)
		{
			bool flag = r < this.Result;
			if (flag)
			{
				this.Result = r;
			}
		}

		public override void Init()
		{
			base.Init();
			this.Accept = true;
			this.Result = ProjectResultType.PJRES_BEHIT;
			this.Type = DamageType.DMG_INVALID;
			this.Value = 0.0;
			this.AbsorbDamage = 0.0;
			this.TrueDamage = 0.0;
			this.IsTargetDead = false;
			this.Flag = XFastEnumIntEqualityComparer<DamageFlag>.ToInt(DamageFlag.DMGFLAG_NONE);
			this.Caster = 0UL;
			this.ComboCount = 0;
			this._EffectHelper = XDataPool<CombatEffectHelper>.GetData();
		}

		public override void Recycle()
		{
			this._EffectHelper.Recycle();
			XDataPool<ProjectDamageResult>.Recycle(this);
		}
	}
}