Formula

CommonFun.calcBuff_2430

formula.lua
1function CommonFun.calcBuff_2430(srcUser, targetUser, a, b, c, d, lv)
2  if srcUser == nil or targetUser == nil then
3    return 0
4  end
5  local skilllv_1 = srcUser:GetLernedSkillLevel(494_RUNEMASTER:STRIP_SHIELD)
6  local skilllv_2 = srcUser:GetLernedSkillLevel(495_RUNEMASTER:STRIP_BOOTS)
7  local skilllv_3 = srcUser:GetLernedSkillLevel(496_RUNEMASTER:STRIP_HELM)
8  local skilllv_4 = srcUser:GetLernedSkillLevel(497_RUNEMASTER:STRIP_ARMOR)
9  local skilllv_5 = srcUser:GetLernedSkillLevel(498_RUNEMASTER:DOUBLE_ARMOR_REMOVAL)
10  local Luk = srcUser:GetProperty("Luk")
11  local Dex = srcUser:GetProperty("Dex")
12  local RefineLv = srcUser:GetEquipedRefineLv(7_WEAPON)
13  local Weapon = srcUser:GetEquipedID(7_WEAPON)
14  local pojia = 0
15  if Weapon == 40746_ICE_PICK_1 or Weapon == 140746_ICE_PICK_2 or Weapon == 40805_PENETRATOR_1 or Weapon == 140805_PENETRATOR_2 then
16    if 5 <= RefineLv and RefineLv < 10 then
17      pojia = 5
18    elseif 10 <= RefineLv and RefineLv < 15 then
19      pojia = 10
20    elseif 15 <= RefineLv then
21      pojia = 20
22    end
23  end
24  if (srcUser:HasBuffID(90001893_ICE_PICK_TIER_4_:MAX_STACK_0) or srcUser:HasBuffID(22930_PENETRATOR_:MAX_STACK_0)) and 5 < RefineLv then
25    pojia = pojia + (RefineLv - 5) * 1
26  end
27  local Weapon_1 = srcUser:GetEquipedID(7_WEAPON)
28  local pojia_1 = 0
29  if Weapon_1 == 40743 or Weapon_1 == 140743 then
30    pojia_1 = 3
31  end
32  local pojia_8 = 0
33  if srcUser:HasBuffID(90001643_IVORY_KNIFE_TIER_4_:MAX_STACK_0) and 8 <= RefineLv then
34    pojia_8 = 3
35  end
36  local Vit2 = targetUser:GetProperty("Vit")
37  local Rate2 = math.floor(Vit2 / 8)
38  local GemValue = srcUser:GetGemValue(91033_THE_MAX_SUCCESS_RATE_OF_REMOVING_SKILLS_THAT_ARE_AFFECTED_BY_DEX_LUK_AND_SKILL_LEVEL_PERCENTAGE)
39  local GemDam = GemValue / 1000
40  local Rate = math.min(skilllv_1 * 3 + skilllv_2 * 3 + skilllv_3 * 3 + skilllv_4 * 3 + pojia + pojia_1 + pojia_8 + (Luk + Dex) / 5, 90 + GemDam) - math.min(Rate2, 50)
41  if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
42    local skill2 = 0 < skilllv_2
43    local skill3 = 0 < skilllv_3
44    local skill4 = 0 < skilllv_4
45    local skill5 = 0 < skilllv_5
46    local off, equiped = {}, {}
47    off[1], equiped[1] = targetUser:IsEquipForceOff(1), targetUser:GetEquipedID(1) ~= 0
48    off[4], equiped[4] = targetUser:IsEquipForceOff(4), targetUser:GetEquipedID(4) ~= 0
49    off[8], equiped[8] = targetUser:IsEquipForceOff(8), targetUser:GetEquipedID(8) ~= 0
50    off[2], equiped[2] = targetUser:IsEquipForceOff(2), targetUser:GetEquipedID(2) ~= 0
51    local result, rate = 0, 1
52    for i = 1, 2 do
53      local odd = {
54        1,
55        0,
56        0,
57        0
58      }
59      local c1 = 1
60      if off[1] or equiped[1] == false then
61        odd[1] = 0
62        c1 = c1 - 1
63      end
64      if skill2 and off[4] == false and equiped[4] then
65        odd[2] = 1
66        c1 = c1 + 1
67      end
68      if skill3 and off[8] == false and equiped[8] then
69        odd[3] = 1
70        c1 = c1 + 1
71      end
72      if skill4 and off[2] == false and equiped[2] then
73        odd[4] = 1
74        c1 = c1 + 1
75      end
76      local r = 0
77      for k, v in ipairs(odd) do
78        if v == 1 then
79          r = 100 / c1 + r
80          odd[k] = r
81        end
82      end
83      local pos = {
84        [1] = {
85          w = odd[1],
86          pos = 1
87        },
88        [2] = {
89          w = odd[2],
90          pos = 4
91        },
92        [3] = {
93          w = odd[3],
94          pos = 8
95        },
96        [4] = {
97          w = odd[4],
98          pos = 2
99        }
100      }
101      local random = srcUser:GetRandom()
102      for k, v in ipairs(pos) do
103        if random <= v.w then
104          result = result + v.pos * rate
105          rate = rate * 100
106          off[v.pos] = true
107          break
108        end
109      end
110      if srcUser:GetRandom() > skilllv_5 * 7 then
111        break
112      end
113    end
114    return result
115  end
116  return 0
117end
Formula Graph

Connected Archive Data

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

Loading graph filters

CommonFun.calcBuff_2430

commonfun-calcbuff_2430

Nodes

0

Edges

0

Related Nodes

Select at least one node type.