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