warscript 0.0.1-dev.4363c65 → 0.0.1-dev.46595c8

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 (182) hide show
  1. package/attributes.d.ts +5 -0
  2. package/attributes.lua +8 -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 +71 -0
  9. package/core/types/sound.d.ts +17 -24
  10. package/core/types/sound.lua +99 -24
  11. package/core/types/timer.d.ts +6 -7
  12. package/core/types/timer.lua +18 -21
  13. package/core/util.d.ts +1 -1
  14. package/core/util.lua +18 -1
  15. package/decl/native.d.ts +840 -786
  16. package/engine/behavior.d.ts +2 -2
  17. package/engine/behavior.lua +6 -6
  18. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  19. package/engine/behaviour/ability/always-enabled.lua +31 -0
  20. package/engine/behaviour/ability/apply-buff.d.ts +8 -5
  21. package/engine/behaviour/ability/apply-buff.lua +32 -0
  22. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  23. package/engine/behaviour/ability/damage.d.ts +9 -3
  24. package/engine/behaviour/ability/damage.lua +26 -38
  25. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  26. package/engine/behaviour/ability/emulate-impact.lua +42 -0
  27. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  28. package/engine/behaviour/ability/instant-impact.lua +4 -19
  29. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  30. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  31. package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
  32. package/engine/behaviour/ability/remove-buffs.lua +28 -0
  33. package/engine/behaviour/ability.d.ts +20 -4
  34. package/engine/behaviour/ability.lua +112 -39
  35. package/engine/behaviour/unit.d.ts +22 -0
  36. package/engine/behaviour/unit.lua +134 -4
  37. package/engine/buff.d.ts +73 -47
  38. package/engine/buff.lua +329 -236
  39. package/engine/internal/ability.d.ts +20 -13
  40. package/engine/internal/ability.lua +97 -76
  41. package/engine/internal/item/ability.lua +112 -4
  42. package/engine/internal/item+owner.lua +2 -2
  43. package/engine/internal/item.d.ts +7 -4
  44. package/engine/internal/item.lua +131 -28
  45. package/engine/internal/mechanics/ability-duration.lua +1 -1
  46. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  47. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  48. package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
  49. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  50. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  51. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  52. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  53. package/engine/internal/object-data/evasion-probability.lua +16 -0
  54. package/engine/internal/unit/ability.d.ts +15 -1
  55. package/engine/internal/unit/ability.lua +50 -14
  56. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  57. package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
  58. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  59. package/engine/internal/unit/add-item-to-slot.lua +52 -0
  60. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  61. package/engine/internal/unit/allowed-targets.lua +9 -1
  62. package/engine/internal/unit/bonus.d.ts +6 -2
  63. package/engine/internal/unit/bonus.lua +23 -1
  64. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  65. package/engine/internal/unit/ignore-events-items.lua +5 -0
  66. package/engine/internal/unit/item.d.ts +24 -0
  67. package/engine/internal/unit/item.lua +78 -0
  68. package/engine/internal/unit/main-selected.d.ts +13 -0
  69. package/engine/internal/unit/main-selected.lua +51 -0
  70. package/engine/internal/unit/order.d.ts +20 -0
  71. package/engine/internal/unit/order.lua +127 -0
  72. package/engine/internal/unit+ability.lua +2 -2
  73. package/engine/internal/unit+damage.d.ts +2 -11
  74. package/engine/internal/unit+damage.lua +10 -14
  75. package/engine/internal/unit+spellSteal.lua +1 -2
  76. package/engine/internal/unit-missile-launch.lua +25 -6
  77. package/engine/internal/unit.d.ts +52 -13
  78. package/engine/internal/unit.lua +344 -116
  79. package/engine/internal/utility.lua +12 -0
  80. package/engine/lightning.d.ts +12 -5
  81. package/engine/lightning.lua +48 -14
  82. package/engine/local-client.d.ts +7 -2
  83. package/engine/local-client.lua +82 -0
  84. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  85. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  86. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
  87. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  88. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  89. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  90. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  91. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  92. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  93. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  94. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  95. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  96. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  97. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  98. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  99. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  100. package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
  101. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  102. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  103. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  104. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  105. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  106. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  107. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  108. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  109. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  110. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  111. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  112. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  113. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  114. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  115. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  116. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  117. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  118. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  119. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  120. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  121. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  122. package/engine/object-data/entry/ability-type/web.lua +52 -0
  123. package/engine/object-data/entry/ability-type.d.ts +19 -17
  124. package/engine/object-data/entry/ability-type.lua +89 -33
  125. package/engine/object-data/entry/buff-type/applicable.lua +18 -37
  126. package/engine/object-data/entry/buff-type.d.ts +6 -12
  127. package/engine/object-data/entry/buff-type.lua +13 -29
  128. package/engine/object-data/entry/destructible-type.d.ts +1 -1
  129. package/engine/object-data/entry/item-type.d.ts +15 -1
  130. package/engine/object-data/entry/item-type.lua +93 -2
  131. package/engine/object-data/entry/lightning-type.d.ts +1 -1
  132. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  133. package/engine/object-data/entry/sound-preset.lua +140 -0
  134. package/engine/object-data/entry/unit-type.d.ts +10 -3
  135. package/engine/object-data/entry/unit-type.lua +155 -92
  136. package/engine/object-data/entry/upgrade.d.ts +1 -1
  137. package/engine/object-data/entry/upgrade.lua +4 -4
  138. package/engine/object-data/entry.d.ts +16 -14
  139. package/engine/object-data/entry.lua +60 -32
  140. package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
  141. package/engine/object-field/ability.d.ts +10 -4
  142. package/engine/object-field/ability.lua +4 -1
  143. package/engine/object-field/unit.d.ts +46 -3
  144. package/engine/object-field/unit.lua +173 -7
  145. package/engine/object-field.d.ts +17 -6
  146. package/engine/object-field.lua +187 -89
  147. package/engine/standard/entries/buff-type.d.ts +3 -0
  148. package/engine/standard/entries/buff-type.lua +3 -0
  149. package/engine/standard/entries/sound-preset.d.ts +10 -0
  150. package/engine/standard/entries/sound-preset.lua +10 -0
  151. package/engine/standard/fields/ability.d.ts +2 -0
  152. package/engine/standard/fields/ability.lua +2 -0
  153. package/engine/text-tag.d.ts +12 -1
  154. package/engine/text-tag.lua +44 -10
  155. package/engine/unit.d.ts +4 -0
  156. package/engine/unit.lua +4 -0
  157. package/index.d.ts +1 -0
  158. package/index.lua +1 -0
  159. package/net/socket.d.ts +7 -1
  160. package/net/socket.lua +45 -4
  161. package/network.d.ts +1 -0
  162. package/network.lua +3 -2
  163. package/objutil/buff.lua +2 -3
  164. package/objutil/unit.lua +8 -0
  165. package/package.json +2 -2
  166. package/patch-lua.d.ts +0 -0
  167. package/patch-lua.lua +10 -0
  168. package/utility/arrays.d.ts +9 -1
  169. package/utility/arrays.lua +37 -3
  170. package/utility/functions.d.ts +1 -0
  171. package/utility/functions.lua +1 -0
  172. package/utility/lazy.d.ts +2 -0
  173. package/utility/lazy.lua +14 -0
  174. package/utility/linked-set.d.ts +1 -0
  175. package/utility/linked-set.lua +3 -0
  176. package/utility/lua-maps.d.ts +4 -0
  177. package/utility/lua-maps.lua +20 -0
  178. package/utility/lua-sets.d.ts +1 -0
  179. package/utility/lua-sets.lua +3 -0
  180. package/utility/reflection.lua +11 -7
  181. package/core/types/order.d.ts +0 -25
  182. package/core/types/order.lua +0 -55
package/engine/buff.lua CHANGED
@@ -35,6 +35,7 @@ local UnitBonusType = ____bonus.UnitBonusType
35
35
  local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
36
36
  local damageArea = ____area_2Ddamage.damageArea
37
37
  local ____preconditions = require("utility.preconditions")
38
+ local check = ____preconditions.check
38
39
  local checkNotNull = ____preconditions.checkNotNull
39
40
  local ____effect = require("core.types.effect")
40
41
  local Effect = ____effect.Effect
@@ -44,8 +45,14 @@ local ____unit = require("engine.behaviour.unit")
44
45
  local UnitBehavior = ____unit.UnitBehavior
45
46
  local ____arrays = require("utility.arrays")
46
47
  local forEach = ____arrays.forEach
48
+ local ____event = require("event")
49
+ local Event = ____event.Event
47
50
  local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
48
51
  local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
52
+ local ____item = require("engine.internal.item")
53
+ local Item = ____item.Item
54
+ local ____destructable = require("core.types.destructable")
55
+ local Destructable = ____destructable.Destructable
49
56
  local getUnitAbility = BlzGetUnitAbility
50
57
  local stringValueByBuffTypeIdByFieldId = postcompile(function()
51
58
  local stringValueByBuffTypeIdByFieldId = {}
@@ -94,11 +101,15 @@ local buffParametersKeys = {
94
101
  armorIncreaseFactor = true,
95
102
  attackSpeedIncreaseFactor = true,
96
103
  movementSpeedIncreaseFactor = true,
104
+ evasionProbability = true,
105
+ missProbability = true,
106
+ damageFactor = true,
97
107
  receivedDamageFactor = true,
98
108
  receivedMagicDamageFactor = true,
99
109
  durationIncreaseOnAutoAttack = true,
100
110
  maximumDuration = true,
101
111
  maximumRemainingDuration = true,
112
+ turnsIntoGhost = true,
102
113
  stuns = true,
103
114
  ignoresStunImmunity = true,
104
115
  providesStunImmunity = true,
@@ -164,6 +175,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
164
175
  end
165
176
  end
166
177
  local buffBooleanParameters = {
178
+ "turnsIntoGhost",
167
179
  "stuns",
168
180
  "ignoresStunImmunity",
169
181
  "disablesAutoAttack",
@@ -175,7 +187,9 @@ local buffNumberParameters = {
175
187
  "durationIncreaseOnAutoAttack",
176
188
  "attackSpeedIncreaseFactor",
177
189
  "movementSpeedIncreaseFactor",
190
+ "evasionProbability",
178
191
  "armorIncrease",
192
+ "damageFactor",
179
193
  "receivedDamageFactor",
180
194
  "maximumAutoAttackCount",
181
195
  "maximumDamageDealtEventCount",
@@ -214,7 +228,7 @@ local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
214
228
  return checkNotNull(firstNativeBuffTypeId)
215
229
  end
216
230
  local function destroyBuffIfItHasSameUniqueGroup(buff, uniqueGroup)
217
- if buff[103] == uniqueGroup then
231
+ if buff[104] == uniqueGroup then
218
232
  buff:destroy()
219
233
  end
220
234
  end
@@ -222,17 +236,17 @@ local function destroyBuff(buff)
222
236
  buff:destroy()
223
237
  end
224
238
  local function expireBuff(buff)
225
- local remainingDamageOverDuration = buff[112] or 0
226
- local remainingHealingOverDuration = buff[112] or 0
239
+ local remainingDamageOverDuration = buff[113] or 0
240
+ local remainingHealingOverDuration = buff[113] or 0
227
241
  if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
228
242
  buff:flashSpecialEffect()
229
243
  if remainingDamageOverDuration ~= 0 then
230
- (buff[101] or buff[100]):damageTarget(buff[100], remainingDamageOverDuration)
231
- buff[112] = nil
244
+ (buff[102] or buff[101]):damageTarget(buff[101], remainingDamageOverDuration)
245
+ buff[113] = nil
232
246
  end
233
247
  if remainingHealingOverDuration ~= 0 then
234
- (buff[101] or buff[100]):healTarget(buff[100], remainingHealingOverDuration)
235
- buff[117] = nil
248
+ (buff[102] or buff[101]):healTarget(buff[101], remainingHealingOverDuration)
249
+ buff[118] = nil
236
250
  end
237
251
  end
238
252
  Timer:run(destroyBuff, buff)
@@ -240,56 +254,57 @@ local function expireBuff(buff)
240
254
  end
241
255
  local function buffDamageIntervalInitialTimerCallback(buff)
242
256
  buffDamageIntervalTimerCallback(buff)
243
- local timer = buff[113]
244
- local damageInterval = buff[111]
257
+ local timer = buff[114]
258
+ local damageInterval = buff[112]
245
259
  if timer ~= nil and damageInterval ~= nil and damageInterval > 0 then
246
260
  timer:start(damageInterval, true, buffDamageIntervalTimerCallback, buff)
247
261
  end
248
262
  end
249
263
  buffDamageIntervalTimerCallback = function(buff)
250
264
  buff:flashSpecialEffect()
251
- local source = buff[101] or buff[100]
252
- local remainingDamageOverDuration = buff[112] or 0
265
+ local source = buff[102] or buff[101]
266
+ local remainingDamageOverDuration = buff[113] or 0
253
267
  if remainingDamageOverDuration ~= 0 then
254
- local damageInterval = buff[111] or 0
268
+ local damageInterval = buff[112] or 0
255
269
  if damageInterval ~= 0 then
256
270
  local damage = remainingDamageOverDuration / (1 + buff.remainingDuration / damageInterval)
257
- source:damageTarget(buff[100], damage)
258
- buff[112] = remainingDamageOverDuration - damage
271
+ source:damageTarget(buff[101], damage)
272
+ buff[113] = remainingDamageOverDuration - damage
259
273
  end
260
274
  end
261
- local damagePerInterval = buff[110] or 0
275
+ local damagePerInterval = buff[111] or 0
262
276
  if remainingDamageOverDuration == 0 or damagePerInterval ~= 0 then
263
- source:damageTarget(buff[100], damagePerInterval)
277
+ source:damageTarget(buff[101], damagePerInterval)
264
278
  end
265
279
  end
266
280
  local function buffHealingIntervalInitialTimerCallback(buff)
267
281
  buffHealingIntervalTimerCallback(buff)
268
- local timer = buff[118]
269
- local healingInterval = buff[116]
282
+ local timer = buff[119]
283
+ local healingInterval = buff[117]
270
284
  if timer ~= nil and healingInterval ~= nil and healingInterval > 0 then
271
285
  timer:start(healingInterval, true, buffHealingIntervalTimerCallback, buff)
272
286
  end
273
287
  end
274
288
  buffHealingIntervalTimerCallback = function(buff)
275
- if buff[116] ~= buff[111] then
289
+ if buff[117] ~= buff[112] then
276
290
  buff:flashSpecialEffect()
277
291
  end
278
- local source = buff[101] or buff[100]
279
- local remainingHealingOverDuration = buff[117] or 0
292
+ local source = buff[102] or buff[101]
293
+ local remainingHealingOverDuration = buff[118] or 0
280
294
  if remainingHealingOverDuration ~= 0 then
281
- local healingInterval = buff[116] or 0
295
+ local healingInterval = buff[117] or 0
282
296
  if healingInterval ~= 0 then
283
297
  local healing = remainingHealingOverDuration / (1 + buff.remainingDuration / healingInterval)
284
- source:healTarget(buff[100], healing)
285
- buff[117] = remainingHealingOverDuration - healing
298
+ source:healTarget(buff[101], healing)
299
+ buff[118] = remainingHealingOverDuration - healing
286
300
  end
287
301
  end
288
- local healingPerInterval = buff[115] or 0
302
+ local healingPerInterval = buff[116] or 0
289
303
  if remainingHealingOverDuration == 0 or healingPerInterval ~= 0 then
290
- source:healTarget(buff[100], healingPerInterval)
304
+ source:healTarget(buff[101], healingPerInterval)
291
305
  end
292
306
  end
307
+ local buffDestroyEvent = __TS__New(Event)
293
308
  ____exports.Buff = __TS__Class()
294
309
  local Buff = ____exports.Buff
295
310
  Buff.name = "Buff"
@@ -298,7 +313,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
298
313
  UnitBehavior.prototype.____constructor(self, _unit)
299
314
  self._unit = _unit
300
315
  self.parameters = nil
301
- self[100] = _unit
316
+ self[100] = 0
317
+ self[101] = _unit
302
318
  local typeId
303
319
  local polarity
304
320
  local resistanceType
@@ -307,7 +323,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
307
323
  typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
308
324
  polarity = resistanceTypeOrPolarity
309
325
  resistanceType = abilityOrParametersOrResistanceType
310
- if __TS__InstanceOf(parametersOrAbility, Ability) then
326
+ if __TS__InstanceOf(parametersOrAbility, Ability) or parametersOrAbility == nil then
311
327
  ability = parametersOrAbility
312
328
  else
313
329
  ability = nil
@@ -317,7 +333,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
317
333
  typeId = typeIdOrTypeIds
318
334
  polarity = polarityOrTypeIdSelectionPolicy
319
335
  resistanceType = resistanceTypeOrPolarity
320
- if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
336
+ if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) or abilityOrParametersOrResistanceType == nil then
321
337
  ability = abilityOrParametersOrResistanceType
322
338
  parameters = parametersOrAbility
323
339
  else
@@ -326,7 +342,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
326
342
  end
327
343
  end
328
344
  self.typeId = typeId
329
- if not __TS__InstanceOf(ability, Ability) then
345
+ if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
330
346
  parameters = ability
331
347
  ability = nil
332
348
  end
@@ -354,14 +370,19 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
354
370
  end
355
371
  self.polarity = resolveEnumValue(ability, level, polarity)
356
372
  self.resistanceType = resolveEnumValue(ability, level, resistanceType)
373
+ local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
374
+ if missProbability ~= nil then
375
+ missProbability = resolveNumberValue(ability, level, missProbability)
376
+ self[142] = missProbability
377
+ end
357
378
  local buffByTypeId = buffByTypeIdByUnit[_unit]
358
379
  if buffByTypeId == nil then
359
380
  buffByTypeId = {}
360
381
  buffByTypeIdByUnit[_unit] = buffByTypeId
361
382
  end
362
- local ____opt_13 = buffByTypeId[typeId]
363
- if ____opt_13 ~= nil then
364
- ____opt_13:destroy()
383
+ local ____opt_15 = buffByTypeId[typeId]
384
+ if ____opt_15 ~= nil then
385
+ ____opt_15:destroy()
365
386
  end
366
387
  local uniqueGroup = parameters and parameters.uniqueGroup or defaultParameters and defaultParameters.uniqueGroup
367
388
  if uniqueGroup ~= nil then
@@ -375,13 +396,16 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
375
396
  level,
376
397
  duration,
377
398
  spellStealPriority,
378
- learnLevelMinimum
399
+ learnLevelMinimum,
400
+ missProbability
379
401
  ) then
402
+ self[100] = 1
380
403
  UnitBehavior.prototype.destroy(self)
381
404
  error(unsuccessfulApplicationMarker, 0)
382
405
  end
383
406
  local handle = BlzGetUnitAbility(_unit.handle, typeId)
384
407
  if handle == nil then
408
+ self[100] = 1
385
409
  UnitBehavior.prototype.destroy(self)
386
410
  error(unsuccessfulApplicationMarker, 0)
387
411
  end
@@ -390,20 +414,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
390
414
  self._level = level
391
415
  self._spellStealPriority = spellStealPriority
392
416
  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)
417
+ self[102] = source
418
+ self[103] = duration or 0
419
+ self[104] = uniqueGroup
420
+ self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
421
+ self[106] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
398
422
  if parameters ~= nil or (next(defaultParameters)) ~= nil then
399
423
  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]
424
+ local ____ability_24 = ability
425
+ local ____level_25 = level
426
+ local ____temp_23 = parameters and parameters[buffBooleanParameter]
427
+ if ____temp_23 == nil then
428
+ ____temp_23 = defaultParameters[buffBooleanParameter]
405
429
  end
406
- if resolveBooleanValue(____ability_22, ____level_23, ____temp_21) then
430
+ if resolveBooleanValue(____ability_24, ____level_25, ____temp_23) then
407
431
  self[buffBooleanParameter] = true
408
432
  end
409
433
  end
@@ -419,11 +443,11 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
419
443
  end
420
444
  local maximumDuration = parameters and parameters.maximumDuration or defaultParameters.maximumDuration
421
445
  if maximumDuration ~= nil then
422
- self[107] = resolveNumberValue(ability, level, maximumDuration)
446
+ self[108] = resolveNumberValue(ability, level, maximumDuration)
423
447
  end
424
448
  local maximumRemainingDuration = parameters and parameters.maximumRemainingDuration or defaultParameters.maximumRemainingDuration
425
449
  if maximumRemainingDuration ~= nil then
426
- self[108] = resolveNumberValue(ability, level, maximumRemainingDuration)
450
+ self[109] = resolveNumberValue(ability, level, maximumRemainingDuration)
427
451
  end
428
452
  local parametersAbilityTypeIds = parameters and parameters.abilityTypeIds or defaultParameters.abilityTypeIds
429
453
  if parametersAbilityTypeIds ~= nil then
@@ -480,10 +504,12 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
480
504
  timer:start(duration, false, expireBuff, self)
481
505
  self._timer = timer
482
506
  end
507
+ self:onCreate()
508
+ self[100] = 1
483
509
  end
484
510
  function Buff.prototype.getUnitBonus(self, bonusType)
485
- local ____opt_36 = self._bonusIdByBonusType
486
- local bonusId = ____opt_36 and ____opt_36[bonusType]
511
+ local ____opt_38 = self._bonusIdByBonusType
512
+ local bonusId = ____opt_38 and ____opt_38[bonusType]
487
513
  return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
488
514
  end
489
515
  function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
@@ -494,63 +520,71 @@ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
494
520
  end
495
521
  bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
496
522
  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
523
+ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
524
+ if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
525
+ Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
509
526
  else
510
- ____isWidgetProvided_38 = widgetOrDuration
527
+ local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
528
+ local ____Effect_42 = Effect
529
+ local ____Effect_flash_43 = Effect.flash
530
+ local ____array_41 = __TS__SparseArrayNew(
531
+ self[105],
532
+ isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
533
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
534
+ )
535
+ local ____isWidgetProvided_40
536
+ if isWidgetProvided then
537
+ ____isWidgetProvided_40 = yOrParametersOrDuration
538
+ else
539
+ ____isWidgetProvided_40 = widgetOrXOrParametersOrDuration
540
+ end
541
+ __TS__SparseArrayPush(____array_41, ____isWidgetProvided_40)
542
+ ____Effect_flash_43(
543
+ ____Effect_42,
544
+ __TS__SparseArraySpread(____array_41)
545
+ )
511
546
  end
512
- __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
513
- ____Effect_flash_41(
514
- ____Effect_40,
515
- __TS__SparseArraySpread(____array_39)
516
- )
517
547
  end
518
548
  function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
519
549
  local isWidgetProvided = type(widgetOrDuration) == "table"
520
- local ____Effect_44 = Effect
521
- local ____Effect_flash_45 = Effect.flash
522
- local ____array_43 = __TS__SparseArrayNew(
523
- self[105],
550
+ local ____Effect_46 = Effect
551
+ local ____Effect_flash_47 = Effect.flash
552
+ local ____array_45 = __TS__SparseArrayNew(
553
+ self[106],
524
554
  isWidgetProvided and widgetOrDuration or self._unit,
525
555
  stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
526
556
  )
527
- local ____isWidgetProvided_42
557
+ local ____isWidgetProvided_44
528
558
  if isWidgetProvided then
529
- ____isWidgetProvided_42 = duration
559
+ ____isWidgetProvided_44 = duration
530
560
  else
531
- ____isWidgetProvided_42 = widgetOrDuration
561
+ ____isWidgetProvided_44 = widgetOrDuration
532
562
  end
533
- __TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
534
- ____Effect_flash_45(
535
- ____Effect_44,
536
- __TS__SparseArraySpread(____array_43)
563
+ __TS__SparseArrayPush(____array_45, ____isWidgetProvided_44)
564
+ ____Effect_flash_47(
565
+ ____Effect_46,
566
+ __TS__SparseArraySpread(____array_45)
537
567
  )
538
568
  end
569
+ function Buff.prototype.onCreate(self)
570
+ end
539
571
  function Buff.prototype.onDestroy(self)
572
+ check(self[100] ~= 0, "Cannot destroy a buff that has not finished creating yet.")
573
+ self[100] = 2
540
574
  local unit = self._unit
541
575
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
542
576
  removeBuff(unit.handle, self.typeId)
543
577
  end
544
578
  buffByTypeIdByUnit[unit][self.typeId] = nil
545
- local healingIntervalTimer = self[118]
579
+ local healingIntervalTimer = self[119]
546
580
  if healingIntervalTimer ~= nil then
547
581
  healingIntervalTimer:destroy()
548
- self[118] = nil
582
+ self[119] = nil
549
583
  end
550
- local damageIntervalTimer = self[113]
584
+ local damageIntervalTimer = self[114]
551
585
  if damageIntervalTimer ~= nil then
552
586
  damageIntervalTimer:destroy()
553
- self[113] = nil
587
+ self[114] = nil
554
588
  end
555
589
  if self._timer ~= nil then
556
590
  self._timer:destroy()
@@ -560,15 +594,21 @@ function Buff.prototype.onDestroy(self)
560
594
  behavior:destroy()
561
595
  end
562
596
  end
563
- if self[136] then
597
+ if self[139] then
598
+ unit:decrementInvulnerabilityCounter()
599
+ end
600
+ if self[138] then
564
601
  unit:decrementDisableAutoAttackCounter()
565
602
  end
566
- if self[134] then
567
- if self[135] then
603
+ if self[136] then
604
+ if self[137] then
568
605
  unit:decrementStunCounter()
569
606
  end
570
607
  unit:decrementStunCounter()
571
608
  end
609
+ if self[135] then
610
+ unit:decrementGhostCounter()
611
+ end
572
612
  if self._abilityTypeIds ~= nil then
573
613
  for abilityTypeId in pairs(self._abilityTypeIds) do
574
614
  unit:removeAbility(abilityTypeId)
@@ -579,6 +619,8 @@ function Buff.prototype.onDestroy(self)
579
619
  removeUnitBonus(unit, bonusType, bonusId)
580
620
  end
581
621
  end
622
+ Event.invoke(buffDestroyEvent, self)
623
+ self[100] = 3
582
624
  return UnitBehavior.prototype.onDestroy(self)
583
625
  end
584
626
  function Buff.apply(self, ...)
@@ -606,8 +648,8 @@ function Buff.apply(self, ...)
606
648
  end
607
649
  end
608
650
  function Buff.getByTypeId(self, unit, typeId)
609
- local ____opt_46 = buffByTypeIdByUnit[unit]
610
- local buff = ____opt_46 and ____opt_46[typeId]
651
+ local ____opt_48 = buffByTypeIdByUnit[unit]
652
+ local buff = ____opt_48 and ____opt_48[typeId]
611
653
  if __TS__InstanceOf(buff, self) then
612
654
  return buff
613
655
  end
@@ -615,72 +657,72 @@ function Buff.getByTypeId(self, unit, typeId)
615
657
  end
616
658
  function Buff.prototype.onExpiration(self)
617
659
  local unit = self.unit
618
- if self[119] ~= nil then
619
- (self[101] or unit):damageTarget(unit, self[119] or 0)
620
- end
621
660
  if self[120] ~= nil then
622
- (self[101] or unit):healTarget(unit, self[119] or 0)
661
+ (self[102] or unit):damageTarget(unit, self[120] or 0)
623
662
  end
624
- if self[139] then
663
+ if self[121] ~= nil then
664
+ (self[102] or unit):healTarget(unit, self[120] or 0)
665
+ end
666
+ if self[141] then
625
667
  unit:explode()
626
- elseif self[138] then
668
+ elseif self[140] then
627
669
  unit:kill()
628
670
  end
629
671
  end
630
672
  function Buff.prototype.onDeath(self, source)
631
673
  local unit = self.unit
632
- if self[121] ~= nil then
674
+ if self[122] ~= nil then
633
675
  damageArea(
634
- self[101] or unit,
635
- self[121],
676
+ self[102] or unit,
677
+ self[122],
636
678
  unit.x,
637
679
  unit.y,
680
+ self[124] or 0,
638
681
  self[123] or 0,
639
- self[122] or 0,
682
+ self[126] or 0,
640
683
  self[125] or 0,
641
- self[124] or 0,
642
- self[127] or 0,
643
- self[126] or 0
684
+ self[128] or 0,
685
+ self[127] or 0
644
686
  )
645
687
  end
646
688
  end
647
689
  function Buff.prototype.onDamageDealt(self, target, event)
648
690
  if event.isAttack then
649
- if self[106] ~= nil then
650
- local durationIncrease = self[106]
651
- local maximumDuration = self[107] or 0
691
+ if self[107] ~= nil then
692
+ local durationIncrease = self[107]
693
+ local maximumDuration = self[108] or 0
652
694
  if maximumDuration > 0 then
653
695
  durationIncrease = min(
654
696
  durationIncrease,
655
- max(0, maximumDuration - self[102])
697
+ max(0, maximumDuration - self[103])
656
698
  )
657
699
  end
658
700
  local remainingDuration = self.remainingDuration + durationIncrease
659
- local maximumRemainingDuration = self[108] or 0
701
+ local maximumRemainingDuration = self[109] or 0
660
702
  if maximumRemainingDuration > 0 then
661
703
  remainingDuration = min(remainingDuration, maximumRemainingDuration)
662
704
  end
663
705
  self.remainingDuration = remainingDuration
664
706
  end
665
- local autoAttackCount = (self[128] or 0) + 1
666
- self[128] = autoAttackCount
667
- if autoAttackCount == self[129] then
707
+ local autoAttackCount = (self[129] or 0) + 1
708
+ self[129] = autoAttackCount
709
+ if autoAttackCount == self[130] then
668
710
  self:destroy()
669
711
  end
670
712
  end
671
- if event.amount ~= 0 then
672
- local damageDealtEventCount = (self[130] or 0) + 1
673
- self[130] = damageDealtEventCount
674
- if damageDealtEventCount == self[131] then
713
+ if event.originalAmount ~= 0 then
714
+ local damageDealtEventCount = (self[131] or 0) + 1
715
+ self[131] = damageDealtEventCount
716
+ if damageDealtEventCount == self[132] then
675
717
  self:destroy()
676
718
  end
677
719
  end
678
720
  end
679
721
  function Buff.prototype.onDamageReceived(self, source, event)
680
- if event.amount ~= 0 then
681
- local damageReceivedEventCount = (self[132] or 0) + 1
682
- self[132] = damageReceivedEventCount
683
- if damageReceivedEventCount == self[133] then
722
+ if event.originalAmount ~= 0 then
723
+ local damageReceivedEventCount = (self[133] or 0) + 1
724
+ self[133] = damageReceivedEventCount
725
+ if damageReceivedEventCount == self[134] then
684
726
  self:destroy()
685
727
  end
686
728
  end
@@ -690,7 +732,7 @@ __TS__SetDescriptor(
690
732
  Buff.prototype,
691
733
  "source",
692
734
  {get = function(self)
693
- return self[101] or self._unit
735
+ return self[102] or self._unit
694
736
  end},
695
737
  true
696
738
  )
@@ -707,13 +749,13 @@ __TS__SetDescriptor(
707
749
  "remainingDamageOverDuration",
708
750
  {
709
751
  get = function(self)
710
- return self[112] or 0
752
+ return self[113] or 0
711
753
  end,
712
754
  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
755
+ local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[113] or 0)
756
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
757
+ local damageOverDuration = (self[110] or 0) + remainingDamageOverDurationDelta
758
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
717
759
  end
718
760
  },
719
761
  true
@@ -723,13 +765,13 @@ __TS__SetDescriptor(
723
765
  "damageOverDuration",
724
766
  {
725
767
  get = function(self)
726
- return self[109] or 0
768
+ return self[110] or 0
727
769
  end,
728
770
  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
771
+ local damageOverDurationDelta = damageOverDuration - (self[110] or 0)
772
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
773
+ local remainingDamageOverDuration = (self[113] or 0) + damageOverDurationDelta
774
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
733
775
  end
734
776
  },
735
777
  true
@@ -739,10 +781,10 @@ __TS__SetDescriptor(
739
781
  "damagePerInterval",
740
782
  {
741
783
  get = function(self)
742
- return self[110] or 0
784
+ return self[111] or 0
743
785
  end,
744
786
  set = function(self, damagePerInterval)
745
- self[110] = damagePerInterval ~= 0 and damagePerInterval or nil
787
+ self[111] = damagePerInterval ~= 0 and damagePerInterval or nil
746
788
  end
747
789
  },
748
790
  true
@@ -752,25 +794,25 @@ __TS__SetDescriptor(
752
794
  "damageInterval",
753
795
  {
754
796
  get = function(self)
755
- return self[111] or 0
797
+ return self[112] or 0
756
798
  end,
757
799
  set = function(self, damageInterval)
758
800
  if damageInterval <= 0 then
759
- self[111] = damageInterval ~= 0 and damageInterval or nil
760
- local timer = self[113]
801
+ self[112] = damageInterval ~= 0 and damageInterval or nil
802
+ local timer = self[114]
761
803
  if timer ~= nil then
762
804
  timer:destroy()
763
- self[113] = nil
805
+ self[114] = nil
764
806
  end
765
807
  return
766
808
  end
767
- self[111] = damageInterval
768
- local ____opt_48 = self._timer
769
- local elapsed = ____opt_48 and ____opt_48.elapsed or 0
770
- local timer = self[113]
809
+ self[112] = damageInterval
810
+ local ____opt_50 = self._timer
811
+ local elapsed = ____opt_50 and ____opt_50.elapsed or 0
812
+ local timer = self[114]
771
813
  if timer == nil then
772
814
  timer = Timer:create()
773
- self[113] = timer
815
+ self[114] = timer
774
816
  end
775
817
  local initialDelay = damageInterval - (elapsed >= damageInterval and math.fmod(elapsed, damageInterval) or elapsed)
776
818
  if initialDelay == damageInterval then
@@ -787,13 +829,13 @@ __TS__SetDescriptor(
787
829
  "remainingHealingOverDuration",
788
830
  {
789
831
  get = function(self)
790
- return self[117] or 0
832
+ return self[118] or 0
791
833
  end,
792
834
  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
835
+ local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[118] or 0)
836
+ self[113] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
837
+ local healingOverDuration = (self[115] or 0) + remainingHealingOverDurationDelta
838
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
797
839
  end
798
840
  },
799
841
  true
@@ -803,13 +845,13 @@ __TS__SetDescriptor(
803
845
  "healingOverDuration",
804
846
  {
805
847
  get = function(self)
806
- return self[114] or 0
848
+ return self[115] or 0
807
849
  end,
808
850
  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
851
+ local healingOverDurationDelta = healingOverDuration - (self[115] or 0)
852
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
853
+ local remainingHealingOverDuration = (self[118] or 0) + healingOverDurationDelta
854
+ self[118] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
813
855
  end
814
856
  },
815
857
  true
@@ -819,10 +861,10 @@ __TS__SetDescriptor(
819
861
  "healingPerInterval",
820
862
  {
821
863
  get = function(self)
822
- return self[115] or 0
864
+ return self[116] or 0
823
865
  end,
824
866
  set = function(self, healingPerInterval)
825
- self[115] = healingPerInterval ~= 0 and healingPerInterval or nil
867
+ self[116] = healingPerInterval ~= 0 and healingPerInterval or nil
826
868
  end
827
869
  },
828
870
  true
@@ -832,25 +874,25 @@ __TS__SetDescriptor(
832
874
  "healingInterval",
833
875
  {
834
876
  get = function(self)
835
- return self[116] or 0
877
+ return self[117] or 0
836
878
  end,
837
879
  set = function(self, healingInterval)
838
880
  if healingInterval <= 0 then
839
- self[116] = healingInterval ~= 0 and healingInterval or nil
840
- local timer = self[118]
881
+ self[117] = healingInterval ~= 0 and healingInterval or nil
882
+ local timer = self[119]
841
883
  if timer ~= nil then
842
884
  timer:destroy()
843
- self[118] = nil
885
+ self[119] = nil
844
886
  end
845
887
  return
846
888
  end
847
- self[116] = healingInterval
848
- local ____opt_50 = self._timer
849
- local elapsed = ____opt_50 and ____opt_50.elapsed or 0
850
- local timer = self[118]
889
+ self[117] = healingInterval
890
+ local ____opt_52 = self._timer
891
+ local elapsed = ____opt_52 and ____opt_52.elapsed or 0
892
+ local timer = self[119]
851
893
  if timer == nil then
852
894
  timer = Timer:create()
853
- self[118] = timer
895
+ self[119] = timer
854
896
  end
855
897
  local initialDelay = healingInterval - (elapsed >= healingInterval and math.fmod(elapsed, healingInterval) or elapsed)
856
898
  if initialDelay == healingInterval then
@@ -867,10 +909,10 @@ __TS__SetDescriptor(
867
909
  "damageOnExpiration",
868
910
  {
869
911
  get = function(self)
870
- return self[119] or 0
912
+ return self[120] or 0
871
913
  end,
872
914
  set = function(self, damageOnExpiration)
873
- self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
915
+ self[120] = damageOnExpiration ~= 0 and damageOnExpiration or nil
874
916
  end
875
917
  },
876
918
  true
@@ -880,10 +922,23 @@ __TS__SetDescriptor(
880
922
  "healingOnExpiration",
881
923
  {
882
924
  get = function(self)
883
- return self[120] or 0
925
+ return self[121] or 0
884
926
  end,
885
927
  set = function(self, healingOnExpiration)
886
- self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
928
+ self[121] = healingOnExpiration ~= 0 and healingOnExpiration or nil
929
+ end
930
+ },
931
+ true
932
+ )
933
+ __TS__SetDescriptor(
934
+ Buff.prototype,
935
+ "damageFactor",
936
+ {
937
+ get = function(self)
938
+ return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
939
+ end,
940
+ set = function(self, damageFactor)
941
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
887
942
  end
888
943
  },
889
944
  true
@@ -914,30 +969,53 @@ __TS__SetDescriptor(
914
969
  },
915
970
  true
916
971
  )
972
+ __TS__SetDescriptor(
973
+ Buff.prototype,
974
+ "turnsIntoGhost",
975
+ {
976
+ get = function(self)
977
+ local ____self__135_54 = self[135]
978
+ if ____self__135_54 == nil then
979
+ ____self__135_54 = false
980
+ end
981
+ return ____self__135_54
982
+ end,
983
+ set = function(self, turnsIntoGhost)
984
+ if not turnsIntoGhost and self[135] then
985
+ self.object:decrementGhostCounter()
986
+ self[135] = nil
987
+ elseif turnsIntoGhost and not self[135] then
988
+ self.object:incrementGhostCounter()
989
+ self[135] = true
990
+ end
991
+ end
992
+ },
993
+ true
994
+ )
917
995
  __TS__SetDescriptor(
918
996
  Buff.prototype,
919
997
  "stuns",
920
998
  {
921
999
  get = function(self)
922
- local ____self__134_52 = self[134]
923
- if ____self__134_52 == nil then
924
- ____self__134_52 = false
1000
+ local ____self__136_55 = self[136]
1001
+ if ____self__136_55 == nil then
1002
+ ____self__136_55 = false
925
1003
  end
926
- return ____self__134_52
1004
+ return ____self__136_55
927
1005
  end,
928
1006
  set = function(self, stuns)
929
- if not stuns and self[134] then
930
- if self[135] then
1007
+ if not stuns and self[136] then
1008
+ if self[137] then
931
1009
  self.object:decrementStunCounter()
932
1010
  end
933
1011
  self.object:decrementStunCounter()
934
- self[134] = nil
935
- elseif stuns and not self[134] then
936
- if self[135] then
1012
+ self[136] = nil
1013
+ elseif stuns and not self[136] then
1014
+ if self[137] then
937
1015
  self.object:incrementStunCounter()
938
1016
  end
939
1017
  self.object:incrementStunCounter()
940
- self[134] = true
1018
+ self[136] = true
941
1019
  end
942
1020
  end
943
1021
  },
@@ -948,23 +1026,23 @@ __TS__SetDescriptor(
948
1026
  "ignoresStunImmunity",
949
1027
  {
950
1028
  get = function(self)
951
- local ____self__135_53 = self[135]
952
- if ____self__135_53 == nil then
953
- ____self__135_53 = false
1029
+ local ____self__137_56 = self[137]
1030
+ if ____self__137_56 == nil then
1031
+ ____self__137_56 = false
954
1032
  end
955
- return ____self__135_53
1033
+ return ____self__137_56
956
1034
  end,
957
1035
  set = function(self, ignoresStunImmunity)
958
- if not ignoresStunImmunity and self[135] then
959
- if self[134] then
1036
+ if not ignoresStunImmunity and self[137] then
1037
+ if self[136] then
960
1038
  self.object:decrementStunCounter()
961
1039
  end
962
- self[135] = nil
963
- elseif ignoresStunImmunity and not self[135] then
964
- if self[134] then
1040
+ self[137] = nil
1041
+ elseif ignoresStunImmunity and not self[137] then
1042
+ if self[136] then
965
1043
  self.object:incrementStunCounter()
966
1044
  end
967
- self[135] = true
1045
+ self[137] = true
968
1046
  end
969
1047
  end
970
1048
  },
@@ -975,19 +1053,19 @@ __TS__SetDescriptor(
975
1053
  "disablesAutoAttack",
976
1054
  {
977
1055
  get = function(self)
978
- local ____self__136_54 = self[136]
979
- if ____self__136_54 == nil then
980
- ____self__136_54 = false
1056
+ local ____self__138_57 = self[138]
1057
+ if ____self__138_57 == nil then
1058
+ ____self__138_57 = false
981
1059
  end
982
- return ____self__136_54
1060
+ return ____self__138_57
983
1061
  end,
984
1062
  set = function(self, disablesAutoAttack)
985
- if not disablesAutoAttack and self[136] then
1063
+ if not disablesAutoAttack and self[138] then
986
1064
  self.object:decrementDisableAutoAttackCounter()
987
- self[136] = nil
988
- elseif disablesAutoAttack and not self[136] then
1065
+ self[138] = nil
1066
+ elseif disablesAutoAttack and not self[138] then
989
1067
  self.object:incrementDisableAutoAttackCounter()
990
- self[136] = true
1068
+ self[138] = true
991
1069
  end
992
1070
  end
993
1071
  },
@@ -998,19 +1076,19 @@ __TS__SetDescriptor(
998
1076
  "providesInvulnerability",
999
1077
  {
1000
1078
  get = function(self)
1001
- local ____self__137_55 = self[137]
1002
- if ____self__137_55 == nil then
1003
- ____self__137_55 = false
1079
+ local ____self__139_58 = self[139]
1080
+ if ____self__139_58 == nil then
1081
+ ____self__139_58 = false
1004
1082
  end
1005
- return ____self__137_55
1083
+ return ____self__139_58
1006
1084
  end,
1007
1085
  set = function(self, providesInvulnerability)
1008
- if not providesInvulnerability and self[137] then
1086
+ if not providesInvulnerability and self[139] then
1009
1087
  self.object:decrementInvulnerabilityCounter()
1010
- self[137] = nil
1011
- elseif providesInvulnerability and not self[137] then
1088
+ self[139] = nil
1089
+ elseif providesInvulnerability and not self[139] then
1012
1090
  self.object:incrementInvulnerabilityCounter()
1013
- self[137] = true
1091
+ self[139] = true
1014
1092
  end
1015
1093
  end
1016
1094
  },
@@ -1021,17 +1099,17 @@ __TS__SetDescriptor(
1021
1099
  "killsOnExpiration",
1022
1100
  {
1023
1101
  get = function(self)
1024
- local ____self__138_56 = self[138]
1025
- if ____self__138_56 == nil then
1026
- ____self__138_56 = false
1102
+ local ____self__140_59 = self[140]
1103
+ if ____self__140_59 == nil then
1104
+ ____self__140_59 = false
1027
1105
  end
1028
- return ____self__138_56
1106
+ return ____self__140_59
1029
1107
  end,
1030
1108
  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
1109
+ if not killsOnExpiration and self[140] then
1110
+ self[140] = nil
1111
+ elseif killsOnExpiration and not self[140] then
1112
+ self[140] = true
1035
1113
  end
1036
1114
  end
1037
1115
  },
@@ -1042,17 +1120,17 @@ __TS__SetDescriptor(
1042
1120
  "explodesOnExpiration",
1043
1121
  {
1044
1122
  get = function(self)
1045
- local ____self__139_57 = self[139]
1046
- if ____self__139_57 == nil then
1047
- ____self__139_57 = false
1123
+ local ____self__141_60 = self[141]
1124
+ if ____self__141_60 == nil then
1125
+ ____self__141_60 = false
1048
1126
  end
1049
- return ____self__139_57
1127
+ return ____self__141_60
1050
1128
  end,
1051
1129
  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
1130
+ if not killsOnExpiration and self[141] then
1131
+ self[141] = nil
1132
+ elseif killsOnExpiration and not self[141] then
1133
+ self[141] = true
1056
1134
  end
1057
1135
  end
1058
1136
  },
@@ -1063,13 +1141,13 @@ __TS__SetDescriptor(
1063
1141
  "maximumDamageDealtEventCount",
1064
1142
  {
1065
1143
  get = function(self)
1066
- return self[131] or 0
1144
+ return self[132] or 0
1067
1145
  end,
1068
1146
  set = function(self, maximumDamageDealtEventCount)
1069
1147
  if maximumDamageDealtEventCount == 0 then
1070
- self[131] = nil
1148
+ self[132] = nil
1071
1149
  else
1072
- self[131] = maximumDamageDealtEventCount
1150
+ self[132] = maximumDamageDealtEventCount
1073
1151
  end
1074
1152
  end
1075
1153
  },
@@ -1080,13 +1158,13 @@ __TS__SetDescriptor(
1080
1158
  "maximumDamageReceivedEventCount",
1081
1159
  {
1082
1160
  get = function(self)
1083
- return self[133] or 0
1161
+ return self[134] or 0
1084
1162
  end,
1085
1163
  set = function(self, maximumDamageReceivedEventCount)
1086
1164
  if maximumDamageReceivedEventCount == 0 then
1087
- self[133] = nil
1165
+ self[134] = nil
1088
1166
  else
1089
- self[133] = maximumDamageReceivedEventCount
1167
+ self[134] = maximumDamageReceivedEventCount
1090
1168
  end
1091
1169
  end
1092
1170
  },
@@ -1097,13 +1175,13 @@ __TS__SetDescriptor(
1097
1175
  "maximumAutoAttackCount",
1098
1176
  {
1099
1177
  get = function(self)
1100
- return self[129] or 0
1178
+ return self[130] or 0
1101
1179
  end,
1102
1180
  set = function(self, maximumAutoAttackCount)
1103
1181
  if maximumAutoAttackCount == 0 then
1104
- self[129] = nil
1182
+ self[130] = nil
1105
1183
  else
1106
- self[129] = maximumAutoAttackCount
1184
+ self[130] = maximumAutoAttackCount
1107
1185
  end
1108
1186
  end
1109
1187
  },
@@ -1114,10 +1192,10 @@ __TS__SetDescriptor(
1114
1192
  "durationIncreaseOnAutoAttack",
1115
1193
  {
1116
1194
  get = function(self)
1117
- return self[106] or 0
1195
+ return self[107] or 0
1118
1196
  end,
1119
1197
  set = function(self, durationIncreaseOnAutoAttack)
1120
- self[106] = durationIncreaseOnAutoAttack
1198
+ self[107] = durationIncreaseOnAutoAttack
1121
1199
  end
1122
1200
  },
1123
1201
  true
@@ -1148,11 +1226,24 @@ __TS__SetDescriptor(
1148
1226
  },
1149
1227
  true
1150
1228
  )
1229
+ __TS__SetDescriptor(
1230
+ Buff.prototype,
1231
+ "evasionProbability",
1232
+ {
1233
+ get = function(self)
1234
+ return self:getUnitBonus(UnitBonusType.EVASION_PROBABILITY)
1235
+ end,
1236
+ set = function(self, evasionProbability)
1237
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.EVASION_PROBABILITY, evasionProbability)
1238
+ end
1239
+ },
1240
+ true
1241
+ )
1151
1242
  __TS__SetDescriptor(
1152
1243
  Buff.prototype,
1153
1244
  "duration",
1154
1245
  {get = function(self)
1155
- return self[102]
1246
+ return self[103]
1156
1247
  end},
1157
1248
  true
1158
1249
  )
@@ -1161,15 +1252,15 @@ __TS__SetDescriptor(
1161
1252
  "remainingDuration",
1162
1253
  {
1163
1254
  get = function(self)
1164
- local ____opt_58 = self._timer
1165
- return ____opt_58 and ____opt_58.remaining or 0
1255
+ local ____opt_61 = self._timer
1256
+ return ____opt_61 and ____opt_61.remaining or 0
1166
1257
  end,
1167
1258
  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)
1259
+ local ____remainingDuration_65 = remainingDuration
1260
+ local ____opt_63 = self._timer
1261
+ local remainingDurationDelta = ____remainingDuration_65 - (____opt_63 and ____opt_63.remaining or 0)
1171
1262
  if remainingDurationDelta ~= 0 then
1172
- self[102] = self[102] + remainingDurationDelta
1263
+ self[103] = self[103] + remainingDurationDelta
1173
1264
  if remainingDuration <= 0 then
1174
1265
  Timer:run(destroyBuff, self)
1175
1266
  else
@@ -1181,7 +1272,8 @@ __TS__SetDescriptor(
1181
1272
  self._level,
1182
1273
  remainingDuration,
1183
1274
  self._spellStealPriority,
1184
- self._learnLevelMinimum
1275
+ self._learnLevelMinimum,
1276
+ self[142]
1185
1277
  ) then
1186
1278
  local timer = self._timer
1187
1279
  if timer == nil then
@@ -1195,10 +1287,11 @@ __TS__SetDescriptor(
1195
1287
  end
1196
1288
  },
1197
1289
  true
1198
- );
1290
+ )
1291
+ Buff.destroyEvent = buffDestroyEvent;
1199
1292
  (function(self)
1200
1293
  local function destroyBuffIfNeeded(buff)
1201
- if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1294
+ if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
1202
1295
  buff:destroy()
1203
1296
  end
1204
1297
  end