warscript 0.0.1-dev.bd2b0f6 → 0.0.1-dev.c056064

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