From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/Buff/XBuffTriggerByHit.cs | 149 +++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffTriggerByHit.cs') 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 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.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; + } + } + } + } +} -- cgit v1.1-26-g67d0