warscript 0.0.1-dev.6fe4470 → 0.0.1-dev.702d52d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/attributes.d.ts +6 -0
  2. package/attributes.lua +17 -1
  3. package/config.d.ts +5 -0
  4. package/config.lua +10 -0
  5. package/core/types/effect.d.ts +14 -6
  6. package/core/types/effect.lua +131 -35
  7. package/core/types/frame.d.ts +4 -0
  8. package/core/types/frame.lua +95 -21
  9. package/core/types/player.d.ts +16 -0
  10. package/core/types/player.lua +60 -15
  11. package/core/types/playerCamera.d.ts +2 -0
  12. package/core/types/playerCamera.lua +123 -5
  13. package/core/types/sound.d.ts +17 -24
  14. package/core/types/sound.lua +99 -24
  15. package/core/types/tileCell.d.ts +11 -1
  16. package/core/types/tileCell.lua +97 -0
  17. package/core/types/timer.d.ts +9 -8
  18. package/core/types/timer.lua +45 -23
  19. package/core/util.d.ts +1 -1
  20. package/core/util.lua +18 -1
  21. package/decl/native.d.ts +846 -790
  22. package/destroyable.d.ts +1 -0
  23. package/destroyable.lua +9 -0
  24. package/engine/behavior.d.ts +16 -3
  25. package/engine/behavior.lua +233 -73
  26. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  27. package/engine/behaviour/ability/always-enabled.lua +31 -0
  28. package/engine/behaviour/ability/apply-buff.d.ts +5 -0
  29. package/engine/behaviour/ability/apply-buff.lua +36 -4
  30. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  31. package/engine/behaviour/ability/damage.d.ts +9 -3
  32. package/engine/behaviour/ability/damage.lua +26 -38
  33. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  34. package/engine/behaviour/ability/emulate-impact.lua +43 -0
  35. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  36. package/engine/behaviour/ability/instant-impact.lua +4 -19
  37. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  38. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  39. package/engine/behaviour/ability/remove-buffs.d.ts +25 -0
  40. package/engine/behaviour/ability/remove-buffs.lua +49 -0
  41. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  42. package/engine/behaviour/ability/restore-mana.lua +6 -6
  43. package/engine/behaviour/ability.d.ts +22 -5
  44. package/engine/behaviour/ability.lua +113 -48
  45. package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
  46. package/engine/behaviour/unit/stun-immunity.lua +57 -31
  47. package/engine/behaviour/unit.d.ts +45 -2
  48. package/engine/behaviour/unit.lua +289 -6
  49. package/engine/buff.d.ts +83 -47
  50. package/engine/buff.lua +431 -272
  51. package/engine/internal/ability.d.ts +23 -14
  52. package/engine/internal/ability.lua +129 -85
  53. package/engine/internal/item/ability.lua +162 -4
  54. package/engine/internal/item+owner.lua +12 -6
  55. package/engine/internal/item.d.ts +20 -19
  56. package/engine/internal/item.lua +191 -74
  57. package/engine/internal/mechanics/ability-duration.lua +1 -1
  58. package/engine/internal/mechanics/cast-ability.lua +6 -3
  59. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  60. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  61. package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
  62. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  63. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  64. package/engine/internal/misc/frame-coordinates.lua +21 -0
  65. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  66. package/engine/internal/misc/get-terrain-z.lua +11 -0
  67. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  68. package/engine/internal/misc/player-local-handle.lua +5 -0
  69. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  70. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  71. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  72. package/engine/internal/object-data/evasion-probability.lua +16 -0
  73. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
  74. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
  75. package/engine/internal/unit/ability.d.ts +45 -1
  76. package/engine/internal/unit/ability.lua +128 -17
  77. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  78. package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
  79. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  80. package/engine/internal/unit/add-item-to-slot.lua +52 -0
  81. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  82. package/engine/internal/unit/allowed-targets.lua +9 -1
  83. package/engine/internal/unit/attributes.d.ts +17 -0
  84. package/engine/internal/unit/attributes.lua +46 -0
  85. package/engine/internal/unit/bonus.d.ts +8 -2
  86. package/engine/internal/unit/bonus.lua +33 -1
  87. package/engine/internal/unit/fly-height.d.ts +7 -0
  88. package/engine/internal/unit/fly-height.lua +20 -0
  89. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  90. package/engine/internal/unit/ignore-events-items.lua +5 -0
  91. package/engine/internal/unit/interrupts.d.ts +12 -0
  92. package/engine/internal/unit/interrupts.lua +28 -0
  93. package/engine/internal/unit/item.d.ts +24 -0
  94. package/engine/internal/unit/item.lua +78 -0
  95. package/engine/internal/unit/main-selected.d.ts +13 -0
  96. package/engine/internal/unit/main-selected.lua +36 -0
  97. package/engine/internal/unit/order.d.ts +20 -0
  98. package/engine/internal/unit/order.lua +136 -0
  99. package/engine/internal/unit/scale.d.ts +7 -0
  100. package/engine/internal/unit/scale.lua +20 -0
  101. package/engine/internal/unit+ability.lua +12 -3
  102. package/engine/internal/unit+damage.d.ts +2 -11
  103. package/engine/internal/unit+damage.lua +10 -14
  104. package/engine/internal/unit+spellSteal.lua +1 -2
  105. package/engine/internal/unit-missile-launch.lua +70 -13
  106. package/engine/internal/unit.d.ts +62 -29
  107. package/engine/internal/unit.lua +483 -258
  108. package/engine/internal/utility.lua +12 -0
  109. package/engine/lightning.d.ts +12 -5
  110. package/engine/lightning.lua +48 -14
  111. package/engine/local-client.d.ts +9 -2
  112. package/engine/local-client.lua +112 -0
  113. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  114. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  115. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  116. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  117. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
  118. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  119. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  120. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  121. package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
  122. package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
  123. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  124. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  125. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  126. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  127. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  128. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  129. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  130. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  131. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  132. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  133. package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
  134. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  135. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  136. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  137. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  138. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  139. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  140. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  141. package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
  142. package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
  143. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  144. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  145. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  146. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  147. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  148. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  149. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  150. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  151. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  152. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  153. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  154. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  155. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  156. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  157. package/engine/object-data/entry/ability-type/web.lua +52 -0
  158. package/engine/object-data/entry/ability-type.d.ts +19 -17
  159. package/engine/object-data/entry/ability-type.lua +93 -36
  160. package/engine/object-data/entry/buff-type/applicable.lua +18 -37
  161. package/engine/object-data/entry/buff-type.d.ts +6 -12
  162. package/engine/object-data/entry/buff-type.lua +13 -29
  163. package/engine/object-data/entry/destructible-type.d.ts +28 -2
  164. package/engine/object-data/entry/destructible-type.lua +155 -0
  165. package/engine/object-data/entry/item-type.d.ts +15 -1
  166. package/engine/object-data/entry/item-type.lua +93 -2
  167. package/engine/object-data/entry/lightning-type.d.ts +1 -1
  168. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  169. package/engine/object-data/entry/sound-preset.lua +140 -0
  170. package/engine/object-data/entry/unit-type.d.ts +25 -5
  171. package/engine/object-data/entry/unit-type.lua +258 -93
  172. package/engine/object-data/entry/upgrade.d.ts +1 -1
  173. package/engine/object-data/entry/upgrade.lua +4 -4
  174. package/engine/object-data/entry.d.ts +16 -14
  175. package/engine/object-data/entry.lua +60 -32
  176. package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
  177. package/engine/object-field/ability.d.ts +12 -6
  178. package/engine/object-field/ability.lua +9 -5
  179. package/engine/object-field/unit.d.ts +72 -3
  180. package/engine/object-field/unit.lua +268 -7
  181. package/engine/object-field.d.ts +25 -6
  182. package/engine/object-field.lua +359 -116
  183. package/engine/random.d.ts +9 -0
  184. package/engine/random.lua +13 -0
  185. package/engine/standard/entries/buff-type.d.ts +3 -0
  186. package/engine/standard/entries/buff-type.lua +3 -0
  187. package/engine/standard/entries/sound-preset.d.ts +10 -0
  188. package/engine/standard/entries/sound-preset.lua +10 -0
  189. package/engine/standard/fields/ability.d.ts +4 -2
  190. package/engine/standard/fields/ability.lua +4 -2
  191. package/engine/standard/fields/unit.d.ts +12 -0
  192. package/engine/standard/fields/unit.lua +20 -0
  193. package/engine/synchronization.d.ts +11 -0
  194. package/engine/synchronization.lua +77 -0
  195. package/engine/text-tag.d.ts +36 -2
  196. package/engine/text-tag.lua +250 -10
  197. package/engine/unit.d.ts +8 -0
  198. package/engine/unit.lua +8 -0
  199. package/index.d.ts +1 -0
  200. package/index.lua +1 -0
  201. package/net/socket.d.ts +7 -1
  202. package/net/socket.lua +45 -4
  203. package/network.d.ts +1 -0
  204. package/network.lua +3 -2
  205. package/objutil/buff.lua +12 -11
  206. package/objutil/unit.lua +8 -0
  207. package/package.json +2 -2
  208. package/patch-lua.d.ts +0 -0
  209. package/patch-lua.lua +25 -0
  210. package/patch-lualib.lua +1 -1
  211. package/utility/arrays.d.ts +10 -1
  212. package/utility/arrays.lua +45 -3
  213. package/utility/callback-array.d.ts +17 -0
  214. package/utility/callback-array.lua +61 -0
  215. package/utility/functions.d.ts +8 -0
  216. package/utility/functions.lua +13 -0
  217. package/utility/lazy.d.ts +2 -0
  218. package/utility/lazy.lua +14 -0
  219. package/utility/linked-map.d.ts +26 -0
  220. package/utility/linked-map.lua +66 -0
  221. package/utility/linked-set.d.ts +2 -0
  222. package/utility/linked-set.lua +26 -1
  223. package/utility/lua-maps.d.ts +15 -2
  224. package/utility/lua-maps.lua +53 -2
  225. package/utility/lua-sets.d.ts +2 -0
  226. package/utility/lua-sets.lua +7 -0
  227. package/utility/records.lua +20 -1
  228. package/utility/reflection.lua +11 -7
  229. package/utility/types.d.ts +3 -0
  230. package/core/types/order.d.ts +0 -25
  231. package/core/types/order.lua +0 -55
package/engine/buff.lua CHANGED
@@ -16,6 +16,7 @@ local internalApplyBuff = ____applicable.internalApplyBuff
16
16
  local removeBuff = ____applicable.removeBuff
17
17
  local ____ability = require("engine.internal.ability")
18
18
  local Ability = ____ability.Ability
19
+ local UnitAbility = ____ability.UnitAbility
19
20
  local ____ability = require("engine.object-field.ability")
20
21
  local AbilityBooleanField = ____ability.AbilityBooleanField
21
22
  local AbilityNumberField = ____ability.AbilityNumberField
@@ -28,13 +29,11 @@ local ____math = require("math")
28
29
  local max = ____math.max
29
30
  local min = ____math.min
30
31
  local ____bonus = require("engine.internal.unit.bonus")
31
- local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
32
- local getUnitBonus = ____bonus.getUnitBonus
33
- local removeUnitBonus = ____bonus.removeUnitBonus
34
32
  local UnitBonusType = ____bonus.UnitBonusType
35
33
  local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
36
34
  local damageArea = ____area_2Ddamage.damageArea
37
35
  local ____preconditions = require("utility.preconditions")
36
+ local check = ____preconditions.check
38
37
  local checkNotNull = ____preconditions.checkNotNull
39
38
  local ____effect = require("core.types.effect")
40
39
  local Effect = ____effect.Effect
@@ -43,9 +42,22 @@ local BuffType = ____buff_2Dtype.BuffType
43
42
  local ____unit = require("engine.behaviour.unit")
44
43
  local UnitBehavior = ____unit.UnitBehavior
45
44
  local ____arrays = require("utility.arrays")
45
+ local emptyArray = ____arrays.emptyArray
46
46
  local forEach = ____arrays.forEach
47
+ local ____event = require("event")
48
+ local Event = ____event.Event
47
49
  local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
48
50
  local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
51
+ local ____item = require("engine.internal.item")
52
+ local Item = ____item.Item
53
+ local ____destructable = require("core.types.destructable")
54
+ local Destructable = ____destructable.Destructable
55
+ local ____ability = require("engine.standard.fields.ability")
56
+ local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
57
+ local ____ability = require("engine.behaviour.ability")
58
+ local AbilityBehavior = ____ability.AbilityBehavior
59
+ local ____records = require("utility.records")
60
+ local sortedKeysUnnested = ____records.sortedKeysUnnested
49
61
  local getUnitAbility = BlzGetUnitAbility
50
62
  local stringValueByBuffTypeIdByFieldId = postcompile(function()
51
63
  local stringValueByBuffTypeIdByFieldId = {}
@@ -94,11 +106,16 @@ local buffParametersKeys = {
94
106
  armorIncreaseFactor = true,
95
107
  attackSpeedIncreaseFactor = true,
96
108
  movementSpeedIncreaseFactor = true,
109
+ manaRegenerationRateIncreaseFactor = true,
110
+ evasionProbability = true,
111
+ missProbability = true,
112
+ damageFactor = true,
97
113
  receivedDamageFactor = true,
98
114
  receivedMagicDamageFactor = true,
99
115
  durationIncreaseOnAutoAttack = true,
100
116
  maximumDuration = true,
101
117
  maximumRemainingDuration = true,
118
+ turnsIntoGhost = true,
102
119
  stuns = true,
103
120
  ignoresStunImmunity = true,
104
121
  providesStunImmunity = true,
@@ -113,7 +130,8 @@ local buffParametersKeys = {
113
130
  damageOnExpiration = true,
114
131
  healingOnExpiration = true,
115
132
  killsOnExpiration = true,
116
- explodesOnExpiration = true
133
+ explodesOnExpiration = true,
134
+ abilityCooldownFactor = true
117
135
  }
118
136
  local function resolveEnumValue(ability, level, value)
119
137
  if value == nil or type(value) == "number" then
@@ -164,6 +182,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
164
182
  end
165
183
  end
166
184
  local buffBooleanParameters = {
185
+ "turnsIntoGhost",
167
186
  "stuns",
168
187
  "ignoresStunImmunity",
169
188
  "disablesAutoAttack",
@@ -175,7 +194,10 @@ local buffNumberParameters = {
175
194
  "durationIncreaseOnAutoAttack",
176
195
  "attackSpeedIncreaseFactor",
177
196
  "movementSpeedIncreaseFactor",
197
+ "manaRegenerationRateIncreaseFactor",
198
+ "evasionProbability",
178
199
  "armorIncrease",
200
+ "damageFactor",
179
201
  "receivedDamageFactor",
180
202
  "maximumAutoAttackCount",
181
203
  "maximumDamageDealtEventCount",
@@ -187,7 +209,8 @@ local buffNumberParameters = {
187
209
  "healingPerInterval",
188
210
  "healingOverDuration",
189
211
  "damageOnExpiration",
190
- "healingOnExpiration"
212
+ "healingOnExpiration",
213
+ "abilityCooldownFactor"
191
214
  }
192
215
  local unsuccessfulApplicationMarker = {}
193
216
  local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
@@ -214,7 +237,7 @@ local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
214
237
  return checkNotNull(firstNativeBuffTypeId)
215
238
  end
216
239
  local function destroyBuffIfItHasSameUniqueGroup(buff, uniqueGroup)
217
- if buff[103] == uniqueGroup then
240
+ if buff[104] == uniqueGroup then
218
241
  buff:destroy()
219
242
  end
220
243
  end
@@ -222,17 +245,17 @@ local function destroyBuff(buff)
222
245
  buff:destroy()
223
246
  end
224
247
  local function expireBuff(buff)
225
- local remainingDamageOverDuration = buff[112] or 0
226
- local remainingHealingOverDuration = buff[112] or 0
248
+ local remainingDamageOverDuration = buff[113] or 0
249
+ local remainingHealingOverDuration = buff[113] or 0
227
250
  if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
228
251
  buff:flashSpecialEffect()
229
252
  if remainingDamageOverDuration ~= 0 then
230
- (buff[101] or buff[100]):damageTarget(buff[100], remainingDamageOverDuration)
231
- buff[112] = nil
253
+ (buff[102] or buff[101]):damageTarget(buff[101], remainingDamageOverDuration)
254
+ buff[113] = nil
232
255
  end
233
256
  if remainingHealingOverDuration ~= 0 then
234
- (buff[101] or buff[100]):healTarget(buff[100], remainingHealingOverDuration)
235
- buff[117] = nil
257
+ (buff[102] or buff[101]):healTarget(buff[101], remainingHealingOverDuration)
258
+ buff[118] = nil
236
259
  end
237
260
  end
238
261
  Timer:run(destroyBuff, buff)
@@ -240,56 +263,58 @@ local function expireBuff(buff)
240
263
  end
241
264
  local function buffDamageIntervalInitialTimerCallback(buff)
242
265
  buffDamageIntervalTimerCallback(buff)
243
- local timer = buff[113]
244
- local damageInterval = buff[111]
266
+ local timer = buff[114]
267
+ local damageInterval = buff[112]
245
268
  if timer ~= nil and damageInterval ~= nil and damageInterval > 0 then
246
269
  timer:start(damageInterval, true, buffDamageIntervalTimerCallback, buff)
247
270
  end
248
271
  end
249
272
  buffDamageIntervalTimerCallback = function(buff)
250
273
  buff:flashSpecialEffect()
251
- local source = buff[101] or buff[100]
252
- local remainingDamageOverDuration = buff[112] or 0
274
+ local source = buff[102] or buff[101]
275
+ local remainingDamageOverDuration = buff[113] or 0
253
276
  if remainingDamageOverDuration ~= 0 then
254
- local damageInterval = buff[111] or 0
277
+ local damageInterval = buff[112] or 0
255
278
  if damageInterval ~= 0 then
256
279
  local damage = remainingDamageOverDuration / (1 + buff.remainingDuration / damageInterval)
257
- source:damageTarget(buff[100], damage)
258
- buff[112] = remainingDamageOverDuration - damage
280
+ source:damageTarget(buff[101], damage)
281
+ buff[113] = remainingDamageOverDuration - damage
259
282
  end
260
283
  end
261
- local damagePerInterval = buff[110] or 0
284
+ local damagePerInterval = buff[111] or 0
262
285
  if remainingDamageOverDuration == 0 or damagePerInterval ~= 0 then
263
- source:damageTarget(buff[100], damagePerInterval)
286
+ source:damageTarget(buff[101], damagePerInterval)
264
287
  end
265
288
  end
266
289
  local function buffHealingIntervalInitialTimerCallback(buff)
267
290
  buffHealingIntervalTimerCallback(buff)
268
- local timer = buff[118]
269
- local healingInterval = buff[116]
291
+ local timer = buff[119]
292
+ local healingInterval = buff[117]
270
293
  if timer ~= nil and healingInterval ~= nil and healingInterval > 0 then
271
294
  timer:start(healingInterval, true, buffHealingIntervalTimerCallback, buff)
272
295
  end
273
296
  end
274
297
  buffHealingIntervalTimerCallback = function(buff)
275
- if buff[116] ~= buff[111] then
298
+ if buff[117] ~= buff[112] then
276
299
  buff:flashSpecialEffect()
277
300
  end
278
- local source = buff[101] or buff[100]
279
- local remainingHealingOverDuration = buff[117] or 0
301
+ local source = buff[102] or buff[101]
302
+ local remainingHealingOverDuration = buff[118] or 0
280
303
  if remainingHealingOverDuration ~= 0 then
281
- local healingInterval = buff[116] or 0
304
+ local healingInterval = buff[117] or 0
282
305
  if healingInterval ~= 0 then
283
306
  local healing = remainingHealingOverDuration / (1 + buff.remainingDuration / healingInterval)
284
- source:healTarget(buff[100], healing)
285
- buff[117] = remainingHealingOverDuration - healing
307
+ source:healTarget(buff[101], healing)
308
+ buff[118] = remainingHealingOverDuration - healing
286
309
  end
287
310
  end
288
- local healingPerInterval = buff[115] or 0
311
+ local healingPerInterval = buff[116] or 0
289
312
  if remainingHealingOverDuration == 0 or healingPerInterval ~= 0 then
290
- source:healTarget(buff[100], healingPerInterval)
313
+ source:healTarget(buff[101], healingPerInterval)
291
314
  end
292
315
  end
316
+ local buffCreatedEvent = __TS__New(Event)
317
+ local buffBeingDestroyedEvent = __TS__New(Event)
293
318
  ____exports.Buff = __TS__Class()
294
319
  local Buff = ____exports.Buff
295
320
  Buff.name = "Buff"
@@ -298,38 +323,44 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
298
323
  UnitBehavior.prototype.____constructor(self, _unit)
299
324
  self._unit = _unit
300
325
  self.parameters = nil
301
- self[100] = _unit
326
+ self[100] = 0
327
+ self[101] = _unit
302
328
  local typeId
303
329
  local polarity
304
330
  local resistanceType
305
331
  local ability
332
+ local abilityBehavior
306
333
  if type(typeIdOrTypeIds) ~= "number" then
307
334
  typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
308
335
  polarity = resistanceTypeOrPolarity
309
336
  resistanceType = abilityOrParametersOrResistanceType
310
- if __TS__InstanceOf(parametersOrAbility, Ability) then
337
+ if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
338
+ abilityBehavior = parametersOrAbility
339
+ ability = abilityBehavior.ability
340
+ elseif __TS__InstanceOf(parametersOrAbility, Ability) then
311
341
  ability = parametersOrAbility
312
- else
313
- ability = nil
342
+ elseif parametersOrAbility ~= nil then
314
343
  parameters = parametersOrAbility
315
344
  end
316
345
  else
317
346
  typeId = typeIdOrTypeIds
318
347
  polarity = polarityOrTypeIdSelectionPolicy
319
348
  resistanceType = resistanceTypeOrPolarity
320
- if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
349
+ if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
350
+ abilityBehavior = abilityOrParametersOrResistanceType
351
+ ability = abilityBehavior.ability
352
+ parameters = parametersOrAbility
353
+ elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
321
354
  ability = abilityOrParametersOrResistanceType
322
355
  parameters = parametersOrAbility
323
- else
324
- ability = nil
356
+ elseif abilityOrParametersOrResistanceType ~= nil then
325
357
  parameters = abilityOrParametersOrResistanceType
358
+ else
359
+ parameters = parametersOrAbility
326
360
  end
327
361
  end
362
+ self.sourceAbilityBehavior = abilityBehavior
328
363
  self.typeId = typeId
329
- if not __TS__InstanceOf(ability, Ability) then
330
- parameters = ability
331
- ability = nil
332
- end
333
364
  local defaultParameters = self.constructor.defaultParameters
334
365
  local level = parameters and parameters.level or defaultParameters.level
335
366
  local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
@@ -354,14 +385,19 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
354
385
  end
355
386
  self.polarity = resolveEnumValue(ability, level, polarity)
356
387
  self.resistanceType = resolveEnumValue(ability, level, resistanceType)
388
+ local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
389
+ if missProbability ~= nil then
390
+ missProbability = resolveNumberValue(ability, level, missProbability)
391
+ self[142] = missProbability
392
+ end
357
393
  local buffByTypeId = buffByTypeIdByUnit[_unit]
358
394
  if buffByTypeId == nil then
359
395
  buffByTypeId = {}
360
396
  buffByTypeIdByUnit[_unit] = buffByTypeId
361
397
  end
362
- local ____opt_13 = buffByTypeId[typeId]
363
- if ____opt_13 ~= nil then
364
- ____opt_13:destroy()
398
+ local ____opt_15 = buffByTypeId[typeId]
399
+ if ____opt_15 ~= nil then
400
+ ____opt_15:destroy()
365
401
  end
366
402
  local uniqueGroup = parameters and parameters.uniqueGroup or defaultParameters and defaultParameters.uniqueGroup
367
403
  if uniqueGroup ~= nil then
@@ -375,13 +411,16 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
375
411
  level,
376
412
  duration,
377
413
  spellStealPriority,
378
- learnLevelMinimum
414
+ learnLevelMinimum,
415
+ missProbability
379
416
  ) then
417
+ self[100] = 1
380
418
  UnitBehavior.prototype.destroy(self)
381
419
  error(unsuccessfulApplicationMarker, 0)
382
420
  end
383
421
  local handle = BlzGetUnitAbility(_unit.handle, typeId)
384
422
  if handle == nil then
423
+ self[100] = 1
385
424
  UnitBehavior.prototype.destroy(self)
386
425
  error(unsuccessfulApplicationMarker, 0)
387
426
  end
@@ -390,20 +429,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
390
429
  self._level = level
391
430
  self._spellStealPriority = spellStealPriority
392
431
  self._learnLevelMinimum = learnLevelMinimum
393
- self[101] = source
394
- self[102] = duration or 0
395
- self[103] = uniqueGroup
396
- self[104] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
397
- self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
432
+ self[102] = source
433
+ self[103] = duration or 0
434
+ self[104] = uniqueGroup
435
+ self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
436
+ self[106] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
398
437
  if parameters ~= nil or (next(defaultParameters)) ~= nil then
399
438
  for ____, buffBooleanParameter in ipairs(buffBooleanParameters) do
400
- local ____ability_22 = ability
401
- local ____level_23 = level
402
- local ____temp_21 = parameters and parameters[buffBooleanParameter]
403
- if ____temp_21 == nil then
404
- ____temp_21 = defaultParameters[buffBooleanParameter]
439
+ local ____ability_24 = ability
440
+ local ____level_25 = level
441
+ local ____temp_23 = parameters and parameters[buffBooleanParameter]
442
+ if ____temp_23 == nil then
443
+ ____temp_23 = defaultParameters[buffBooleanParameter]
405
444
  end
406
- if resolveBooleanValue(____ability_22, ____level_23, ____temp_21) then
445
+ if resolveBooleanValue(____ability_24, ____level_25, ____temp_23) then
407
446
  self[buffBooleanParameter] = true
408
447
  end
409
448
  end
@@ -419,11 +458,11 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
419
458
  end
420
459
  local maximumDuration = parameters and parameters.maximumDuration or defaultParameters.maximumDuration
421
460
  if maximumDuration ~= nil then
422
- self[107] = resolveNumberValue(ability, level, maximumDuration)
461
+ self[108] = resolveNumberValue(ability, level, maximumDuration)
423
462
  end
424
463
  local maximumRemainingDuration = parameters and parameters.maximumRemainingDuration or defaultParameters.maximumRemainingDuration
425
464
  if maximumRemainingDuration ~= nil then
426
- self[108] = resolveNumberValue(ability, level, maximumRemainingDuration)
465
+ self[109] = resolveNumberValue(ability, level, maximumRemainingDuration)
427
466
  end
428
467
  local parametersAbilityTypeIds = parameters and parameters.abilityTypeIds or defaultParameters.abilityTypeIds
429
468
  if parametersAbilityTypeIds ~= nil then
@@ -432,24 +471,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
432
471
  abilityTypeIds = {}
433
472
  self._abilityTypeIds = abilityTypeIds
434
473
  end
435
- for abilityTypeId, abilityParameters in pairs(parametersAbilityTypeIds) do
474
+ for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
475
+ local abilityParameters = parametersAbilityTypeIds[abilityTypeId]
436
476
  local addedAbility = _unit:addAbility(abilityTypeId)
437
477
  if addedAbility ~= nil then
438
478
  _unit:makeAbilityPermanent(abilityTypeId, true)
439
479
  _unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
440
- for abilityParameterKey, abilityParameterValue in pairs(abilityParameters) do
441
- if abilityParameterKey == "isButtonVisible" then
442
- if not resolveBooleanValue(ability, level, abilityParameterValue) then
443
- _unit:hideAbility(abilityTypeId, true)
444
- end
445
- elseif abilityParameterKey ~= "level" then
446
- abilityParameterKey:setValue(
447
- addedAbility,
448
- resolveNumberValue(ability, level, abilityParameterValue)
449
- )
450
- end
480
+ if abilityParameters.isButtonVisible == false then
481
+ _unit:hideAbility(abilityTypeId, true)
451
482
  end
452
- abilityTypeIds[abilityTypeId] = true
483
+ for ____, field in ipairs(abilityParameters.fields or emptyArray()) do
484
+ field[1]:setValue(
485
+ addedAbility,
486
+ resolveNumberValue(ability, level, field[2])
487
+ )
488
+ end
489
+ abilityTypeIds[#abilityTypeIds + 1] = abilityTypeId
453
490
  end
454
491
  end
455
492
  local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
@@ -461,18 +498,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
461
498
  self._behaviors = behaviors
462
499
  end
463
500
  end
464
- local additionalParameters = {}
465
- for key, value in pairs(parameters) do
466
- if not buffParametersKeys[key] then
467
- if ability then
468
- additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, value)
469
- else
470
- additionalParameters[key] = value
501
+ if parameters ~= nil then
502
+ local additionalParameters = {}
503
+ for ____, key in ipairs(sortedKeysUnnested(parameters)) do
504
+ if not buffParametersKeys[key] then
505
+ if ability then
506
+ additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, parameters[key])
507
+ else
508
+ additionalParameters[key] = parameters[key]
509
+ end
471
510
  end
472
511
  end
473
- end
474
- if (next(additionalParameters)) ~= nil then
475
- self.parameters = additionalParameters
512
+ if (next(additionalParameters)) ~= nil then
513
+ self.parameters = additionalParameters
514
+ end
476
515
  end
477
516
  end
478
517
  if duration ~= nil and duration > 0 then
@@ -480,47 +519,57 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
480
519
  timer:start(duration, false, expireBuff, self)
481
520
  self._timer = timer
482
521
  end
522
+ self:onCreate()
523
+ self[100] = 1
524
+ Event.invoke(buffCreatedEvent, self)
483
525
  end
484
- function Buff.prototype.getUnitBonus(self, bonusType)
485
- local ____opt_36 = self._bonusIdByBonusType
486
- local bonusId = ____opt_36 and ____opt_36[bonusType]
487
- return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
526
+ function Buff.prototype.onAbilityGained(self, ability)
527
+ if __TS__InstanceOf(ability, UnitAbility) then
528
+ local abilityCooldownModifier = self[144]
529
+ if abilityCooldownModifier then
530
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
531
+ end
532
+ end
488
533
  end
489
- function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
490
- local bonusIdByBonusType = self._bonusIdByBonusType
491
- if bonusIdByBonusType == nil then
492
- bonusIdByBonusType = {}
493
- self._bonusIdByBonusType = bonusIdByBonusType
534
+ function Buff.prototype.onAbilityLost(self, ability)
535
+ if __TS__InstanceOf(ability, UnitAbility) then
536
+ local abilityCooldownModifier = self[144]
537
+ if abilityCooldownModifier then
538
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
539
+ end
494
540
  end
495
- bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
496
541
  end
497
- function Buff.prototype.flashEffect(self, widgetOrDuration, duration)
498
- local isWidgetProvided = type(widgetOrDuration) == "table"
499
- local ____Effect_40 = Effect
500
- local ____Effect_flash_41 = Effect.flash
501
- local ____array_39 = __TS__SparseArrayNew(
502
- self[104],
503
- isWidgetProvided and widgetOrDuration or self._unit,
504
- stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
505
- )
506
- local ____isWidgetProvided_38
507
- if isWidgetProvided then
508
- ____isWidgetProvided_38 = duration
542
+ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
543
+ if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
544
+ Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
509
545
  else
510
- ____isWidgetProvided_38 = widgetOrDuration
546
+ local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
547
+ local ____Effect_40 = Effect
548
+ local ____Effect_flash_41 = Effect.flash
549
+ local ____array_39 = __TS__SparseArrayNew(
550
+ self[105],
551
+ isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
552
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
553
+ )
554
+ local ____isWidgetProvided_38
555
+ if isWidgetProvided then
556
+ ____isWidgetProvided_38 = yOrParametersOrDuration
557
+ else
558
+ ____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
559
+ end
560
+ __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
561
+ ____Effect_flash_41(
562
+ ____Effect_40,
563
+ __TS__SparseArraySpread(____array_39)
564
+ )
511
565
  end
512
- __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
513
- ____Effect_flash_41(
514
- ____Effect_40,
515
- __TS__SparseArraySpread(____array_39)
516
- )
517
566
  end
518
567
  function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
519
568
  local isWidgetProvided = type(widgetOrDuration) == "table"
520
569
  local ____Effect_44 = Effect
521
570
  local ____Effect_flash_45 = Effect.flash
522
571
  local ____array_43 = __TS__SparseArrayNew(
523
- self[105],
572
+ self[106],
524
573
  isWidgetProvided and widgetOrDuration or self._unit,
525
574
  stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
526
575
  )
@@ -536,21 +585,25 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
536
585
  __TS__SparseArraySpread(____array_43)
537
586
  )
538
587
  end
588
+ function Buff.prototype.onCreate(self)
589
+ end
539
590
  function Buff.prototype.onDestroy(self)
591
+ check(self[100] ~= 0, "Cannot destroy a buff that has not finished creating yet.")
592
+ self[100] = 2
540
593
  local unit = self._unit
541
594
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
542
595
  removeBuff(unit.handle, self.typeId)
543
596
  end
544
597
  buffByTypeIdByUnit[unit][self.typeId] = nil
545
- local healingIntervalTimer = self[118]
598
+ local healingIntervalTimer = self[119]
546
599
  if healingIntervalTimer ~= nil then
547
600
  healingIntervalTimer:destroy()
548
- self[118] = nil
601
+ self[119] = nil
549
602
  end
550
- local damageIntervalTimer = self[113]
603
+ local damageIntervalTimer = self[114]
551
604
  if damageIntervalTimer ~= nil then
552
605
  damageIntervalTimer:destroy()
553
- self[113] = nil
606
+ self[114] = nil
554
607
  end
555
608
  if self._timer ~= nil then
556
609
  self._timer:destroy()
@@ -560,25 +613,34 @@ function Buff.prototype.onDestroy(self)
560
613
  behavior:destroy()
561
614
  end
562
615
  end
563
- if self[136] then
616
+ local previousAbilityCooldownModifier = self[144]
617
+ if previousAbilityCooldownModifier then
618
+ for ____, ability in ipairs(self._unit.abilities) do
619
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
620
+ end
621
+ end
622
+ if self[139] then
623
+ unit:decrementInvulnerabilityCounter()
624
+ end
625
+ if self[138] then
564
626
  unit:decrementDisableAutoAttackCounter()
565
627
  end
566
- if self[134] then
567
- if self[135] then
568
- unit:decrementStunCounter()
628
+ if self[136] then
629
+ if self[137] then
630
+ unit:decrementForceStunCounter()
569
631
  end
570
632
  unit:decrementStunCounter()
571
633
  end
634
+ if self[135] then
635
+ unit:decrementGhostCounter()
636
+ end
572
637
  if self._abilityTypeIds ~= nil then
573
- for abilityTypeId in pairs(self._abilityTypeIds) do
638
+ for ____, abilityTypeId in ipairs(self._abilityTypeIds) do
574
639
  unit:removeAbility(abilityTypeId)
575
640
  end
576
641
  end
577
- if self._bonusIdByBonusType ~= nil then
578
- for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
579
- removeUnitBonus(unit, bonusType, bonusId)
580
- end
581
- end
642
+ Event.invoke(buffBeingDestroyedEvent, self)
643
+ self[100] = 3
582
644
  return UnitBehavior.prototype.onDestroy(self)
583
645
  end
584
646
  function Buff.apply(self, ...)
@@ -615,72 +677,72 @@ function Buff.getByTypeId(self, unit, typeId)
615
677
  end
616
678
  function Buff.prototype.onExpiration(self)
617
679
  local unit = self.unit
618
- if self[119] ~= nil then
619
- (self[101] or unit):damageTarget(unit, self[119] or 0)
620
- end
621
680
  if self[120] ~= nil then
622
- (self[101] or unit):healTarget(unit, self[119] or 0)
681
+ (self[102] or unit):damageTarget(unit, self[120] or 0)
623
682
  end
624
- if self[139] then
683
+ if self[121] ~= nil then
684
+ (self[102] or unit):healTarget(unit, self[120] or 0)
685
+ end
686
+ if self[141] then
625
687
  unit:explode()
626
- elseif self[138] then
688
+ elseif self[140] then
627
689
  unit:kill()
628
690
  end
629
691
  end
630
692
  function Buff.prototype.onDeath(self, source)
631
693
  local unit = self.unit
632
- if self[121] ~= nil then
694
+ if self[122] ~= nil then
633
695
  damageArea(
634
- self[101] or unit,
635
- self[121],
696
+ self[102] or unit,
697
+ self[122],
636
698
  unit.x,
637
699
  unit.y,
700
+ self[124] or 0,
638
701
  self[123] or 0,
639
- self[122] or 0,
702
+ self[126] or 0,
640
703
  self[125] or 0,
641
- self[124] or 0,
642
- self[127] or 0,
643
- self[126] or 0
704
+ self[128] or 0,
705
+ self[127] or 0
644
706
  )
645
707
  end
646
708
  end
647
709
  function Buff.prototype.onDamageDealt(self, target, event)
648
710
  if event.isAttack then
649
- if self[106] ~= nil then
650
- local durationIncrease = self[106]
651
- local maximumDuration = self[107] or 0
711
+ if self[107] ~= nil then
712
+ local durationIncrease = self[107]
713
+ local maximumDuration = self[108] or 0
652
714
  if maximumDuration > 0 then
653
715
  durationIncrease = min(
654
716
  durationIncrease,
655
- max(0, maximumDuration - self[102])
717
+ max(0, maximumDuration - self[103])
656
718
  )
657
719
  end
658
720
  local remainingDuration = self.remainingDuration + durationIncrease
659
- local maximumRemainingDuration = self[108] or 0
721
+ local maximumRemainingDuration = self[109] or 0
660
722
  if maximumRemainingDuration > 0 then
661
723
  remainingDuration = min(remainingDuration, maximumRemainingDuration)
662
724
  end
663
725
  self.remainingDuration = remainingDuration
664
726
  end
665
- local autoAttackCount = (self[128] or 0) + 1
666
- self[128] = autoAttackCount
667
- if autoAttackCount == self[129] then
727
+ local autoAttackCount = (self[129] or 0) + 1
728
+ self[129] = autoAttackCount
729
+ if autoAttackCount == self[130] then
668
730
  self:destroy()
669
731
  end
670
732
  end
671
733
  if event.originalAmount ~= 0 then
672
- local damageDealtEventCount = (self[130] or 0) + 1
673
- self[130] = damageDealtEventCount
674
- if damageDealtEventCount == self[131] then
734
+ local damageDealtEventCount = (self[131] or 0) + 1
735
+ self[131] = damageDealtEventCount
736
+ if damageDealtEventCount == self[132] then
675
737
  self:destroy()
676
738
  end
677
739
  end
678
740
  end
679
741
  function Buff.prototype.onDamageReceived(self, source, event)
680
742
  if event.originalAmount ~= 0 then
681
- local damageReceivedEventCount = (self[132] or 0) + 1
682
- self[132] = damageReceivedEventCount
683
- if damageReceivedEventCount == self[133] then
743
+ local damageReceivedEventCount = (self[133] or 0) + 1
744
+ self[133] = damageReceivedEventCount
745
+ if damageReceivedEventCount == self[134] then
684
746
  self:destroy()
685
747
  end
686
748
  end
@@ -690,7 +752,7 @@ __TS__SetDescriptor(
690
752
  Buff.prototype,
691
753
  "source",
692
754
  {get = function(self)
693
- return self[101] or self._unit
755
+ return self[102] or self._unit
694
756
  end},
695
757
  true
696
758
  )
@@ -707,13 +769,13 @@ __TS__SetDescriptor(
707
769
  "remainingDamageOverDuration",
708
770
  {
709
771
  get = function(self)
710
- return self[112] or 0
772
+ return self[113] or 0
711
773
  end,
712
774
  set = function(self, remainingDamageOverDuration)
713
- local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[112] or 0)
714
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
715
- local damageOverDuration = (self[109] or 0) + remainingDamageOverDurationDelta
716
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
775
+ local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[113] or 0)
776
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
777
+ local damageOverDuration = (self[110] or 0) + remainingDamageOverDurationDelta
778
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
717
779
  end
718
780
  },
719
781
  true
@@ -723,13 +785,13 @@ __TS__SetDescriptor(
723
785
  "damageOverDuration",
724
786
  {
725
787
  get = function(self)
726
- return self[109] or 0
788
+ return self[110] or 0
727
789
  end,
728
790
  set = function(self, damageOverDuration)
729
- local damageOverDurationDelta = damageOverDuration - (self[109] or 0)
730
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
731
- local remainingDamageOverDuration = (self[112] or 0) + damageOverDurationDelta
732
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
791
+ local damageOverDurationDelta = damageOverDuration - (self[110] or 0)
792
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
793
+ local remainingDamageOverDuration = (self[113] or 0) + damageOverDurationDelta
794
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
733
795
  end
734
796
  },
735
797
  true
@@ -739,10 +801,10 @@ __TS__SetDescriptor(
739
801
  "damagePerInterval",
740
802
  {
741
803
  get = function(self)
742
- return self[110] or 0
804
+ return self[111] or 0
743
805
  end,
744
806
  set = function(self, damagePerInterval)
745
- self[110] = damagePerInterval ~= 0 and damagePerInterval or nil
807
+ self[111] = damagePerInterval ~= 0 and damagePerInterval or nil
746
808
  end
747
809
  },
748
810
  true
@@ -752,25 +814,25 @@ __TS__SetDescriptor(
752
814
  "damageInterval",
753
815
  {
754
816
  get = function(self)
755
- return self[111] or 0
817
+ return self[112] or 0
756
818
  end,
757
819
  set = function(self, damageInterval)
758
820
  if damageInterval <= 0 then
759
- self[111] = damageInterval ~= 0 and damageInterval or nil
760
- local timer = self[113]
821
+ self[112] = damageInterval ~= 0 and damageInterval or nil
822
+ local timer = self[114]
761
823
  if timer ~= nil then
762
824
  timer:destroy()
763
- self[113] = nil
825
+ self[114] = nil
764
826
  end
765
827
  return
766
828
  end
767
- self[111] = damageInterval
829
+ self[112] = damageInterval
768
830
  local ____opt_48 = self._timer
769
831
  local elapsed = ____opt_48 and ____opt_48.elapsed or 0
770
- local timer = self[113]
832
+ local timer = self[114]
771
833
  if timer == nil then
772
834
  timer = Timer:create()
773
- self[113] = timer
835
+ self[114] = timer
774
836
  end
775
837
  local initialDelay = damageInterval - (elapsed >= damageInterval and math.fmod(elapsed, damageInterval) or elapsed)
776
838
  if initialDelay == damageInterval then
@@ -787,13 +849,13 @@ __TS__SetDescriptor(
787
849
  "remainingHealingOverDuration",
788
850
  {
789
851
  get = function(self)
790
- return self[117] or 0
852
+ return self[118] or 0
791
853
  end,
792
854
  set = function(self, remainingHealingOverDuration)
793
- local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[117] or 0)
794
- self[112] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
795
- local healingOverDuration = (self[114] or 0) + remainingHealingOverDurationDelta
796
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
855
+ local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[118] or 0)
856
+ self[113] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
857
+ local healingOverDuration = (self[115] or 0) + remainingHealingOverDurationDelta
858
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
797
859
  end
798
860
  },
799
861
  true
@@ -803,13 +865,13 @@ __TS__SetDescriptor(
803
865
  "healingOverDuration",
804
866
  {
805
867
  get = function(self)
806
- return self[114] or 0
868
+ return self[115] or 0
807
869
  end,
808
870
  set = function(self, healingOverDuration)
809
- local healingOverDurationDelta = healingOverDuration - (self[114] or 0)
810
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
811
- local remainingHealingOverDuration = (self[117] or 0) + healingOverDurationDelta
812
- self[117] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
871
+ local healingOverDurationDelta = healingOverDuration - (self[115] or 0)
872
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
873
+ local remainingHealingOverDuration = (self[118] or 0) + healingOverDurationDelta
874
+ self[118] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
813
875
  end
814
876
  },
815
877
  true
@@ -819,10 +881,10 @@ __TS__SetDescriptor(
819
881
  "healingPerInterval",
820
882
  {
821
883
  get = function(self)
822
- return self[115] or 0
884
+ return self[116] or 0
823
885
  end,
824
886
  set = function(self, healingPerInterval)
825
- self[115] = healingPerInterval ~= 0 and healingPerInterval or nil
887
+ self[116] = healingPerInterval ~= 0 and healingPerInterval or nil
826
888
  end
827
889
  },
828
890
  true
@@ -832,25 +894,25 @@ __TS__SetDescriptor(
832
894
  "healingInterval",
833
895
  {
834
896
  get = function(self)
835
- return self[116] or 0
897
+ return self[117] or 0
836
898
  end,
837
899
  set = function(self, healingInterval)
838
900
  if healingInterval <= 0 then
839
- self[116] = healingInterval ~= 0 and healingInterval or nil
840
- local timer = self[118]
901
+ self[117] = healingInterval ~= 0 and healingInterval or nil
902
+ local timer = self[119]
841
903
  if timer ~= nil then
842
904
  timer:destroy()
843
- self[118] = nil
905
+ self[119] = nil
844
906
  end
845
907
  return
846
908
  end
847
- self[116] = healingInterval
909
+ self[117] = healingInterval
848
910
  local ____opt_50 = self._timer
849
911
  local elapsed = ____opt_50 and ____opt_50.elapsed or 0
850
- local timer = self[118]
912
+ local timer = self[119]
851
913
  if timer == nil then
852
914
  timer = Timer:create()
853
- self[118] = timer
915
+ self[119] = timer
854
916
  end
855
917
  local initialDelay = healingInterval - (elapsed >= healingInterval and math.fmod(elapsed, healingInterval) or elapsed)
856
918
  if initialDelay == healingInterval then
@@ -867,10 +929,10 @@ __TS__SetDescriptor(
867
929
  "damageOnExpiration",
868
930
  {
869
931
  get = function(self)
870
- return self[119] or 0
932
+ return self[120] or 0
871
933
  end,
872
934
  set = function(self, damageOnExpiration)
873
- self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
935
+ self[120] = damageOnExpiration ~= 0 and damageOnExpiration or nil
874
936
  end
875
937
  },
876
938
  true
@@ -880,10 +942,23 @@ __TS__SetDescriptor(
880
942
  "healingOnExpiration",
881
943
  {
882
944
  get = function(self)
883
- return self[120] or 0
945
+ return self[121] or 0
884
946
  end,
885
947
  set = function(self, healingOnExpiration)
886
- self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
948
+ self[121] = healingOnExpiration ~= 0 and healingOnExpiration or nil
949
+ end
950
+ },
951
+ true
952
+ )
953
+ __TS__SetDescriptor(
954
+ Buff.prototype,
955
+ "damageFactor",
956
+ {
957
+ get = function(self)
958
+ return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
959
+ end,
960
+ set = function(self, damageFactor)
961
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
887
962
  end
888
963
  },
889
964
  true
@@ -914,30 +989,53 @@ __TS__SetDescriptor(
914
989
  },
915
990
  true
916
991
  )
992
+ __TS__SetDescriptor(
993
+ Buff.prototype,
994
+ "turnsIntoGhost",
995
+ {
996
+ get = function(self)
997
+ local ____self__135_52 = self[135]
998
+ if ____self__135_52 == nil then
999
+ ____self__135_52 = false
1000
+ end
1001
+ return ____self__135_52
1002
+ end,
1003
+ set = function(self, turnsIntoGhost)
1004
+ if not turnsIntoGhost and self[135] then
1005
+ self.object:decrementGhostCounter()
1006
+ self[135] = nil
1007
+ elseif turnsIntoGhost and not self[135] then
1008
+ self.object:incrementGhostCounter()
1009
+ self[135] = true
1010
+ end
1011
+ end
1012
+ },
1013
+ true
1014
+ )
917
1015
  __TS__SetDescriptor(
918
1016
  Buff.prototype,
919
1017
  "stuns",
920
1018
  {
921
1019
  get = function(self)
922
- local ____self__134_52 = self[134]
923
- if ____self__134_52 == nil then
924
- ____self__134_52 = false
1020
+ local ____self__136_53 = self[136]
1021
+ if ____self__136_53 == nil then
1022
+ ____self__136_53 = false
925
1023
  end
926
- return ____self__134_52
1024
+ return ____self__136_53
927
1025
  end,
928
1026
  set = function(self, stuns)
929
- if not stuns and self[134] then
930
- if self[135] then
931
- self.object:decrementStunCounter()
1027
+ if not stuns and self[136] then
1028
+ if self[137] then
1029
+ self.object:decrementForceStunCounter()
932
1030
  end
933
1031
  self.object:decrementStunCounter()
934
- self[134] = nil
935
- elseif stuns and not self[134] then
936
- if self[135] then
937
- self.object:incrementStunCounter()
1032
+ self[136] = nil
1033
+ elseif stuns and not self[136] then
1034
+ if self[137] then
1035
+ self.object:incrementForceStunCounter()
938
1036
  end
939
1037
  self.object:incrementStunCounter()
940
- self[134] = true
1038
+ self[136] = true
941
1039
  end
942
1040
  end
943
1041
  },
@@ -948,23 +1046,23 @@ __TS__SetDescriptor(
948
1046
  "ignoresStunImmunity",
949
1047
  {
950
1048
  get = function(self)
951
- local ____self__135_53 = self[135]
952
- if ____self__135_53 == nil then
953
- ____self__135_53 = false
1049
+ local ____self__137_54 = self[137]
1050
+ if ____self__137_54 == nil then
1051
+ ____self__137_54 = false
954
1052
  end
955
- return ____self__135_53
1053
+ return ____self__137_54
956
1054
  end,
957
1055
  set = function(self, ignoresStunImmunity)
958
- if not ignoresStunImmunity and self[135] then
959
- if self[134] then
960
- self.object:decrementStunCounter()
1056
+ if not ignoresStunImmunity and self[137] then
1057
+ if self[136] then
1058
+ self.object:decrementForceStunCounter()
961
1059
  end
962
- self[135] = nil
963
- elseif ignoresStunImmunity and not self[135] then
964
- if self[134] then
965
- self.object:incrementStunCounter()
1060
+ self[137] = nil
1061
+ elseif ignoresStunImmunity and not self[137] then
1062
+ if self[136] then
1063
+ self.object:incrementForceStunCounter()
966
1064
  end
967
- self[135] = true
1065
+ self[137] = true
968
1066
  end
969
1067
  end
970
1068
  },
@@ -975,19 +1073,19 @@ __TS__SetDescriptor(
975
1073
  "disablesAutoAttack",
976
1074
  {
977
1075
  get = function(self)
978
- local ____self__136_54 = self[136]
979
- if ____self__136_54 == nil then
980
- ____self__136_54 = false
1076
+ local ____self__138_55 = self[138]
1077
+ if ____self__138_55 == nil then
1078
+ ____self__138_55 = false
981
1079
  end
982
- return ____self__136_54
1080
+ return ____self__138_55
983
1081
  end,
984
1082
  set = function(self, disablesAutoAttack)
985
- if not disablesAutoAttack and self[136] then
1083
+ if not disablesAutoAttack and self[138] then
986
1084
  self.object:decrementDisableAutoAttackCounter()
987
- self[136] = nil
988
- elseif disablesAutoAttack and not self[136] then
1085
+ self[138] = nil
1086
+ elseif disablesAutoAttack and not self[138] then
989
1087
  self.object:incrementDisableAutoAttackCounter()
990
- self[136] = true
1088
+ self[138] = true
991
1089
  end
992
1090
  end
993
1091
  },
@@ -998,19 +1096,19 @@ __TS__SetDescriptor(
998
1096
  "providesInvulnerability",
999
1097
  {
1000
1098
  get = function(self)
1001
- local ____self__137_55 = self[137]
1002
- if ____self__137_55 == nil then
1003
- ____self__137_55 = false
1099
+ local ____self__139_56 = self[139]
1100
+ if ____self__139_56 == nil then
1101
+ ____self__139_56 = false
1004
1102
  end
1005
- return ____self__137_55
1103
+ return ____self__139_56
1006
1104
  end,
1007
1105
  set = function(self, providesInvulnerability)
1008
- if not providesInvulnerability and self[137] then
1106
+ if not providesInvulnerability and self[139] then
1009
1107
  self.object:decrementInvulnerabilityCounter()
1010
- self[137] = nil
1011
- elseif providesInvulnerability and not self[137] then
1108
+ self[139] = nil
1109
+ elseif providesInvulnerability and not self[139] then
1012
1110
  self.object:incrementInvulnerabilityCounter()
1013
- self[137] = true
1111
+ self[139] = true
1014
1112
  end
1015
1113
  end
1016
1114
  },
@@ -1021,17 +1119,17 @@ __TS__SetDescriptor(
1021
1119
  "killsOnExpiration",
1022
1120
  {
1023
1121
  get = function(self)
1024
- local ____self__138_56 = self[138]
1025
- if ____self__138_56 == nil then
1026
- ____self__138_56 = false
1122
+ local ____self__140_57 = self[140]
1123
+ if ____self__140_57 == nil then
1124
+ ____self__140_57 = false
1027
1125
  end
1028
- return ____self__138_56
1126
+ return ____self__140_57
1029
1127
  end,
1030
1128
  set = function(self, killsOnExpiration)
1031
- if not killsOnExpiration and self[138] then
1032
- self[138] = nil
1033
- elseif killsOnExpiration and not self[138] then
1034
- self[138] = true
1129
+ if not killsOnExpiration and self[140] then
1130
+ self[140] = nil
1131
+ elseif killsOnExpiration and not self[140] then
1132
+ self[140] = true
1035
1133
  end
1036
1134
  end
1037
1135
  },
@@ -1042,17 +1140,17 @@ __TS__SetDescriptor(
1042
1140
  "explodesOnExpiration",
1043
1141
  {
1044
1142
  get = function(self)
1045
- local ____self__139_57 = self[139]
1046
- if ____self__139_57 == nil then
1047
- ____self__139_57 = false
1143
+ local ____self__141_58 = self[141]
1144
+ if ____self__141_58 == nil then
1145
+ ____self__141_58 = false
1048
1146
  end
1049
- return ____self__139_57
1147
+ return ____self__141_58
1050
1148
  end,
1051
1149
  set = function(self, killsOnExpiration)
1052
- if not killsOnExpiration and self[139] then
1053
- self[139] = nil
1054
- elseif killsOnExpiration and not self[139] then
1055
- self[139] = true
1150
+ if not killsOnExpiration and self[141] then
1151
+ self[141] = nil
1152
+ elseif killsOnExpiration and not self[141] then
1153
+ self[141] = true
1056
1154
  end
1057
1155
  end
1058
1156
  },
@@ -1063,13 +1161,13 @@ __TS__SetDescriptor(
1063
1161
  "maximumDamageDealtEventCount",
1064
1162
  {
1065
1163
  get = function(self)
1066
- return self[131] or 0
1164
+ return self[132] or 0
1067
1165
  end,
1068
1166
  set = function(self, maximumDamageDealtEventCount)
1069
1167
  if maximumDamageDealtEventCount == 0 then
1070
- self[131] = nil
1168
+ self[132] = nil
1071
1169
  else
1072
- self[131] = maximumDamageDealtEventCount
1170
+ self[132] = maximumDamageDealtEventCount
1073
1171
  end
1074
1172
  end
1075
1173
  },
@@ -1080,13 +1178,13 @@ __TS__SetDescriptor(
1080
1178
  "maximumDamageReceivedEventCount",
1081
1179
  {
1082
1180
  get = function(self)
1083
- return self[133] or 0
1181
+ return self[134] or 0
1084
1182
  end,
1085
1183
  set = function(self, maximumDamageReceivedEventCount)
1086
1184
  if maximumDamageReceivedEventCount == 0 then
1087
- self[133] = nil
1185
+ self[134] = nil
1088
1186
  else
1089
- self[133] = maximumDamageReceivedEventCount
1187
+ self[134] = maximumDamageReceivedEventCount
1090
1188
  end
1091
1189
  end
1092
1190
  },
@@ -1097,13 +1195,13 @@ __TS__SetDescriptor(
1097
1195
  "maximumAutoAttackCount",
1098
1196
  {
1099
1197
  get = function(self)
1100
- return self[129] or 0
1198
+ return self[130] or 0
1101
1199
  end,
1102
1200
  set = function(self, maximumAutoAttackCount)
1103
1201
  if maximumAutoAttackCount == 0 then
1104
- self[129] = nil
1202
+ self[130] = nil
1105
1203
  else
1106
- self[129] = maximumAutoAttackCount
1204
+ self[130] = maximumAutoAttackCount
1107
1205
  end
1108
1206
  end
1109
1207
  },
@@ -1114,10 +1212,10 @@ __TS__SetDescriptor(
1114
1212
  "durationIncreaseOnAutoAttack",
1115
1213
  {
1116
1214
  get = function(self)
1117
- return self[106] or 0
1215
+ return self[107] or 0
1118
1216
  end,
1119
1217
  set = function(self, durationIncreaseOnAutoAttack)
1120
- self[106] = durationIncreaseOnAutoAttack
1218
+ self[107] = durationIncreaseOnAutoAttack
1121
1219
  end
1122
1220
  },
1123
1221
  true
@@ -1148,11 +1246,37 @@ __TS__SetDescriptor(
1148
1246
  },
1149
1247
  true
1150
1248
  )
1249
+ __TS__SetDescriptor(
1250
+ Buff.prototype,
1251
+ "evasionProbability",
1252
+ {
1253
+ get = function(self)
1254
+ return self:getUnitBonus(UnitBonusType.EVASION_PROBABILITY)
1255
+ end,
1256
+ set = function(self, evasionProbability)
1257
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.EVASION_PROBABILITY, evasionProbability)
1258
+ end
1259
+ },
1260
+ true
1261
+ )
1262
+ __TS__SetDescriptor(
1263
+ Buff.prototype,
1264
+ "manaRegenerationRateIncreaseFactor",
1265
+ {
1266
+ get = function(self)
1267
+ return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
1268
+ end,
1269
+ set = function(self, manaRegenerationRateIncreaseFactor)
1270
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
1271
+ end
1272
+ },
1273
+ true
1274
+ )
1151
1275
  __TS__SetDescriptor(
1152
1276
  Buff.prototype,
1153
1277
  "duration",
1154
1278
  {get = function(self)
1155
- return self[102]
1279
+ return self[103]
1156
1280
  end},
1157
1281
  true
1158
1282
  )
@@ -1161,15 +1285,15 @@ __TS__SetDescriptor(
1161
1285
  "remainingDuration",
1162
1286
  {
1163
1287
  get = function(self)
1164
- local ____opt_58 = self._timer
1165
- return ____opt_58 and ____opt_58.remaining or 0
1288
+ local ____opt_59 = self._timer
1289
+ return ____opt_59 and ____opt_59.remaining or 0
1166
1290
  end,
1167
1291
  set = function(self, remainingDuration)
1168
- local ____remainingDuration_62 = remainingDuration
1169
- local ____opt_60 = self._timer
1170
- local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1292
+ local ____remainingDuration_63 = remainingDuration
1293
+ local ____opt_61 = self._timer
1294
+ local remainingDurationDelta = ____remainingDuration_63 - (____opt_61 and ____opt_61.remaining or 0)
1171
1295
  if remainingDurationDelta ~= 0 then
1172
- self[102] = self[102] + remainingDurationDelta
1296
+ self[103] = self[103] + remainingDurationDelta
1173
1297
  if remainingDuration <= 0 then
1174
1298
  Timer:run(destroyBuff, self)
1175
1299
  else
@@ -1181,7 +1305,8 @@ __TS__SetDescriptor(
1181
1305
  self._level,
1182
1306
  remainingDuration,
1183
1307
  self._spellStealPriority,
1184
- self._learnLevelMinimum
1308
+ self._learnLevelMinimum,
1309
+ self[142]
1185
1310
  ) then
1186
1311
  local timer = self._timer
1187
1312
  if timer == nil then
@@ -1195,10 +1320,38 @@ __TS__SetDescriptor(
1195
1320
  end
1196
1321
  },
1197
1322
  true
1198
- );
1323
+ )
1324
+ __TS__SetDescriptor(
1325
+ Buff.prototype,
1326
+ "abilityCooldownFactor",
1327
+ {
1328
+ get = function(self)
1329
+ return self[143] or 1
1330
+ end,
1331
+ set = function(self, abilityCooldownFactor)
1332
+ local previousAbilityCooldownModifier = self[144]
1333
+ if previousAbilityCooldownModifier then
1334
+ for ____, ability in ipairs(self._unit.abilities) do
1335
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
1336
+ end
1337
+ end
1338
+ local function modifier(ability, level, cooldown)
1339
+ return cooldown * abilityCooldownFactor
1340
+ end
1341
+ for ____, ability in ipairs(self._unit.abilities) do
1342
+ COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
1343
+ end
1344
+ self[144] = modifier
1345
+ self[143] = abilityCooldownFactor
1346
+ end
1347
+ },
1348
+ true
1349
+ )
1350
+ Buff.createdEvent = buffCreatedEvent
1351
+ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
1199
1352
  (function(self)
1200
1353
  local function destroyBuffIfNeeded(buff)
1201
- if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1354
+ if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
1202
1355
  buff:destroy()
1203
1356
  end
1204
1357
  end
@@ -1249,5 +1402,11 @@ __TS__SetDescriptor(
1249
1402
  ____exports.checkBuffs(target)
1250
1403
  end
1251
1404
  )
1405
+ buffCreatedEvent:addListener(function(buff)
1406
+ UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
1407
+ end)
1408
+ buffBeingDestroyedEvent:addListener(function(buff)
1409
+ UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
1410
+ end)
1252
1411
  end)(Buff)
1253
1412
  return ____exports