blob: 26f39e1ade2dc2fe2daeafc010bb81a3a312a969 (
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
|
using System;
using System.Collections.Generic;
using XUtliPoolLib;
namespace XMainClient
{
internal class XBuffClear : BuffEffect
{
private XEntity _entity;
private HashSet<int> m_Types;
public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
{
bool flag = rowData.ClearTypes == null || rowData.ClearTypes.Length == 0;
bool result;
if (flag)
{
result = false;
}
else
{
buff.AddEffect(new XBuffClear(rowData.ClearTypes));
result = true;
}
return result;
}
public XBuffClear(byte[] _Types)
{
this.m_Types = new HashSet<int>();
bool flag = _Types != null;
if (flag)
{
for (int i = 0; i < _Types.Length; i++)
{
bool flag2 = _Types[i] == 0;
if (!flag2)
{
this.m_Types.Add((int)_Types[i]);
}
}
}
}
public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
{
this._entity = entity;
XBuffComponent xbuffComponent = entity.GetXComponent(XBuffComponent.uuID) as XBuffComponent;
bool flag = xbuffComponent == null;
if (!flag)
{
for (int i = 0; i < xbuffComponent.BuffList.Count; i++)
{
XBuff xbuff = xbuffComponent.BuffList[i];
bool flag2 = xbuff.Valid && this.m_Types.Contains((int)xbuff.ClearType);
if (flag2)
{
XBuffRemoveEventArgs @event = XEventPool<XBuffRemoveEventArgs>.GetEvent();
@event.xBuffID = xbuff.ID;
@event.Firer = entity;
XSingleton<XEventMgr>.singleton.FireEvent(@event);
}
}
}
}
public override void OnRemove(XEntity entity, bool IsReplaced)
{
}
public override bool CanBuffAdd(int clearType)
{
bool flag = this.m_Types.Contains(clearType);
return !flag;
}
}
}
|