Formula Source
function CommonFun.CalcDef(srcUser, targetUser, params) local Buff = srcUser:HasBuffID(24700) local targetRace = targetUser.race if srcUser:HasBuffID(49320) and srcUser:HasBuffID(49325) then elseif srcUser:HasBuffID(49320) then targetRace = 2 end local Def2 = targetUser:GetProperty("Def") local Vit2 = targetUser:GetProperty("Vit") local VitPer2 = targetUser:GetProperty("VitPer") local DefPer2 = targetUser:GetProperty("DefPer") local RealDef = Def2 - Vit2 if Def2 <= 0 then Def2 = 0 end if Buff == true and targetRace == 1 then RealDef = 0 end if RealDef <= 0 then RealDef = 0 end 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 params ~= nil then local SkillID, SkillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel) local BuffIDs, IgnoreDefAdd = CommonFun.EquipBuffAndIgnoreDef(SkillID) local TempAdd = true for i = 1, #BuffIDs do if BuffIDs[i] ~= 0 and srcUser:HasBuffID(BuffIDs[i]) == false then TempAdd = false break end end if TempAdd then IgnoreDef = IgnoreDef + IgnoreDefAdd end end local Card1 = srcUser:GetEquipCardNum(7, 24667) if (targetUser.boss or targetUser.mini) and 0 < Card1 and srcUser:HasBuffID(81002110) then IgnoreDef = IgnoreDef + Card1 * 0.25 + 0.05 elseif (targetUser.boss or targetUser.mini) and 0 < Card1 then IgnoreDef = IgnoreDef + Card1 * 0.25 end if (targetUser.boss or targetUser.mini) and srcUser:HasBuffID(57710) then local RefineLv2 = srcUser:GetEquipedRefineLv(2) IgnoreDef = IgnoreDef + RefineLv2 * 0.01 end local Card2 = srcUser:GetEquipCardNum(7, 23238) if (targetUser.boss or targetUser.mini or targetUser:GetNpcID() ~= 0) and 0 < Card2 then local RefineLv = srcUser:GetEquipedRefineLv(7) IgnoreDef = IgnoreDef + Card2 * (0.2 + RefineLv * 0.02) end if nil ~= CommonFun.Shape and CommonFun.Shape.L == targetUser.shape and srcUser:HasBuffID(90004494) then IgnoreDef = IgnoreDef + 0.2 end if nil ~= CommonFun.Shape and CommonFun.Shape.L == targetUser.shape and srcUser:HasBuffID(90004384) then IgnoreDef = IgnoreDef + 0.3 end if targetUser:GetBuffActive(137321) then IgnoreDef = 0 end local pvpReduce = 0 local mapid, maptype = srcUser:GetMapInfo() if (maptype == 2 or maptype == 4) and targetUser:GetNpcID() ~= 40022 then DefPer2 = DefPer2 < -1 and -1 or 1 < DefPer2 and 1 or DefPer2 DefPer2 = math.floor(DefPer2 * 1000) / 1000 DefPer2 = DefPer2 + 0.5 * (1 - math.sin(DefPer2 * 3.14 / 2)) local Master = targetUser:GetMasterUser() if targetUser:GetNpcID() == 0 or Master ~= nil then pvpReduce = 0.2 end end local DefFinal = RealDef * (1 + DefPer2 - IgnoreDef + pvpReduce) + Vit2 * (1 + VitPer2 + pvpReduce * 5) if DefFinal < 0 then DefFinal = 0 end local div = 4000 + DefFinal * 10 div = div ~= 0 and div or 1 local DefReduc1 = (4000 + DefFinal) / div local Atk = srcUser:GetProperty("Atk") local AtkPer = srcUser:GetProperty("AtkPer") local AtkFinal = Atk * (1 + AtkPer) local DefReduc2 = 1 / (1 + 6 * DefFinal / AtkFinal) local DefReduc = math.max(DefReduc1, DefReduc2) return DefReduc end
No formula links