CommonFun

CommonFun.GetDamReduceValue

Dataset · 20251127_update

Formula Source

function CommonFun.GetDamReduceValue(srcUser, targetUser, value)
  local damage = value
  if damage ~= 0 then
  end
  local mapid, maptype = srcUser:GetMapInfo()
  if damage ~= 0 and mapid == 7200 then
    damage = damage / 500
  end
  if damage ~= 0 and mapid == 7204 then
    damage = damage / (math.random(0, 1) * 4 + 48) / 10
  end
  if damage ~= 0 and (mapid == 7505 or mapid == 7510 or mapid == 7515 or mapid == 7520) then
    damage = damage / 10
  end
  if damage ~= 0 and targetUser.zoneType == 28 then
    damage = damage / (math.random(0, 6) + 47)
  end
  if damage ~= 0 and mapid == 149 then
    local shengwang1 = srcUser:GetPrestigeLevel()
    local shengwang2 = targetUser:GetPrestigeLevel()
    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 ~= 0 and targetUser:isCostBattleCount() == true then
    local PlayerBaseLv = srcUser.BaseLv
    local monster_cfg = Table_Monster[targetUser:GetNpcID()]
    local Monsterlevel = 0
    if monster_cfg ~= nil then
      Monsterlevel = monster_cfg.Level
    end
    local Pressing = 1
    local deltalv = Monsterlevel - PlayerBaseLv
    if 40 < deltalv then
      Pressing = 1 - math.min((deltalv - 40) * 0.05 + 0.5, 0.95)
    elseif 20 < deltalv then
      Pressing = 1 - math.min((deltalv - 20) * 0.025, 0.95)
    end
    damage = damage * Pressing
  end
  local damReduceType = targetUser:GetDamReduceType()
  if damage ~= 0 and damReduceType ~= 0 then
    local func = CommonFun.CalcDamReduce[damReduceType]
    if nil ~= func then
      damage = func(damage, targetUser)
    end
  end
  if damage <= 1 then
    return 1
  end
  if 2147483647 <= damage then
    damage = 2147483647
  end
  return damage
end
No formula links

Changes: 20251127_update vs 20251120_update

 function CommonFun.GetDamReduceValue(srcUser, targetUser, value)
  local damage = value
  if damage ~= 0 then
  end
  local mapid, maptype = srcUser:GetMapInfo()
  if damage ~= 0 and mapid == 7200 then
    damage = damage / 500
  end
  if damage ~= 0 and mapid == 7204 then
    damage = damage / (math.random(0, 1) * 4 + 48) / 10
  end
  if damage ~= 0 and (mapid == 7505 or mapid == 7510 or mapid == 7515 or mapid == 7520) then
    damage = damage / 10
  end
  if damage ~= 0 and targetUser.zoneType == 28 then
    damage = damage / (math.random(0, 6) + 47)
  end
  if damage ~= 0 and mapid == 149 then
    local shengwang1 = srcUser:GetPrestigeLevel()
    local shengwang2 = targetUser:GetPrestigeLevel()
    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 ~= 0 and targetUser:isCostBattleCount() == true then
    local PlayerBaseLv = srcUser.BaseLv
    local monster_cfg = Table_Monster[targetUser:GetNpcID()]
    local Monsterlevel = 0
    if monster_cfg ~= nil then
      Monsterlevel = monster_cfg.Level
    end
    local Pressing = 1
    local deltalv = Monsterlevel - PlayerBaseLv
    if 40 < deltalv then
      Pressing = 1 - math.min((deltalv - 40) * 0.05 + 0.5, 0.95)
    elseif 20 < deltalv then
      Pressing = 1 - math.min((deltalv - 20) * 0.025, 0.95)
    end
    damage = damage * Pressing
  end
-  if damage <= 1 then
    return 1
  end
  if damage ~= 0 and targetUser.damReduceType ~= 0 then
    local func = CommonFun.CalcDamReduce[targetUser.damReduceType]
+  local damReduceType = targetUser:GetDamReduceType()
  if damage ~= 0 and damReduceType ~= 0 then
    local func = CommonFun.CalcDamReduce[damReduceType]
     if nil ~= func then
      damage = func(damage, targetUser)
    end
  end
+  if damage <= 1 then
    return 1
  end
   if 2147483647 <= damage then
    damage = 2147483647
  end
  return damage
end

Version History

Loading dependencies...
Loading usage...