Formula

CommonFun.calcBuff_6640

function CommonFun.calcBuff_6640(srcUser, targetUser, a, b, c, d, lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local Refine = srcUser:GetProperty("Refine")
  local DefReduc = CommonFun.CalcDef(srcUser, targetUser)
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local skilllv = srcUser:GetLernedSkillLevel(2040_RANGER:VOID_SLASH)
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits2 = CommonFun.getBits(StateEffect)
  local StateRatio = 1
  if bits2[CommonFun.StateEffect.Blood] == 1 and 10 < skilllv then
    StateRatio = 1 + (skilllv - 10) * 0.2
  end
  local A = -(Atk * (1 + AtkPer) * DefReduc * (1 - DamReduc2) + Refine) * math.min(skilllv, 10) * (1 - RefineDamReduc) * (1 + DamIncrease) * StateRatio
  local AttrFunction = srcUser:GetProperty("AttrFunction")
  local bitfunc = CommonFun.getBits(AttrFunction)
  if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and (targetUser.zoneType == 1 or targetUser.zoneType == 22) and targetUser.noPunishBoss == false and bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 and targetUser.isBossFromBranch == false then
    A = 0
  end
  if CommonFun.checkAttrFunctionMiss(targetUser, srcUser) then
    A = 0
  end
  if targetUser.boss and targetUser.zoneType == 22 and CommonFun.CheckStormBossMiss(targetUser, srcUser) then
    A = 0
  end
  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