Formula

CommonFun.GetDamReduceValue

function CommonFun.GetDamReduceValue(srcUser, targetUser, value)
  local damage = value
  if damage ~= 0 then
  end
  local mapid, maptype = srcUser:GetMapInfo()
  if damage ~= 0 and targetUser.zoneType == 24 then
    damage = damage / 500
  end
  if damage ~= 0 and mapid == WHITESTAR_AIRSHIP then
    damage = damage / (math.random(0, 1) * 4 + 48) / 10
  end
  local shengwang1 = srcUser:GetPrestigeLevel()
  local shengwang2 = targetUser:GetPrestigeLevel()
  if damage ~= 0 and shengwang1 * shengwang2 ~= 0 then
    local xishu = shengwang2 - shengwang1
    local jianshang = 1
    if 1 <= xishu then
      if xishu <= 3 then
        jianshang = 1 - xishu * 0.3
      else
        jianshang = 0.01
      end
    end
    if xishu <= -1 and targetUser:GetNpcID() == 0 then
      jianshang = -xishu * 2
    end
    damage = damage * jianshang
  end
  if damage <= 1 then
    return 1
  end
  if 2147483647 <= damage then
    damage = 2147483647
  end
  return damage
end