
Auto Attack (Spell)
Lv 1AttackMagic
Deals (Atk100%) Dmg to the target
Range: 6
Formula
1function CommonFun.calcDamage_36(srcUser, targetUser, params, damageParam, logger)
2 local Luk = srcUser:GetProperty("Luk")
3 local Int = srcUser:GetProperty("Int")
4 local Vit = srcUser:GetProperty("Vit")
5 local MAtk = srcUser:GetProperty("MAtk")
6 local NormalAtk = srcUser:GetProperty("NormalAtk")
7 NormalAtk = NormalAtk + 3 * Int
8 local MAtkPer1 = srcUser:GetProperty("MAtkPer")
9 local Num1 = srcUser:GetRunePoint(22017_AESIR_AUTO_ATTACKS_DEALT_BY_MAGES_ENJOY_M_ATK_BONUS_5)
10 local Num2 = srcUser:GetRunePoint(22022)
11 local Num3 = srcUser:GetRunePoint(22023)
12 local RuneDamage3 = (Num1 + Num2 + Num3) * 0.05
13 local MAtkPer = MAtkPer1 + RuneDamage3
14 local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
15 local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
16 if 1 <= IgnoreMDef then
17 IgnoreMDef = 1
18 end
19 local Num11 = srcUser:GetRunePoint(21005_AESIR_AUTO_ATTACKS_HAVE_A_5_CHANCE_TO_TRIGGER_SPELL_CRIT_DEALING_10_DAMAGE_LUCK_INCREASES_CRIT_RATE)
20 local Num12 = srcUser:GetRunePoint(21008)
21 local Num13 = srcUser:GetRunePoint(21009)
22 local Num14 = srcUser:GetRunePoint(21011)
23 local Num15 = srcUser:GetRunePoint(21017)
24 local Num16 = srcUser:GetRunePoint(22011)
25 local Num17 = srcUser:GetRunePoint(22026)
26 local Num18 = srcUser:GetRunePoint(22029)
27 local Num19 = srcUser:GetBuffLayer(90000952_SILK_ROBE_TIER_3_:MAX_STACK_0)
28 local Num20 = srcUser:GetBuffLayer(90000953_SILK_ROBE_TIER_4_:MAX_STACK_0)
29 local Num21 = srcUser:GetBuffLayer(90000954_SILK_ROBE_TIER_5_:MAX_STACK_0)
30 local Num24 = 0
31 local RefineLv2 = srcUser:GetEquipedRefineLv(2)
32 if srcUser:HasBuffID(90000959_1905_:MAX_STACK_0) then
33 Num24 = Num24 + RefineLv2 * 0.01
34 end
35 local Num26 = 0
36 local equipRing = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_EQUIP, CommonFun.EquipPos.EEQUIPPOS_ARMOUR)
37 if equipRing.id == 42126 or equipRing.id == 142126 then
38 Num26 = Num26 + equipRing.refinelv * 0.01 + 0.1
39 end
40 if (equipRing.id == 42126 or equipRing.id == 142126) and equipRing.refinelv >= 15 then
41 Num26 = Num26 + 0.05
42 end
43 local equipRingSD = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_SHADOWEQUIP, CommonFun.EquipPos.EEQUIPPOS_ARMOUR)
44 if equipRingSD.id == 42126 or equipRingSD.id == 142126 then
45 Num26 = Num26 + (equipRingSD.refinelv * 0.01 + 0.1) * equipRingSD.quench_per / 100
46 end
47 if (equipRingSD.id == 42126 or equipRingSD.id == 142126) and equipRingSD.refinelv >= 15 then
48 Num26 = Num26 + 0.05 * equipRingSD.quench_per / 100
49 end
50 local RefineLv7 = srcUser:GetEquipedRefineLv(7_WEAPON)
51 if srcUser:HasBuffID(90004304_LOST_STAFF_1_TIER_5_:MAX_STACK_0) then
52 Num26 = Num26 + 0.04 * RefineLv7
53 end
54 local EquipDamage = 0
55 if srcUser:HasBuffID(90004304_LOST_STAFF_1_TIER_5_:MAX_STACK_0) then
56 EquipDamage = EquipDamage + 0.1 * RefineLv7
57 end
58 local Num22 = srcUser:GetBuffLayer(90000942_TIDAL_SHOES_TIER_3_:MAX_STACK_0)
59 local Num23 = srcUser:GetBuffLayer(90000944_TIDAL_SHOES_TIER_5_:MAX_STACK_0)
60 local Num25 = 0
61 local RefineLv4 = srcUser:GetEquipedRefineLv(4)
62 if srcUser:HasBuffID(90000949_1910_:MAX_STACK_0) and 10 <= RefineLv4 then
63 Num25 = 1
64 end
65 local Num27 = 0
66 local equipRingshoes = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_EQUIP, CommonFun.EquipPos.EEQUIPPOS_SHOES)
67 if equipRingshoes.id == 43587 or equipRingshoes.id == 143587 then
68 if equipRingshoes.refinelv < 5 then
69 Num27 = Num27 + 10
70 elseif equipRingshoes.refinelv >= 5 and equipRingshoes.refinelv < 10 then
71 Num27 = Num27 + 10 + 5
72 elseif equipRingshoes.refinelv >= 10 and equipRingshoes.refinelv < 15 then
73 Num27 = Num27 + 10 + 5 + 5
74 elseif equipRingshoes.refinelv >= 15 then
75 Num27 = Num27 + 10 + 5 + 5 + 5
76 end
77 end
78 local equipRingSDshoes = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_SHADOWEQUIP, CommonFun.EquipPos.EEQUIPPOS_SHOES)
79 if equipRingSDshoes.id == 43587 or equipRingSDshoes.id == 143587 then
80 if equipRingSDshoes.refinelv < 5 then
81 Num27 = Num27 + 10 * equipRingSDshoes.quench_per / 100
82 elseif equipRingSDshoes.refinelv >= 5 and equipRingSDshoes.refinelv < 10 then
83 Num27 = Num27 + 15 * equipRingSDshoes.quench_per / 100
84 elseif equipRingSDshoes.refinelv >= 10 and equipRingSDshoes.refinelv < 15 then
85 Num27 = Num27 + 20 * equipRingSDshoes.quench_per / 100
86 elseif equipRingSDshoes.refinelv >= 15 then
87 Num27 = Num27 + 25 * equipRingSDshoes.quench_per / 100
88 end
89 end
90 local RuneDamage = (Num11 + Num12 + Num13 + Num14 + Num15 + Num16 + Num17 + Num18) * 0.1 + 1 + 0.03 * Num19 + 0.03 * Num20 + 0.04 * Num21 + Num24 + Num26
91 local RuneDamage1 = 0
92 if 0 < Num11 + Num12 + Num13 + Num14 + Num15 + Num16 + Num17 + Num18 + Num22 + Num23 + Num25 + Num27 then
93 RuneDamage1 = 5 + Luk / 3 + Num22 * 5 + Num23 * 5 + Num25 * 5 + Num27
94 end
95 local MRefine = srcUser:GetProperty("MRefine")
96 local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, targetUser, params, damageParam)
97 local targetDefElement = targetUser:GetProperty("DefAttr")
98 local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
99 local raceparam = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
100 local raceparam2 = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
101 local bossparam = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
102 local bossparam2 = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
103 local MDef2 = targetUser:GetProperty("MDef")
104 local MDefPer2 = targetUser:GetProperty("MDefPer")
105 local Vit2 = targetUser:GetProperty("Vit")
106 local VitPer2 = targetUser:GetProperty("VitPer")
107 local Int2 = targetUser:GetProperty("Int")
108 local IntPer2 = targetUser:GetProperty("IntPer")
109 local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
110 local RefineMDamReduc = CommonFun.calcRefineMDamReduc(srcUser, targetUser)
111 local damChangePer = damageParam.damChangePer
112 local BaseMAtk = Int + math.floor(Int * Int / 100)
113 local MAtkFinal = ((MAtk - BaseMAtk + NormalAtk) * (1 + MAtkPer) + BaseMAtk) * raceparam * bossparam * bossparam2
114 local MDefReduc = CommonFun.CalcMDef(srcUser, targetUser)
115 local srcAtkElement1 = 1
116 local elementInc1 = 0
117 local elementRed1 = 0
118 local targetDefElement = targetUser:GetProperty("DefAttr")
119 if nil == targetDefElement then
120 logger.error(string.format("%s targetDefElement is nil", targetUser.name))
121 return 0
122 end
123 if nil == CommonFun.NatureProps[targetDefElement] then
124 logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
125 return 0
126 end
127 if nil == CommonFun.NatureProps[srcAtkElement1] then
128 logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement1)))
129 return 0
130 end
131 elementInc1 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
132 elementRed1 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][2])
133 elementAtk1 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][3])
134 if nil == elementAtk1 then
135 elementAtk1 = 0
136 end
137 local result1 = 1 + elementAtk1 - elementRed1
138 if result1 <= 0.1 then
139 result1 = 0.1
140 end
141 local srcAtkElement2 = 2
142 local elementInc2 = 0
143 local elementRed2 = 0
144 local targetDefElement = targetUser:GetProperty("DefAttr")
145 if nil == targetDefElement then
146 logger.error(string.format("%s targetDefElement is nil", targetUser.name))
147 return 0
148 end
149 if nil == CommonFun.NatureProps[targetDefElement] then
150 logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
151 return 0
152 end
153 if nil == CommonFun.NatureProps[srcAtkElement2] then
154 logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement2)))
155 return 0
156 end
157 elementInc2 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
158 elementRed2 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][2])
159 elementAtk2 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][3])
160 if nil == elementAtk2 then
161 elementAtk2 = 0
162 end
163 local result2 = 1 + elementAtk2 - elementRed2
164 if result2 <= 0.1 then
165 result2 = 0.1
166 end
167 local srcAtkElement3 = 3
168 local elementInc3 = 0
169 local elementRed3 = 0
170 local targetDefElement = targetUser:GetProperty("DefAttr")
171 if nil == targetDefElement then
172 logger.error(string.format("%s targetDefElement is nil", targetUser.name))
173 return 0
174 end
175 if nil == CommonFun.NatureProps[targetDefElement] then
176 logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
177 return 0
178 end
179 if nil == CommonFun.NatureProps[srcAtkElement3] then
180 logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement3)))
181 return 0
182 end
183 elementInc3 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
184 elementRed3 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][2])
185 elementAtk3 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][3])
186 if nil == elementAtk3 then
187 elementAtk3 = 0
188 end
189 local result3 = 1 + elementAtk3 - elementRed3
190 if result3 <= 0.1 then
191 result3 = 0.1
192 end
193 local srcAtkElement4 = 4
194 local elementInc4 = 0
195 local elementRed4 = 0
196 local targetDefElement = targetUser:GetProperty("DefAttr")
197 if nil == targetDefElement then
198 logger.error(string.format("%s targetDefElement is nil", targetUser.name))
199 return 0
200 end
201 if nil == CommonFun.NatureProps[targetDefElement] then
202 logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
203 return 0
204 end
205 if nil == CommonFun.NatureProps[srcAtkElement4] then
206 logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement4)))
207 return 0
208 end
209 elementInc4 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
210 elementRed4 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][2])
211 elementAtk4 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][3])
212 if nil == elementAtk4 then
213 elementAtk4 = 0
214 end
215 local result4 = 1 + elementAtk4 - elementRed4
216 if result4 <= 0.1 then
217 result4 = 0.1
218 end
219 local elementparam21 = result1
220 local elementparam22 = result2
221 local elementparam23 = result3
222 local elementparam24 = result4
223 local A1 = (MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (damChangePer + EquipDamage) * (1 - RefineMDamReduc) * (1 + MDamIncrease) * CommonFun.GetElementRate(srcUser, srcAtkElement1, targetUser, targetDefElement, params, damageParam) * elementparam21 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)
224 local A2 = (MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (damChangePer + EquipDamage) * (1 - RefineMDamReduc) * (1 + MDamIncrease) * CommonFun.GetElementRate(srcUser, srcAtkElement2, targetUser, targetDefElement, params, damageParam) * elementparam22 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)
225 local A3 = (MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (damChangePer + EquipDamage) * (1 - RefineMDamReduc) * (1 + MDamIncrease) * CommonFun.GetElementRate(srcUser, srcAtkElement3, targetUser, targetDefElement, params, damageParam) * elementparam23 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)
226 local A4 = (MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (damChangePer + EquipDamage) * (1 - RefineMDamReduc) * (1 + MDamIncrease) * CommonFun.GetElementRate(srcUser, srcAtkElement4, targetUser, targetDefElement, params, damageParam) * elementparam24 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)
227 local skilllv_1 = srcUser:GetLernedSkillLevel(1163_THIEF:ELEMENTAL_ENHANCEMENT)
228 local A5 = 0
229 if 6 <= skilllv_1 then
230 local fireball = 0
231 local waterball = 0
232 local windball = 0
233 local earthball = 0
234 if srcUser:HasBuffID(116830_FIRE_ELEMENT_:MAX_STACK_0) then
235 fireball = 1
236 end
237 if srcUser:HasBuffID(116831_AQUA_ELEMENTAL_:MAX_STACK_0) then
238 waterball = 1
239 end
240 if srcUser:HasBuffID(116832_WIND_ELEMENT_:MAX_STACK_0) then
241 windball = 1
242 end
243 if srcUser:HasBuffID(116833_EARTH_ELEMENT_:MAX_STACK_0) then
244 earthball = 1
245 end
246 A5 = (A1 * windball + A2 * earthball + A3 * waterball + A4 * fireball) * (skilllv_1 - 5) * 0.02
247 end
248 local A = (MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (1 - RefineMDamReduc) * (damChangePer + EquipDamage) * (1 + MDamIncrease) * CommonFun.calcMagicElement(srcUser, targetUser, params, damageParam) * elementparam2 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2) + A5
249 if A <= 1 then
250 return 1
251 end
252 if CommonFun.IsInRate(RuneDamage1, srcUser:GetRandom()) then
253 return (A - A5) * RuneDamage + A5, CommonFun.DamageType.Crit
254 end
255 return A
256endPreserved HTML snapshot from ROM Handbook
