Formula

CommonFun.calcDamage_69501

function CommonFun.calcDamage_69501(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local Vit = srcUser:GetProperty("Vit")
  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 damChangePer = damageParam.damChangePer
  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits = CommonFun.getBits(AttrEffect)
  local raceparam = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2 = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2 = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2 = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
  local BaseAtk = Str * 2 + math.floor(Str * Str / 100) + math.floor(Dex / 5) + math.floor(Luk / 5)
  local AtkFinal = ((Atk - BaseAtk) * (1 + AtkPer) * CommonFun.ShapeCorrection(srcUser, targetUser) * bodyparam * elementparam * elementparam2 + BaseAtk) * raceparam * bossparam * bossparam2
  local DefReduc = CommonFun.CalcDef(srcUser, targetUser)
  local ShortRangeDamReduc2 = targetUser:GetProperty("ShortRangeDamReduc")
  local skilllv_jz = srcUser:GetLernedSkillLevel(2777_SAINT:COSMIC_RING)
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  if skillID == 2773_SAINT:SUPER_LONG_STAR_WAVE or skillID == 2782_SAINT:SUPER_LONG_STAR_WAVE then
    damChangePer = damChangePer + Str / 20
    local targetid = targetUser:GetGuid()
    local distance = srcUser:GetDistance(targetid)
    if distance <= 5 then
      damChangePer = damChangePer * 1.5
    end
  end
  local DifferentWorldUncle = 1
  if skillID == 2772_SAINT:SIDE_SPLIT or skillID == 2781_SAINT:SIDE_SPLIT then
    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 = ((AtkFinal * DefReduc * (1 - DamReduc2) + Refine) * damChangePer * (1 - RefineDamReduc) * (1 + DamIncrease - ShortRangeDamReduc2) - Vit2 * (1 + VitPer2)) * DifferentWorldUncle
  if A <= 1 then
    return 1
  end
  return A
end