Formula

CommonFun.calcDamage_75501

function CommonFun.calcDamage_75501(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local NormalAtk = srcUser:GetProperty("NormalAtk")
  NormalAtk = NormalAtk + 3 * Int
  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 skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  local BaseMAtk = Int + math.floor(Int * Int / 100)
  local MAtkFinal = ((MAtk - BaseMAtk) * (1 + MAtkPer) + BaseMAtk) * raceparam * bossparam * bossparam2
  if skillID == 2920_MERCHANT:BASIC_DISH then
    MAtkFinal = ((MAtk - BaseMAtk + NormalAtk) * (1 + MAtkPer) + BaseMAtk) * raceparam * bossparam * bossparam2
  end
  local MDefReduc = CommonFun.CalcMDef(srcUser, targetUser)
  if skillID == 2933_MERCHANT:MAGICAL_PANDA_TOFU_MERCHANT:MAGICAL_PANDA_TOFU then
    local skilllv_mp = srcUser:GetLernedSkillLevel(2922_MERCHANT:MAGICAL_PANDA_TOFU)
    damChangePer = skilllv_mp * 2 + 8
  end
  local RefineLv7 = srcUser:GetEquipedRefineLv(7_WEAPON)
  if skillID == 2922_MERCHANT:MAGICAL_PANDA_TOFU or skillID == 2933_MERCHANT:MAGICAL_PANDA_TOFU_MERCHANT:MAGICAL_PANDA_TOFU then
    local GemValue = srcUser:GetGemValue(215111_DAMAGE_OF_GREAT_MAGIC_PANDA_TOFU_PERCENTAGE)
    damChangePer = damChangePer * (1 + GemValue / 100000)
    local BoyWeapon = 1
    if srcUser:HasBuffID(23170_40518_LITTLE_HOUSEKEEPER_SPECIAL_MARTIAL_1_:MAX_STACK_0) then
      BoyWeapon = BoyWeapon + 0.01 * RefineLv7
    elseif srcUser:HasBuffID(23180_40519_LITTLE_HOUSEKEEPER_INFUSE_AFTER_1_:MAX_STACK_0) then
      BoyWeapon = BoyWeapon + 0.03 * RefineLv7
    end
    damChangePer = damChangePer * BoyWeapon
  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)) * (1 + RangeDam)
  local skilllv_yld = srcUser:GetLernedSkillLevel(2929_MERCHANT:FOREVER_SPIRIT_KNIFE)
  if srcUser:HasBuffID(90006094_231010_:MAX_STACK_0) and 15 <= RefineLv7 then
    skilllv_yld = skilllv_yld * 2
  end
  A = A * (1 + skilllv_yld * 0.03)
  if A <= 1 then
    return 1
  end
  return A
end