Formula
CommonFun.calcDamage_71502
function CommonFun.calcDamage_71502(srcUser, targetUser, params, damageParam, logger)
local Str = srcUser:GetProperty("Str")
local Dex = srcUser:GetProperty("Dex")
local Agi = srcUser:GetProperty("Agi")
local Luk = srcUser:GetProperty("Luk")
local Atk = srcUser:GetProperty("Atk")
local AtkPer = srcUser:GetProperty("AtkPer")
local DamIncrease = srcUser:GetProperty("DamIncrease")
local IgnoreDef = 0
local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
if targetUser.boss or targetUser.mini then
IgnoreDef = IgnoreDef1
else
IgnoreDef = IgnoreDef1 + IgnoreDef2
end
if 1 <= IgnoreDef then
IgnoreDef = 1
end
local Refine = srcUser:GetProperty("Refine")
local Def2 = targetUser:GetProperty("Def")
local DefPer2 = targetUser:GetProperty("DefPer")
local Vit2 = targetUser:GetProperty("Vit")
local VitPer2 = targetUser:GetProperty("VitPer")
local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
local AttrEffect2 = srcUser:GetProperty("AttrEffect")
local bits2 = CommonFun.getBits(AttrEffect2)
local raceparam = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
local bodyparam = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
local elementparam = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
local bossparam = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
local raceparam2 = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
local bodyparam2 = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
local bossparam2 = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
local BaseAtk = Dex * 2 + math.floor(Dex * Dex / 100) + math.floor(Str / 5) + math.floor(Luk / 5)
local AtkFinal = ((Atk - BaseAtk) * (1 + AtkPer) * CommonFun.ShapeCorrection(srcUser, targetUser) * bodyparam * elementparam * elementparam2 + BaseAtk) * raceparam * bossparam * bossparam2
local DefReduc = CommonFun.CalcDef(srcUser, targetUser)
local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
local damChangePer = damageParam.damChangePer
local damageType = CommonFun.DamageType.Normal
local Cri = srcUser:GetProperty("Cri")
local CriRes2 = targetUser:GetProperty("CriRes")
local CriDamPer = srcUser:GetProperty("CriDamPer")
local CriDefPer2 = targetUser:GetProperty("CriDefPer")
local Rate = (Cri - CriRes2) / 2
local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
if skillID == 2823_SAINT:MOON_WOLF_ASSAULT or skillID == 2814_SAINT:MOON_WOLF_ASSAULT then
local skilllv_yl = srcUser:GetLernedSkillLevel(2814_SAINT:MOON_WOLF_ASSAULT)
local skilllv_bd = srcUser:GetLernedSkillLevel(2821_SAINT:MOON_WOLF_S_RAGE)
local GemValue = srcUser:GetGemValue(211141_MOON_WOLF_ASSAULT_CRIT_DMG_INCREASES_BY_PERCENTAGE)
damChangePer = skilllv_yl * (1 + skilllv_bd * 0.03)
if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
DefReduc = 1
damChangePer = damChangePer * (1.5 + CriDamPer - CriDefPer2) * (1 + GemValue / 100000)
damageType = CommonFun.DamageType.Crit
if srcUser.isServerCall then
srcUser:AddBuff(138560_MOON_WOLF_S_RAGE_:MAX_STACK_0, targetUser:GetGuid())
end
end
end
local skilllv_xy = srcUser:GetLernedSkillLevel(2818_SAINT:BLOODMOON)
local Hp2 = targetUser:GetProperty("Hp")
local MaxHp2 = targetUser:GetProperty("MaxHp")
local HpRatio = 1 + (MaxHp2 - Hp2) / MaxHp2 * skilllv_xy * 0.2
local A = ((AtkFinal * DefReduc * (1 - DamReduc2) + Refine) * damChangePer * (1 - RefineDamReduc) * (1 + DamIncrease - LongRangeDamReduc2) - Vit2 * (1 + VitPer2)) * HpRatio
if A <= 1 then
return 1
end
return A, damageType
end