Formula

CommonFun.calcBuff_2271

function CommonFun.calcBuff_2271(srcUser, targetUser, a, b, c, d, lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Sp = srcUser:GetProperty("Sp")
  local Luk = srcUser:GetProperty("Luk")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local SkillDam = srcUser:GetProperty("SkillDam")
  local SkillRes = targetUser:GetProperty("SkillRes")
  local ResultDamInc = srcUser:GetProperty("ResultDamInc")
  local ResultDamRes = targetUser:GetProperty("ResultDamRes")
  local ActuallySkiRes = SkillRes - SkillDam
  local mapid, maptype = srcUser:GetMapInfo()
  if maptype == PVP_MAPS then
    ActuallySkiRes = ActuallySkiRes < -1 and -1 or 1 < ActuallySkiRes and 1 or ActuallySkiRes
    ActuallySkiRes = math.floor(ActuallySkiRes * 1000) / 1000
    ActuallySkiRes = ActuallySkiRes + 0.4 * (1 - math.sin(ActuallySkiRes * 3.14 / 2))
  end
  local SkillEnd = 1 - ActuallySkiRes
  local Result = 1 + ResultDamInc - ResultDamRes
  local SkillRealDam = math.floor(Sp * (6 + Luk / 50))
  SkillEnd = math.max(SkillEnd, 0.1)
  Result = math.max(Result, 0.1)
  SkillRealDam = math.max(SkillRealDam, 1)
  local A = -SkillRealDam * (1 - RefineDamReduc) * SkillEnd * Result
  if targetUser:GetNpcID() == 30043_YEAR or targetUser:GetNpcID() == 280303_WILDNESS_SPIRIT_BEAST or targetUser:GetNpcID() == 56008_GOMORA or targetUser:GetNpcID() == 56009_BALTAN or targetUser:GetNpcID() == 56010_GOLZA or targetUser:GetNpcID() == 56011_BEMSTAR or targetUser:GetNpcID() == 56012_ELEKING or targetUser:GetNpcID() == 56013_KING_JOE then
    A = -1
  end
  if targetUser:DamageAlways1() then
    A = -1
  end
  return A
end