Formula

CommonFun.calcBuff_3150

function CommonFun.calcBuff_3150(srcUser, targetUser, a, b, c, d, lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local off1 = targetUser:IsEquipForceOff(1)
  local off2 = targetUser:IsEquipForceOff(2)
  local off3 = targetUser:IsEquipForceOff(3)
  local off4 = targetUser:IsEquipForceOff(4)
  local off5 = targetUser:IsEquipForceOff(5)
  local off6 = targetUser:IsEquipForceOff(6)
  local off7 = targetUser:IsEquipForceOff(7)
  local off8 = targetUser:IsEquipForceOff(8)
  local equiped1 = targetUser:GetEquipedID(1) ~= 0
  local equiped2 = targetUser:GetEquipedID(2) ~= 0
  local equiped3 = targetUser:GetEquipedID(3) ~= 0
  local equiped4 = targetUser:GetEquipedID(4) ~= 0
  local equiped5 = targetUser:GetEquipedID(5_ACCESSORY) ~= 0
  local equiped6 = targetUser:GetEquipedID(6_ACCESSORY) ~= 0
  local equiped7 = targetUser:GetEquipedID(7_WEAPON) ~= 0
  local equiped8 = targetUser:GetEquipedID(8) ~= 0
  local list = {}
  if off1 == false and equiped1 == true then
    table.insert(list, 1)
  end
  if off2 == false and equiped2 == true then
    table.insert(list, 2)
  end
  if off3 == false and equiped3 == true then
    table.insert(list, 3)
  end
  if off4 == false and equiped4 == true then
    table.insert(list, 4)
  end
  if off5 == false and equiped5 == true then
    table.insert(list, 5)
  end
  if off6 == false and equiped6 == true then
    table.insert(list, 6)
  end
  if off7 == false and equiped7 == true then
    table.insert(list, 7)
  end
  if off8 == false and equiped8 == true then
    table.insert(list, 8)
  end
  if #list <= 0 then
    return 0
  end
  local random = srcUser:GetRandom()
  return list[random % #list + 1]
end