Formula
CommonFun.calcDamage_64501
function CommonFun.calcDamage_64501(srcUser, targetUser, params, damageParam, logger)
local Int = srcUser:GetProperty("Int")
local Dex = srcUser:GetProperty("Dex")
local Vit = srcUser:GetProperty("Vit")
local Luk = srcUser:GetProperty("Luk")
local MAtk = srcUser:GetProperty("MAtk")
local MAtkPer = srcUser:GetProperty("MAtkPer")
local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
if 1 <= IgnoreMDef then
IgnoreMDef = 1
end
local MRefine = srcUser:GetProperty("MRefine")
local RangeDam = srcUser:GetProperty("RangeDam")
local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, targetUser, params, damageParam)
local targetDefElement = targetUser:GetProperty("DefAttr")
local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
local raceparam = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
local raceparam2 = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
local bossparam = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
local bossparam2 = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
local MDef2 = targetUser:GetProperty("MDef")
local MDefPer2 = targetUser:GetProperty("MDefPer")
local Vit2 = targetUser:GetProperty("Vit")
local VitPer2 = targetUser:GetProperty("VitPer")
local Int2 = targetUser:GetProperty("Int")
local IntPer2 = targetUser:GetProperty("IntPer")
local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
local damChangePer = damageParam.damChangePer
local BaseMAtk = Int + math.floor(Int * Int / 100)
local MAtkFinal = ((MAtk - BaseMAtk) * (1 + MAtkPer) + BaseMAtk) * raceparam * bossparam * bossparam2
local MDefReduc = CommonFun.CalcMDef(srcUser, targetUser)
local Str2 = targetUser:GetProperty("Str")
local Agi2 = targetUser:GetProperty("Agi")
local Dex2 = targetUser:GetProperty("Dex")
local Luk2 = targetUser:GetProperty("Luk")
local skilllv_bt = srcUser:GetLernedSkillLevel(2622_ARCHBISHOP:CASTIGATE)
local Luk_Ratio = 1
if math.min(Str2, Agi2, Vit2, Int2, Dex2, Luk2) == 0 and 0 < skilllv_bt then
Luk_Ratio = 1 + Luk / 500 * skilllv_bt * 0.1
end
if 0 < skilllv_bt and targetUser:GetNpcID() ~= 0 then
local Point = math.min(math.floor(Dex / 5), math.floor(Int / 5), math.floor(Luk / 5))
Luk_Ratio = Luk_Ratio + skilllv_bt * 0.002 * Point
end
local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
if skillID == 2615_HIGH_PRIEST:FATAL_DREAM or skillID == 2633_ARCHBISHOP:FATAL_DREAM then
local targetid = targetUser:GetGuid()
local BasicValue = srcUser:GetTarInterferenceValue(targetid)
damChangePer = damChangePer * (1 + BasicValue / 10 * 0.04)
end
if skillID == 2637_ARCHBISHOP:STORM_GUST or skillID == 2639_ARCHBISHOP:HELL_WILD_ROAR then
local skilllv_jem = srcUser:GetLernedSkillLevel(2612_HIGH_PRIEST:GARM)
local skilllv_kq = srcUser:GetLernedSkillLevel(2620_ARCHBISHOP:RABIES_VACCINATION)
damChangePer = (3 + skilllv_jem * 1.3) * (1 + skilllv_kq * 0.03)
end
local A = ((MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (1 - RefineMDamReduc) * damChangePer * (1 + MDamIncrease) * CommonFun.calcMagicElement(srcUser, targetUser, params, damageParam) * elementparam2 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)) * Luk_Ratio
if A <= 1 then
return 1
end
return A
end