diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/Buff |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Buff')
88 files changed, 6552 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs new file mode 100644 index 00000000..d293e397 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs @@ -0,0 +1,718 @@ +using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuff
+ {
+ public int ID
+ {
+ get
+ {
+ return this._buffInfo.BuffID;
+ }
+ }
+
+ public ulong CasterID
+ {
+ get
+ {
+ return this._casterID;
+ }
+ set
+ {
+ this._casterID = value;
+ }
+ }
+
+ public int Level
+ {
+ get
+ {
+ return (int)this._buffInfo.BuffLevel;
+ }
+ }
+
+ public string BuffIcon
+ {
+ get
+ {
+ return this._buffInfo.BuffIcon;
+ }
+ }
+
+ public double HP
+ {
+ get
+ {
+ return this._HP;
+ }
+ }
+
+ public double MaxHP
+ {
+ get
+ {
+ return this._MaxHP;
+ }
+ }
+
+ public uint StackCount
+ {
+ get
+ {
+ return this._StackCount;
+ }
+ }
+
+ public XBuffMergeType MergeType
+ {
+ get
+ {
+ return (XBuffMergeType)this._buffInfo.BuffMergeType;
+ }
+ }
+
+ public int TargetType
+ {
+ get
+ {
+ return (int)this._buffInfo.TargetType;
+ }
+ }
+
+ public BuffTable.RowData BuffInfo
+ {
+ get
+ {
+ return this._buffInfo;
+ }
+ }
+
+ public float Duration
+ {
+ get
+ {
+ return this._TimeDuration;
+ }
+ }
+
+ public float OriginalDuration
+ {
+ get
+ {
+ return this._OriginalDuration;
+ }
+ }
+
+ public float ActualDuration
+ {
+ get
+ {
+ return Time.time - this._StartTime;
+ }
+ }
+
+ public bool Valid
+ {
+ get
+ {
+ return this._valid;
+ }
+ }
+
+ public byte ClearType
+ {
+ get
+ {
+ return this._buffInfo.BuffClearType;
+ }
+ }
+
+ public XBuffEffectData EffectData
+ {
+ get
+ {
+ return this._EffectData;
+ }
+ }
+
+ public uint SkillID
+ {
+ get
+ {
+ return this._SkillID;
+ }
+ }
+
+ public XBuffComponent BuffComponent
+ {
+ get
+ {
+ return this._component;
+ }
+ }
+
+ public UIBuffInfo UIBuff
+ {
+ get
+ {
+ return this._UIBuff;
+ }
+ }
+
+ public HashSet<uint> RelevantSkills
+ {
+ get
+ {
+ return this._RelevantSkills;
+ }
+ }
+
+ public XBuffExclusive ExclusiveData
+ {
+ get
+ {
+ return this._Exclusive;
+ }
+ }
+
+ public static readonly int InfinityTime = -1;
+
+ protected float _StartTime = 0f;
+
+ protected float _TimeDuration = 0f;
+
+ protected float _OriginalDuration = 0f;
+
+ protected uint _TimerToken = 0u;
+
+ protected BuffTable.RowData _buffInfo = null;
+
+ protected List<BuffEffect> _buffEffects = ListPool<BuffEffect>.Get();
+
+ protected XBuffModifyEffect _buffModifies = default(XBuffModifyEffect);
+
+ protected HashSet<uint> _RelevantSkills = null;
+
+ protected bool _valid = true;
+
+ protected ulong _casterID = 0UL;
+
+ protected XBuffEffectData _EffectData = new XBuffEffectData();
+
+ protected double _HP = 100.0;
+
+ protected double _MaxHP = 100.0;
+
+ protected uint _StackCount = 1u;
+
+ protected XBuffComponent _component = null;
+
+ protected UIBuffInfo _UIBuff;
+
+ protected uint _SkillID;
+
+ private XTimerMgr.ElapsedEventHandler _timeCb = null;
+
+ protected XBuffExclusive _Exclusive;
+
+ public static XBuffEffectPrioriy EffectEnumeratorPriorityCur = XBuffEffectPrioriy.BEP_START;
+
+ public static XBuffEffectPrioriy EffectEnumeratorPriorityNext = XBuffEffectPrioriy.BEP_END;
+
+ private int m_EffectEnumeratorIndex;
+
+ public delegate void BuffEffectDelegate(BuffEffect effect, HurtInfo rawInput, ProjectDamageResult result);
+
+ public XBuff(CombatEffectHelper pEffectHelper, ref BuffDesc desc)
+ {
+ this._buffInfo = pEffectHelper.BuffInfo;
+ bool flag = desc.EffectTime <= 0f;
+ if (flag)
+ {
+ this._OriginalDuration = this._buffInfo.BuffDuration;
+ }
+ else
+ {
+ this._OriginalDuration = desc.EffectTime;
+ }
+ this._OriginalDuration += pEffectHelper.GetBuffDuration();
+ this._TimeDuration = this._OriginalDuration;
+ this._SkillID = desc.SkillID;
+ this._timeCb = new XTimerMgr.ElapsedEventHandler(this.OnBuffTimeEnd);
+ this._StartTime = Time.time;
+ this._UIBuff = UIBuffInfo.Create(this);
+ bool flag2 = this._buffInfo.RelevantSkills != null && this._buffInfo.RelevantSkills.Length != 0;
+ if (flag2)
+ {
+ this._RelevantSkills = HashPool<uint>.Get();
+ for (int i = 0; i < this._buffInfo.RelevantSkills.Length; i++)
+ {
+ this._RelevantSkills.Add(XSingleton<XCommon>.singleton.XHash(this._buffInfo.RelevantSkills[i]));
+ }
+ }
+ this._Exclusive.Set(this._buffInfo);
+ }
+
+ protected void _CreateEffects(CombatEffectHelper pEffectHelper, bool bIncludeTrigger = true)
+ {
+ XBuffChangeAttribute.TryCreate(pEffectHelper, this);
+ XBuffSpecialState.TryCreate(this._buffInfo, this);
+ XBuffRegenerate.TryCreate(pEffectHelper, this);
+ XBuffLifeAddAttack.TryCreate(this._buffInfo, this);
+ XBuffDamageDistanceScale.TryCreate(this._buffInfo, this);
+ XBuffAuraCheck.TryCreate(this._buffInfo, this);
+ XBuffReduceDamage.TryCreate(this._buffInfo, this);
+ XBuffDamageReflection.TryCreate(this._buffInfo, this);
+ XBuffMob.TryCreate(this._buffInfo, this);
+ XBuffChangeFightGroup.TryCreate(this._buffInfo, this);
+ XBuffLifeSteal.TryCreate(this._buffInfo, this);
+ XBuffReduceSkillCD.TryCreate(pEffectHelper, this);
+ XBuffTargetLifeAddAttack.TryCreate(this._buffInfo, this);
+ XBuffManipulate.TryCreate(this._buffInfo, this);
+ XBuffSkillsReplace.TryCreate(this._buffInfo, this);
+ XBuffKill.TryCreate(this._buffInfo, this);
+ this._buffModifies.TryCreate(pEffectHelper, this);
+ if (bIncludeTrigger)
+ {
+ XBuffTrigger.TryCreate(this._buffInfo, this);
+ }
+ }
+
+ public void AddEffect(BuffEffect eff)
+ {
+ bool flag = eff == null;
+ if (!flag)
+ {
+ this._buffEffects.Add(eff);
+ }
+ }
+
+ public double ModifySkillCost()
+ {
+ return this._buffModifies.ModifySkillCost();
+ }
+
+ public double ModifySkillDamage()
+ {
+ return this._buffModifies.ModifySkillDamage();
+ }
+
+ public double IncReceivedDamage()
+ {
+ return this._buffModifies.IncReceivedDamage();
+ }
+
+ public double DecReceivedDamage()
+ {
+ return this._buffModifies.DecReceivedDamage();
+ }
+
+ public double ChangeSkillDamage(uint skillID)
+ {
+ return this._buffModifies.ChangeSkillDamage(skillID);
+ }
+
+ public void OnAttributeChanged(XBuffComponent component, XAttrChangeEventArgs e)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnAttributeChanged(e);
+ }
+ }
+
+ public void OnQTEStateChanged(XBuffComponent component, XSkillQTEEventArgs e)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnQTEStateChanged(e);
+ }
+ }
+
+ public void OnRealDead(XRealDeadEventArgs e)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnRealDead(e);
+ }
+ }
+
+ public void OnComboChange(uint comboCount)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnComboChange(comboCount);
+ }
+ }
+
+ private void _AppendHP(float param0, float param1)
+ {
+ bool flag = param1 != 0f;
+ if (flag)
+ {
+ int num = (int)param0;
+ bool flag2 = num == 0;
+ if (flag2)
+ {
+ this._MaxHP += (double)param1;
+ }
+ else
+ {
+ XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(this.CasterID);
+ bool flag3 = entity != null && !entity.Deprecated;
+ if (flag3)
+ {
+ this._MaxHP += entity.Attributes.GetAttr((XAttributeDefine)num) * (double)param1 / 100.0;
+ }
+ }
+ }
+ }
+
+ protected void _InitHP(CombatEffectHelper pEffectHelper)
+ {
+ bool flag = this._component == null;
+ if (!flag)
+ {
+ this._MaxHP = 0.0;
+ this._AppendHP(this._buffInfo.BuffHP[0], this._buffInfo.BuffHP[1]);
+ bool flag2 = pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_HP);
+ if (flag2)
+ {
+ SequenceList<float> sequenceList = CommonObjectPool<SequenceList<float>>.Get();
+ pEffectHelper.GetBuffHP(sequenceList);
+ for (int i = 0; i < sequenceList.Count; i++)
+ {
+ this._AppendHP(sequenceList[i, 0], sequenceList[i, 1]);
+ }
+ CommonObjectPool<SequenceList<float>>.Release(sequenceList);
+ }
+ bool flag3 = this._MaxHP == 0.0;
+ if (flag3)
+ {
+ this._MaxHP = 100.0;
+ }
+ this._HP = this._MaxHP;
+ }
+ }
+
+ public void OnAdd(XBuffComponent component, CombatEffectHelper pEffectHelper)
+ {
+ bool flag = XSingleton<XCommon>.singleton.IsGreater(this._TimeDuration, 0f);
+ if (flag)
+ {
+ this._TimerToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._TimeDuration, this._timeCb, component);
+ }
+ this._component = component;
+ this._InitHP(pEffectHelper);
+ this._CreateEffects(pEffectHelper, true);
+ this._buffEffects.Sort();
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ this._buffEffects[i].bValid = true;
+ this._buffEffects[i].OnAdd(component.Entity, pEffectHelper);
+ }
+ this._UIBuff.Set(this);
+ }
+
+ public bool Append(XBuffComponent component, CombatEffectHelper pEffectHelper)
+ {
+ bool flag = this._TimerToken > 0u;
+ if (flag)
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimerToken);
+ }
+ bool flag2 = XSingleton<XCommon>.singleton.IsGreater(this._TimeDuration, 0f);
+ if (flag2)
+ {
+ this._TimerToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._TimeDuration, this._timeCb, component);
+ }
+ this._HP = this._MaxHP;
+ bool flag3 = (uint)this._buffInfo.StackMaxCount <= this._StackCount;
+ bool result;
+ if (flag3)
+ {
+ this._UIBuff.Set(this);
+ result = false;
+ }
+ else
+ {
+ int count = this._buffEffects.Count;
+ this._CreateEffects(pEffectHelper, false);
+ for (int i = count; i < this._buffEffects.Count; i++)
+ {
+ this._buffEffects[i].bValid = true;
+ this._buffEffects[i].OnAdd(component.Entity, pEffectHelper);
+ }
+ this._buffEffects.Sort();
+ this._StackCount += 1u;
+ this._UIBuff.Set(this);
+ result = true;
+ }
+ return result;
+ }
+
+ public void OnAppend(XBuffComponent component)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnAppend(component.Entity);
+ }
+ }
+
+ public float GetLeftTime()
+ {
+ bool flag = this._TimerToken == 0u;
+ float result;
+ if (flag)
+ {
+ result = -1f;
+ }
+ else
+ {
+ float num = (float)XSingleton<XTimerMgr>.singleton.TimeLeft(this._TimerToken);
+ bool flag2 = num == 0f;
+ if (flag2)
+ {
+ result = -1f;
+ }
+ else
+ {
+ result = num;
+ }
+ }
+ return result;
+ }
+
+ public void OnRemove(XBuffComponent component, bool IsReplaced)
+ {
+ bool valid = this._valid;
+ if (valid)
+ {
+ this._valid = false;
+ bool flag = this._TimerToken > 0u;
+ if (flag)
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimerToken);
+ this._TimerToken = 0u;
+ }
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ this._buffEffects[i].bValid = false;
+ this._buffEffects[i].OnRemove(component.Entity, IsReplaced);
+ }
+ this._buffModifies.OnRemove(this);
+ }
+ this._component = null;
+ this.Destroy();
+ }
+
+ public void OnBattleEnd(XBuffComponent component)
+ {
+ bool valid = this._valid;
+ if (valid)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ this._buffEffects[i].OnBattleEnd(component.Entity);
+ }
+ this._buffModifies.OnBattleEnd(this);
+ }
+ }
+
+ private void OnBuffTimeEnd(object args)
+ {
+ this._TimerToken = 0u;
+ XBuffComponent xbuffComponent = args as XBuffComponent;
+ XBuffRemoveEventArgs @event = XEventPool<XBuffRemoveEventArgs>.GetEvent();
+ @event.xBuffID = this.ID;
+ @event.Firer = xbuffComponent.Entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+
+ public void Destroy()
+ {
+ bool flag = this._RelevantSkills != null;
+ if (flag)
+ {
+ HashPool<uint>.Release(this._RelevantSkills);
+ this._RelevantSkills = null;
+ }
+ ListPool<BuffEffect>.Release(this._buffEffects);
+ this._buffModifies.Destroy();
+ this._Exclusive.Destroy();
+ }
+
+ public void OnBuffEffect(HurtInfo rawInput, ProjectDamageResult result, XBuff.BuffEffectDelegate func)
+ {
+ int count = this._buffEffects.Count;
+ bool flag = XBuff.EffectEnumeratorPriorityCur == XBuffEffectPrioriy.BEP_START;
+ if (flag)
+ {
+ this.m_EffectEnumeratorIndex = 0;
+ }
+ while (this.m_EffectEnumeratorIndex < this._buffEffects.Count)
+ {
+ BuffEffect buffEffect = this._buffEffects[this.m_EffectEnumeratorIndex];
+ XBuffEffectPrioriy priority = buffEffect.Priority;
+ bool flag2 = priority > XBuff.EffectEnumeratorPriorityCur;
+ if (flag2)
+ {
+ bool flag3 = priority < XBuff.EffectEnumeratorPriorityNext;
+ if (flag3)
+ {
+ XBuff.EffectEnumeratorPriorityNext = priority;
+ }
+ break;
+ }
+ func(buffEffect, rawInput, result);
+ this.m_EffectEnumeratorIndex++;
+ }
+ }
+
+ public static void OnHurt(BuffEffect effect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ effect.OnBuffEffect(rawInput, result);
+ }
+
+ public static void OnCastDamage(BuffEffect effect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ effect.OnCastDamage(rawInput, result);
+ }
+
+ public void OnCastSkill(HurtInfo rawInput)
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnCastSkill(rawInput);
+ }
+ }
+
+ public bool ResetTime(XBuffComponent component)
+ {
+ bool flag = this._TimerToken == 0u;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimerToken);
+ bool flag2 = XSingleton<XCommon>.singleton.IsGreater(this._TimeDuration, 0f);
+ if (flag2)
+ {
+ this._TimerToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._TimeDuration, this._timeCb, component);
+ }
+ this._UIBuff.Set(this);
+ result = true;
+ }
+ return result;
+ }
+
+ public void AddBuffTime(float extendTime, XBuffComponent component)
+ {
+ bool flag = this._TimerToken == 0u;
+ if (!flag)
+ {
+ float num = (float)XSingleton<XTimerMgr>.singleton.TimeLeft(this._TimerToken);
+ this._TimeDuration = num + extendTime;
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimerToken);
+ bool flag2 = XSingleton<XCommon>.singleton.IsGreater(this._TimeDuration, 0f);
+ if (flag2)
+ {
+ this._TimerToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._TimeDuration, this._timeCb, component);
+ }
+ this._UIBuff.Set(this);
+ }
+ }
+
+ public void Update()
+ {
+ for (int i = 0; i < this._buffEffects.Count; i++)
+ {
+ bool flag = !this.Valid;
+ if (flag)
+ {
+ break;
+ }
+ this._buffEffects[i].OnUpdate();
+ }
+ }
+
+ public double ChangeBuffHP(double deltaHP)
+ {
+ this._HP += deltaHP;
+ bool flag = this.Valid && this._component != null;
+ if (flag)
+ {
+ bool flag2 = this._HP <= 0.0;
+ if (flag2)
+ {
+ deltaHP -= this._HP;
+ XBuffRemoveEventArgs @event = XEventPool<XBuffRemoveEventArgs>.GetEvent();
+ @event.xBuffID = this.ID;
+ @event.Firer = this._component.Entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ this._UIBuff.HP = this._HP;
+ }
+ return deltaHP;
+ }
+
+ public static bool HasTag(BuffTable.RowData data, XBuffTag tag)
+ {
+ bool flag = data == null || data.Tags == null;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ for (int i = 0; i < data.Tags.Length; i++)
+ {
+ bool flag2 = (XBuffTag)data.Tags[i] == tag;
+ if (flag2)
+ {
+ return true;
+ }
+ }
+ result = false;
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs.meta new file mode 100644 index 00000000..f22468ed --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuff.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4af08cdc1370d541ac8d3a9957c1207 +timeCreated: 1611404855 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs new file mode 100644 index 00000000..bc8c76f9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs @@ -0,0 +1,26 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffAddEventArgs : XEventArgs
+ {
+ public BuffDesc xBuffDesc;
+
+ public bool xEffectImm;
+
+ public XBuffAddEventArgs()
+ {
+ this._eDefine = XEventDefine.XEvent_BuffAdd;
+ this.xBuffDesc.Reset();
+ this.xEffectImm = false;
+ }
+
+ public override void Recycle()
+ {
+ base.Recycle();
+ this.xBuffDesc.Reset();
+ this.xEffectImm = false;
+ XEventPool<XBuffAddEventArgs>.Recycle(this);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs.meta new file mode 100644 index 00000000..2755e193 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffAddEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 37f54f5d300be634b817149c2585464d +timeCreated: 1611403568 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs new file mode 100644 index 00000000..a89f8be5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs @@ -0,0 +1,312 @@ +using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffAuraCheck : BuffEffect
+ {
+ private XBuff _buff = null;
+
+ private XEntity _entity = null;
+
+ private XBuffAuraCheck.ShapeType _type = XBuffAuraCheck.ShapeType.BACT_CIRCLE;
+
+ private bool m_effectexcept = false;
+
+ private bool m_effectexceptself = false;
+
+ private float _sqrRadius = 0f;
+
+ private float _sqrExclusiveRadius = 0f;
+
+ private float _halfWidth = 0f;
+
+ private float _halfHeight = 0f;
+
+ private float _halfExclusiveWidth = 0f;
+
+ private float _halfExclusiveHeight = 0f;
+
+ private float _startTime = 0f;
+
+ private float _interval = 0f;
+
+ private uint _TimeToken = 0u;
+
+ private HashSet<uint> _EffectGroups = null;
+
+ private XTimerMgr.ElapsedEventHandler _timeCb = null;
+
+ private enum ShapeType
+ {
+ BACT_CIRCLE,
+ BACT_RECTANGLE
+ }
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.AuraAddBuffID.Count == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffAuraCheck(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffAuraCheck(XBuff buff)
+ {
+ this._buff = buff;
+ this._type = (XBuffAuraCheck.ShapeType)this._GetParam(0);
+ this._startTime = this._GetParam(1);
+ this._interval = Mathf.Max(XSingleton<XGlobalConfig>.singleton.BuffMinAuraInterval, this._GetParam(2));
+ short[] effectGroup = buff.BuffInfo.EffectGroup;
+ this._timeCb = new XTimerMgr.ElapsedEventHandler(this.OnTimer);
+ bool flag = effectGroup != null;
+ if (flag)
+ {
+ for (int i = 0; i < effectGroup.Length; i++)
+ {
+ bool flag2 = effectGroup[i] == -1;
+ if (flag2)
+ {
+ this.m_effectexcept = true;
+ }
+ else
+ {
+ bool flag3 = effectGroup[i] == -2;
+ if (flag3)
+ {
+ this.m_effectexcept = true;
+ this.m_effectexceptself = true;
+ }
+ else
+ {
+ bool flag4 = this._EffectGroups == null;
+ if (flag4)
+ {
+ this._EffectGroups = new HashSet<uint>();
+ }
+ this._EffectGroups.Add((uint)effectGroup[i]);
+ }
+ }
+ }
+ }
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ XBuffAuraCheck.ShapeType type = this._type;
+ if (type != XBuffAuraCheck.ShapeType.BACT_CIRCLE)
+ {
+ if (type == XBuffAuraCheck.ShapeType.BACT_RECTANGLE)
+ {
+ this._halfWidth = this._GetParam(3) / 2f;
+ this._halfHeight = this._GetParam(4) / 2f;
+ this._halfExclusiveWidth = this._GetParam(5) / 2f;
+ this._halfExclusiveHeight = this._GetParam(6) / 2f;
+ }
+ }
+ else
+ {
+ float num = this._GetParam(3);
+ num += pEffectHelper.GetBuffAuraRadius();
+ this._sqrRadius = num * num;
+ float num2 = this._GetParam(4);
+ this._sqrExclusiveRadius = num2 * num2;
+ }
+ bool flag = this._entity == null || this._entity.IsDummy;
+ if (flag)
+ {
+ this._EffectGroups = null;
+ }
+ else
+ {
+ bool effectexcept = this.m_effectexcept;
+ if (effectexcept)
+ {
+ bool effectexceptself = this.m_effectexceptself;
+ if (effectexceptself)
+ {
+ bool flag2 = this._EffectGroups == null;
+ if (flag2)
+ {
+ this._EffectGroups = new HashSet<uint>();
+ }
+ this._EffectGroups.Add(this._entity.Attributes.FightGroup);
+ }
+ }
+ else
+ {
+ bool flag3 = this._EffectGroups == null;
+ if (flag3)
+ {
+ this._EffectGroups = new HashSet<uint>();
+ }
+ bool flag4 = this._EffectGroups.Count == 0;
+ if (flag4)
+ {
+ this._EffectGroups.Add(this._entity.Attributes.FightGroup);
+ }
+ }
+ }
+ bool flag5 = this._startTime <= 0f;
+ if (flag5)
+ {
+ this._timeCb(null);
+ }
+ else
+ {
+ this._TimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._startTime, this._timeCb, null);
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimeToken);
+ }
+
+ public void OnTimer(object o)
+ {
+ bool isDummy = this._entity.IsDummy;
+ if (isDummy)
+ {
+ this._AddBuffs(this._entity);
+ }
+ else
+ {
+ List<XEntity> all = XSingleton<XEntityMgr>.singleton.GetAll();
+ Vector3 forward = this._entity.MoveObj.Forward;
+ Vector3 vector = XSingleton<XCommon>.singleton.HorizontalRotateVetor3(forward, 90f, true);
+ Vector3 position = this._entity.MoveObj.Position;
+ for (int i = 0; i < all.Count; i++)
+ {
+ XEntity xentity = all[i];
+ bool flag = xentity.IsDead || xentity.Deprecated;
+ if (!flag)
+ {
+ bool flag2 = xentity.Attributes == null || !this._CanAttack(xentity.Attributes.FightGroup);
+ if (!flag2)
+ {
+ XBuffAuraCheck.ShapeType type = this._type;
+ if (type != XBuffAuraCheck.ShapeType.BACT_CIRCLE)
+ {
+ if (type == XBuffAuraCheck.ShapeType.BACT_RECTANGLE)
+ {
+ Vector3 vector2 = xentity.MoveObj.Position - position;
+ bool flag3 = this._halfWidth > 0f || this._halfExclusiveWidth > 0f;
+ if (flag3)
+ {
+ float num = Math.Abs(Vector3.Dot(vector2, forward));
+ bool flag4 = this._halfWidth > 0f && num > this._halfWidth;
+ if (flag4)
+ {
+ goto IL_284;
+ }
+ bool flag5 = this._halfExclusiveWidth > 0f && num < this._halfExclusiveWidth;
+ if (flag5)
+ {
+ goto IL_284;
+ }
+ }
+ bool flag6 = this._halfHeight > 0f || this._halfExclusiveHeight > 0f;
+ if (flag6)
+ {
+ float num2 = Math.Abs(Vector3.Dot(vector2, vector));
+ bool flag7 = this._halfHeight > 0f && num2 > this._halfHeight;
+ if (flag7)
+ {
+ goto IL_284;
+ }
+ bool flag8 = this._halfExclusiveHeight > 0f && num2 < this._halfExclusiveHeight;
+ if (flag8)
+ {
+ goto IL_284;
+ }
+ }
+ }
+ }
+ else
+ {
+ bool flag9 = this._sqrRadius > 0f || this._sqrExclusiveRadius > 0f;
+ if (flag9)
+ {
+ float num3 = Vector3.SqrMagnitude(position - xentity.MoveObj.Position);
+ bool flag10 = this._sqrRadius > 0f && num3 > this._sqrRadius;
+ if (flag10)
+ {
+ goto IL_284;
+ }
+ bool flag11 = this._sqrExclusiveRadius > 0f && num3 < this._sqrExclusiveRadius;
+ if (flag11)
+ {
+ goto IL_284;
+ }
+ }
+ }
+ this._AddBuffs(xentity);
+ }
+ }
+ IL_284:;
+ }
+ bool bValid = base.bValid;
+ if (bValid)
+ {
+ this._TimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(this._interval, this._timeCb, o);
+ }
+ }
+ }
+
+ private void _AddBuffs(XEntity entity)
+ {
+ for (int i = 0; i < this._buff.BuffInfo.AuraAddBuffID.Count; i++)
+ {
+ XBuffAddEventArgs @event = XEventPool<XBuffAddEventArgs>.GetEvent();
+ @event.xBuffDesc.BuffID = this._buff.BuffInfo.AuraAddBuffID[i, 0];
+ @event.xBuffDesc.BuffLevel = this._buff.BuffInfo.AuraAddBuffID[i, 1];
+ @event.Firer = entity;
+ @event.xBuffDesc.CasterID = this._buff.CasterID;
+ @event.xBuffDesc.SkillID = this._buff.SkillID;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+
+ private bool _CanAttack(uint fightGroup)
+ {
+ bool effectexcept = this.m_effectexcept;
+ bool result;
+ if (effectexcept)
+ {
+ result = (this._EffectGroups == null || !this._EffectGroups.Contains(fightGroup));
+ }
+ else
+ {
+ result = (this._EffectGroups != null && this._EffectGroups.Contains(fightGroup));
+ }
+ return result;
+ }
+
+ private float _GetParam(int index)
+ {
+ bool flag = this._buff.BuffInfo.AuraParams == null || this._buff.BuffInfo.AuraParams.Length <= index;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ result = this._buff.BuffInfo.AuraParams[index];
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs.meta new file mode 100644 index 00000000..6d461a87 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffAuraCheck.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b8be5fed26df70643aec574d1eeba643 +timeCreated: 1611404406 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs new file mode 100644 index 00000000..07ce3134 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs @@ -0,0 +1,24 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffBillboardAddEventArgs : XEventArgs
+ {
+ public int xBuffID;
+
+ public int xBuffLevel;
+
+ public XBuffBillboardAddEventArgs()
+ {
+ this._eDefine = XEventDefine.XEvent_BuffBillboardAdd;
+ this.xBuffID = 0;
+ this.xBuffLevel = 0;
+ }
+
+ public override void Recycle()
+ {
+ base.Recycle();
+ XEventPool<XBuffBillboardAddEventArgs>.Recycle(this);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs.meta new file mode 100644 index 00000000..e1e95d97 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardAddEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a6cc8cc4335a3f645bfa475443760fea +timeCreated: 1611404290 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs new file mode 100644 index 00000000..2547a803 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs @@ -0,0 +1,21 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffBillboardRemoveEventArgs : XEventArgs
+ {
+ public int xBuffID;
+
+ public XBuffBillboardRemoveEventArgs()
+ {
+ this._eDefine = XEventDefine.XEvent_BuffBillboardRemove;
+ this.xBuffID = 0;
+ }
+
+ public override void Recycle()
+ {
+ base.Recycle();
+ XEventPool<XBuffBillboardRemoveEventArgs>.Recycle(this);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs.meta new file mode 100644 index 00000000..426b49ec --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffBillboardRemoveEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6ee673a5594cd7b4ea959c2d0652fc25 +timeCreated: 1611403907 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs new file mode 100644 index 00000000..764469fa --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs @@ -0,0 +1,331 @@ +using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffChangeAttribute : BuffEffect
+ {
+ private XBuff _buff = null;
+
+ private HashSet<XAttributeDefine> m_SetConvertor = new HashSet<XAttributeDefine>(default(XFastEnumIntEqualityComparer<XAttributeDefine>));
+
+ private Dictionary<int, double> m_ConvertorDeltaValue = new Dictionary<int, double>();
+
+ private SequenceList<float> m_OriginalAttrs = null;
+
+ private List<XAttrPair> m_AdditionalAttrs = null;
+
+ private bool m_bChanging;
+
+ private XEntity m_Entity;
+
+ public static bool TryCreate(CombatEffectHelper helper, XBuff buff)
+ {
+ bool flag = helper.BuffInfo.BuffChangeAttribute.Count == 0 && !helper.bHasEffect(CombatEffectType.CET_Buff_ChangeAttribute);
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffChangeAttribute(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffChangeAttribute(XBuff buff)
+ {
+ this._buff = buff;
+ }
+
+ private void _Convert(int attrID, double deltaValue)
+ {
+ bool flag = this.m_Entity == null || this.m_Entity.Attributes == null;
+ if (!flag)
+ {
+ bool flag2 = !this.m_Entity.IsRole;
+ if (!flag2)
+ {
+ int basicTypeID = (int)this.m_Entity.Attributes.BasicTypeID;
+ bool flag3 = !XAttributeCommon.IsFirstLevelAttr((XAttributeDefine)attrID);
+ if (!flag3)
+ {
+ int basicAttr = XAttributeCommon.GetBasicAttr(attrID);
+ XTuple<int, double>[] convertCoefficient = XSingleton<XPowerPointCalculator>.singleton.GetConvertCoefficient(basicAttr, basicTypeID);
+ bool flag4 = convertCoefficient == null;
+ if (!flag4)
+ {
+ bool flag5 = XAttributeCommon.IsPercentRange(attrID);
+ if (flag5)
+ {
+ deltaValue *= 0.01 * this.m_Entity.Attributes.GetAttr((XAttributeDefine)basicAttr);
+ }
+ bool flag6 = Math.Abs(deltaValue) < 1E-06;
+ if (!flag6)
+ {
+ bool flag7 = this.m_AdditionalAttrs == null;
+ if (flag7)
+ {
+ this.m_AdditionalAttrs = ListPool<XAttrPair>.Get();
+ }
+ for (int i = 0; i < convertCoefficient.Length; i++)
+ {
+ XAttributeDefine item = (XAttributeDefine)convertCoefficient[i].Item1;
+ double value = convertCoefficient[i].Item2 * deltaValue;
+ XAttributeDefine attrCurAttr = XAttributeCommon.GetAttrCurAttr(item);
+ bool flag8 = attrCurAttr != XAttributeDefine.XAttr_Invalid;
+ if (flag8)
+ {
+ bool flag9 = deltaValue > 0.0;
+ if (flag9)
+ {
+ this.m_AdditionalAttrs.Add(new XAttrPair(item, value));
+ this.m_AdditionalAttrs.Add(new XAttrPair(attrCurAttr, value));
+ }
+ else
+ {
+ this.m_AdditionalAttrs.Add(new XAttrPair(attrCurAttr, value));
+ this.m_AdditionalAttrs.Add(new XAttrPair(item, value));
+ }
+ }
+ else
+ {
+ this.m_AdditionalAttrs.Add(new XAttrPair(item, value));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this.m_Entity = entity;
+ bool flag = entity.IsDummy || entity.IsDead;
+ if (!flag)
+ {
+ this.m_bChanging = true;
+ bool flag2 = pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_ChangeAttribute);
+ ISeqListRef<float> seqListRef;
+ if (flag2)
+ {
+ this.m_OriginalAttrs = CommonObjectPool<SequenceList<float>>.Get();
+ this.m_OriginalAttrs.Reset(3);
+ this.m_OriginalAttrs.Append(this._buff.BuffInfo.BuffChangeAttribute, 3);
+ pEffectHelper.GetBuffChangeAttribute(this.m_OriginalAttrs);
+ seqListRef = this.m_OriginalAttrs;
+ }
+ else
+ {
+ seqListRef = this._buff.BuffInfo.BuffChangeAttribute;
+ }
+ for (int i = 0; i < seqListRef.Count; i++)
+ {
+ XAttributeDefine attrKey = (XAttributeDefine)seqListRef[i, 0];
+ double num = (double)seqListRef[i, 1];
+ bool flag3 = seqListRef[i, 2] != 0f;
+ if (flag3)
+ {
+ XAttributeDefine xattributeDefine = (XAttributeDefine)seqListRef[i, 2];
+ num *= entity.Attributes.GetAttr(xattributeDefine);
+ this.m_ConvertorDeltaValue[i] = num;
+ this.m_SetConvertor.Add(xattributeDefine);
+ }
+ XBuffChangeAttribute.ChangeAttribute(entity.Attributes, attrKey, num);
+ this._Convert((int)seqListRef[i, 0], num);
+ }
+ bool flag4 = this.m_AdditionalAttrs != null;
+ if (flag4)
+ {
+ for (int j = 0; j < this.m_AdditionalAttrs.Count; j++)
+ {
+ XBuffChangeAttribute.ChangeAttribute(entity.Attributes, this.m_AdditionalAttrs[j].AttrID, this.m_AdditionalAttrs[j].AttrValue);
+ }
+ }
+ this.m_bChanging = false;
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool flag = entity.IsDummy || entity.IsDead;
+ if (!flag)
+ {
+ this.m_bChanging = true;
+ XSecurityBuffInfo xsecurityBuffInfo = XSecurityBuffInfo.TryGetStatistics(entity);
+ bool flag2 = this.m_AdditionalAttrs != null;
+ if (flag2)
+ {
+ for (int i = this.m_AdditionalAttrs.Count - 1; i >= 0; i--)
+ {
+ bool flag3 = xsecurityBuffInfo != null;
+ if (flag3)
+ {
+ xsecurityBuffInfo.OnAttributeChanged(entity.Attributes, this._buff, this.m_AdditionalAttrs[i].AttrID, this.m_AdditionalAttrs[i].AttrValue);
+ }
+ XBuffChangeAttribute.ChangeAttribute(entity.Attributes, this.m_AdditionalAttrs[i].AttrID, -this.m_AdditionalAttrs[i].AttrValue);
+ }
+ }
+ ISeqListRef<float> seqListRef = this.m_OriginalAttrs;
+ bool flag4 = seqListRef == null;
+ if (flag4)
+ {
+ seqListRef = this._buff.BuffInfo.BuffChangeAttribute;
+ }
+ for (int j = seqListRef.Count - 1; j >= 0; j--)
+ {
+ XAttributeDefine xattributeDefine = (XAttributeDefine)seqListRef[j, 0];
+ double num = (double)(-(double)seqListRef[j, 1]);
+ bool flag5 = seqListRef[j, 2] != 0f && this.m_ConvertorDeltaValue.ContainsKey(j);
+ if (flag5)
+ {
+ num = -this.m_ConvertorDeltaValue[j];
+ }
+ bool flag6 = xsecurityBuffInfo != null;
+ if (flag6)
+ {
+ xsecurityBuffInfo.OnAttributeChanged(entity.Attributes, this._buff, xattributeDefine, -num);
+ }
+ XBuffChangeAttribute.ChangeAttribute(entity.Attributes, xattributeDefine, num);
+ }
+ this.m_bChanging = false;
+ this._buff = null;
+ bool flag7 = this.m_AdditionalAttrs != null;
+ if (flag7)
+ {
+ ListPool<XAttrPair>.Release(this.m_AdditionalAttrs);
+ this.m_AdditionalAttrs = null;
+ }
+ bool flag8 = this.m_OriginalAttrs != null;
+ if (flag8)
+ {
+ CommonObjectPool<SequenceList<float>>.Release(this.m_OriginalAttrs);
+ this.m_OriginalAttrs = null;
+ }
+ }
+ }
+
+ public override void OnBattleEnd(XEntity entity)
+ {
+ base.OnBattleEnd(entity);
+ bool flag = entity.IsDummy || entity.IsDead;
+ if (!flag)
+ {
+ XSecurityBuffInfo xsecurityBuffInfo = XSecurityBuffInfo.TryGetStatistics(entity);
+ bool flag2 = xsecurityBuffInfo == null;
+ if (!flag2)
+ {
+ bool flag3 = this.m_AdditionalAttrs != null;
+ if (flag3)
+ {
+ for (int i = this.m_AdditionalAttrs.Count - 1; i >= 0; i--)
+ {
+ bool flag4 = xsecurityBuffInfo != null;
+ if (flag4)
+ {
+ xsecurityBuffInfo.OnAttributeChanged(entity.Attributes, this._buff, this.m_AdditionalAttrs[i].AttrID, this.m_AdditionalAttrs[i].AttrValue);
+ }
+ }
+ }
+ ISeqListRef<float> seqListRef = this.m_OriginalAttrs;
+ bool flag5 = seqListRef == null;
+ if (flag5)
+ {
+ seqListRef = this._buff.BuffInfo.BuffChangeAttribute;
+ }
+ for (int j = seqListRef.Count - 1; j >= 0; j--)
+ {
+ XAttributeDefine attr = (XAttributeDefine)seqListRef[j, 0];
+ double num = (double)(-(double)seqListRef[j, 1]);
+ bool flag6 = seqListRef[j, 2] != 0f && this.m_ConvertorDeltaValue.ContainsKey(j);
+ if (flag6)
+ {
+ num = -this.m_ConvertorDeltaValue[j];
+ }
+ bool flag7 = xsecurityBuffInfo != null;
+ if (flag7)
+ {
+ xsecurityBuffInfo.OnAttributeChanged(entity.Attributes, this._buff, attr, -num);
+ }
+ }
+ }
+ }
+ }
+
+ public override void OnAttributeChanged(XAttrChangeEventArgs e)
+ {
+ base.OnAttributeChanged(e);
+ bool flag = this.m_Entity.IsDummy || this.m_Entity.IsDead;
+ if (!flag)
+ {
+ bool bChanging = this.m_bChanging;
+ if (!bChanging)
+ {
+ bool flag2 = !this.m_SetConvertor.Contains(e.AttrKey) || this.m_ConvertorDeltaValue.Count == 0;
+ if (!flag2)
+ {
+ this.m_bChanging = true;
+ ISeqListRef<float> seqListRef = this.m_OriginalAttrs;
+ bool flag3 = seqListRef == null;
+ if (flag3)
+ {
+ seqListRef = this._buff.BuffInfo.BuffChangeAttribute;
+ }
+ for (int i = 0; i < seqListRef.Count; i++)
+ {
+ bool flag4 = seqListRef[i, 2] == 0f;
+ if (!flag4)
+ {
+ XAttributeDefine xattributeDefine = (XAttributeDefine)seqListRef[i, 2];
+ bool flag5 = xattributeDefine != e.AttrKey;
+ if (!flag5)
+ {
+ double num;
+ bool flag6 = !this.m_ConvertorDeltaValue.TryGetValue(i, out num);
+ if (!flag6)
+ {
+ double num2 = (double)seqListRef[i, 1];
+ num2 *= this.m_Entity.Attributes.GetAttr(xattributeDefine);
+ XAttributeDefine attrKey = (XAttributeDefine)seqListRef[i, 0];
+ double num3 = num2 - num;
+ Dictionary<int, double> convertorDeltaValue = this.m_ConvertorDeltaValue;
+ int key = i;
+ convertorDeltaValue[key] += num3;
+ XBuffChangeAttribute.ChangeAttribute(this.m_Entity.Attributes, attrKey, num3);
+ }
+ }
+ }
+ }
+ this.m_bChanging = false;
+ }
+ }
+ }
+ }
+
+ public static void ChangeAttribute(XAttributes attributes, XAttributeDefine attrKey, double attrValue)
+ {
+ bool flag = attributes == null || attributes.Entity == null;
+ if (!flag)
+ {
+ XEntity entity = attributes.Entity;
+ PercentWatcher percentWatcher = new PercentWatcher(attributes, attrKey, attrValue / 100.0);
+ double num = XCombat.CheckChangeHPLimit(attrKey, attrValue, entity, true, true);
+ bool flag2 = num == 0.0;
+ if (!flag2)
+ {
+ XAttrChangeEventArgs @event = XEventPool<XAttrChangeEventArgs>.GetEvent();
+ @event.AttrKey = attrKey;
+ @event.DeltaValue = num;
+ @event.Firer = entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ percentWatcher.Check();
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs.meta new file mode 100644 index 00000000..2025d10a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeAttribute.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: acd67ebca1ebd174298d3a48b57dab70 +timeCreated: 1611404332 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs new file mode 100644 index 00000000..fdc3892f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs @@ -0,0 +1,65 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffChangeEventArgs : XEventArgs
+ {
+ public UIBuffInfo addBuff;
+
+ public UIBuffInfo removeBuff;
+
+ public UIBuffInfo updateBuff;
+
+ public XEntity entity;
+
+ public XBuffChangeEventArgs()
+ {
+ this._eDefine = XEventDefine.XEvent_BuffChange;
+ this.addBuff = null;
+ this.removeBuff = null;
+ this.updateBuff = null;
+ this.entity = null;
+ }
+
+ public override void Recycle()
+ {
+ base.Recycle();
+ this.addBuff = null;
+ this.removeBuff = null;
+ this.updateBuff = null;
+ this.entity = null;
+ XEventPool<XBuffChangeEventArgs>.Recycle(this);
+ }
+
+ public UIBuffInfo GetActive()
+ {
+ bool flag = this.addBuff != null;
+ UIBuffInfo result;
+ if (flag)
+ {
+ result = this.addBuff;
+ }
+ else
+ {
+ bool flag2 = this.removeBuff != null;
+ if (flag2)
+ {
+ result = this.removeBuff;
+ }
+ else
+ {
+ bool flag3 = this.updateBuff != null;
+ if (flag3)
+ {
+ result = this.updateBuff;
+ }
+ else
+ {
+ result = null;
+ }
+ }
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs.meta new file mode 100644 index 00000000..156bd532 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 189410d1f30b2c54fb01b6474af86970 +timeCreated: 1611403297 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs new file mode 100644 index 00000000..05f571f0 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs @@ -0,0 +1,44 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffChangeFightGroup : BuffEffect
+ {
+ private uint m_FightGroup;
+
+ private uint m_PreservedFightGroup;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.ChangeFightGroup == -1;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffChangeFightGroup(buff, (uint)rowData.ChangeFightGroup));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffChangeFightGroup(XBuff buff, uint fightgroup)
+ {
+ this.m_FightGroup = fightgroup;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this.m_PreservedFightGroup = entity.Attributes.FightGroup;
+ entity.Attributes.OnFightGroupChange(this.m_FightGroup);
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ entity.Attributes.OnFightGroupChange(this.m_PreservedFightGroup);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs.meta new file mode 100644 index 00000000..d3bc8112 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffChangeFightGroup.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4751d16031bcb844ab033a84a6e76cd8 +timeCreated: 1611403653 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs new file mode 100644 index 00000000..26f39e1a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs @@ -0,0 +1,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;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs.meta new file mode 100644 index 00000000..a98405e8 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffClear.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5811c28a59f01db46a02b8c5ed842616 +timeCreated: 1611403752 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs new file mode 100644 index 00000000..3d94fa42 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs @@ -0,0 +1,1261 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffComponent : XComponent
+ {
+ public override uint ID
+ {
+ get
+ {
+ return XBuffComponent.uuID;
+ }
+ }
+
+ public List<XBuff> BuffList
+ {
+ get
+ {
+ return this._BuffList;
+ }
+ }
+
+ public List<ServerBuffInfo> ServerBuffList
+ {
+ get
+ {
+ return this._ServerBuffList;
+ }
+ }
+
+ public bool bDemo
+ {
+ get
+ {
+ return this._entity.IsDummy;
+ }
+ }
+
+ public bool bLeavingScene
+ {
+ get
+ {
+ return this.m_bLeavingScene;
+ }
+ }
+
+ public bool bDestroying
+ {
+ get
+ {
+ return this.m_bDestroying;
+ }
+ }
+
+ public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("Character_Buff");
+
+ private bool _removeFlag = false;
+
+ private List<XBuff> _BuffList = new List<XBuff>();
+
+ private List<BuffDesc> _AddBuffQueue = new List<BuffDesc>();
+
+ private List<BuffDesc> _AddBuffQueue2 = new List<BuffDesc>();
+
+ private List<ServerBuffInfo> _ServerBuffList = new List<ServerBuffInfo>();
+
+ private Dictionary<int, ClientBuffInfo> _ScaleFx = new Dictionary<int, ClientBuffInfo>();
+
+ private Dictionary<int, ClientBuffInfo> _NoScaleFx = new Dictionary<int, ClientBuffInfo>();
+
+ public Dictionary<int, XTriggerCondition> m_GlobalTriggerState = new Dictionary<int, XTriggerCondition>();
+
+ private bool m_bLeavingScene;
+
+ private bool m_bDestroying;
+
+ private static double CAST_DAMAGE_CHANGE_UPPERBOUND;
+
+ private static double CAST_DAMAGE_CHANGE_LOWERBOUND;
+
+ private static double RECEIVED_DAMAGE_CHANGE_UPPERBOUND;
+
+ private static double RECEIVED_DAMAGE_CHANGE_LOWERBOUND;
+
+ private static double MP_COST_CHANGE_UPPERBOUND;
+
+ private static double MP_COST_CHANGE_LOWERBOUND;
+
+ public static HashSet<int> TransformBuffsChangeOutlook = new HashSet<int>();
+
+ private bool _bPostUpdating = false;
+
+ private List<uint> m_TempBuffList = new List<uint>();
+
+ private List<UIBuffInfo> m_UIBuffList = new List<UIBuffInfo>();
+
+ public static void InitConfigs()
+ {
+ XBuffComponent._ParseBounds(ref XBuffComponent.CAST_DAMAGE_CHANGE_LOWERBOUND, ref XBuffComponent.CAST_DAMAGE_CHANGE_UPPERBOUND, "BuffChangeCastDamageLimit");
+ XBuffComponent._ParseBounds(ref XBuffComponent.RECEIVED_DAMAGE_CHANGE_LOWERBOUND, ref XBuffComponent.RECEIVED_DAMAGE_CHANGE_UPPERBOUND, "BuffChangeReceivedDamageLimit");
+ XBuffComponent._ParseBounds(ref XBuffComponent.MP_COST_CHANGE_LOWERBOUND, ref XBuffComponent.MP_COST_CHANGE_UPPERBOUND, "MpCostChangeLimit");
+ XBuffComponent.TransformBuffsChangeOutlook.Clear();
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("TransformBuffsChangeOutlook").Split(XGlobalConfig.ListSeparator);
+ for (int i = 0; i < array.Length; i++)
+ {
+ XBuffComponent.TransformBuffsChangeOutlook.Add(int.Parse(array[i]));
+ }
+ }
+
+ private static void _ParseBounds(ref double lowerBound, ref double upperBound, string key)
+ {
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue(key).Split(XGlobalConfig.SequenceSeparator);
+ bool flag = array.Length != 2;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(key, " format error: ", XSingleton<XGlobalConfig>.singleton.GetValue("key"), null, null, null);
+ }
+ else
+ {
+ lowerBound = double.Parse(array[0]) - 1.0;
+ upperBound = double.Parse(array[1]) - 1.0;
+ }
+ }
+
+ public override void Attached()
+ {
+ bool flag = !XSingleton<XGame>.singleton.SyncMode && this._entity.Attributes != null;
+ if (flag)
+ {
+ int i = 0;
+ int count = this._entity.Attributes.InBornBuff.Count;
+ while (i < count)
+ {
+ int buffID = this._entity.Attributes.InBornBuff[i, 0];
+ int buffLevel = this._entity.Attributes.InBornBuff[i, 1];
+ XBuffAddEventArgs @event = XEventPool<XBuffAddEventArgs>.GetEvent();
+ @event.Firer = this._entity;
+ @event.xBuffDesc.BuffID = buffID;
+ @event.xBuffDesc.BuffLevel = buffLevel;
+ @event.xBuffDesc.CasterID = this._entity.ID;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ i++;
+ }
+ this._entity.Attributes.SkillLevelInfo.CaskAuraSkills(this._entity);
+ }
+ this.m_bLeavingScene = false;
+ this.m_bDestroying = false;
+ }
+
+ public bool IsBuffStateOn(XBuffType type)
+ {
+ bool flag = this._entity.Attributes == null;
+ return !flag && this._entity.Attributes.BuffState.IsBuffStateOn(type);
+ }
+
+ public short GetBuffStateCounter(XBuffType type)
+ {
+ bool flag = this._entity.Attributes == null;
+ short result;
+ if (flag)
+ {
+ result = 0;
+ }
+ else
+ {
+ result = this._entity.Attributes.BuffState.GetBuffStateCounter(type);
+ }
+ return result;
+ }
+
+ public void IncBuffState(XBuffType type, int param)
+ {
+ bool flag = this._entity.Attributes == null;
+ if (!flag)
+ {
+ this._entity.Attributes.BuffState.IncBuffState(type, param);
+ }
+ }
+
+ public void DecBuffState(XBuffType type, int param)
+ {
+ bool flag = this._entity.Attributes == null;
+ if (!flag)
+ {
+ this._entity.Attributes.BuffState.DecBuffState(type, param);
+ }
+ }
+
+ public int GetStateParam(XBuffType type)
+ {
+ bool flag = this._entity.Attributes == null;
+ int result;
+ if (flag)
+ {
+ result = 0;
+ }
+ else
+ {
+ result = this._entity.Attributes.BuffState.GetStateParam(type);
+ }
+ return result;
+ }
+
+ public void ClearBuff()
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool valid = xbuff.Valid;
+ if (valid)
+ {
+ this._RemoveBuff(xbuff, false);
+ }
+ }
+ bool flag = this.m_bLeavingScene || this.m_bDestroying;
+ if (flag)
+ {
+ for (int j = this._ServerBuffList.Count - 1; j >= 0; j--)
+ {
+ ServerBuffInfo buff = this._ServerBuffList[j];
+ this._ServerBuffList.RemoveAt(j);
+ this._RemoveBuff(buff, null);
+ }
+ }
+ this._BuffList.Clear();
+ this._AddBuffQueue.Clear();
+ this._AddBuffQueue2.Clear();
+ this._ServerBuffList.Clear();
+ this._RefreshQueueImm();
+ bool flag2 = this._entity.Attributes != null;
+ if (flag2)
+ {
+ bool flag3 = !XSingleton<XGame>.singleton.SyncMode;
+ if (flag3)
+ {
+ this._entity.Attributes.BuffState.CheckBuffState();
+ }
+ this._entity.Attributes.BuffState.Reset();
+ }
+ }
+
+ public void OnHurt(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (!flag)
+ {
+ xbuff.OnBuffEffect(rawInput, result, new XBuff.BuffEffectDelegate(XBuff.OnHurt));
+ }
+ }
+ }
+
+ public void OnCastDamage(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (!flag)
+ {
+ xbuff.OnBuffEffect(rawInput, result, new XBuff.BuffEffectDelegate(XBuff.OnCastDamage));
+ }
+ }
+ }
+
+ public void OnCastSkill(HurtInfo rawInput)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (!flag)
+ {
+ xbuff.OnCastSkill(rawInput);
+ }
+ }
+ }
+
+ public void MakeSingleEffect(XBuff buff)
+ {
+ bool flag = buff == null;
+ if (!flag)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag2 = !xbuff.Valid || xbuff == buff;
+ if (!flag2)
+ {
+ bool flag3 = xbuff.ExclusiveData.IsSingleEffectConflict(buff.ExclusiveData);
+ if (flag3)
+ {
+ this._RemoveBuff(xbuff, false);
+ }
+ }
+ }
+ }
+ }
+
+ protected void _CheckRelatedBuffs(BuffTable.RowData rowData, out bool bCanAdd, List<XBuff> buffsShouldRemove)
+ {
+ bCanAdd = true;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (!flag)
+ {
+ bool flag2 = !xbuff.ExclusiveData.CanAdd(rowData.BuffClearType);
+ if (flag2)
+ {
+ bCanAdd = false;
+ break;
+ }
+ }
+ }
+ }
+
+ private bool _PreAddBuff(BuffTable.RowData rowData)
+ {
+ List<XBuff> list = ListPool<XBuff>.Get();
+ bool flag;
+ this._CheckRelatedBuffs(rowData, out flag, list);
+ bool flag2 = !flag;
+ bool result;
+ if (flag2)
+ {
+ ListPool<XBuff>.Release(list);
+ result = false;
+ }
+ else
+ {
+ bool flag3 = list.Count != 0;
+ if (flag3)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ this._RemoveBuff(list[i], false);
+ }
+ }
+ result = true;
+ }
+ return result;
+ }
+
+ private void _PostAddBuff(XBuff newBuff)
+ {
+ bool flag = newBuff == null;
+ if (!flag)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag2 = !xbuff.Valid || xbuff == newBuff;
+ if (!flag2)
+ {
+ bool flag3 = !newBuff.ExclusiveData.ShouldClear(xbuff.ClearType);
+ if (flag3)
+ {
+ this._RemoveBuff(xbuff, false);
+ }
+ }
+ }
+ }
+ }
+
+ private void _AddBuff(BuffDesc buffDesc)
+ {
+ BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(buffDesc.BuffID, buffDesc.BuffLevel);
+ bool flag = buffData == null;
+ if (!flag)
+ {
+ bool flag2 = !this._PreAddBuff(buffData);
+ if (!flag2)
+ {
+ bool flag3 = buffDesc.CasterID == 0UL;
+ if (flag3)
+ {
+ buffDesc.CasterID = this._entity.ID;
+ }
+ CombatEffectHelper data = XDataPool<CombatEffectHelper>.GetData();
+ data.Set(buffData, buffDesc.CasterID, this._entity);
+ XBuff xbuff = XSingleton<XBuffTemplateManager>.singleton.CreateBuff(buffDesc, data);
+ bool flag4 = xbuff == null;
+ if (flag4)
+ {
+ data.Recycle();
+ }
+ else
+ {
+ xbuff.CasterID = buffDesc.CasterID;
+ xbuff.OnAdd(this, data);
+ this._PostAddBuff(xbuff);
+ this._BuffList.Add(xbuff);
+ this._SendAIEvent(xbuff);
+ this._AddBuffNotifyDoc(xbuff.UIBuff);
+ this._PlayBuffFx(xbuff.ID, xbuff.Level, xbuff.Duration);
+ data.Recycle();
+ }
+ }
+ }
+ }
+
+ private void _AppendBuff(XBuff oldBuff)
+ {
+ CombatEffectHelper data = XDataPool<CombatEffectHelper>.GetData();
+ data.Set(oldBuff.BuffInfo, oldBuff.CasterID, this._entity);
+ oldBuff.Append(this, data);
+ this._UpdateBuffNotifyDoc(oldBuff.UIBuff);
+ data.Recycle();
+ oldBuff.OnAppend(this);
+ }
+
+ private void _RemoveBuff(XBuff buff, bool bIsReplaced)
+ {
+ UIBuffInfo uibuff = buff.UIBuff;
+ this._StopBuffFx(buff.ID);
+ buff.OnRemove(this, bIsReplaced);
+ this._removeFlag = true;
+ this._RemoveBuffNotifyDoc(uibuff);
+ }
+
+ private void _SendAIEvent(XBuff buff)
+ {
+ bool flag = buff.BuffInfo.AIEvent[0].Length != 0 && buff.BuffInfo.AIEvent[1].Length != 0;
+ if (flag)
+ {
+ XAIEventArgs @event = XEventPool<XAIEventArgs>.GetEvent();
+ @event.EventArg = buff.BuffInfo.AIEvent[1];
+ @event.TypeId = buff.ID;
+ @event.Pos = this._entity.MoveObj.Position;
+ @event.Firer = ((buff.BuffInfo.AIEvent[0] == "0") ? XSingleton<XLevelSpawnMgr>.singleton.AIGlobal.Host : this._entity);
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+
+ private void PlayFxAtSlot(int slot, int buffID, string fxPath, Dictionary<int, ClientBuffInfo> container, bool scale, XEntity entity)
+ {
+ bool flag = container.ContainsKey(slot);
+ ClientBuffInfo clientBuffInfo;
+ if (flag)
+ {
+ clientBuffInfo = container[slot];
+ }
+ else
+ {
+ clientBuffInfo = new ClientBuffInfo();
+ container.Add(slot, clientBuffInfo);
+ }
+ bool flag2 = clientBuffInfo.oFx != null;
+ if (flag2)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(clientBuffInfo.oFx, true);
+ clientBuffInfo.oFx = null;
+ }
+ clientBuffInfo.BuffID = buffID;
+ bool flag3 = XSingleton<XScene>.singleton.IsMustTransform && entity.IsRole && !entity.IsTransform;
+ if (!flag3)
+ {
+ float num = scale ? entity.Height : 1f;
+ bool flag4 = fxPath != "nullfx";
+ if (flag4)
+ {
+ clientBuffInfo.oFx = XSingleton<XFxMgr>.singleton.CreateFx(fxPath, null, true);
+ bool sticky = fxPath.Contains("_TIEDI");
+ clientBuffInfo.oFx.Play(entity.EngineObject, Vector3.zero, num / entity.Scale * Vector3.one, 1f, true, sticky, "", 0f);
+ }
+ }
+ }
+
+ private void _PlayBuffFx(int BuffID, int BuffLevel, float duration)
+ {
+ bool flag = !this._entity.IsVisible;
+ if (!flag)
+ {
+ bool flag2 = duration > 0f && duration < 3f && XEntity.FilterFx(this._entity, XFxMgr.FilterFxDis2);
+ if (!flag2)
+ {
+ BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(BuffID, BuffLevel);
+ bool flag3 = buffData == null;
+ if (flag3)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("Play buff fx: Buff data not found: [{0} {1}]", BuffID, BuffLevel), null, null, null, null, null);
+ }
+ else
+ {
+ bool flag4 = !string.IsNullOrEmpty(buffData.BuffEffectFx);
+ if (flag4)
+ {
+ int slot = 0;
+ string[] array = buffData.BuffEffectFx.Split(XGlobalConfig.ListSeparator);
+ for (int i = 0; i < array.Length; i++)
+ {
+ string[] array2 = array[i].Split(XGlobalConfig.SequenceSeparator);
+ bool flag5 = array2.Length == 2;
+ if (flag5)
+ {
+ int.TryParse(array2[1], out slot);
+ }
+ this.PlayFxAtSlot(slot, BuffID, array2[0], this._NoScaleFx, true, this._entity);
+ }
+ }
+ bool flag6 = !string.IsNullOrEmpty(buffData.BuffFx);
+ if (flag6)
+ {
+ int slot2 = 0;
+ string[] array3 = buffData.BuffFx.Split(XGlobalConfig.ListSeparator);
+ for (int j = 0; j < array3.Length; j++)
+ {
+ string[] array4 = array3[j].Split(XGlobalConfig.SequenceSeparator);
+ bool flag7 = array4.Length == 2;
+ if (flag7)
+ {
+ int.TryParse(array4[1], out slot2);
+ }
+ this.PlayFxAtSlot(slot2, BuffID, array4[0], this._ScaleFx, false, this._entity);
+ }
+ }
+ bool flag8 = !string.IsNullOrEmpty(buffData.BuffSpriteFx) && !XQualitySetting.GetQuality(EFun.ELowEffect);
+ if (flag8)
+ {
+ int slot3 = 10;
+ XAffiliate xaffiliate = null;
+ bool flag9 = !this._entity.IsTransform && this._entity.Equipment != null;
+ if (flag9)
+ {
+ xaffiliate = this._entity.Equipment.Sprite;
+ }
+ bool flag10 = xaffiliate != null;
+ if (flag10)
+ {
+ string[] array5 = buffData.BuffSpriteFx.Split(XGlobalConfig.ListSeparator);
+ for (int k = 0; k < array5.Length; k++)
+ {
+ string[] array6 = array5[k].Split(XGlobalConfig.SequenceSeparator);
+ bool flag11 = array6.Length == 2;
+ if (flag11)
+ {
+ int.TryParse(array6[1], out slot3);
+ }
+ this.PlayFxAtSlot(slot3, BuffID, array6[0], this._NoScaleFx, false, xaffiliate);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void _StopBuffFx(int BuffID)
+ {
+ foreach (KeyValuePair<int, ClientBuffInfo> keyValuePair in this._NoScaleFx)
+ {
+ bool flag = keyValuePair.Value.BuffID == BuffID;
+ if (flag)
+ {
+ bool flag2 = keyValuePair.Value.oFx != null;
+ if (flag2)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(keyValuePair.Value.oFx, true);
+ keyValuePair.Value.oFx = null;
+ keyValuePair.Value.BuffID = 0;
+ }
+ }
+ }
+ foreach (KeyValuePair<int, ClientBuffInfo> keyValuePair2 in this._ScaleFx)
+ {
+ bool flag3 = keyValuePair2.Value.BuffID == BuffID;
+ if (flag3)
+ {
+ bool flag4 = keyValuePair2.Value.oFx != null;
+ if (flag4)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(keyValuePair2.Value.oFx, true);
+ keyValuePair2.Value.oFx = null;
+ keyValuePair2.Value.BuffID = 0;
+ }
+ break;
+ }
+ }
+ }
+
+ public XBuff GetBuffByID(int buffID)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (!flag)
+ {
+ bool flag2 = xbuff.ID == buffID;
+ if (flag2)
+ {
+ return xbuff;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected override void EventSubscribe()
+ {
+ base.RegisterEvent(XEventDefine.XEvent_BuffAdd, new XComponent.XEventHandler(this.OnAddBuffEvent));
+ base.RegisterEvent(XEventDefine.XEvent_BuffRemove, new XComponent.XEventHandler(this.OnRemoveBuffEvent));
+ base.RegisterEvent(XEventDefine.XEvent_RealDead, new XComponent.XEventHandler(this.OnRealDead));
+ base.RegisterEvent(XEventDefine.XEvent_LeaveScene, new XComponent.XEventHandler(this.OnLeaveScene));
+ bool flag = !this.bDemo;
+ if (flag)
+ {
+ base.RegisterEvent(XEventDefine.XEvent_AttributeChange, new XComponent.XEventHandler(this.OnAttributeChange));
+ }
+ else
+ {
+ base.RegisterEvent(XEventDefine.XEvent_AttackShowEnd, new XComponent.XEventHandler(this.SkillPlayFinished));
+ }
+ bool flag2 = !XSingleton<XGame>.singleton.SyncMode;
+ if (flag2)
+ {
+ base.RegisterEvent(XEventDefine.XEvent_ComboChange, new XComponent.XEventHandler(this.OnComboChange));
+ }
+ base.RegisterEvent(XEventDefine.XEvent_BattleEnd, new XComponent.XEventHandler(this.OnBattleEndEvent));
+ }
+
+ private bool SkillPlayFinished(XEventArgs args)
+ {
+ this.ClearBuff();
+ this.ClearBuffFx();
+ return true;
+ }
+
+ private bool OnLeaveScene(XEventArgs e)
+ {
+ this.m_bLeavingScene = true;
+ this.ClearBuff();
+ this.ClearTriggerStates();
+ return true;
+ }
+
+ private bool OnRealDead(XEventArgs e)
+ {
+ XRealDeadEventArgs e2 = e as XRealDeadEventArgs;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool valid = xbuff.Valid;
+ if (valid)
+ {
+ xbuff.OnRealDead(e2);
+ }
+ }
+ this.ClearBuff();
+ this.ClearBuffFx();
+ return true;
+ }
+
+ public void ClearBuffFx()
+ {
+ foreach (KeyValuePair<int, ClientBuffInfo> keyValuePair in this._NoScaleFx)
+ {
+ bool flag = keyValuePair.Value.oFx != null;
+ if (flag)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(keyValuePair.Value.oFx, true);
+ keyValuePair.Value.oFx = null;
+ }
+ }
+ foreach (KeyValuePair<int, ClientBuffInfo> keyValuePair2 in this._ScaleFx)
+ {
+ bool flag2 = keyValuePair2.Value.oFx != null;
+ if (flag2)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(keyValuePair2.Value.oFx, true);
+ keyValuePair2.Value.oFx = null;
+ }
+ }
+ this._NoScaleFx.Clear();
+ this._ScaleFx.Clear();
+ }
+
+ private void _MergeBuff(BuffDesc buffDesc, XBuff existBuff)
+ {
+ BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(buffDesc.BuffID, buffDesc.BuffLevel);
+ bool flag = buffData == null;
+ if (!flag)
+ {
+ bool flag2 = existBuff.Level > (int)buffData.BuffLevel;
+ if (!flag2)
+ {
+ bool flag3 = existBuff.Level < (int)buffData.BuffLevel;
+ if (flag3)
+ {
+ this._RemoveBuff(existBuff, true);
+ this._AddBuff(buffDesc);
+ }
+ else
+ {
+ switch (existBuff.MergeType)
+ {
+ case XBuffMergeType.XBuffMergeType_Replace:
+ this._RemoveBuff(existBuff, true);
+ this._AddBuff(buffDesc);
+ break;
+ case XBuffMergeType.XBuffMergeType_ExtendTime:
+ XSingleton<XDebug>.singleton.AddGreenLog("extend buff ", buffData.BuffID.ToString(), " to ", this._entity.ID.ToString(), " at time ", (Environment.TickCount % 1000000).ToString());
+ existBuff.AddBuffTime(existBuff.OriginalDuration, this);
+ this._UpdateBuffNotifyDoc(existBuff.UIBuff);
+ break;
+ case XBuffMergeType.XBuffMergeType_Stacking:
+ this._AppendBuff(existBuff);
+ break;
+ case XBuffMergeType.XBuffMergeType_Reset:
+ existBuff.ResetTime(this);
+ this._UpdateBuffNotifyDoc(existBuff.UIBuff);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private bool OnAddBuffEvent(XEventArgs e)
+ {
+ XBuffAddEventArgs xbuffAddEventArgs = e as XBuffAddEventArgs;
+ BuffDesc xBuffDesc = xbuffAddEventArgs.xBuffDesc;
+ this._AddBuffQueue.Add(xBuffDesc);
+ bool xEffectImm = xbuffAddEventArgs.xEffectImm;
+ if (xEffectImm)
+ {
+ this._RefreshQueueImm();
+ }
+ return true;
+ }
+
+ private bool OnRemoveBuffEvent(XEventArgs e)
+ {
+ XBuffRemoveEventArgs xbuffRemoveEventArgs = e as XBuffRemoveEventArgs;
+ for (int i = this._AddBuffQueue.Count - 1; i >= 0; i--)
+ {
+ bool flag = this._AddBuffQueue[i].BuffID == xbuffRemoveEventArgs.xBuffID;
+ if (flag)
+ {
+ this._AddBuffQueue.RemoveAt(i);
+ }
+ }
+ XBuff buffByID = this.GetBuffByID(xbuffRemoveEventArgs.xBuffID);
+ bool flag2 = buffByID == null;
+ bool result;
+ if (flag2)
+ {
+ result = true;
+ }
+ else
+ {
+ this._RemoveBuff(buffByID, false);
+ result = true;
+ }
+ return result;
+ }
+
+ private bool OnBattleEndEvent(XEventArgs e)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ bool valid = this._BuffList[i].Valid;
+ if (valid)
+ {
+ this._BuffList[i].OnBattleEnd(this);
+ }
+ }
+ return true;
+ }
+
+ public override void Update(float fDeltaT)
+ {
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ bool valid = this._BuffList[i].Valid;
+ if (valid)
+ {
+ this._BuffList[i].Update();
+ }
+ }
+ }
+
+ public override void PostUpdate(float fDeltaT)
+ {
+ bool bPostUpdating = this._bPostUpdating;
+ if (!bPostUpdating)
+ {
+ this._bPostUpdating = true;
+ bool removeFlag = this._removeFlag;
+ if (removeFlag)
+ {
+ this._removeFlag = false;
+ for (int i = this._BuffList.Count - 1; i >= 0; i--)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool flag = !xbuff.Valid;
+ if (flag)
+ {
+ this._BuffList.RemoveAt(i);
+ }
+ }
+ }
+ while (this._AddBuffQueue.Count > 0)
+ {
+ List<BuffDesc> addBuffQueue = this._AddBuffQueue;
+ this._AddBuffQueue = this._AddBuffQueue2;
+ this._AddBuffQueue2 = addBuffQueue;
+ for (int j = 0; j < addBuffQueue.Count; j++)
+ {
+ XBuff buffByID = this.GetBuffByID(addBuffQueue[j].BuffID);
+ bool flag2 = buffByID != null;
+ if (flag2)
+ {
+ this._MergeBuff(addBuffQueue[j], buffByID);
+ }
+ else
+ {
+ this._AddBuff(addBuffQueue[j]);
+ }
+ }
+ addBuffQueue.Clear();
+ }
+ this._bPostUpdating = false;
+ }
+ }
+
+ protected bool OnAttributeChange(XEventArgs e)
+ {
+ XAttrChangeEventArgs e2 = e as XAttrChangeEventArgs;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool valid = xbuff.Valid;
+ if (valid)
+ {
+ xbuff.OnAttributeChanged(this, e2);
+ }
+ }
+ return true;
+ }
+
+ protected bool OnQTEChange(XEventArgs e)
+ {
+ XSkillQTEEventArgs e2 = e as XSkillQTEEventArgs;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool valid = xbuff.Valid;
+ if (valid)
+ {
+ xbuff.OnQTEStateChanged(this, e2);
+ }
+ }
+ return true;
+ }
+
+ protected bool OnComboChange(XEventArgs e)
+ {
+ XOnComboChangeEventArgs xonComboChangeEventArgs = e as XOnComboChangeEventArgs;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ XBuff xbuff = this._BuffList[i];
+ bool valid = xbuff.Valid;
+ if (valid)
+ {
+ xbuff.OnComboChange(xonComboChangeEventArgs.ComboCount);
+ }
+ }
+ return true;
+ }
+
+ public double ModifySkillDamage()
+ {
+ double num = 0.0;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ num += this._BuffList[i].ModifySkillDamage();
+ }
+ return XSingleton<XCommon>.singleton.Clamp(num, XBuffComponent.CAST_DAMAGE_CHANGE_LOWERBOUND, XBuffComponent.CAST_DAMAGE_CHANGE_UPPERBOUND);
+ }
+
+ public double IncReceivedDamage()
+ {
+ double num = 0.0;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ num += this._BuffList[i].IncReceivedDamage();
+ }
+ bool flag = num > XBuffComponent.RECEIVED_DAMAGE_CHANGE_UPPERBOUND;
+ double result;
+ if (flag)
+ {
+ result = XBuffComponent.RECEIVED_DAMAGE_CHANGE_UPPERBOUND;
+ }
+ else
+ {
+ result = num;
+ }
+ return result;
+ }
+
+ public double DecReceivedDamage()
+ {
+ double num = 0.0;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ num += this._BuffList[i].DecReceivedDamage();
+ }
+ bool flag = num < XBuffComponent.RECEIVED_DAMAGE_CHANGE_LOWERBOUND;
+ double result;
+ if (flag)
+ {
+ result = XBuffComponent.RECEIVED_DAMAGE_CHANGE_LOWERBOUND;
+ }
+ else
+ {
+ result = num;
+ }
+ return result;
+ }
+
+ public double ChangeSkillDamage(uint skillID)
+ {
+ double num = 0.0;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ num += this._BuffList[i].ChangeSkillDamage(skillID);
+ }
+ return num;
+ }
+
+ public double ModifySkillCost()
+ {
+ double num = 0.0;
+ for (int i = 0; i < this._BuffList.Count; i++)
+ {
+ num += this._BuffList[i].ModifySkillCost();
+ }
+ return XSingleton<XCommon>.singleton.Clamp(num, XBuffComponent.MP_COST_CHANGE_LOWERBOUND, XBuffComponent.MP_COST_CHANGE_UPPERBOUND);
+ }
+
+ public List<uint> GetBuffList()
+ {
+ this.m_TempBuffList.Clear();
+ bool syncMode = XSingleton<XGame>.singleton.SyncMode;
+ List<uint> tempBuffList;
+ if (syncMode)
+ {
+ for (int i = 0; i < this._ServerBuffList.Count; i++)
+ {
+ this.m_TempBuffList.Add(this._ServerBuffList[i].buffID);
+ }
+ tempBuffList = this.m_TempBuffList;
+ }
+ else
+ {
+ for (int j = 0; j < this._BuffList.Count; j++)
+ {
+ bool valid = this._BuffList[j].Valid;
+ if (valid)
+ {
+ this.m_TempBuffList.Add((uint)this._BuffList[j].ID);
+ }
+ }
+ tempBuffList = this.m_TempBuffList;
+ }
+ return tempBuffList;
+ }
+
+ public List<UIBuffInfo> GetUIBuffList()
+ {
+ this.m_UIBuffList.Clear();
+ bool syncMode = XSingleton<XGame>.singleton.SyncMode;
+ List<UIBuffInfo> uibuffList;
+ if (syncMode)
+ {
+ for (int i = 0; i < this._ServerBuffList.Count; i++)
+ {
+ this.m_UIBuffList.Add(this._ServerBuffList[i].UIBuff);
+ }
+ uibuffList = this.m_UIBuffList;
+ }
+ else
+ {
+ for (int j = 0; j < this._BuffList.Count; j++)
+ {
+ bool valid = this._BuffList[j].Valid;
+ if (valid)
+ {
+ this.m_UIBuffList.Add(this._BuffList[j].UIBuff);
+ }
+ }
+ uibuffList = this.m_UIBuffList;
+ }
+ return uibuffList;
+ }
+
+ public void AddBuffByServer(BuffInfo data)
+ {
+ ServerBuffInfo serverBuffInfo = new ServerBuffInfo();
+ bool flag = !serverBuffInfo.Set(data);
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("cant find add buff in client, while id = ", data.BuffID.ToString(), " and level = ", data.BuffLevel.ToString(), null, null);
+ }
+ else
+ {
+ this._ServerBuffList.Add(serverBuffInfo);
+ this._AddBuffNotifyDoc(serverBuffInfo.UIBuff);
+ bool flag2 = serverBuffInfo.UIBuff.buffInfo != null;
+ if (flag2)
+ {
+ this._PlayBuffFx((int)serverBuffInfo.buffID, (int)serverBuffInfo.buffLevel, serverBuffInfo.UIBuff.buffInfo.BuffDuration);
+ }
+ this._OnAddServerBuff(serverBuffInfo);
+ }
+ }
+
+ private void _OnAddServerBuff(ServerBuffInfo info)
+ {
+ XBuffSpecialState.TryTransform(this._entity, (int)info.buffID, info.transformID, true);
+ XBuffSpecialState.TryScale(this._entity, info.UIBuff, true);
+ XBuffSpecialState.TryToggleTrapUI(this._entity, info.UIBuff, true);
+ XBuffSpecialState.TryStealth(this._entity, info.UIBuff, true);
+ XBuffSkillsReplace.TrySkillsReplace(this._entity, info.UIBuff, true);
+ }
+
+ public void RemoveBuffByServer(BuffInfo data)
+ {
+ ServerBuffInfo serverBuffInfo = null;
+ for (int i = 0; i < this._ServerBuffList.Count; i++)
+ {
+ bool flag = this._ServerBuffList[i].buffID == data.BuffID && this._ServerBuffList[i].buffLevel == data.BuffLevel;
+ if (flag)
+ {
+ serverBuffInfo = this._ServerBuffList[i];
+ this._ServerBuffList.RemoveAt(i);
+ break;
+ }
+ }
+ bool flag2 = serverBuffInfo == null;
+ if (!flag2)
+ {
+ this._RemoveBuff(serverBuffInfo, data);
+ }
+ }
+
+ private void _RemoveBuff(ServerBuffInfo buff, BuffInfo data)
+ {
+ bool flag = buff == null;
+ if (!flag)
+ {
+ UIBuffInfo uibuff = buff.UIBuff;
+ bool flag2 = data != null;
+ if (flag2)
+ {
+ buff.UpdateFromRemoveBuff(data);
+ }
+ this._OnRemoveServerBuff(buff);
+ this._RemoveBuffNotifyDoc(uibuff);
+ this._StopBuffFx((int)buff.buffID);
+ }
+ }
+
+ private void _OnRemoveServerBuff(ServerBuffInfo info)
+ {
+ bool flag = !this.m_bDestroying && !this.m_bLeavingScene;
+ if (flag)
+ {
+ XBuffSpecialState.TryTransform(this._entity, (int)info.buffID, info.transformID, false);
+ }
+ bool flag2 = !this.m_bLeavingScene;
+ if (flag2)
+ {
+ XBuffSpecialState.TryScale(this._entity, info.UIBuff, false);
+ XBuffSpecialState.TryToggleTrapUI(this._entity, info.UIBuff, false);
+ XBuffSpecialState.TryStealth(this._entity, info.UIBuff, false);
+ XBuffSkillsReplace.TrySkillsReplace(this._entity, info.UIBuff, false);
+ }
+ }
+
+ public void UpdateBuffByServer(BuffInfo data)
+ {
+ UIBuffInfo uibuffInfo = null;
+ ServerBuffInfo serverBuffInfo = null;
+ for (int i = 0; i < this._ServerBuffList.Count; i++)
+ {
+ bool flag = this._ServerBuffList[i].buffID == data.BuffID && this._ServerBuffList[i].buffLevel == data.BuffLevel;
+ if (flag)
+ {
+ serverBuffInfo = this._ServerBuffList[i];
+ serverBuffInfo.Set(data);
+ uibuffInfo = serverBuffInfo.UIBuff;
+ break;
+ }
+ }
+ bool flag2 = uibuffInfo == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("cant find update buff in client, while id = ", data.BuffID.ToString(), " and level = ", data.BuffLevel.ToString(), null, null);
+ }
+ else
+ {
+ this._UpdateBuffNotifyDoc(uibuffInfo);
+ this._OnUpdateServerBuff(serverBuffInfo);
+ }
+ }
+
+ private void _OnUpdateServerBuff(ServerBuffInfo info)
+ {
+ XBuffSpecialState.TryTransform(this._entity, (int)info.buffID, info.transformID, true);
+ }
+
+ public void SetServerAllBuffsInfo(AllBuffsInfo data)
+ {
+ bool flag = data == null;
+ if (!flag)
+ {
+ this.SetServerBuffState(data.BuffState);
+ this.SetServerBuffValues(data.StateParamIndex, data.StateParamValues);
+ }
+ }
+
+ public void SetServerBuffState(uint state)
+ {
+ for (int i = 0; i < XFastEnumIntEqualityComparer<XBuffType>.ToInt(XBuffType.XBuffType_Max); i++)
+ {
+ this._entity.Attributes.BuffState.SetBuffState((XBuffType)i, (short)(state >> i & 1u));
+ }
+ }
+
+ public void SetServerBuffValues(List<int> index, List<int> values)
+ {
+ for (int i = 0; i < XFastEnumIntEqualityComparer<XBuffType>.ToInt(XBuffType.XBuffType_Max); i++)
+ {
+ this._entity.Attributes.BuffState.SetStateParam((XBuffType)i, 0);
+ }
+ bool flag = index.Count != values.Count;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("data.StateParamValues.Count ({0}) != data.StateParamIndex.Count ({1})", values.Count, index.Count), null, null, null, null, null);
+ }
+ for (int j = 0; j < index.Count; j++)
+ {
+ this._entity.Attributes.BuffState.SetStateParam((XBuffType)index[j], values[j]);
+ }
+ }
+
+ public override void OnDetachFromHost()
+ {
+ this.m_bDestroying = true;
+ this.ClearBuff();
+ this.ClearBuffFx();
+ base.OnDetachFromHost();
+ }
+
+ public void InitFromServer(List<BuffInfo> buffs, AllBuffsInfo states)
+ {
+ this.ClearBuff();
+ this.ClearBuffFx();
+ this.SetServerAllBuffsInfo(states);
+ this.AddBuffByServer(buffs);
+ }
+
+ public void AddBuffByServer(List<BuffInfo> buffs)
+ {
+ bool flag = buffs == null;
+ if (!flag)
+ {
+ for (int i = 0; i < buffs.Count; i++)
+ {
+ this.AddBuffByServer(buffs[i]);
+ }
+ }
+ }
+
+ private void _AddBuffNotifyDoc(UIBuffInfo buffInfo)
+ {
+ bool flag = buffInfo == null;
+ if (!flag)
+ {
+ XBuffChangeEventArgs @event = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ @event.addBuff = buffInfo;
+ @event.entity = base.Entity;
+ @event.Firer = XSingleton<XGame>.singleton.Doc;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ XBuffChangeEventArgs event2 = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ event2.addBuff = buffInfo;
+ event2.entity = base.Entity;
+ event2.Firer = this._entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(event2);
+ }
+ }
+
+ private void _RemoveBuffNotifyDoc(UIBuffInfo buffInfo)
+ {
+ bool flag = buffInfo == null;
+ if (!flag)
+ {
+ XBuffChangeEventArgs @event = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ @event.removeBuff = buffInfo;
+ @event.entity = base.Entity;
+ @event.Firer = XSingleton<XGame>.singleton.Doc;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ XBuffChangeEventArgs event2 = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ event2.removeBuff = buffInfo;
+ event2.entity = base.Entity;
+ event2.Firer = this._entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(event2);
+ }
+ }
+
+ private void _UpdateBuffNotifyDoc(UIBuffInfo buffInfo)
+ {
+ bool flag = buffInfo == null;
+ if (!flag)
+ {
+ XBuffChangeEventArgs @event = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ @event.updateBuff = buffInfo;
+ @event.entity = base.Entity;
+ @event.Firer = XSingleton<XGame>.singleton.Doc;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ XBuffChangeEventArgs event2 = XEventPool<XBuffChangeEventArgs>.GetEvent();
+ event2.updateBuff = buffInfo;
+ event2.entity = base.Entity;
+ event2.Firer = this._entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(event2);
+ }
+ }
+
+ private void _RefreshQueueImm()
+ {
+ this.PostUpdate(0f);
+ }
+
+ public XTriggerCondition GetTriggerState(BuffTable.RowData info)
+ {
+ XTriggerCondition xtriggerCondition;
+ bool flag = !this.m_GlobalTriggerState.TryGetValue(info.BuffID, out xtriggerCondition);
+ if (flag)
+ {
+ xtriggerCondition = new XTriggerCondition(info);
+ this.m_GlobalTriggerState[info.BuffID] = xtriggerCondition;
+ }
+ return xtriggerCondition;
+ }
+
+ public void ClearTriggerStates()
+ {
+ this.m_GlobalTriggerState.Clear();
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs.meta new file mode 100644 index 00000000..afaaf49a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffComponent.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5cdfee8b01a91b24ea2c3679740573bd +timeCreated: 1611403803 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs new file mode 100644 index 00000000..97ce2e54 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs @@ -0,0 +1,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);
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs.meta new file mode 100644 index 00000000..4dba61bb --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageDistanceScale.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ad163b386e478aa4a905b3f1a65142a4 +timeCreated: 1611404333 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs new file mode 100644 index 00000000..f94e9fff --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs @@ -0,0 +1,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));
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs.meta new file mode 100644 index 00000000..5511ee58 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffDamageReflection.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5cc00c4c390121645a9c63051c77d498 +timeCreated: 1611403802 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs new file mode 100644 index 00000000..dde59c49 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs @@ -0,0 +1,9 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffEffectData
+ {
+ public ulong MobID = 0UL;
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs.meta new file mode 100644 index 00000000..f87a5860 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 62501ccd6a9c627449a83e9fcf1a0ba9 +timeCreated: 1611403840 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs new file mode 100644 index 00000000..4015f34d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs @@ -0,0 +1,22 @@ +using System;
+
+namespace XMainClient
+{
+ internal enum XBuffEffectPrioriy
+ {
+ BEP_START,
+ BEP_Default = 0,
+ BEP_SpecialState_Trapped,
+ BEP_TriggerByHit,
+ BEP_TargetLifeAddAttack,
+ BEP_ReduceDamage,
+ BEP_SpecialState_Immortal,
+ BEP_SpecialState_Shield,
+ BEP_SpecialState_CantDie,
+ BEP_TriggerByBeHit,
+ BEP_DamageReflection,
+ BEP_TriggerByHit_Death,
+ BEP_Kill,
+ BEP_END
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs.meta new file mode 100644 index 00000000..3ad69e13 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffEffectPrioriy.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2e9c647b87fb0cd4f909f0c5be3f1a83 +timeCreated: 1611403510 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs new file mode 100644 index 00000000..9bbe0322 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs @@ -0,0 +1,81 @@ +using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal struct XBuffExclusive
+ {
+ private HashSet<byte> _ClearTypes;
+
+ private HashSet<byte> _SingleEffects;
+
+ public void Set(BuffTable.RowData rowData)
+ {
+ bool flag = rowData == null;
+ if (!flag)
+ {
+ bool flag2 = rowData.ClearTypes != null && rowData.ClearTypes.Length != 0;
+ if (flag2)
+ {
+ this._ClearTypes = HashPool<byte>.Get();
+ for (int i = 0; i < rowData.ClearTypes.Length; i++)
+ {
+ this._ClearTypes.Add(rowData.ClearTypes[i]);
+ }
+ }
+ bool flag3 = rowData.BuffState != null && rowData.BuffState.Length != 0;
+ if (flag3)
+ {
+ this._SingleEffects = HashPool<byte>.Get();
+ for (int j = 0; j < rowData.BuffState.Length; j++)
+ {
+ XBuffType xbuffType = (XBuffType)rowData.BuffState[j];
+ if (xbuffType == XBuffType.XBuffType_Transform || xbuffType == XBuffType.XBuffType_Scale)
+ {
+ this._SingleEffects.Add(rowData.BuffState[j]);
+ }
+ }
+ }
+ }
+ }
+
+ public bool CanAdd(byte clearType)
+ {
+ bool flag = this._ClearTypes == null;
+ return flag || !this._ClearTypes.Contains(clearType);
+ }
+
+ public bool IsSingleEffectConflict(XBuffExclusive other)
+ {
+ return XBuffExclusive._Overlaped(this._SingleEffects, other._SingleEffects);
+ }
+
+ private static bool _Overlaped(HashSet<byte> left, HashSet<byte> right)
+ {
+ bool flag = left == null || right == null || left.Count == 0 || right.Count == 0;
+ return !flag && left.Overlaps(right);
+ }
+
+ public bool ShouldClear(byte clearType)
+ {
+ return this.CanAdd(clearType);
+ }
+
+ public void Destroy()
+ {
+ bool flag = this._ClearTypes != null;
+ if (flag)
+ {
+ HashPool<byte>.Release(this._ClearTypes);
+ this._ClearTypes = null;
+ }
+ bool flag2 = this._SingleEffects != null;
+ if (flag2)
+ {
+ HashPool<byte>.Release(this._SingleEffects);
+ this._SingleEffects = null;
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs.meta new file mode 100644 index 00000000..a5591f77 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffExclusive.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5fba60cac730a1549b1a60332416cba9 +timeCreated: 1611403830 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs new file mode 100644 index 00000000..39338059 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs @@ -0,0 +1,45 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffKill : BuffEffect
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ return XBuffEffectPrioriy.BEP_Kill;
+ }
+ }
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.Kill == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffKill());
+ result = true;
+ }
+ return result;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool flag = !IsReplaced && !entity.IsDead && !entity.Buffs.bLeavingScene && !entity.Buffs.bDestroying;
+ if (flag)
+ {
+ XSingleton<XDeath>.singleton.DeathDetect(entity, null, true);
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs.meta new file mode 100644 index 00000000..06caf98f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffKill.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d100226e8dddf3e4da3b1e4c9e389476 +timeCreated: 1611404590 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs new file mode 100644 index 00000000..83696bfe --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs @@ -0,0 +1,61 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffLifeAddAttack : 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.SelfLifeAddAttack.Count == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffLifeAddAttack(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffLifeAddAttack(XBuff buff)
+ {
+ this._buff = buff;
+ BuffTable.RowData buffInfo = buff.BuffInfo;
+ this.m_Data.SetRange(0.0, 0.0, 1.0, 0.0);
+ this.m_Data.Init(ref buffInfo.SelfLifeAddAttack);
+ }
+
+ 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)
+ {
+ double hppercent = this._entity.Attributes.HPPercent;
+ result.Value *= 1.0 + this.m_Data.GetData(hppercent);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs.meta new file mode 100644 index 00000000..94ff7bc6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeAddAttack.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f44c4f60c53e28445ad2fa17266abdea +timeCreated: 1611404853 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs new file mode 100644 index 00000000..a2250c2e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs @@ -0,0 +1,93 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffLifeSteal : BuffEffect
+ {
+ private float m_Ratio;
+
+ private float m_UpperBoundRatio;
+
+ private double m_StealUpperBound = 0.0;
+
+ private XBuff m_Buff;
+
+ private XEntity m_Entity;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.LifeSteal[0] == 0f;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffLifeSteal(ref rowData.LifeSteal, buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffLifeSteal(ref SeqRef<float> data, XBuff _Buff)
+ {
+ this.m_Ratio = data[0];
+ this.m_Buff = _Buff;
+ this.m_UpperBoundRatio = data[1];
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this.m_Entity = entity;
+ bool flag = this.m_UpperBoundRatio > 0f && entity != null && entity.Attributes != null;
+ if (flag)
+ {
+ this.m_StealUpperBound = entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total) * (double)this.m_UpperBoundRatio;
+ }
+ }
+
+ 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.m_Buff.RelevantSkills != null && this.m_Buff.RelevantSkills.Count != 0;
+ if (flag2)
+ {
+ bool flag3 = !this.m_Buff.RelevantSkills.Contains(rawInput.SkillID);
+ if (flag3)
+ {
+ return;
+ }
+ }
+ bool accept = result.Accept;
+ if (accept)
+ {
+ double num = result.Value * (double)this.m_Ratio;
+ bool flag4 = this.m_UpperBoundRatio > 0f;
+ if (flag4)
+ {
+ num = Math.Min(num, this.m_StealUpperBound);
+ this.m_StealUpperBound -= num;
+ }
+ bool flag5 = num > 0.0;
+ if (flag5)
+ {
+ XAttrChangeEventArgs @event = XEventPool<XAttrChangeEventArgs>.GetEvent();
+ @event.AttrKey = XAttributeDefine.XAttr_CurrentHP_Basic;
+ @event.DeltaValue = num;
+ @event.Firer = this.m_Entity;
+ @event.bShowHUD = !this.m_Buff.BuffInfo.DontShowText;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs.meta new file mode 100644 index 00000000..4b6796e5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffLifeSteal.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 74ff7abbea2384c49a70f493a1b725f1 +timeCreated: 1611403945 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs new file mode 100644 index 00000000..dc3028d1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs @@ -0,0 +1,73 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffManipulate : BuffEffect
+ {
+ private XEntity _entity;
+
+ private XBuff _Buff;
+
+ private long _Token;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.Manipulate == null || rowData.Manipulate.Length == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffManipulate(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffManipulate(XBuff buff)
+ {
+ this._Buff = buff;
+ }
+
+ private float _GetParam(int index)
+ {
+ bool flag = this._Buff.BuffInfo.Manipulate == null || this._Buff.BuffInfo.Manipulate.Length <= index;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ result = this._Buff.BuffInfo.Manipulate[index];
+ }
+ return result;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ XManipulationData xmanipulationData = new XManipulationData();
+ xmanipulationData.Degree = 360f;
+ xmanipulationData.Force = this._GetParam(0);
+ xmanipulationData.Radius = this._GetParam(1);
+ xmanipulationData.TargetIsOpponent = ((int)this._GetParam(2) == 0);
+ XManipulationOnEventArgs @event = XEventPool<XManipulationOnEventArgs>.GetEvent();
+ @event.data = xmanipulationData;
+ @event.Firer = this._entity;
+ this._Token = @event.Token;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ XManipulationOffEventArgs @event = XEventPool<XManipulationOffEventArgs>.GetEvent();
+ @event.DenyToken = this._Token;
+ @event.Firer = entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs.meta new file mode 100644 index 00000000..fed613a4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffManipulate.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a59f1b4d527ad744d8e42d7e11eea379 +timeCreated: 1611404286 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs new file mode 100644 index 00000000..fde7b7bb --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs @@ -0,0 +1,12 @@ +using System;
+
+namespace XMainClient
+{
+ internal enum XBuffMergeType
+ {
+ XBuffMergeType_Replace,
+ XBuffMergeType_ExtendTime,
+ XBuffMergeType_Stacking,
+ XBuffMergeType_Reset
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs.meta new file mode 100644 index 00000000..df94abd4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffMergeType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6466526973bfcfb43960ec3879ab799a +timeCreated: 1611403847 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs new file mode 100644 index 00000000..5425bb30 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs @@ -0,0 +1,79 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffMob : BuffEffect
+ {
+ private XEntity _entity;
+
+ private XEntity _Mob = null;
+
+ private XBuff _Buff;
+
+ private uint _MobTemplateID = 0u;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.MobID == 0u;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffMob(rowData.MobID, buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffMob(uint templateID, XBuff buff)
+ {
+ this._MobTemplateID = templateID;
+ this._Buff = buff;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ XEntity entity2 = XSingleton<XEntityMgr>.singleton.GetEntity(this._Buff.CasterID);
+ bool flag = XEntity.ValideEntity(entity2);
+ if (flag)
+ {
+ this._Mob = XSingleton<XEntityMgr>.singleton.CreateEntity(this._MobTemplateID, this._entity.EngineObject.Position, this._entity.EngineObject.Rotation, true, (entity2.Attributes != null) ? entity2.Attributes.FightGroup : uint.MaxValue);
+ XSingleton<XSkillEffectMgr>.singleton.SetMobProperty(this._Mob, entity2, 0u);
+ this._Buff.EffectData.MobID = this._Mob.ID;
+ bool isBoss = entity2.IsBoss;
+ if (isBoss)
+ {
+ XSecurityAIInfo xsecurityAIInfo = XSecurityAIInfo.TryGetStatistics(entity2);
+ bool flag2 = xsecurityAIInfo != null;
+ if (flag2)
+ {
+ xsecurityAIInfo.OnExternalCallMonster();
+ }
+ }
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ XSingleton<XEntityMgr>.singleton.DestroyEntity(this._Mob);
+ this._Mob = null;
+ }
+
+ public override void OnUpdate()
+ {
+ bool flag = !XEntity.ValideEntity(this._Mob);
+ if (flag)
+ {
+ XBuffRemoveEventArgs @event = XEventPool<XBuffRemoveEventArgs>.GetEvent();
+ @event.xBuffID = this._Buff.ID;
+ @event.Firer = this._entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs.meta new file mode 100644 index 00000000..b5c54d4d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffMob.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6774fd70bd206884b927aa30d706c2df +timeCreated: 1611403858 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs new file mode 100644 index 00000000..bf9f2bd7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs @@ -0,0 +1,180 @@ +using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal struct XBuffModifyEffect
+ {
+ private double m_CostModify;
+
+ private double m_CastDamageModify;
+
+ private double m_IncReceivedDamageModify;
+
+ private double m_DecReceivedDamageModify;
+
+ private Dictionary<uint, double> m_ChangeSkillDamage;
+
+ public bool TryCreate(CombatEffectHelper pEffectHelper, XBuff buff)
+ {
+ BuffTable.RowData buffInfo = pEffectHelper.BuffInfo;
+ bool flag = buffInfo.CostModify != 0f;
+ if (flag)
+ {
+ this.m_CostModify += (double)buffInfo.CostModify - 1.0;
+ }
+ double num = 0.0;
+ double num2 = 0.0;
+ pEffectHelper.GetBuffChangeDamage(out num, out num2);
+ num += (double)buffInfo.ChangeDamage[0];
+ num2 += (double)buffInfo.ChangeDamage[1];
+ bool flag2 = num != 0.0;
+ if (flag2)
+ {
+ this.m_CastDamageModify += num - 1.0;
+ }
+ bool flag3 = num2 != 0.0;
+ if (flag3)
+ {
+ bool flag4 = num2 > 1.0;
+ if (flag4)
+ {
+ this.m_IncReceivedDamageModify += num2 - 1.0;
+ }
+ else
+ {
+ this.m_DecReceivedDamageModify += num2 - 1.0;
+ }
+ }
+ bool flag5 = buffInfo.ChangeSkillDamage.Count > 0;
+ if (flag5)
+ {
+ bool flag6 = this.m_ChangeSkillDamage == null;
+ if (flag6)
+ {
+ this.m_ChangeSkillDamage = DictionaryPool<uint, double>.Get();
+ }
+ for (int i = 0; i < buffInfo.ChangeSkillDamage.Count; i++)
+ {
+ uint num3 = XSingleton<XCommon>.singleton.XHash(buffInfo.ChangeSkillDamage[i, 0]);
+ double num4 = double.Parse(buffInfo.ChangeSkillDamage[i, 1]) / 100.0;
+ bool flag7 = this.m_ChangeSkillDamage.ContainsKey(num3);
+ if (flag7)
+ {
+ Dictionary<uint, double> changeSkillDamage = this.m_ChangeSkillDamage;
+ uint key = num3;
+ changeSkillDamage[key] += num4;
+ }
+ else
+ {
+ this.m_ChangeSkillDamage[num3] = num4;
+ }
+ }
+ }
+ bool flag8 = pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_ChangeSkillDamage);
+ if (flag8)
+ {
+ bool flag9 = this.m_ChangeSkillDamage == null;
+ if (flag9)
+ {
+ this.m_ChangeSkillDamage = DictionaryPool<uint, double>.Get();
+ }
+ SequenceList<uint> sequenceList = CommonObjectPool<SequenceList<uint>>.Get();
+ pEffectHelper.GetBuffChangeSkillDamage(sequenceList);
+ for (int j = 0; j < sequenceList.Count; j++)
+ {
+ uint num5 = sequenceList[j, 0];
+ double num6 = sequenceList[j, 1] / 100.0;
+ bool flag10 = this.m_ChangeSkillDamage.ContainsKey(num5);
+ if (flag10)
+ {
+ Dictionary<uint, double> changeSkillDamage = this.m_ChangeSkillDamage;
+ uint key = num5;
+ changeSkillDamage[key] += num6;
+ }
+ else
+ {
+ this.m_ChangeSkillDamage[num5] = num6;
+ }
+ }
+ CommonObjectPool<SequenceList<uint>>.Release(sequenceList);
+ }
+ return true;
+ }
+
+ public void Destroy()
+ {
+ bool flag = this.m_ChangeSkillDamage != null;
+ if (flag)
+ {
+ DictionaryPool<uint, double>.Release(this.m_ChangeSkillDamage);
+ this.m_ChangeSkillDamage = null;
+ }
+ }
+
+ public double ModifySkillDamage()
+ {
+ return this.m_CastDamageModify;
+ }
+
+ public double IncReceivedDamage()
+ {
+ return this.m_IncReceivedDamageModify;
+ }
+
+ public double DecReceivedDamage()
+ {
+ return this.m_DecReceivedDamageModify;
+ }
+
+ public double ModifySkillCost()
+ {
+ return this.m_CostModify;
+ }
+
+ public double ChangeSkillDamage(uint skillID)
+ {
+ double num = 0;
+ bool flag = this.m_ChangeSkillDamage != null && this.m_ChangeSkillDamage.TryGetValue(skillID, out num);
+ double result;
+ if (flag)
+ {
+ result = num;
+ }
+ else
+ {
+ result = 0.0;
+ }
+ return result;
+ }
+
+ private void _RefreshSecuriy(XBuff buff)
+ {
+ bool flag = buff.BuffComponent == null;
+ if (!flag)
+ {
+ bool flag2 = this.m_DecReceivedDamageModify == 0.0;
+ if (!flag2)
+ {
+ XSecurityBuffInfo xsecurityBuffInfo = XSecurityBuffInfo.TryGetStatistics(buff.BuffComponent.Entity);
+ bool flag3 = xsecurityBuffInfo != null;
+ if (flag3)
+ {
+ xsecurityBuffInfo.OnReduceDamage(buff, -this.m_DecReceivedDamageModify);
+ }
+ }
+ }
+ }
+
+ public void OnRemove(XBuff buff)
+ {
+ this._RefreshSecuriy(buff);
+ }
+
+ public void OnBattleEnd(XBuff buff)
+ {
+ this._RefreshSecuriy(buff);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs.meta new file mode 100644 index 00000000..f1bf2215 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffModifyEffect.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e111b53f9580491488fef229d8d645eb +timeCreated: 1611404700 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs new file mode 100644 index 00000000..e58fb48d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs @@ -0,0 +1,79 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffReduceDamage : BuffEffect
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ return XBuffEffectPrioriy.BEP_ReduceDamage;
+ }
+ }
+
+ private int _buffID;
+
+ private XPieceWiseDataMgr m_Data = new XPieceWiseDataMgr();
+
+ private XEntity _entity;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.DamageReduce.Count == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffReduceDamage(ref rowData.DamageReduce, rowData.BuffID));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffReduceDamage(ref SeqListRef<float> reducePecents, int buffID)
+ {
+ this._buffID = buffID;
+ this.m_Data.SetRange(0.0, 1.0, 1.0, 0.0);
+ this.m_Data.Init(ref reducePecents);
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ }
+
+ public override void OnAttributeChanged(XAttrChangeEventArgs e)
+ {
+ bool flag = e.AttrKey == XAttributeDefine.XAttr_CurrentHP_Basic;
+ if (flag)
+ {
+ bool flag2 = this.m_Data.GetData(this._entity.Attributes.HPPercent) < 1E-06;
+ if (flag2)
+ {
+ XBuffRemoveEventArgs @event = XEventPool<XBuffRemoveEventArgs>.GetEvent();
+ @event.xBuffID = this._buffID;
+ @event.Firer = this._entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ XSingleton<XDebug>.singleton.AddGreenLog("delete reduce damage buff", null, null, null, null, null);
+ }
+ }
+ }
+
+ public override void OnBuffEffect(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ int num = (int)result.Value;
+ double hppercent = rawInput.Target.Attributes.HPPercent;
+ result.Value *= 1.0 - this.m_Data.GetData(hppercent);
+ int num2 = (int)result.Value;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs.meta new file mode 100644 index 00000000..a5eae8fd --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceDamage.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 49f15558983530d4a92dfd70a1c7ac36 +timeCreated: 1611403663 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs new file mode 100644 index 00000000..194f058f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs @@ -0,0 +1,183 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffReduceSkillCD : BuffEffect
+ {
+ private XBuff _buff = null;
+
+ private SequenceList<uint> _AllList = null;
+
+ public static bool TryCreate(CombatEffectHelper pEffectHelper, XBuff buff)
+ {
+ bool flag = pEffectHelper.BuffInfo.ReduceSkillCD.Count == 0 && !pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_ReduceCD);
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffReduceSkillCD(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffReduceSkillCD(XBuff buff)
+ {
+ this._buff = buff;
+ }
+
+ private static void _SetSequenceList(SequenceList<uint> _AllList, CombatEffectHelper pEffectHelper)
+ {
+ _AllList.Reset(3);
+ bool flag = pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_ReduceCD);
+ if (flag)
+ {
+ pEffectHelper.GetBuffReduceSkillCD(_AllList);
+ }
+ SeqListRef<string> reduceSkillCD = pEffectHelper.BuffInfo.ReduceSkillCD;
+ for (int i = 0; i < reduceSkillCD.Count; i++)
+ {
+ _AllList.Append(new uint[]
+ {
+ XSingleton<XCommon>.singleton.XHash(reduceSkillCD[i, 0]),
+ uint.Parse(reduceSkillCD[i, 1]),
+ string.IsNullOrEmpty(reduceSkillCD[i, 2]) ? 0u : uint.Parse(reduceSkillCD[i, 2])
+ });
+ }
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ this._AllList = CommonObjectPool<SequenceList<uint>>.Get();
+ XBuffReduceSkillCD._SetSequenceList(this._AllList, pEffectHelper);
+ XBuffReduceSkillCD.DoReduce(this._AllList, entity);
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ XBuffReduceSkillCD.UnDo(this._AllList, entity);
+ CommonObjectPool<SequenceList<uint>>.Release(this._AllList);
+ }
+ }
+
+ public static void DoReduce(SequenceList<uint> datas, XEntity entity)
+ {
+ bool flag = entity == null;
+ if (!flag)
+ {
+ XSkillMgr skillMgr = entity.SkillMgr;
+ bool flag2 = skillMgr == null;
+ if (!flag2)
+ {
+ for (int i = 0; i < datas.Count; i++)
+ {
+ uint id = datas[i, 0];
+ switch (datas[i, 2])
+ {
+ case 0u:
+ {
+ float delta = datas[i, 1] * 0.001f;
+ skillMgr.Accelerate(id, delta, false);
+ break;
+ }
+ case 1u:
+ {
+ float delta2 = datas[i, 1] * 0.01f;
+ skillMgr.Accelerate(id, delta2, true);
+ break;
+ }
+ case 2u:
+ {
+ float delta3 = datas[i, 1] * 0.01f;
+ skillMgr.AccelerateStaticCD(id, delta3);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static void UnDo(SequenceList<uint> datas, XEntity entity)
+ {
+ bool flag = entity == null;
+ if (!flag)
+ {
+ XSkillMgr skillMgr = entity.SkillMgr;
+ bool flag2 = skillMgr == null;
+ if (!flag2)
+ {
+ for (int i = 0; i < datas.Count; i++)
+ {
+ uint id = datas[i, 0];
+ uint num = datas[i, 2];
+ uint num2 = num;
+ if (num2 == 2u)
+ {
+ skillMgr.ResetStaticCD(id);
+ }
+ }
+ }
+ }
+ }
+
+ public static void DoReduce(int buffID, int buffLevel, XEntity entity)
+ {
+ bool flag = entity == null;
+ if (!flag)
+ {
+ BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(buffID, buffLevel);
+ bool flag2 = buffData == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("DoReduce Buff data not found: [{0} {1}]", buffID, buffLevel), null, null, null, null, null);
+ }
+ else
+ {
+ CombatEffectHelper data = XDataPool<CombatEffectHelper>.GetData();
+ data.Set(buffData, entity);
+ SequenceList<uint> sequenceList = CommonObjectPool<SequenceList<uint>>.Get();
+ XBuffReduceSkillCD._SetSequenceList(sequenceList, data);
+ XBuffReduceSkillCD.DoReduce(sequenceList, entity);
+ CommonObjectPool<SequenceList<uint>>.Release(sequenceList);
+ data.Recycle();
+ }
+ }
+ }
+
+ public static void UnDo(int buffID, int buffLevel, XEntity entity)
+ {
+ bool flag = entity == null;
+ if (!flag)
+ {
+ BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(buffID, buffLevel);
+ bool flag2 = buffData == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("UnDoReduce Buff data not found: [{0} {1}]", buffID, buffLevel), null, null, null, null, null);
+ }
+ else
+ {
+ CombatEffectHelper data = XDataPool<CombatEffectHelper>.GetData();
+ data.Set(buffData, entity);
+ SequenceList<uint> sequenceList = CommonObjectPool<SequenceList<uint>>.Get();
+ XBuffReduceSkillCD._SetSequenceList(sequenceList, data);
+ XBuffReduceSkillCD.UnDo(sequenceList, entity);
+ CommonObjectPool<SequenceList<uint>>.Release(sequenceList);
+ data.Recycle();
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs.meta new file mode 100644 index 00000000..6fe0f39e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffReduceSkillCD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a1070ba1c975c14479a038c72edfaf4f +timeCreated: 1611404252 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs new file mode 100644 index 00000000..50816624 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs @@ -0,0 +1,258 @@ +using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffRegenerate : BuffEffect
+ {
+ private XBuff _buff = null;
+
+ private XBuffComponent _component = null;
+
+ private uint _TimeToken = 0u;
+
+ private List<DotTimeInfo> _Dots = null;
+
+ private float _StartTime;
+
+ private float _NextTime;
+
+ private XTimerMgr.AccurateElapsedEventHandler _onTimeCb = null;
+
+ public static bool TryCreate(CombatEffectHelper pEffectHelper, XBuff buff)
+ {
+ bool flag = pEffectHelper.BuffInfo.BuffDOT.Count == 0 && !pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_DOTorHOT);
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffRegenerate(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffRegenerate(XBuff buff)
+ {
+ this._buff = buff;
+ this._onTimeCb = new XTimerMgr.AccurateElapsedEventHandler(this.OnTimer);
+ }
+
+ private void ConvertSpecialBuff(DotTimeInfo info)
+ {
+ bool flag = info.attrID == XAttributeDefine.XAttr_MaxHP_Percent;
+ if (flag)
+ {
+ info.attrID = XAttributeDefine.XAttr_CurrentHP_Basic;
+ info.attrValue *= this._component.Entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total) / 100.0;
+ }
+ }
+
+ private double _GetCasterAttr(XEntity caster, int attrID, int attrValue)
+ {
+ bool flag = caster != null && !caster.Deprecated;
+ double result;
+ if (flag)
+ {
+ result = caster.Attributes.GetAttr((XAttributeDefine)attrID) * (double)attrValue / 100.0;
+ }
+ else
+ {
+ result = 0.0;
+ }
+ return result;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ this._NextTime = float.MaxValue;
+ this._StartTime = Time.time;
+ this._component = entity.Buffs;
+ XEntity xentity = null;
+ SequenceList<float> sequenceList = null;
+ SequenceList<int> sequenceList2 = null;
+ bool flag = pEffectHelper.bHasEffect(CombatEffectType.CET_Buff_DOTorHOT);
+ ISeqListRef<float> seqListRef;
+ ISeqListRef<int> seqListRef2;
+ if (flag)
+ {
+ sequenceList = CommonObjectPool<SequenceList<float>>.Get();
+ sequenceList2 = CommonObjectPool<SequenceList<int>>.Get();
+ sequenceList.Reset(3);
+ sequenceList2.Reset(2);
+ sequenceList.Append(this._buff.BuffInfo.BuffDOT, 3);
+ sequenceList2.Append(this._buff.BuffInfo.BuffDOTValueFromCaster, 2);
+ bool buffRegenerate = pEffectHelper.GetBuffRegenerate(sequenceList, sequenceList2);
+ if (buffRegenerate)
+ {
+ seqListRef = sequenceList;
+ seqListRef2 = sequenceList2;
+ }
+ else
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("Data error when get dothot for buff ", this._buff.BuffInfo.BuffID.ToString(), null, null, null, null);
+ seqListRef = this._buff.BuffInfo.BuffDOT;
+ seqListRef2 = this._buff.BuffInfo.BuffDOTValueFromCaster;
+ CommonObjectPool<SequenceList<int>>.Release(sequenceList2);
+ CommonObjectPool<SequenceList<float>>.Release(sequenceList);
+ sequenceList2 = null;
+ sequenceList = null;
+ }
+ }
+ else
+ {
+ seqListRef = this._buff.BuffInfo.BuffDOT;
+ seqListRef2 = this._buff.BuffInfo.BuffDOTValueFromCaster;
+ }
+ int count = seqListRef.Count;
+ bool flag2 = seqListRef2.Count == count;
+ if (flag2)
+ {
+ xentity = XSingleton<XEntityMgr>.singleton.GetEntity(this._buff.CasterID);
+ bool flag3 = sequenceList != null;
+ if (flag3)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ bool flag4 = sequenceList2[i, 0] != 0;
+ if (flag4)
+ {
+ sequenceList[i, 1] = (float)this._GetCasterAttr(xentity, sequenceList2[i, 0], sequenceList2[i, 1]);
+ }
+ }
+ }
+ }
+ bool flag5 = sequenceList != null;
+ if (flag5)
+ {
+ pEffectHelper.Merge(sequenceList, 1);
+ count = seqListRef.Count;
+ }
+ this._Dots = new List<DotTimeInfo>();
+ for (int j = 0; j < count; j++)
+ {
+ DotTimeInfo dotTimeInfo = new DotTimeInfo();
+ dotTimeInfo.attrID = (XAttributeDefine)seqListRef[j, 0];
+ dotTimeInfo.attrValue = (double)seqListRef[j, 1];
+ dotTimeInfo.interval = Math.Max(XSingleton<XGlobalConfig>.singleton.BuffMinRegenerateInterval * 1000f, seqListRef[j, 2]);
+ dotTimeInfo.tickCount = 0;
+ dotTimeInfo.totalCount = (int)(this._buff.BuffInfo.BuffDuration * 1000f / seqListRef[j, 2]);
+ dotTimeInfo.timeleft = dotTimeInfo.interval;
+ bool flag6 = xentity != null && sequenceList == null;
+ if (flag6)
+ {
+ bool flag7 = seqListRef2[j, 0] != 0;
+ if (flag7)
+ {
+ dotTimeInfo.attrValue = this._GetCasterAttr(xentity, seqListRef2[j, 0], seqListRef2[j, 1]);
+ }
+ }
+ this.ConvertSpecialBuff(dotTimeInfo);
+ this._Dots.Add(dotTimeInfo);
+ this._NextTime = Math.Min(dotTimeInfo.timeleft, this._NextTime);
+ }
+ bool flag8 = sequenceList2 != null;
+ if (flag8)
+ {
+ CommonObjectPool<SequenceList<int>>.Release(sequenceList2);
+ }
+ bool flag9 = sequenceList != null;
+ if (flag9)
+ {
+ CommonObjectPool<SequenceList<float>>.Release(sequenceList);
+ }
+ this._TimeToken = XSingleton<XTimerMgr>.singleton.SetTimerAccurate(this._NextTime * 0.001f, this._onTimeCb, null);
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimeToken);
+ bool flag = entity.IsDead || entity.Deprecated;
+ if (!flag)
+ {
+ bool flag2 = !IsReplaced;
+ if (flag2)
+ {
+ float time = Time.time;
+ for (int i = 0; i < this._Dots.Count; i++)
+ {
+ DotTimeInfo dotTimeInfo = this._Dots[i];
+ int num = Mathf.Min((int)((time - this._StartTime) * 1000f / dotTimeInfo.interval), dotTimeInfo.totalCount);
+ for (int j = dotTimeInfo.tickCount; j < num; j++)
+ {
+ bool flag3 = dotTimeInfo.attrID == XAttributeDefine.XAttr_CurrentHP_Basic && dotTimeInfo.attrValue < 0.0;
+ if (flag3)
+ {
+ XCombat.ProjectExternalDamage(-dotTimeInfo.attrValue, this._buff.CasterID, this._component.Entity, !this._buff.BuffInfo.DontShowText, 0);
+ }
+ else
+ {
+ XAttrChangeEventArgs @event = XEventPool<XAttrChangeEventArgs>.GetEvent();
+ @event.AttrKey = dotTimeInfo.attrID;
+ @event.DeltaValue = dotTimeInfo.attrValue;
+ @event.CasterID = this._buff.CasterID;
+ @event.bShowHUD = !this._buff.BuffInfo.DontShowText;
+ @event.Firer = this._component.Entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void OnTimer(object o, float delay)
+ {
+ float num = float.MaxValue;
+ for (int i = 0; i < this._Dots.Count; i++)
+ {
+ DotTimeInfo dotTimeInfo = this._Dots[i];
+ dotTimeInfo.timeleft -= this._NextTime + delay * 1000f;
+ while (dotTimeInfo.tickCount <= dotTimeInfo.totalCount && dotTimeInfo.timeleft <= 0f)
+ {
+ dotTimeInfo.tickCount++;
+ dotTimeInfo.timeleft += dotTimeInfo.interval;
+ bool flag = dotTimeInfo.attrID == XAttributeDefine.XAttr_CurrentHP_Basic && dotTimeInfo.attrValue < 0.0;
+ if (flag)
+ {
+ XCombat.ProjectExternalDamage(-dotTimeInfo.attrValue, this._buff.CasterID, this._component.Entity, !this._buff.BuffInfo.DontShowText, 0);
+ }
+ else
+ {
+ XAttrChangeEventArgs @event = XEventPool<XAttrChangeEventArgs>.GetEvent();
+ @event.AttrKey = dotTimeInfo.attrID;
+ @event.DeltaValue = dotTimeInfo.attrValue;
+ @event.CasterID = this._buff.CasterID;
+ @event.bShowHUD = !this._buff.BuffInfo.DontShowText;
+ @event.Firer = this._component.Entity;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ bool flag2 = dotTimeInfo.timeleft > 0f;
+ if (flag2)
+ {
+ num = Math.Min(num, dotTimeInfo.timeleft);
+ }
+ }
+ bool flag3 = base.bValid && num != float.MaxValue && num > 0f;
+ if (flag3)
+ {
+ this._NextTime = num;
+ this._TimeToken = XSingleton<XTimerMgr>.singleton.SetTimerAccurate(this._NextTime * 0.001f, this._onTimeCb, o);
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs.meta new file mode 100644 index 00000000..a4f64b98 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffRegenerate.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 690a6b97277f1b64ca5e532f0c46e825 +timeCreated: 1611403884 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs new file mode 100644 index 00000000..1212e405 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs @@ -0,0 +1,21 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffRemoveEventArgs : XEventArgs
+ {
+ public int xBuffID;
+
+ public XBuffRemoveEventArgs()
+ {
+ this._eDefine = XEventDefine.XEvent_BuffRemove;
+ this.xBuffID = 0;
+ }
+
+ public override void Recycle()
+ {
+ base.Recycle();
+ XEventPool<XBuffRemoveEventArgs>.Recycle(this);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs.meta new file mode 100644 index 00000000..38c3e384 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffRemoveEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8b04fb6c1739d354888c7c41ec24cf3c +timeCreated: 1611404094 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs new file mode 100644 index 00000000..19f7caf9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs @@ -0,0 +1,84 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffSkillsReplace : BuffEffect
+ {
+ private XBuff m_Buff;
+
+ private XEntity m_Entity;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.SkillsReplace.Count == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffSkillsReplace(buff));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffSkillsReplace(XBuff _Buff)
+ {
+ this.m_Buff = _Buff;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this.m_Entity = entity;
+ XBuffSkillsReplace.DoAdd(entity, ref this.m_Buff.BuffInfo.SkillsReplace);
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ XBuffSkillsReplace.DoRemove(entity, ref this.m_Buff.BuffInfo.SkillsReplace);
+ }
+
+ public static void TrySkillsReplace(XEntity entity, UIBuffInfo uibuffInfo, bool bOpen)
+ {
+ bool flag = uibuffInfo == null || uibuffInfo.buffInfo == null || uibuffInfo.buffInfo.SkillsReplace.Count == 0;
+ if (!flag)
+ {
+ if (bOpen)
+ {
+ XBuffSkillsReplace.DoAdd(entity, ref uibuffInfo.buffInfo.SkillsReplace);
+ }
+ else
+ {
+ XBuffSkillsReplace.DoRemove(entity, ref uibuffInfo.buffInfo.SkillsReplace);
+ }
+ }
+ }
+
+ public static void DoAdd(XEntity entity, ref SeqListRef<string> list)
+ {
+ bool flag = entity == null || entity.Skill == null;
+ if (!flag)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ entity.Skill.SetSkillReplace(XSingleton<XCommon>.singleton.XHash(list[i, 0]), XSingleton<XCommon>.singleton.XHash(list[i, 1]));
+ }
+ }
+ }
+
+ public static void DoRemove(XEntity entity, ref SeqListRef<string> list)
+ {
+ bool flag = entity == null || entity.Skill == null;
+ if (!flag)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ entity.Skill.SetSkillReplace(XSingleton<XCommon>.singleton.XHash(list[i, 0]), 0u);
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs.meta new file mode 100644 index 00000000..76a97cfb --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 68fe043121576fe45aeb65eebfa13d6c +timeCreated: 1611403884 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs new file mode 100644 index 00000000..67342c26 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs @@ -0,0 +1,516 @@ +using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffSpecialState : BuffEffect
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ switch (this._buffType)
+ {
+ case XBuffType.XBuffType_Immortal:
+ return XBuffEffectPrioriy.BEP_SpecialState_Immortal;
+ case XBuffType.XBuffType_CantDie:
+ return XBuffEffectPrioriy.BEP_SpecialState_CantDie;
+ case XBuffType.XBuffType_Shield:
+ return XBuffEffectPrioriy.BEP_SpecialState_Shield;
+ case XBuffType.XBuffType_Trapped:
+ return XBuffEffectPrioriy.BEP_SpecialState_Trapped;
+ }
+ return XBuffEffectPrioriy.BEP_START;
+ }
+ }
+
+ private XBuffType _buffType = XBuffType.XBuffType_Max;
+
+ private XBuff _buff = null;
+
+ private long _token;
+
+ private static Dictionary<XBuffType, XBuffSpecialState.SpecialBuffHandler> _buffHandler = new Dictionary<XBuffType, XBuffSpecialState.SpecialBuffHandler>(default(XFastEnumIntEqualityComparer<XBuffType>));
+
+ private delegate void SpecialBuffHandler(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result);
+
+ public enum SpecialStateResult
+ {
+ SSR_Success,
+ SSR_Error,
+ SSR_NoEffect
+ }
+
+ static XBuffSpecialState()
+ {
+ XBuffSpecialState._buffHandler[XBuffType.XBuffType_Bati] = new XBuffSpecialState.SpecialBuffHandler(XBuffSpecialState.OnBati);
+ XBuffSpecialState._buffHandler[XBuffType.XBuffType_Immortal] = new XBuffSpecialState.SpecialBuffHandler(XBuffSpecialState.OnImmortal);
+ XBuffSpecialState._buffHandler[XBuffType.XBuffType_CantDie] = new XBuffSpecialState.SpecialBuffHandler(XBuffSpecialState.OnCantDie);
+ XBuffSpecialState._buffHandler[XBuffType.XBuffType_Shield] = new XBuffSpecialState.SpecialBuffHandler(XBuffSpecialState.OnShield);
+ XBuffSpecialState._buffHandler[XBuffType.XBuffType_Trapped] = new XBuffSpecialState.SpecialBuffHandler(XBuffSpecialState.OnTrapped);
+ }
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.BuffState == null || rowData.BuffState.Length == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ for (int i = 0; i < rowData.BuffState.Length; i++)
+ {
+ buff.AddEffect(new XBuffSpecialState(buff, (XBuffType)rowData.BuffState[i]));
+ }
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffSpecialState(XBuff buff, XBuffType state)
+ {
+ this._buffType = state;
+ this._buff = buff;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ XBuffType buffType = this._buffType;
+ if (buffType != XBuffType.XBuffType_Transform && buffType != XBuffType.XBuffType_Scale)
+ {
+ entity.Buffs.IncBuffState(this._buffType, this._buff.BuffInfo.StateParam);
+ }
+ else
+ {
+ entity.Buffs.IncBuffState(this._buffType, this._buff.ID);
+ }
+ XBuffType buffType2 = this._buffType;
+ if (buffType2 != XBuffType.XBuffType_Freeze)
+ {
+ switch (buffType2)
+ {
+ case XBuffType.XBuffType_Trapped:
+ XBuffSpecialState.TryToggleTrapUI(entity, this._buff.UIBuff, true);
+ break;
+ case XBuffType.XBuffType_Silencing:
+ case XBuffType.XBuffType_Puzzled:
+ break;
+ case XBuffType.XBuffType_Transform:
+ {
+ bool flag = XBuffSpecialState.TryTransform(entity, this._buff.ID, this._buff.BuffInfo.StateParam, true) == XBuffSpecialState.SpecialStateResult.SSR_Success;
+ if (flag)
+ {
+ entity.Buffs.MakeSingleEffect(this._buff);
+ }
+ break;
+ }
+ case XBuffType.XBuffType_Stealth:
+ XBuffSpecialState.TryStealth(entity, this._buff.UIBuff, true);
+ break;
+ default:
+ if (buffType2 == XBuffType.XBuffType_Scale)
+ {
+ bool flag2 = XBuffSpecialState.TryScale(entity, this._buff.UIBuff, true) == XBuffSpecialState.SpecialStateResult.SSR_Success;
+ if (flag2)
+ {
+ entity.Buffs.MakeSingleEffect(this._buff);
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ XHitData xhitData = new XHitData();
+ xhitData.State = XBeHitState.Hit_Freezed;
+ xhitData.FreezeDuration = this._buff.Duration;
+ xhitData.FreezePresent = false;
+ XFreezeEventArgs @event = XEventPool<XFreezeEventArgs>.GetEvent();
+ @event.HitData = xhitData;
+ @event.Dir = entity.EngineObject.Forward;
+ @event.Firer = entity;
+ this._token = XSingleton<XCommon>.singleton.UniqueToken;
+ @event.Token = this._token;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ XBuffType buffType = this._buffType;
+ if (buffType <= XBuffType.XBuffType_Freeze)
+ {
+ if (buffType != XBuffType.XBuffType_Immortal)
+ {
+ if (buffType == XBuffType.XBuffType_Freeze)
+ {
+ bool flag = !IsReplaced;
+ if (flag)
+ {
+ XEntity entity2 = XSingleton<XEntityMgr>.singleton.GetEntity(this._buff.CasterID);
+ bool flag2 = entity2 != null && !entity2.Deprecated;
+ if (flag2)
+ {
+ XSecurityBuffInfo xsecurityBuffInfo = XSecurityBuffInfo.TryGetStatistics(entity2);
+ bool flag3 = xsecurityBuffInfo != null;
+ if (flag3)
+ {
+ xsecurityBuffInfo.OnFreeze(this._buff);
+ }
+ }
+ bool flag4 = entity.Machine.ActionToken == this._token;
+ if (flag4)
+ {
+ entity.Machine.ForceToDefaultState(false);
+ }
+ }
+ }
+ }
+ else
+ {
+ bool flag5 = !IsReplaced;
+ if (flag5)
+ {
+ XSecurityBuffInfo xsecurityBuffInfo2 = XSecurityBuffInfo.TryGetStatistics(entity);
+ bool flag6 = xsecurityBuffInfo2 != null;
+ if (flag6)
+ {
+ xsecurityBuffInfo2.OnImmortal(this._buff);
+ }
+ }
+ }
+ }
+ else
+ {
+ switch (buffType)
+ {
+ case XBuffType.XBuffType_Trapped:
+ {
+ bool flag7 = !IsReplaced;
+ if (flag7)
+ {
+ XBuffSpecialState.TryToggleTrapUI(entity, this._buff.UIBuff, false);
+ }
+ break;
+ }
+ case XBuffType.XBuffType_Silencing:
+ case XBuffType.XBuffType_Puzzled:
+ break;
+ case XBuffType.XBuffType_Transform:
+ {
+ bool flag8 = !IsReplaced;
+ if (flag8)
+ {
+ bool flag9 = this._buff.BuffInfo.StateParam > 0 || !entity.IsDead;
+ if (flag9)
+ {
+ XBuffSpecialState.TryTransform(entity, this._buff.ID, this._buff.BuffInfo.StateParam, false);
+ }
+ }
+ break;
+ }
+ case XBuffType.XBuffType_Stealth:
+ XBuffSpecialState.TryStealth(entity, this._buff.UIBuff, false);
+ break;
+ default:
+ if (buffType == XBuffType.XBuffType_Scale)
+ {
+ bool flag10 = !IsReplaced;
+ if (flag10)
+ {
+ XBuffSpecialState.TryScale(entity, this._buff.UIBuff, false);
+ }
+ }
+ break;
+ }
+ }
+ bool flag11 = this._buffType == XBuffType.XBuffType_Transform;
+ if (flag11)
+ {
+ entity.Buffs.DecBuffState(this._buffType, this._buff.ID);
+ }
+ else
+ {
+ entity.Buffs.DecBuffState(this._buffType, this._buff.BuffInfo.StateParam);
+ }
+ }
+ }
+
+ public override void OnBattleEnd(XEntity entity)
+ {
+ base.OnBattleEnd(entity);
+ bool isDummy = entity.IsDummy;
+ if (!isDummy)
+ {
+ XBuffType buffType = this._buffType;
+ if (buffType != XBuffType.XBuffType_Immortal)
+ {
+ if (buffType == XBuffType.XBuffType_Freeze)
+ {
+ XEntity entity2 = XSingleton<XEntityMgr>.singleton.GetEntity(this._buff.CasterID);
+ bool flag = entity2 != null && !entity2.Deprecated;
+ if (flag)
+ {
+ XSecurityBuffInfo xsecurityBuffInfo = XSecurityBuffInfo.TryGetStatistics(entity2);
+ bool flag2 = xsecurityBuffInfo != null;
+ if (flag2)
+ {
+ xsecurityBuffInfo.OnFreeze(this._buff);
+ }
+ }
+ }
+ }
+ else
+ {
+ XSecurityBuffInfo xsecurityBuffInfo2 = XSecurityBuffInfo.TryGetStatistics(entity);
+ bool flag3 = xsecurityBuffInfo2 != null;
+ if (flag3)
+ {
+ xsecurityBuffInfo2.OnImmortal(this._buff);
+ }
+ }
+ }
+ }
+
+ public override void OnBuffEffect(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ bool flag = XBuffSpecialState._buffHandler.ContainsKey(this._buffType);
+ if (flag)
+ {
+ XBuffSpecialState._buffHandler[this._buffType](this, rawInput, result);
+ }
+ }
+
+ private static void OnBati(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ result.SetResult(ProjectResultType.PJRES_BATI);
+ }
+
+ private static void OnImmortal(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ result.SetResult(ProjectResultType.PJRES_IMMORTAL);
+ result.Value = 0.0;
+ }
+
+ private static void OnCantDie(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ result.Value = -XBuffSpecialState.GetCantDieDamage(-result.Value, rawInput.Target.Attributes);
+ }
+
+ private static void OnShield(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ bool flag = result.Value > 0.0;
+ if (flag)
+ {
+ double absorbDamage = -buffEffect._buff.ChangeBuffHP(-result.Value);
+ result.AbsorbDamage = absorbDamage;
+ }
+ }
+
+ private static void OnTrapped(XBuffSpecialState buffEffect, HurtInfo rawInput, ProjectDamageResult result)
+ {
+ bool flag = result.Value > 0.0;
+ if (flag)
+ {
+ bool flag2 = rawInput.Caster != null && rawInput.Caster.Attributes != null;
+ if (flag2)
+ {
+ bool flag3 = !XFightGroupDocument.IsOpponent(rawInput.Target.Attributes.FightGroup, rawInput.Caster.Attributes.FightGroup);
+ if (flag3)
+ {
+ double num = -buffEffect._buff.ChangeBuffHP(-result.Value);
+ result.Value = 0.0;
+ }
+ }
+ }
+ }
+
+ public static double GetCantDieDamage(double originalDeltaValue, XAttributes attributes)
+ {
+ double attr = attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic);
+ bool flag = attr + originalDeltaValue <= 0.0;
+ double result;
+ if (flag)
+ {
+ result = Math.Min(-(attr - 1.0), 0.0);
+ }
+ else
+ {
+ result = originalDeltaValue;
+ }
+ return result;
+ }
+
+ public static double GetActualChangeAttr(XAttributeDefine attr, double deltaValue, XEntity entity, bool bIgnoreImmortal = false, bool bForceCantDie = false)
+ {
+ bool flag = attr == XAttributeDefine.XAttr_CurrentHP_Basic && deltaValue < 0.0;
+ double result;
+ if (flag)
+ {
+ XAttributes attributes = entity.Attributes;
+ bool flag2 = !bIgnoreImmortal && attributes.BuffState.IsBuffStateOn(XBuffType.XBuffType_Immortal);
+ if (flag2)
+ {
+ result = 0.0;
+ }
+ else
+ {
+ bool flag3 = attributes.BuffState.IsBuffStateOn(XBuffType.XBuffType_CantDie) || bForceCantDie;
+ if (flag3)
+ {
+ result = XBuffSpecialState.GetCantDieDamage(deltaValue, attributes);
+ }
+ else
+ {
+ result = deltaValue;
+ }
+ }
+ }
+ else
+ {
+ result = deltaValue;
+ }
+ return result;
+ }
+
+ public static XBuffSpecialState.SpecialStateResult TryTransform(XEntity entity, int buffID, int transformID, bool bTransform)
+ {
+ bool flag = entity == null || transformID == 0 || entity.Attributes == null;
+ XBuffSpecialState.SpecialStateResult result;
+ if (flag)
+ {
+ result = XBuffSpecialState.SpecialStateResult.SSR_Error;
+ }
+ else
+ {
+ bool flag2 = entity.Attributes.BuffState.GetStateParam(XBuffType.XBuffType_Transform) != buffID;
+ if (flag2)
+ {
+ result = XBuffSpecialState.SpecialStateResult.SSR_NoEffect;
+ }
+ else
+ {
+ if (bTransform)
+ {
+ entity.OnTransform((uint)Math.Abs(transformID));
+ }
+ else
+ {
+ entity.OnTransform(0u);
+ }
+ bool flag3 = bTransform && entity.IsPlayer && XBuffComponent.TransformBuffsChangeOutlook.Contains(buffID);
+ if (flag3)
+ {
+ XTransformDocument.TryReqLeftTime();
+ }
+ result = XBuffSpecialState.SpecialStateResult.SSR_Success;
+ }
+ }
+ return result;
+ }
+
+ public static XBuffSpecialState.SpecialStateResult TryScale(XEntity entity, UIBuffInfo buff, bool bScale)
+ {
+ bool flag = entity == null || buff == null || entity.Attributes == null;
+ XBuffSpecialState.SpecialStateResult result;
+ if (flag)
+ {
+ result = XBuffSpecialState.SpecialStateResult.SSR_Error;
+ }
+ else
+ {
+ bool flag2 = (long)entity.Attributes.BuffState.GetStateParam(XBuffType.XBuffType_Scale) != (long)((ulong)buff.buffID);
+ if (flag2)
+ {
+ result = XBuffSpecialState.SpecialStateResult.SSR_NoEffect;
+ }
+ else
+ {
+ if (bScale)
+ {
+ entity.OnScale((uint)buff.buffInfo.StateParam);
+ }
+ else
+ {
+ entity.OnScale(0u);
+ }
+ bool flag3 = bScale && entity.IsPlayer && XBuffComponent.TransformBuffsChangeOutlook.Contains((int)buff.buffID);
+ if (flag3)
+ {
+ XTransformDocument.TryReqLeftTime();
+ }
+ result = XBuffSpecialState.SpecialStateResult.SSR_Success;
+ }
+ }
+ return result;
+ }
+
+ public static void TryToggleTrapUI(XEntity entity, UIBuffInfo buff, bool bOpen)
+ {
+ bool flag = entity == null || entity.Buffs == null || buff == null || buff.buffInfo == null;
+ if (!flag)
+ {
+ bool flag2 = buff.buffInfo.BuffState != null && entity.Buffs.IsBuffStateOn(XBuffType.XBuffType_Trapped);
+ if (flag2)
+ {
+ for (int i = 0; i < buff.buffInfo.BuffState.Length; i++)
+ {
+ bool flag3 = buff.buffInfo.BuffState[i] == 6;
+ if (flag3)
+ {
+ bool flag4 = entity.BillBoard != null;
+ if (flag4)
+ {
+ entity.BillBoard.SetFreezeBuffState(bOpen ? buff : null);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public static void TryStealth(XEntity entity, UIBuffInfo buff, bool bOpen)
+ {
+ bool flag = entity == null || entity.Buffs == null || buff == null || buff.buffInfo == null;
+ if (!flag)
+ {
+ bool flag2 = buff.buffInfo.BuffState != null && entity.Buffs.GetBuffStateCounter(XBuffType.XBuffType_Stealth) == 1;
+ if (flag2)
+ {
+ for (int i = 0; i < buff.buffInfo.BuffState.Length; i++)
+ {
+ bool flag3 = buff.buffInfo.BuffState[i] == 10;
+ if (flag3)
+ {
+ bool flag4 = XSingleton<XEntityMgr>.singleton.IsAlly(entity);
+ if (flag4)
+ {
+ entity.OnFade(!bOpen, 0.5f, true, BillBoardHideType.Stealth);
+ }
+ else
+ {
+ entity.OnFade(!bOpen, 0.5f, false, BillBoardHideType.Stealth);
+ if (bOpen)
+ {
+ entity.Buffs.ClearBuffFx();
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs.meta new file mode 100644 index 00000000..2c7d670d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffSpecialState.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6e7063f8863eb9743853da5dfff34dac +timeCreated: 1611403904 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs new file mode 100644 index 00000000..13e522a5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs @@ -0,0 +1,103 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffStateInfo
+ {
+ protected short[] _BuffState;
+
+ protected int[] _StateParam;
+
+ public XBuffStateInfo()
+ {
+ this._BuffState = new short[XFastEnumIntEqualityComparer<XBuffType>.ToInt(XBuffType.XBuffType_Max)];
+ this._StateParam = new int[XFastEnumIntEqualityComparer<XBuffType>.ToInt(XBuffType.XBuffType_Max)];
+ }
+
+ public void CheckBuffState()
+ {
+ for (int i = 0; i < this._BuffState.Length; i++)
+ {
+ bool flag = this._BuffState[i] != 0;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("Clear buff, state {0} is {1}", i, this._BuffState[i]), null, null, null, null, null);
+ }
+ }
+ }
+
+ public void Reset()
+ {
+ for (int i = 0; i < this._BuffState.Length; i++)
+ {
+ this._BuffState[i] = 0;
+ this._StateParam[i] = 0;
+ }
+ }
+
+ public void SetBuffState(XBuffType state, short count)
+ {
+ this._BuffState[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] = count;
+ }
+
+ public void IncBuffState(XBuffType state, int param = 0)
+ {
+ short[] buffState = this._BuffState;
+ int num = XFastEnumIntEqualityComparer<XBuffType>.ToInt(state);
+ buffState[num] += 1;
+ if (state != XBuffType.XBuffType_Transform && state != XBuffType.XBuffType_Scale)
+ {
+ this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] += param;
+ }
+ else
+ {
+ this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] = param;
+ }
+ }
+
+ public void DecBuffState(XBuffType state, int param = 0)
+ {
+ int num = XFastEnumIntEqualityComparer<XBuffType>.ToInt(state);
+ short[] buffState = this._BuffState;
+ int num2 = num;
+ buffState[num2] -= 1;
+ if (state != XBuffType.XBuffType_Transform && state != XBuffType.XBuffType_Scale)
+ {
+ this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] -= param;
+ }
+ else
+ {
+ bool flag = this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] == param;
+ if (flag)
+ {
+ this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] = 0;
+ }
+ }
+ bool flag2 = this._BuffState[num] < 0;
+ if (flag2)
+ {
+ }
+ }
+
+ public bool IsBuffStateOn(XBuffType state)
+ {
+ return this._BuffState[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] != 0;
+ }
+
+ public short GetBuffStateCounter(XBuffType state)
+ {
+ return this._BuffState[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)];
+ }
+
+ public int GetStateParam(XBuffType state)
+ {
+ return this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)];
+ }
+
+ public void SetStateParam(XBuffType state, int v)
+ {
+ this._StateParam[XFastEnumIntEqualityComparer<XBuffType>.ToInt(state)] = v;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs.meta new file mode 100644 index 00000000..d267606c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffStateInfo.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4b3c67eadc415334fb276339b876dcd2 +timeCreated: 1611403686 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs new file mode 100644 index 00000000..e0b388c7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs @@ -0,0 +1,9 @@ +using System;
+
+namespace XMainClient
+{
+ internal enum XBuffTag
+ {
+ BT_SpriteEffect = 1
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs.meta new file mode 100644 index 00000000..29e38611 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTag.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: df8e9ac860481294ebccce4df67f5bf5 +timeCreated: 1611404693 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs new file mode 100644 index 00000000..28993230 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs @@ -0,0 +1,57 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTargetLifeAddAttack : BuffEffect
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ return XBuffEffectPrioriy.BEP_TargetLifeAddAttack;
+ }
+ }
+
+ private XPieceWiseDataMgr m_Data = new XPieceWiseDataMgr();
+
+ private XEntity _entity;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.TargetLifeAddAttack.Count == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ buff.AddEffect(new XBuffTargetLifeAddAttack(ref rowData.TargetLifeAddAttack));
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffTargetLifeAddAttack(ref SeqListRef<float> reducePecents)
+ {
+ this.m_Data.SetRange(0.0, 0.0, 1.0, 0.0);
+ this.m_Data.Init(ref reducePecents);
+ }
+
+ 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)
+ {
+ double hppercent = rawInput.Target.Attributes.HPPercent;
+ result.Value *= 1.0 + this.m_Data.GetData(hppercent);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs.meta new file mode 100644 index 00000000..fb463191 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTargetLifeAddAttack.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ff3ef94d5a121104a9232e0f41cdb85e +timeCreated: 1611404946 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs new file mode 100644 index 00000000..a7b73b56 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs @@ -0,0 +1,198 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTemplateManager : XSingleton<XBuffTemplateManager>
+ {
+ private XTableAsyncLoader _async_loader = null;
+
+ private BuffTable m_BuffConfig = new BuffTable();
+
+ private BuffTable m_BuffConfigPVP = new BuffTable();
+
+ private Dictionary<int, BuffTable.RowData> m_BuffIndex = new Dictionary<int, BuffTable.RowData>();
+
+ private Dictionary<int, BuffTable.RowData> m_BuffIndexPVP = new Dictionary<int, BuffTable.RowData>();
+
+ private enum BuffTypeEM
+ {
+ BUFFTYPE_CHANGE_ATTRIBUTE = 1,
+ BUFFTYPE_CHANGE_STATUS,
+ BUFFTYPE_STUN
+ }
+
+ public int GetBuffKey(int buffID, int buffLevel)
+ {
+ return buffID << 8 | buffLevel;
+ }
+
+ public void GetBuffIdentity(int buffKey, out int buffID, out int buffLevel)
+ {
+ buffID = buffKey >> 8;
+ buffLevel = (buffKey & 15);
+ }
+
+ public override bool Init()
+ {
+ bool flag = this._async_loader == null;
+ if (flag)
+ {
+ this._async_loader = new XTableAsyncLoader();
+ this._async_loader.AddTask("Table/BuffList", this.m_BuffConfig, false);
+ this._async_loader.AddTask("Table/BuffListPVP", this.m_BuffConfigPVP, false);
+ this._async_loader.Execute(null);
+ }
+ bool flag2 = !this._async_loader.IsDone;
+ bool result;
+ if (flag2)
+ {
+ result = false;
+ }
+ else
+ {
+ for (int i = 0; i < this.m_BuffConfig.Table.Length; i++)
+ {
+ BuffTable.RowData rowData = this.m_BuffConfig.Table[i];
+ int buffKey = this.GetBuffKey(rowData.BuffID, (int)rowData.BuffLevel);
+ this.m_BuffIndex.Add(buffKey, rowData);
+ }
+ this.m_BuffConfig.Clear();
+ for (int j = 0; j < this.m_BuffConfigPVP.Table.Length; j++)
+ {
+ BuffTable.RowData rowData2 = this.m_BuffConfigPVP.Table[j];
+ int buffKey2 = this.GetBuffKey(rowData2.BuffID, (int)rowData2.BuffLevel);
+ this.m_BuffIndexPVP.Add(buffKey2, rowData2);
+ }
+ this.m_BuffConfigPVP.Clear();
+ result = true;
+ }
+ return result;
+ }
+
+ public override void Uninit()
+ {
+ this.m_BuffIndex.Clear();
+ this.m_BuffIndexPVP.Clear();
+ this._async_loader = null;
+ }
+
+ private bool CanUseBuff(int sceneType, BuffTable.RowData row)
+ {
+ bool flag = false;
+ bool flag2 = false;
+ bool flag3 = false;
+ bool flag4 = false;
+ bool flag5 = row.SceneEffect != null && row.SceneEffect.Length != 0;
+ if (flag5)
+ {
+ for (int i = 0; i < row.SceneEffect.Length; i++)
+ {
+ int num = (int)row.SceneEffect[i];
+ bool flag6 = num > 0;
+ if (flag6)
+ {
+ flag4 = true;
+ bool flag7 = num == sceneType;
+ if (flag7)
+ {
+ flag2 = true;
+ }
+ }
+ else
+ {
+ flag3 = true;
+ bool flag8 = -num == sceneType;
+ if (flag8)
+ {
+ flag = true;
+ }
+ }
+ }
+ }
+ bool flag9 = flag4 && flag2;
+ bool result;
+ if (flag9)
+ {
+ result = true;
+ }
+ else
+ {
+ bool flag10 = flag3 && !flag;
+ result = (flag10 || (!flag4 && !flag3));
+ }
+ return result;
+ }
+
+ public XBuff CreateBuff(BuffDesc buffDesc, CombatEffectHelper pEffectHelper)
+ {
+ int sceneType = XFastEnumIntEqualityComparer<SceneType>.ToInt(XSingleton<XScene>.singleton.SceneType);
+ int buffKey = this.GetBuffKey(buffDesc.BuffID, buffDesc.BuffLevel);
+ BuffTable.RowData row = null;
+ bool flag = true;
+ bool flag2 = this.m_BuffIndexPVP.TryGetValue(buffKey, out row);
+ if (flag2)
+ {
+ flag = this.CanUseBuff(sceneType, row);
+ }
+ row = null;
+ bool flag3 = true;
+ bool flag4 = this.m_BuffIndex.TryGetValue(buffKey, out row);
+ if (flag4)
+ {
+ flag3 = this.CanUseBuff(sceneType, row);
+ }
+ bool flag5 = !flag || !flag3;
+ XBuff result;
+ if (flag5)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new XBuff(pEffectHelper, ref buffDesc);
+ }
+ return result;
+ }
+
+ public int GetBuffTargetType(int BuffID)
+ {
+ BuffTable.RowData buffData = this.GetBuffData(BuffID, 1);
+ bool flag = buffData == null;
+ int result;
+ if (flag)
+ {
+ result = -1;
+ }
+ else
+ {
+ result = (int)buffData.TargetType;
+ }
+ return result;
+ }
+
+ public BuffTable.RowData GetBuffData(int BuffID, int BuffLevel)
+ {
+ BuffTable.RowData rowData = null;
+ int buffKey = this.GetBuffKey(BuffID, BuffLevel);
+ bool isPVPScene = XSingleton<XScene>.singleton.IsPVPScene;
+ if (isPVPScene)
+ {
+ this.m_BuffIndexPVP.TryGetValue(buffKey, out rowData);
+ }
+ bool flag = rowData == null && !this.m_BuffIndex.TryGetValue(buffKey, out rowData);
+ BuffTable.RowData result;
+ if (flag)
+ {
+ result = null;
+ }
+ else
+ {
+ result = rowData;
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs.meta new file mode 100644 index 00000000..13f08b57 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTemplateManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8152d5b005115c14dadc77b7911184c8 +timeCreated: 1611404036 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs new file mode 100644 index 00000000..2c107c6e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs @@ -0,0 +1,284 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal abstract class XBuffTrigger : BuffEffect
+ {
+ public XEntity Entity
+ {
+ get
+ {
+ return this._entity;
+ }
+ }
+
+ private float _triggerRate = 0f;
+
+ private bool _bRandomTriggerBuff = false;
+
+ private uint _triggerSkillID = 0u;
+
+ private XTriggerCondition _TriggerCondition = null;
+
+ private XEntity _entity;
+
+ protected XBuff _Buff;
+
+ private XEntity _Target = null;
+
+ private XLocateTargetComponent _locate = null;
+
+ private bool _bSkillTriggered = false;
+
+ protected bool m_bIsTriggerImm = false;
+
+ public static bool TryCreate(BuffTable.RowData rowData, XBuff buff)
+ {
+ bool flag = rowData.BuffTriggerCond == 0;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ switch (rowData.BuffTriggerCond)
+ {
+ case 1:
+ buff.AddEffect(new XBuffTriggerByBeHit(buff));
+ break;
+ case 2:
+ buff.AddEffect(new XBuffTriggerByLife(buff));
+ break;
+ case 3:
+ buff.AddEffect(new XBuffTriggerAlways(buff));
+ break;
+ case 4:
+ buff.AddEffect(new XBuffTriggerByHit(buff));
+ break;
+ case 5:
+ buff.AddEffect(new XBuffTriggerByCombo(buff));
+ break;
+ case 7:
+ buff.AddEffect(new XBuffTriggerByDeath(buff));
+ break;
+ case 8:
+ buff.AddEffect(new XBuffTriggerByQTE(buff));
+ break;
+ case 9:
+ buff.AddEffect(new XBuffTriggerWhenRemove(buff));
+ break;
+ case 10:
+ buff.AddEffect(new XBuffTriggerByCastSkill(buff));
+ break;
+ case 11:
+ buff.AddEffect(new XBuffTriggerByStacking(buff));
+ break;
+ }
+ result = true;
+ }
+ return result;
+ }
+
+ public XBuffTrigger(XBuff buff)
+ {
+ this._Buff = buff;
+ BuffTable.RowData buffInfo = buff.BuffInfo;
+ this._triggerRate = buffInfo.BuffTriggerRate;
+ bool flag = buffInfo.BuffTriggerBuff.Count > 0;
+ if (flag)
+ {
+ bool flag2 = buffInfo.BuffTriggerBuff[0, 0] == 0 && buffInfo.BuffTriggerBuff[0, 1] == 0;
+ if (flag2)
+ {
+ this._bRandomTriggerBuff = true;
+ }
+ }
+ this.m_bIsTriggerImm = buffInfo.IsTriggerImm;
+ this._triggerSkillID = XSingleton<XCommon>.singleton.XHash(buffInfo.BuffTriggerSkill);
+ bool flag3 = this._triggerRate == 0f;
+ if (flag3)
+ {
+ this._triggerRate = 1f;
+ }
+ }
+
+ public virtual bool CheckTriggerCondition()
+ {
+ return true;
+ }
+
+ protected void _SetTarget(XEntity entity)
+ {
+ this._Target = entity;
+ }
+
+ private void AddTriggerBuff()
+ {
+ bool flag = this._Buff.BuffInfo.BuffTriggerBuff.Count == 0;
+ if (!flag)
+ {
+ int num = 0;
+ int num2 = this._Buff.BuffInfo.BuffTriggerBuff.Count;
+ bool bRandomTriggerBuff = this._bRandomTriggerBuff;
+ if (bRandomTriggerBuff)
+ {
+ num = XSingleton<XCommon>.singleton.RandomInt(1, num2);
+ num2 = num + 1;
+ }
+ for (int i = num; i < num2; i++)
+ {
+ XBuffAddEventArgs @event = XEventPool<XBuffAddEventArgs>.GetEvent();
+ @event.xBuffDesc.BuffID = this._Buff.BuffInfo.BuffTriggerBuff[i, 0];
+ @event.xBuffDesc.BuffLevel = this._Buff.BuffInfo.BuffTriggerBuff[i, 1];
+ @event.xBuffDesc.CasterID = this._Buff.CasterID;
+ @event.xBuffDesc.SkillID = this._Buff.SkillID;
+ @event.Firer = this._Target;
+ @event.xEffectImm = this.m_bIsTriggerImm;
+ XSingleton<XEventMgr>.singleton.FireEvent(@event);
+ }
+ }
+ }
+
+ private void CastTriggerSkill()
+ {
+ bool flag = this._triggerSkillID == 0u;
+ if (!flag)
+ {
+ bool flag2 = this.Entity.Net != null;
+ if (flag2)
+ {
+ bool flag3 = this._locate != null;
+ if (flag3)
+ {
+ this.Entity.Net.ReportSkillAction(this._locate.Target, this._triggerSkillID, -1);
+ }
+ else
+ {
+ bool flag4 = this.Entity.AI != null;
+ if (flag4)
+ {
+ this.Entity.Net.ReportSkillAction(this.Entity.AI.Target, this._triggerSkillID, -1);
+ }
+ }
+ }
+ }
+ }
+
+ protected virtual void OnTrigger()
+ {
+ }
+
+ public void Trigger()
+ {
+ bool flag = this._TriggerCondition.CanTrigger();
+ if (flag)
+ {
+ bool flag2 = this.CheckTriggerCondition();
+ if (flag2)
+ {
+ float num = XSingleton<XCommon>.singleton.RandomFloat(0f, 1f);
+ bool flag3 = num <= this._triggerRate;
+ if (flag3)
+ {
+ this._TriggerCondition.OnTrigger();
+ this.OnTrigger();
+ this.AddTriggerBuff();
+ bool bIsTriggerImm = this.m_bIsTriggerImm;
+ if (bIsTriggerImm)
+ {
+ this.CastTriggerSkill();
+ }
+ else
+ {
+ this._bSkillTriggered = true;
+ }
+ }
+ else
+ {
+ this._TriggerCondition.OnRandFail();
+ }
+ }
+ }
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ this._entity = entity;
+ this._Target = entity;
+ this._triggerRate += pEffectHelper.GetBuffTriggerRate();
+ bool isGlobalTrigger = this._Buff.BuffInfo.IsGlobalTrigger;
+ if (isGlobalTrigger)
+ {
+ this._TriggerCondition = entity.Buffs.GetTriggerState(this._Buff.BuffInfo);
+ }
+ else
+ {
+ this._TriggerCondition = new XTriggerCondition(this._Buff.BuffInfo);
+ }
+ this._locate = (this._entity.IsPlayer ? (this._entity.GetXComponent(XLocateTargetComponent.uuID) as XLocateTargetComponent) : null);
+ this._bSkillTriggered = false;
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ }
+
+ public override void OnUpdate()
+ {
+ base.OnUpdate();
+ bool bSkillTriggered = this._bSkillTriggered;
+ if (bSkillTriggered)
+ {
+ this._bSkillTriggered = false;
+ this.CastTriggerSkill();
+ }
+ }
+
+ protected float _GetTriggerParam(BuffTable.RowData buffInfo, int index)
+ {
+ bool flag = buffInfo == null || buffInfo.BuffTriggerParam == null || buffInfo.BuffTriggerParam.Length <= index;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ result = float.Parse(buffInfo.BuffTriggerParam[index]);
+ }
+ return result;
+ }
+
+ protected int _GetTriggerParamInt(BuffTable.RowData buffInfo, int index)
+ {
+ bool flag = buffInfo == null || buffInfo.BuffTriggerParam == null || buffInfo.BuffTriggerParam.Length <= index;
+ int result;
+ if (flag)
+ {
+ result = 0;
+ }
+ else
+ {
+ result = int.Parse(buffInfo.BuffTriggerParam[index]);
+ }
+ return result;
+ }
+
+ protected string _GetTriggerParamStr(BuffTable.RowData buffInfo, int index)
+ {
+ bool flag = buffInfo == null || buffInfo.BuffTriggerParam == null || buffInfo.BuffTriggerParam.Length <= index;
+ string result;
+ if (flag)
+ {
+ result = string.Empty;
+ }
+ else
+ {
+ result = buffInfo.BuffTriggerParam[index];
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs.meta new file mode 100644 index 00000000..621d92b9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a3181af81c7deb2479d5383222c5525e +timeCreated: 1611404259 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs new file mode 100644 index 00000000..8cdb2b6f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs @@ -0,0 +1,35 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerAlways : XBuffTrigger
+ {
+ private uint _TimeToken = 0u;
+
+ private XTimerMgr.ElapsedEventHandler _timeCb = null;
+
+ public XBuffTriggerAlways(XBuff buff) : base(buff)
+ {
+ this._timeCb = new XTimerMgr.ElapsedEventHandler(this.OnTimer);
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ base.OnAdd(entity, pEffectHelper);
+ this.OnTimer(null);
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ base.OnRemove(entity, IsReplaced);
+ XSingleton<XTimerMgr>.singleton.KillTimer(this._TimeToken);
+ }
+
+ public void OnTimer(object o)
+ {
+ base.Trigger();
+ this._TimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(1f, this._timeCb, o);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs.meta new file mode 100644 index 00000000..f6601649 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerAlways.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5c09f99f894872c4882e609360cd7b6b +timeCreated: 1611403801 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs new file mode 100644 index 00000000..6e71f72a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs @@ -0,0 +1,75 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByBeHit : XBuffTrigger
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ return XBuffEffectPrioriy.BEP_TriggerByBeHit;
+ }
+ }
+
+ private int m_Type;
+
+ private int m_Param0;
+
+ private XEntity m_Entity;
+
+ private HurtInfo m_RawInput;
+
+ private ProjectDamageResult m_Result;
+
+ public XBuffTriggerByBeHit(XBuff buff) : base(buff)
+ {
+ this.m_Type = base._GetTriggerParamInt(buff.BuffInfo, 0);
+ this.m_Param0 = base._GetTriggerParamInt(buff.BuffInfo, 1);
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ base.OnAdd(entity, pEffectHelper);
+ this.m_Entity = entity;
+ }
+
+ public override void OnBuffEffect(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ bool flag = rawInput.SkillID == 0u;
+ if (!flag)
+ {
+ this.m_RawInput = rawInput;
+ this.m_Result = result;
+ base.Trigger();
+ }
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ int type = this.m_Type;
+ if (type != 0)
+ {
+ if (type == 1)
+ {
+ bool flag = this.m_Result.Result != ProjectResultType.PJRES_IMMORTAL;
+ if (flag)
+ {
+ return false;
+ }
+ bool flag2 = this.m_Param0 != 0;
+ if (flag2)
+ {
+ XBuff buffByID = this.m_Entity.Buffs.GetBuffByID(this.m_Param0);
+ bool flag3 = buffByID == null;
+ if (flag3)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs.meta new file mode 100644 index 00000000..af9f1309 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByBeHit.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d95321483f49d8a4a945d05c101bf08b +timeCreated: 1611404643 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs new file mode 100644 index 00000000..9478300a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs @@ -0,0 +1,30 @@ +using System;
+using System.Collections.Generic;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByCastSkill : XBuffTrigger
+ {
+ private HurtInfo m_RawInput;
+
+ private HashSet<uint> m_SpecifiedSkillsSet;
+
+ public XBuffTriggerByCastSkill(XBuff buff) : base(buff)
+ {
+ this.m_SpecifiedSkillsSet = buff.RelevantSkills;
+ }
+
+ public override void OnCastSkill(HurtInfo rawInput)
+ {
+ base.OnCastSkill(rawInput);
+ this.m_RawInput = rawInput;
+ base.Trigger();
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ bool flag = this.m_SpecifiedSkillsSet != null && (this.m_RawInput == null || !this.m_SpecifiedSkillsSet.Contains(this.m_RawInput.SkillID));
+ return !flag;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs.meta new file mode 100644 index 00000000..16d35093 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCastSkill.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e5e4771522694c249b707a19293aaded +timeCreated: 1611404744 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs new file mode 100644 index 00000000..46871868 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs @@ -0,0 +1,32 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByCombo : XBuffTrigger
+ {
+ private uint m_Base;
+
+ private uint m_Count;
+
+ public XBuffTriggerByCombo(XBuff buff) : base(buff)
+ {
+ this.m_Base = (uint)base._GetTriggerParamInt(buff.BuffInfo, 0);
+ bool flag = this.m_Base == 0u;
+ if (flag)
+ {
+ this.m_Base = 1u;
+ }
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ return this.m_Count != 0u && this.m_Count % this.m_Base == 0u;
+ }
+
+ public override void OnComboChange(uint comboCount)
+ {
+ this.m_Count = comboCount;
+ base.Trigger();
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs.meta new file mode 100644 index 00000000..ef6c46ce --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByCombo.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: aaa3b859908dfb041906c1c67200df47 +timeCreated: 1611404304 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs new file mode 100644 index 00000000..0d92508a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs @@ -0,0 +1,68 @@ +using System;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByDeath : XBuffTrigger
+ {
+ private int m_Type;
+
+ private int m_Param0;
+
+ private XEntity m_Entity;
+
+ public XBuffTriggerByDeath(XBuff buff) : base(buff)
+ {
+ this.m_Type = base._GetTriggerParamInt(buff.BuffInfo, 0);
+ this.m_Param0 = base._GetTriggerParamInt(buff.BuffInfo, 1);
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ base.OnAdd(entity, pEffectHelper);
+ this.m_Entity = entity;
+ }
+
+ public override void OnRealDead(XRealDeadEventArgs e)
+ {
+ base.Trigger();
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ int type = this.m_Type;
+ if (type == 0)
+ {
+ bool flag = !XSingleton<XScene>.singleton.SceneData.CanRevive;
+ if (!flag)
+ {
+ bool flag2 = this.m_Param0 == 1;
+ if (flag2)
+ {
+ XReviveDocument specificDocument = XDocuments.GetSpecificDocument<XReviveDocument>(XReviveDocument.uuID);
+ bool flag3 = specificDocument.ReviveUsedTime >= specificDocument.ReviveMaxTime;
+ if (flag3)
+ {
+ goto IL_5D;
+ }
+ }
+ return true;
+ }
+ }
+ IL_5D:
+ return false;
+ }
+
+ protected override void OnTrigger()
+ {
+ base.OnTrigger();
+ int type = this.m_Type;
+ if (type == 0)
+ {
+ XSingleton<XDebug>.singleton.AddGreenLog("Trigger by death.", null, null, null, null, null);
+ XReviveDocument specificDocument = XDocuments.GetSpecificDocument<XReviveDocument>(XReviveDocument.uuID);
+ specificDocument.SetAutoReviveData(this.m_Param0 == 1, 2f);
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs.meta new file mode 100644 index 00000000..40224962 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByDeath.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f8fb1f6cdd243354db6e7636158aa817 +timeCreated: 1611404897 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs new file mode 100644 index 00000000..39b63517 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs @@ -0,0 +1,149 @@ +using System;
+using System.Collections.Generic;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByHit : XBuffTrigger
+ {
+ public override XBuffEffectPrioriy Priority
+ {
+ get
+ {
+ bool flag = this.m_Type == 3;
+ XBuffEffectPrioriy result;
+ if (flag)
+ {
+ result = XBuffEffectPrioriy.BEP_TriggerByHit_Death;
+ }
+ else
+ {
+ result = XBuffEffectPrioriy.BEP_TriggerByHit;
+ }
+ return result;
+ }
+ }
+
+ private int m_Type;
+
+ private HurtInfo m_RawInput;
+
+ private ProjectDamageResult m_Result;
+
+ private HashSet<uint> m_SpecifiedSkillsSet;
+
+ private int m_SpecifiedBuffID;
+
+ private double m_CriticalChangeRatio = 0.0;
+
+ public XBuffTriggerByHit(XBuff buff) : base(buff)
+ {
+ this.m_Type = base._GetTriggerParamInt(buff.BuffInfo, 0);
+ this.m_SpecifiedSkillsSet = buff.RelevantSkills;
+ int type = this.m_Type;
+ if (type != 2)
+ {
+ if (type == 5)
+ {
+ this.m_SpecifiedBuffID = base._GetTriggerParamInt(buff.BuffInfo, 1);
+ }
+ }
+ else
+ {
+ this.m_CriticalChangeRatio = Math.Max(0.0, 1.0 + (double)(base._GetTriggerParam(buff.BuffInfo, 1) / 100f));
+ }
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ bool flag = this.m_SpecifiedSkillsSet != null && (this.m_RawInput == null || !this.m_SpecifiedSkillsSet.Contains(this.m_RawInput.SkillID));
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ switch (this.m_Type)
+ {
+ case 0:
+ return true;
+ case 1:
+ {
+ bool flag2 = this.m_RawInput != null && base.Entity.SkillMgr != null && base.Entity.SkillMgr.IsPhysicalAttack(this.m_RawInput.SkillID);
+ if (flag2)
+ {
+ return true;
+ }
+ break;
+ }
+ case 2:
+ {
+ bool flag3 = (this.m_Result.Flag & XFastEnumIntEqualityComparer<DamageFlag>.ToInt(DamageFlag.DMGFLAG_CRITICAL)) != 0;
+ if (flag3)
+ {
+ return true;
+ }
+ break;
+ }
+ case 3:
+ {
+ bool isTargetDead = this.m_Result.IsTargetDead;
+ if (isTargetDead)
+ {
+ return true;
+ }
+ bool flag4 = this.m_RawInput != null && this.m_RawInput.Target != null && !this.m_RawInput.Target.Deprecated && this.m_RawInput.Target.Attributes != null;
+ if (flag4)
+ {
+ return this.m_RawInput.Target.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic) - this.m_Result.Value <= 0.0;
+ }
+ break;
+ }
+ case 5:
+ {
+ bool flag5 = this.m_RawInput != null && this.m_RawInput.Target != null && !this.m_RawInput.Target.Deprecated;
+ if (flag5)
+ {
+ XBuffComponent buffs = this.m_RawInput.Target.Buffs;
+ bool flag6 = buffs != null && buffs.GetBuffByID(this.m_SpecifiedBuffID) != null;
+ if (flag6)
+ {
+ base._SetTarget(this.m_RawInput.Target);
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ result = false;
+ }
+ return result;
+ }
+
+ public override void OnCastDamage(HurtInfo rawInput, ProjectDamageResult result)
+ {
+ bool flag = rawInput.SkillID == 0u;
+ if (!flag)
+ {
+ this.m_RawInput = rawInput;
+ this.m_Result = result;
+ base.Trigger();
+ }
+ }
+
+ protected override void OnTrigger()
+ {
+ base.OnTrigger();
+ int type = this.m_Type;
+ if (type == 2)
+ {
+ bool flag = this.m_CriticalChangeRatio != 1.0;
+ if (flag)
+ {
+ this.m_Result.Value *= this.m_CriticalChangeRatio;
+ }
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs.meta new file mode 100644 index 00000000..36a5f126 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 53483e6bbbdf18e4cbdb9cdd4ddcae08 +timeCreated: 1611403710 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs new file mode 100644 index 00000000..f54a6aa6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs @@ -0,0 +1,35 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByLife : XBuffTrigger
+ {
+ private float _hpTriggerPercent = 0f;
+
+ public XBuffTriggerByLife(XBuff buff) : base(buff)
+ {
+ this._hpTriggerPercent = base._GetTriggerParam(buff.BuffInfo, 0);
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ bool isDummy = base.Entity.IsDummy;
+ return !isDummy && base.Entity.Attributes.HPPercent <= (double)this._hpTriggerPercent;
+ }
+
+ public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper)
+ {
+ base.OnAdd(entity, pEffectHelper);
+ base.Trigger();
+ }
+
+ public override void OnAttributeChanged(XAttrChangeEventArgs e)
+ {
+ bool flag = e.AttrKey == XAttributeDefine.XAttr_CurrentHP_Basic;
+ if (flag)
+ {
+ base.Trigger();
+ }
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs.meta new file mode 100644 index 00000000..95c64894 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByLife.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 188b0e8f4f6cd7f43b7ef241288e327c +timeCreated: 1611403297 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs new file mode 100644 index 00000000..9416d80f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs @@ -0,0 +1,69 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByQTE : XBuffTrigger
+ {
+ private HashSet<int> m_QTEList = new HashSet<int>();
+
+ private long m_PreToken = 0L;
+
+ public XBuffTriggerByQTE(XBuff buff) : base(buff)
+ {
+ int num = 0;
+ for (;;)
+ {
+ int num2 = base._GetTriggerParamInt(buff.BuffInfo, num);
+ bool flag = num2 == 0;
+ if (flag)
+ {
+ break;
+ }
+ this.m_QTEList.Add(num2);
+ num++;
+ }
+ }
+
+ public override void OnUpdate()
+ {
+ base.Trigger();
+ base.OnUpdate();
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ bool flag = base.Entity.Machine == null;
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ bool flag2 = this.m_PreToken == base.Entity.Machine.ActionToken;
+ if (flag2)
+ {
+ result = false;
+ }
+ else
+ {
+ this.m_PreToken = base.Entity.Machine.ActionToken;
+ bool flag3 = base.Entity.Machine.Current != XStateDefine.XState_BeHit && base.Entity.Machine.Current != XStateDefine.XState_Freeze;
+ if (flag3)
+ {
+ result = false;
+ }
+ else
+ {
+ KKSG.XQTEState qtespecificPhase = base.Entity.GetQTESpecificPhase();
+ result = this.m_QTEList.Contains(XFastEnumIntEqualityComparer<KKSG.XQTEState>.ToInt(qtespecificPhase));
+ }
+ }
+ }
+ return result;
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs.meta new file mode 100644 index 00000000..d6fcf639 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByQTE.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3a506533f74d27c46a82762a22e092e5 +timeCreated: 1611403596 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs new file mode 100644 index 00000000..d792adec --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs @@ -0,0 +1,30 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerByStacking : XBuffTrigger
+ {
+ private uint m_Base;
+
+ public XBuffTriggerByStacking(XBuff buff) : base(buff)
+ {
+ this.m_Base = (uint)base._GetTriggerParamInt(buff.BuffInfo, 0);
+ bool flag = this.m_Base == 0u;
+ if (flag)
+ {
+ this.m_Base = 1u;
+ }
+ }
+
+ public override bool CheckTriggerCondition()
+ {
+ return this._Buff.StackCount % this.m_Base == 0u;
+ }
+
+ public override void OnAppend(XEntity entity)
+ {
+ base.OnAppend(entity);
+ base.Trigger();
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs.meta new file mode 100644 index 00000000..1cc03201 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByStacking.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d4828cc6239ec9a48b2e87ad5dd07da0 +timeCreated: 1611404602 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs new file mode 100644 index 00000000..60d994d1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs @@ -0,0 +1,21 @@ +using System;
+
+namespace XMainClient
+{
+ internal class XBuffTriggerWhenRemove : XBuffTrigger
+ {
+ public XBuffTriggerWhenRemove(XBuff buff) : base(buff)
+ {
+ }
+
+ public override void OnRemove(XEntity entity, bool IsReplaced)
+ {
+ bool flag = !IsReplaced;
+ if (flag)
+ {
+ base.Trigger();
+ }
+ base.OnRemove(entity, IsReplaced);
+ }
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs.meta new file mode 100644 index 00000000..ac36ba23 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerWhenRemove.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 74e6ecd57fc99d546a3c20d70cad5f9f +timeCreated: 1611403945 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs new file mode 100644 index 00000000..58d595ac --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs @@ -0,0 +1,23 @@ +using System;
+
+namespace XMainClient
+{
+ internal enum XBuffType
+ {
+ XBuffType_Immortal = 1,
+ XBuffType_Bati,
+ XBuffType_Freeze,
+ XBuffType_CantDie,
+ XBuffType_Shield,
+ XBuffType_Trapped,
+ XBuffType_Silencing,
+ XBuffType_Puzzled,
+ XBuffType_Transform,
+ XBuffType_Stealth,
+ XBuffType_LockFoot,
+ XBuffType_Mark,
+ XBuffType_Scale,
+ XBuffType_Blind,
+ XBuffType_Max
+ }
+}
diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs.meta b/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs.meta new file mode 100644 index 00000000..4cea8f33 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eaf6f946423833b4a812a3d9e80b6c83 +timeCreated: 1611404781 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |