-- Lua compatibility: some runtimes do not provide math.pow (use ^ operator instead) if math and math.pow == nil then math.pow = function(a, b) return a ^ b end end local function safeGetRoleAttr(mapId, instanceId, roleId, attrId) local value = role.GetRoleAttValue(mapId, instanceId, roleId, attrId) if value == nil then return 0 end return value end function x_RoleHolyCalDmg(MapID, InstanceID, RoleID, TargetID, Target_ESAT_Demage, Target_ESAT_HolyDef, Target_ESAT_Crit, Target_ESAT_CritRate, Target_ESAT_ExDmg, Target_ESAT_AttackTec, Target_ESAT_NeglectToughness, Target_ESAT_LingNeng, Src_ESAT_Demage, Src_ESAT_HolyDef, Src_ESAT_Crit, Src_ESAT_CritRate, Src_ESAT_ExDmg, Src_ESAT_AttackTec, Src_ESAT_NeglectToughness, Src_ESAT_LingNeng, nSkillDmg, fActionTime) if nSkillDmg > 10000 then nSkillDmg = nSkillDmg / 10000 end if fActionTime > 4 then fActionTime = 4 end if fActionTime < 1 then fActionTime = 1 end local dwTmpValue = 0 local BaseDmg = 0 local fDerateCoef = 0 local a = safeGetRoleAttr(MapID, InstanceID, RoleID, 140) local b = safeGetRoleAttr(MapID, InstanceID, TargetID, 137) local c = safeGetRoleAttr(MapID, InstanceID, RoleID, 136) if Target_ESAT_HolyDef > 0 then if (Src_ESAT_ExDmg + a) >= (Target_ESAT_HolyDef + b) then dwTmpValue = (Src_ESAT_ExDmg + a) - (Target_ESAT_HolyDef + b) end BaseDmg = (Src_ESAT_Demage + c + nSkillDmg) * (2 + (dwTmpValue * fActionTime) / 500000) else BaseDmg = (Src_ESAT_Demage + c + nSkillDmg) * (3 + (Src_ESAT_ExDmg * fActionTime) / 500000) end if Target_ESAT_HolyDef > 0 then fDerateCoef = (Target_ESAT_HolyDef + b) / (Target_ESAT_HolyDef + b + 100000) end local fDmg = (BaseDmg - BaseDmg * fDerateCoef) / 2 -- ���������� ����� �� �������� if not unit.IsPlayer(TargetID) then fDmg = fDmg * 1 -- ���������� ����� �� �������� � 5 ��� end if fDmg > 2147483647 then fDmg = 2147483647 end if MapID == 3911351072 then fDmg = 1 end return fDmg end aux.RegisterRoleEvent(96, "x_RoleHolyCalDmg") function x_RoleHolyCanCrit(MapID, InstanceID, RoleID, TargetID, Target_ESAT_Demage, Target_ESAT_HolyDef, Target_ESAT_Crit, Target_ESAT_CritRate, Target_ESAT_ExDmg, Target_ESAT_AttackTec, Target_ESAT_NeglectToughness, Target_ESAT_LingNeng, Src_ESAT_Demage, Src_ESAT_HolyDef, Src_ESAT_Crit, Src_ESAT_CritRate, Src_ESAT_ExDmg, Src_ESAT_AttackTec, Src_ESAT_NeglectToughness, Src_ESAT_LingNeng, nSkillDmg, fActionTime, SkillCrit) local a = safeGetRoleAttr(MapID, InstanceID, RoleID, 138) local b = safeGetRoleAttr(MapID, InstanceID, TargetID, 142) local fBaseCrit = math.pow((Src_ESAT_Crit + a) / ((Src_ESAT_Crit + a) + 15000), 0.75) local fCrit = 0 if Target_ESAT_HolyDef > 0 then fCrit = fBaseCrit * (1 + (Src_ESAT_Crit + a - (Target_ESAT_NeglectToughness + b)) / 20000.0) + SkillCrit * 0.75 else fCrit = fBaseCrit * (1 + (Src_ESAT_Crit + a) / 20000.0) + SkillCrit * 0.75 end if fCrit < 0 then fCrit = 0 end if fCrit > 1 then fCrit = 1 end return fCrit end aux.RegisterRoleEvent(97, "x_RoleHolyCanCrit") function x_RoleHolyCalCrit(MapID, InstanceID, RoleID, TargetID, Target_ESAT_Demage, Target_ESAT_HolyDef, Target_ESAT_Crit, Target_ESAT_CritRate, Target_ESAT_ExDmg, Target_ESAT_AttackTec, Target_ESAT_NeglectToughness, Target_ESAT_LingNeng, Src_ESAT_Demage, Src_ESAT_HolyDef, Src_ESAT_Crit, Src_ESAT_CritRate, Src_ESAT_ExDmg, Src_ESAT_AttackTec, Src_ESAT_NeglectToughness, Src_ESAT_LingNeng, nSkillDmg, fActionTime) local a = safeGetRoleAttr(MapID, InstanceID, RoleID, 139) local fCritAmount = math.floor((Src_ESAT_CritRate + a) / 100000) if fCritAmount < 0 then fCritAmount = 0 end return fCritAmount end aux.RegisterRoleEvent(98, "x_RoleHolyCalCrit") function x_RoleHolyCanHit(MapID, InstanceID, RoleID, TargetID, Target_ESAT_Demage, Target_ESAT_HolyDef, Target_ESAT_Crit, Target_ESAT_CritRate, Target_ESAT_ExDmg, Target_ESAT_AttackTec, Target_ESAT_NeglectToughness, Target_ESAT_LingNeng, Src_ESAT_Demage, Src_ESAT_HolyDef, Src_ESAT_Crit, Src_ESAT_CritRate, Src_ESAT_ExDmg, Src_ESAT_AttackTec, Src_ESAT_NeglectToughness, Src_ESAT_LingNeng, nSkillDmg, fActionTime) local fHolyHit = 0 local result = false local a = safeGetRoleAttr(MapID, InstanceID, TargetID, 142) local b = safeGetRoleAttr(MapID, InstanceID, RoleID, 140) if pTargetHoly and (Target_ESAT_NeglectToughness + a) >= (Src_ESAT_AttackTec + b) then fHolyHit = math.floor(0.9 * (1 - ((Target_ESAT_NeglectToughness + b) - (Src_ESAT_AttackTec + b)) / 100000)) else fHolyHit = 90 end if fHolyHit < 30 then fHolyHit = 30 end if fHolyHit > 90 then fHolyHit = 90 end local f = math.random(100) if f < fHolyHit then result = true else result = false end return result end aux.RegisterRoleEvent(99, "x_RoleHolyCanHit") function x_RoleHolyFinalDmg(MapID, InstanceID, nDmg, nCrit) return (nDmg * (1.5 + nCrit * 1.7)) / 1.2 -- ���������� ������������ ����� �� 30% � ���������� ����� �� �������� end aux.RegisterWorldEvent(10, "x_RoleHolyFinalDmg")