blob: 1655d6f6b9cbe3ab3cc7dc3e23ba8dac6224415d (
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
|
using System;
using XUtliPoolLib;
namespace XMainClient
{
internal struct PercentWatcher
{
public double TargetDeltaValue
{
get
{
return this.m_TargetDeltaBasic;
}
}
public XAttributeDefine BasicAttr
{
get
{
return this.m_BasicAttr;
}
}
private bool m_bValid;
private double m_TargetDeltaPercent;
private double m_TargetDeltaBasic;
private XAttributeDefine m_BasicAttr;
private XAttributes m_Atributes;
public static bool IsValidAttr(XAttributeDefine attr)
{
return attr == XAttributeDefine.XAttr_MaxMP_Percent || attr == XAttributeDefine.XAttr_MaxHP_Percent || attr == XAttributeDefine.XAttr_MaxSuperArmor_Percent;
}
public PercentWatcher(XAttributes attributes, XAttributeDefine attr, double targetDeltaPercent)
{
this.m_bValid = false;
this.m_TargetDeltaPercent = 0.0;
this.m_TargetDeltaBasic = 0.0;
this.m_BasicAttr = XAttributeDefine.XAttr_Invalid;
this.m_Atributes = null;
bool flag = !PercentWatcher.IsValidAttr(attr);
if (!flag)
{
this.m_BasicAttr = XAttributeCommon.GetAttrCurAttr(attr);
bool flag2 = this.m_BasicAttr == XAttributeDefine.XAttr_Invalid;
if (!flag2)
{
this.m_bValid = true;
this.m_Atributes = attributes;
double attr2 = this.m_Atributes.GetAttr(attr);
bool flag3 = attr2 + targetDeltaPercent <= -1.0;
if (flag3)
{
targetDeltaPercent = -1.0 - attr2 + 0.001;
}
this.m_TargetDeltaPercent = targetDeltaPercent;
double num = Math.Max(0.001, 1.0 + attr2);
double attr3 = this.m_Atributes.GetAttr(this.m_BasicAttr);
this.m_TargetDeltaBasic = attr3 / num * this.m_TargetDeltaPercent;
this.m_TargetDeltaBasic = XCombat.CheckChangeHPLimit(this.m_BasicAttr, this.m_TargetDeltaBasic, attributes.Entity, true, true);
bool flag4 = this.m_TargetDeltaPercent < 0.0;
if (flag4)
{
this._ChangeBasic();
}
}
}
}
private void _ChangeBasic()
{
XAttrChangeEventArgs @event = XEventPool<XAttrChangeEventArgs>.GetEvent();
@event.AttrKey = this.m_BasicAttr;
@event.DeltaValue = this.m_TargetDeltaBasic;
@event.Firer = this.m_Atributes.Entity;
XSingleton<XEventMgr>.singleton.FireEvent(@event);
}
public void Check()
{
bool flag = !this.m_bValid;
if (!flag)
{
bool flag2 = this.m_TargetDeltaPercent > 0.0;
if (flag2)
{
this._ChangeBasic();
}
}
}
}
}
|