Formula

CommonFun.calcDamage_69502

function CommonFun.calcDamage_69502(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Str = srcUser:GetProperty("Str")
  local Vit = srcUser:GetProperty("Vit")
  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 skilllv_tx = srcUser:GetLernedSkillLevel(2770_SAINT:ANCIENT_ARTIFACT)
  local skilllv_jz = srcUser:GetLernedSkillLevel(2777_SAINT:COSMIC_RING)
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  if skillID == 2784_SAINT:SUPER_LONG_STAR_WAVE then
    local skilllv_cx = srcUser:GetLernedSkillLevel(2773_SAINT:SUPER_LONG_STAR_WAVE)
    damChangePer = (skilllv_cx * 3 + 15 + Str / 20) * (skilllv_tx * 0.2 + 0.4)
    local targetid = targetUser:GetGuid()
    local distance = srcUser:GetDistance(targetid)
    if distance <= 5 then
      damChangePer = damChangePer * 1.5
    end
  end
  local DifferentWorldUncle = 1
  if skillID == 2783_SAINT:SIDE_SPLIT then
    local skilllv_hp = srcUser:GetLernedSkillLevel(2772_SAINT:SIDE_SPLIT)
    damChangePer = (skilllv_hp * 2.8 + 4) * (skilllv_tx * 0.2 + 0.4)
    local GemValue = srcUser:GetGemValue(209131_WHEN_YOU_USE_SIDE_SPLIT_CONSECUTIVELY_INCREASES_THE_DMG_OF_SIDE_SPLIT_BY_PERCENTAGE)
    local LastSkill = srcUser:GetLastUseSkillBigID()
    if LastSkill == 2772 or LastSkill == 2781 then
      damChangePer = damChangePer * (1 + GemValue / 100000)
    end
    local RefineLv7 = srcUser:GetEquipedRefineLv(7_WEAPON)
    if srcUser:HasBuffID(23050_23_:MAX_STACK_0) then
      DifferentWorldUncle = DifferentWorldUncle + 0.01 * RefineLv7
    end
    if srcUser:HasBuffID(23060_23_:MAX_STACK_0) then
      DifferentWorldUncle = DifferentWorldUncle + 0.02 * RefineLv7
    end
  end
  if targetUser:HasBuffID(138080_COSMIC_RING_:MAX_STACK_0) then
    damChangePer = damChangePer * (1 + skilllv_jz * 0.1)
  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)) * DifferentWorldUncle * (1 + RangeDam)
  if A <= 1 then
    return 1
  end
  return A
end