Formula

CommonFun.GetDamReduceValue

formula.lua
1function CommonFun.GetDamReduceValue(srcUser, targetUser, value)
2  local damage = value
3  if damage ~= 0 then
4  end
5  local mapid, maptype = srcUser:GetMapInfo()
6  if damage ~= 0 and targetUser.zoneType == 24 then
7    damage = damage / 500
8  end
9  if damage ~= 0 and mapid == WHITESTAR_AIRSHIP then
10    damage = damage / (math.random(0, 1) * 4 + 48) / 10
11  end
12  if damage ~= 0 and targetUser.zoneType == 25 then
13    damage = damage / (math.random(0, 1) * 60 + 570)
14  end
15  if damage ~= 0 and targetUser.zoneType == 26 then
16    damage = damage / (math.random(0, 70) + 665)
17  end
18  if damage ~= 0 and targetUser.zoneType == 27 then
19    damage = damage / (math.random(0, 70) + 765)
20  end
21  if damage ~= 0 and (mapid == TOWER_OF_EVILNESS_V or mapid == TOWER_OF_HEAT_V or mapid == TOWER_OF_WORLDLINE_V or mapid == TOWER_OF_DOOM_V) then
22    damage = damage / (math.random(0, 1) * 10 + 95)
23  end
24  if damage ~= 0 and (mapid == TOWER_OF_EVILNESS_IV or mapid == TOWER_OF_HEAT_IV or mapid == TOWER_OF_WORLDLINE_IV or mapid == TOWER_OF_DOOM_IV) then
25    damage = damage / 10
26  end
27  if damage ~= 0 and targetUser.zoneType == 28 then
28    damage = damage / (math.random(0, 250) + 4875)
29  end
30  if GameConfig.Prestige.ValidMap[mapid] == 1 then
31    local shengwang1 = srcUser:GetPrestigeLevel()
32    local shengwang2 = targetUser:GetPrestigeLevel()
33    if damage ~= 0 and shengwang1 * shengwang2 ~= 0 then
34      local xishu = shengwang2 - shengwang1
35      local jianshang = 1
36      if 1 <= xishu then
37        if xishu <= 3 then
38          jianshang = 1 - xishu * 0.3
39        else
40          jianshang = 0.01
41        end
42      end
43      if xishu <= -1 and targetUser:GetNpcID() == 0 then
44        jianshang = -xishu * 2
45      end
46      damage = damage * jianshang
47    end
48  end
49  local damReduceType = targetUser:GetDamReduceType()
50  if damage ~= 0 and damReduceType ~= 0 then
51    local func = CommonFun.CalcDamReduce[damReduceType]
52    if nil ~= func then
53      damage = func(damage, targetUser)
54    end
55  end
56  if damage <= 1 then
57    return 1
58  end
59  if 2147483647 <= damage then
60    damage = 2147483647
61  end
62  return damage
63end
Formula Graph

Connected Archive Data

See which cards, equipment, headwears, buffs, and other archived records connect to this formula.

Loading graph filters

CommonFun.GetDamReduceValue

commonfun-getdamreducevalue

Nodes

0

Edges

0

Related Nodes

Select at least one node type.