warscript 0.0.1-dev.38f0dea → 0.0.1-dev.3d15d22

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