Formula

CommonFun.calcBuff_2410

formula.lua
1function CommonFun.calcBuff_2410(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(491_RUNEMASTER:STRIP_ACCESSORY)
6  local skilllv_2 = srcUser:GetLernedSkillLevel(492_RUNEMASTER:DOUBLE_ACCESSORY_REMOVAL)
7  local skilllv_3 = srcUser:GetLernedSkillLevel(493_RUNEMASTER:STRIP_WEAPON)
8  local Luk = srcUser:GetProperty("Luk")
9  local Dex = srcUser:GetProperty("Dex")
10  local RefineLv = srcUser:GetEquipedRefineLv(7_WEAPON)
11  local Weapon = srcUser:GetEquipedID(7_WEAPON)
12  local pojia = 0
13  if Weapon == 40746_ICE_PICK_1 or Weapon == 140746_ICE_PICK_2 or Weapon == 40805_PENETRATOR_1 or Weapon == 140805_PENETRATOR_2 then
14    if 5 <= RefineLv and RefineLv < 10 then
15      pojia = 5
16    elseif 10 <= RefineLv and RefineLv < 15 then
17      pojia = 10
18    elseif 15 <= RefineLv then
19      pojia = 20
20    end
21  end
22  if (srcUser:HasBuffID(90001893_ICE_PICK_TIER_4_:MAX_STACK_0) or srcUser:HasBuffID(22930_PENETRATOR_:MAX_STACK_0)) and 5 < RefineLv then
23    pojia = pojia + (RefineLv - 5) * 1
24  end
25  local Weapon_1 = srcUser:GetEquipedID(7_WEAPON)
26  local pojia_1 = 0
27  if Weapon_1 == 40743 or Weapon_1 == 140743 then
28    pojia_1 = 3
29  end
30  local pojia_8 = 0
31  if srcUser:HasBuffID(90001643_IVORY_KNIFE_TIER_4_:MAX_STACK_0) and 8 <= RefineLv then
32    pojia_8 = 3
33  end
34  local Vit2 = targetUser:GetProperty("Vit")
35  local Rate2 = math.floor(Vit2 / 8)
36  local GemValue = srcUser:GetGemValue(91033_THE_MAX_SUCCESS_RATE_OF_REMOVING_SKILLS_THAT_ARE_AFFECTED_BY_DEX_LUK_AND_SKILL_LEVEL_PERCENTAGE)
37  local GemDam = GemValue / 1000
38  local Rate = math.min(skilllv_1 * 3 + skilllv_2 * 3 + skilllv_3 * 3 + pojia + pojia_1 + pojia_8 + (Luk + Dex) / 5, 90 + GemDam) - math.min(Rate2, 50)
39  if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
40    local off5 = targetUser:IsEquipForceOff(5)
41    local off6 = targetUser:IsEquipForceOff(6)
42    local off7 = targetUser:IsEquipForceOff(7)
43    local equiped5 = targetUser:GetEquipedID(5_ACCESSORY) ~= 0
44    local equiped6 = targetUser:GetEquipedID(6_ACCESSORY) ~= 0
45    local equiped7 = targetUser:GetEquipedID(7_WEAPON) ~= 0
46    local skill2 = 0 < skilllv_2
47    local skill3 = 0 < skilllv_3
48    local odd = {
49      1,
50      1,
51      0,
52      0
53    }
54    if skill2 then
55      odd[3] = 2
56    end
57    if skill3 then
58      odd[4] = 2
59    end
60    if off5 or equiped5 == false then
61      odd[1] = 0
62    end
63    if off6 or equiped6 == false then
64      odd[2] = 0
65    end
66    if off7 or equiped7 == false then
67      odd[4] = 0
68    end
69    if odd[1] == 0 or odd[2] == 0 then
70      odd[3] = 0
71    end
72    local r = 100
73    local c1, c2 = 0, 0
74    for i, v in ipairs(odd) do
75      if v == 2 then
76        odd[i] = 30
77        r = r - 30
78        c2 = c2 + 1
79      elseif v == 1 then
80        c1 = c1 + 1
81      end
82    end
83    if 0 < c1 then
84      for i, v in ipairs(odd) do
85        if v == 1 then
86          odd[i] = r / c1
87        end
88      end
89    elseif 0 < c2 then
90      for i, v in ipairs(odd) do
91        if v == 30 then
92          odd[i] = 100 / c2
93        end
94      end
95    end
96    r = 0
97    for i, v in ipairs(odd) do
98      if v ~= 0 then
99        r = r + v
100        odd[i] = r
101      end
102    end
103    local pos = {
104      [1] = {
105        w = odd[1],
106        pos = 5
107      },
108      [2] = {
109        w = odd[2],
110        pos = 6
111      },
112      [3] = {
113        w = odd[3],
114        pos = 506
115      },
116      [4] = {
117        w = odd[4],
118        pos = 7
119      }
120    }
121    local random = srcUser:GetRandom()
122    for k, v in ipairs(pos) do
123      if random <= v.w then
124        return v.pos
125      end
126    end
127    return 0
128  end
129  return 0
130end
Formula Graph

Connected Archive Data

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

Loading graph filters

CommonFun.calcBuff_2410

commonfun-calcbuff_2410

Nodes

0

Edges

0

Related Nodes

Select at least one node type.