From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/AttackApplyStun.cs | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AttackApplyStun.cs (limited to 'Client/Assets/Scripts/XMainClient/AttackApplyStun.cs') diff --git a/Client/Assets/Scripts/XMainClient/AttackApplyStun.cs b/Client/Assets/Scripts/XMainClient/AttackApplyStun.cs new file mode 100644 index 00000000..c9c1d808 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AttackApplyStun.cs @@ -0,0 +1,48 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class AttackApplyStun : AttackApplyState + { + public override int GetStateMask() + { + return XFastEnumIntEqualityComparer.ToInt(DamageFlag.DMGFLAG_STUN); + } + + public override bool IsApplyState(XEntity entity) + { + XAttributes attributes = entity.Attributes; + double attr = attributes.GetAttr(XAttributeDefine.XAttr_Stun_Total); + CombatParamTable.RowData combatParam = XSingleton.singleton.GetCombatParam(attributes.Level); + double num = attr / (attr + (double)combatParam.StunBase); + bool flag = num > XSingleton.singleton.StunLimit; + if (flag) + { + num = XSingleton.singleton.StunLimit; + } + float num2 = XSingleton.singleton.RandomFloat(0f, 1f); + return (double)num2 < num; + } + + public override bool IsDefenseState(XEntity entity) + { + XAttributes attributes = entity.Attributes; + double attr = attributes.GetAttr(XAttributeDefine.XAttr_StunResist_Total); + CombatParamTable.RowData combatParam = XSingleton.singleton.GetCombatParam(attributes.Level); + double num = attr / (attr + (double)combatParam.StunResistBase); + bool flag = num > XSingleton.singleton.StunResistLimit; + if (flag) + { + num = XSingleton.singleton.StunResistLimit; + } + float num2 = XSingleton.singleton.RandomFloat(0f, 1f); + return (double)num2 < num; + } + + public override void ApplyState(XEntity caster, ProjectDamageResult result) + { + result.SetResult(ProjectResultType.PJRES_STUN); + } + } +} -- cgit v1.1-26-g67d0