Formula
CommonFun.calcBuff_4640
function CommonFun.calcBuff_4640(srcUser, targetUser, a, b, c, d, lv)
local Str = srcUser:GetProperty("Str")
local Dex = srcUser:GetProperty("Dex")
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 Hp2 = targetUser:GetProperty("Hp")
local MaxHp2 = targetUser:GetProperty("MaxHp")
local raceparam = 1
local srcRace = srcUser.race
local targetRace = targetUser.race
if targetUser:HasBuffID(139410_TWO_FACE_DEMON_KING_HUMAN_:MAX_STACK_0) then
targetRace = 3
end
if srcUser:HasBuffID(139411_TWO_FACE_DEMON_KING_DEMON_:MAX_STACK_0) then
srcRace = 3
end
if srcUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) and srcUser:HasBuffID(49325_RACIAL_ANCIENT_RELICS_CD_:MAX_STACK_0) then
elseif srcUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) then
targetRace = 2
end
if targetUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) and targetUser:HasBuffID(49325_RACIAL_ANCIENT_RELICS_CD_:MAX_STACK_0) then
elseif targetUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) then
srcRace = 2
end
if nil == CommonFun.RaceProps[targetRace] then
return 0
end
if nil == CommonFun.RaceProps[srcRace] then
return 0
end
local raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
local raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])
local raceparam = 1 + raceInc - raceRed
if raceparam <= 0.1 then
raceparam = 0.1
end
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 elementThrough = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][4])
local elementResistance = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][5])
if 0 <= elementRed then
elementRed = elementRed * math.max(1 - elementThrough, 0)
end
if 0 <= elementAtk then
elementAtk = elementAtk * math.max(1 - elementResistance, 0)
end
local elementparam = (1 + elementInc) * ElementRate
local elementparam2 = 1 + elementAtk - elementRed
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 AtkFinal = b * CommonFun.ShapeCorrection(srcUser, targetUser) * ele * raceparam
local DefReduc = CommonFun.CalcDef(srcUser, targetUser)
local A = (AtkFinal * DefReduc * (1 - DamReduc2) + Refine) * (1 - RefineDamReduc) * (1 + DamIncrease) - Vit2 * (1 + VitPer2) + a * MaxHp2
return -A
end