Formula
CommonFun.calcBuff_7150
function CommonFun.calcBuff_7150(srcUser, targetUser, a, b, c, d, lv, damage)
local Int = srcUser:GetProperty("Int")
local Vit = srcUser:GetProperty("Vit")
local MAtk = srcUser:GetProperty("MAtk")
local MAtkPer = srcUser:GetProperty("MAtkPer")
local MaxHp = targetUser:GetProperty("MaxHp")
local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
local MRefine = srcUser:GetProperty("MRefine")
local srcAtkElement = c
local targetDefElement = targetUser:GetProperty("DefAttr")
local ElementRate = CommonFun.GetElementRate(srcUser, srcAtkElement, targetUser, targetDefElement)
if nil == CommonFun.NatureProps[srcAtkElement] or nil == CommonFun.NatureProps[targetDefElement] or nil == targetDefElement then
return 0
end
local elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
local elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
local elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])
local elementparam = ElementRate
local elementparam2 = 1 + elementAtk
if elementparam2 <= 0.1 then
elementparam2 = 0.1
end
local ele = elementparam * elementparam2
if targetDefElement == nil or ElementRate == nil or elementInc == nil or elementRed == nil or elementAtk == nil then
ele = 1
end
local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
local MDamSpike = srcUser:GetProperty("MDamSpike_MPEN")
local ResultDamInc = srcUser:GetProperty("ResultDamInc")
local ResultDamRes = targetUser:GetProperty("ResultDamRes")
local Result = 1 + ResultDamInc - ResultDamRes
Result = math.max(Result, 0.1)
local debuffdu = targetUser:GetBuffLayer(156610_POISON_VULNERABILITY_:MAX_STACK_0)
local debuffhuo = targetUser:GetBuffLayer(156620_FIRE_VULNERABILITY_:MAX_STACK_0)
local debuff = 1
if 1 <= debuffdu or 1 <= debuffhuo then
debuff = 1 + (debuffdu + debuffhuo - 1) * 0.5
end
local A = -((1 + MDamSpike) * b * (1 - RefineMDamReduc) * (1 + MDamIncrease) * Result * ele + MaxHp * a) * debuff
if targetUser:GetNpcID() == 30043_YEAR or targetUser:GetNpcID() == 280303_WILDNESS_SPIRIT_BEAST or targetUser:GetNpcID() == 56008_GOMORA or targetUser:GetNpcID() == 56009_BALTAN or targetUser:GetNpcID() == 56010_GOLZA or targetUser:GetNpcID() == 56011_BEMSTAR or targetUser:GetNpcID() == 56012_ELEKING or targetUser:GetNpcID() == 56013_KING_JOE then
A = -1
end
if targetUser:DamageAlways1() then
A = -1
end
return A
end