warscript 0.0.1-dev.6fe4470 → 0.0.1-dev.70ae346

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