Formula

CommonFun.calcBuff_3541

formula.lua
1function CommonFun.calcBuff_3541(srcUser, targetUser, a, b, c, d, lv)
2  local Str = srcUser:GetProperty("Str")
3  local Dex = srcUser:GetProperty("Dex")
4  local Luk = srcUser:GetProperty("Luk")
5  local Atk = srcUser:GetProperty("Atk")
6  local AtkPer = srcUser:GetProperty("AtkPer")
7  local DamIncrease = srcUser:GetProperty("DamIncrease")
8  local IgnoreDef = 0
9  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
10  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
11  if targetUser.boss or targetUser.mini then
12    IgnoreDef = IgnoreDef1
13  else
14    IgnoreDef = IgnoreDef1 + IgnoreDef2
15  end
16  if 1 <= IgnoreDef then
17    IgnoreDef = 1
18  end
19  local Refine = srcUser:GetProperty("Refine")
20  local Def2 = targetUser:GetProperty("Def")
21  local DefPer2 = targetUser:GetProperty("DefPer")
22  local Vit2 = targetUser:GetProperty("Vit")
23  local VitPer2 = targetUser:GetProperty("VitPer")
24  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
25  local RefineDamReduc = CommonFun.calcRefineDamReduc(srcUser, targetUser)
26  local Hp2 = targetUser:GetProperty("Hp")
27  local MaxHp2 = targetUser:GetProperty("MaxHp")
28  local damChangePer = 0.3 * lv + 1.3
29  local AttrEffect = srcUser:GetProperty("AttrEffect")
30  local bits = CommonFun.getBits(AttrEffect)
31  local raceparam = 1
32  local srcRace = srcUser.race
33  local targetRace = targetUser.race
34  if targetUser:HasBuffID(139410_TWO_FACE_DEMON_KING_HUMAN_:MAX_STACK_0) then
35    targetRace = 3
36  end
37  if srcUser:HasBuffID(139411_TWO_FACE_DEMON_KING_DEMON_:MAX_STACK_0) then
38    srcRace = 3
39  end
40  if srcUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) and srcUser:HasBuffID(49325_RACIAL_ANCIENT_RELICS_CD_:MAX_STACK_0) then
41  elseif srcUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) then
42    targetRace = 2
43  end
44  if targetUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) and targetUser:HasBuffID(49325_RACIAL_ANCIENT_RELICS_CD_:MAX_STACK_0) then
45  elseif targetUser:HasBuffID(49320_RACIAL_ANCIENT_RELICS_PERMANENT_:MAX_STACK_0) then
46    srcRace = 2
47  end
48  if nil == CommonFun.RaceProps[targetRace] then
49    return 0
50  end
51  if nil == CommonFun.RaceProps[srcRace] then
52    return 0
53  end
54  local raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
55  local raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])
56  local raceRedThrough = srcUser:GetProperty(CommonFun.RaceProps[srcRace][3])
57  local raceIncResistance = targetUser:GetProperty(CommonFun.RaceProps[targetRace][4])
58  if nil == raceRedThrough then
59    raceRedThrough = 0
60  end
61  if nil == raceIncResistance then
62    raceIncResistance = 0
63  end
64  if 0 <= raceInc then
65    raceInc = raceInc * math.max(1 - raceIncResistance, 0)
66  end
67  if 0 <= raceRed then
68    raceRed = raceRed * math.max(1 - raceRedThrough, 0)
69  end
70  local raceparam = 1 + raceInc - raceRed
71  local mapid, maptype = srcUser:GetMapInfo()
72  if maptype == PVP_MAPS then
73    local B = raceRed - raceInc
74    B = B < -1 and -1 or 1 < B and 1 or B
75    B = math.floor(B * 1000) / 1000
76    B = B + 0.3 * (1 - math.sin(B * 3.14 / 2))
77    raceparam = 1 - B
78  end
79  if raceparam <= 0.1 then
80    raceparam = 0.1
81  end
82  local srcAtkElement = 10
83  local targetDefElement = targetUser:GetProperty("DefAttr")
84  local ElementRate = CommonFun.GetElementRate(srcUser, srcAtkElement, targetUser, targetDefElement)
85  local NumXp1 = srcUser:GetRunePoint(31019_AESIR_POISON_ELEMENT_DAMAGES_TO_OTHER_DEFENSES_RESTRAIN_FACTOR_25)
86  local NumXp2 = srcUser:GetRunePoint(31020_AESIR_POISON_ELEMENT_DAMAGES_TO_OTHER_DEFENSES_RESTRAIN_FACTOR_25)
87  local RuneRate = (NumXp1 + NumXp2) * 0.1
88  ElementRate = ElementRate + RuneRate
89  if (srcUser:HasBuffID(69650_8608_:MAX_STACK_0) or srcUser:HasBuffID(71090_10658_:MAX_STACK_0)) and 1 < ElementRate then
90    ElementRate = ElementRate * 1.1
91  end
92  if targetUser:HasBuffID(49130_DIVINE_HYMN_CARVER_:MAX_STACK_0) then
93    ElementRate = math.min(ElementRate, 1)
94  end
95  if srcUser:HasBuffID(49210_7892_:MAX_STACK_0) then
96    ElementRate = ElementRate + 0.15
97  end
98  if srcUser:HasBuffID(77480_48193_VICTORY_SWALLOW_1_:MAX_STACK_0) then
99    ElementRate = ElementRate + 0.1
100  end
101  if srcUser:HasBuffID(59630_DINGGUI_SYNERGY_CARD_:MAX_STACK_0) and (srcAtkElement == 3 or srcAtkElement == 4) then
102    ElementRate = ElementRate + 0.1
103  end
104  if srcUser:HasBuffID(59670_RESENTFUL_THOR_SOL_CARD_:MAX_STACK_0) and srcAtkElement == 1 then
105    ElementRate = ElementRate + 0.1
106  end
107  if srcUser:HasBuffID(700680_3013155_TWNPC_REMOVE_WINGS_:MAX_STACK_0) then
108    local RefineLv11 = srcUser:GetEquipedRefineLv(11)
109    ElementRate = ElementRate + 0.01 * RefineLv11
110  end
111  if nil == CommonFun.NatureProps[srcAtkElement] or nil == CommonFun.NatureProps[targetDefElement] or nil == targetDefElement then
112    return 0
113  end
114  local elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
115  local elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
116  local elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])
117  local elementThrough = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][4])
118  local elementResistance = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][5])
119  if 0 <= elementRed then
120    elementRed = elementRed * math.max(1 - elementThrough, 0)
121  end
122  if 0 <= elementAtk then
123    elementAtk = elementAtk * math.max(1 - elementResistance, 0)
124  end
125  local elementparam = (1 + elementInc) * ElementRate
126  local elementparam2 = 1 + elementAtk - elementRed
127  local mapid, maptype = srcUser:GetMapInfo()
128  if maptype == PVP_MAPS then
129    local B = elementRed - elementAtk
130    B = B < -1 and -1 or 1 < B and 1 or B
131    B = math.floor(B * 1000) / 1000
132    B = B + 0.3 * (1 - math.sin(B * 3.14 / 2))
133    elementparam2 = 1 - B
134  end
135  if elementparam2 <= 0.1 then
136    elementparam2 = 0.1
137  end
138  local ele = elementparam * elementparam2
139  if targetDefElement == nil or ElementRate == nil or elementInc == nil or elementRed == nil or elementAtk == nil then
140    ele = 1
141  end
142  local NpcParam = CommonFun.NpcParam(srcUser, targetUser, params, damageParam, logger)
143  local BaseAtk = Str * 2 + math.floor(Str * Str / 100) + math.floor(Dex / 5) + math.floor(Luk / 5)
144  local AtkFinal = ((Atk - BaseAtk) * (1 + AtkPer) * CommonFun.ShapeCorrection(srcUser, targetUser) * ele + BaseAtk) * raceparam * NpcParam
145  local DefReduc = CommonFun.CalcDef(srcUser, targetUser)
146  local bloodrain = 1
147  local StateEffect = targetUser:GetProperty("StateEffect")
148  local bits3 = CommonFun.getBits(StateEffect)
149  if bits3[CommonFun.StateEffect.Poison] == 1 and srcUser:HasBuffID(64350_2982_:MAX_STACK_0) then
150    bloodrain = bloodrain + 0.1
151  end
152  local A = -((AtkFinal * DefReduc * (1 - DamReduc2) + Refine) * damChangePer * (1 - RefineDamReduc) * (1 + DamIncrease) - Vit2 * (1 + VitPer2)) * bloodrain
153  if bits[CommonFun.AttrEffect.Hualiduanjian] == 1 then
154    return A * 1.5
155  end
156  local AttrFunction = srcUser:GetProperty("AttrFunction")
157  local bitfunc = CommonFun.getBits(AttrFunction)
158  if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and (targetUser.zoneType == 1 or targetUser.zoneType == 22) and targetUser.noPunishBoss == false and bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 and targetUser.isBossFromBranch == false then
159    A = 0
160  end
161  if CommonFun.checkAttrFunctionMiss(targetUser, srcUser) then
162    A = 0
163  end
164  if targetUser.boss and targetUser.zoneType == 22 and CommonFun.CheckStormBossMiss(targetUser, srcUser) then
165    A = 0
166  end
167  if targetUser:GetNpcID() == 30043_YEAR or targetUser:GetNpcID() == 280303_WILDNESS_SPIRIT_BEAST or targetUser:GetNpcID() == 56008_GOMORA or targetUser:GetNpcID() == 56009_BALTAN or targetUser:GetNpcID() == 56010_GOLZA or targetUser:GetNpcID() == 56011_BEMSTAR or targetUser:GetNpcID() == 56012_ELEKING or targetUser:GetNpcID() == 56013_KING_JOE then
168    A = -1
169  end
170  if targetUser:DamageAlways1() then
171    A = -1
172  end
173  if targetUser:HasBuffID(20610050_ANTI_GRAVITY_ARMOR_FLEE_HELL_PLANT_:MAX_STACK_0) and targetUser:HasBuffID(117860_HOVER_:MAX_STACK_0) or targetUser:HasBuffID(20610050_ANTI_GRAVITY_ARMOR_FLEE_HELL_PLANT_:MAX_STACK_0) and targetUser:HasBuffID(184020_ANTI_GRAVITY_ARMOR_FLEE_HELL_PLANT_:MAX_STACK_0) then
174    A = 0
175  end
176  if GetNpcID == 280709_DENSE_FOREST_SQUIRREL or GetNpcID == 280436_KLULU then
177    A = math.floor(A / 100)
178  end
179  return A
180end
Formula Graph

Connected Archive Data

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

Loading graph filters

CommonFun.calcBuff_3541

commonfun-calcbuff_3541

Nodes

0

Edges

0

Related Nodes

Select at least one node type.