Formula

CommonFun.calcBuff_8550

function CommonFun.calcBuff_8550(srcUser, targetUser, a, b, c, d, lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Luk = srcUser:GetProperty("Luk")
  local Str = srcUser:GetProperty("Str")
  local skilllv = srcUser:GetLernedSkillLevel(2800_SAINT:HYPERCHARGE)
  local A = 0
  if a == 1 and b == 0 then
    A = -Luk * skilllv * 5
    local skilllv_bwd = srcUser:GetLernedSkillLevel(2799_SAINT:POWER_FLUCTUATION)
    local random_min = 50 + Luk / 10
    local random_max = skilllv_bwd * 10 + 200 + Str / 10
    local ratio = CommonFun.RandomRange(random_min, math.max(random_min, random_max), srcUser:GetRandom())
    if 0 < skilllv_bwd then
      A = A * ratio / 100
    end
    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
  end
  if a == 0 and b == 1 then
    A = -Luk / 3 * skilllv * 0.1
  end
  return A
end