warscript 0.0.1-dev.42d21a8 → 0.0.1-dev.46a1ede

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.
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")
@@ -98,6 +101,7 @@ local buffParametersKeys = {
98
101
  armorIncreaseFactor = true,
99
102
  attackSpeedIncreaseFactor = true,
100
103
  movementSpeedIncreaseFactor = true,
104
+ evasionProbability = true,
101
105
  damageFactor = true,
102
106
  receivedDamageFactor = true,
103
107
  receivedMagicDamageFactor = true,
@@ -180,6 +184,7 @@ local buffNumberParameters = {
180
184
  "durationIncreaseOnAutoAttack",
181
185
  "attackSpeedIncreaseFactor",
182
186
  "movementSpeedIncreaseFactor",
187
+ "evasionProbability",
183
188
  "armorIncrease",
184
189
  "damageFactor",
185
190
  "receivedDamageFactor",
@@ -220,7 +225,7 @@ local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
220
225
  return checkNotNull(firstNativeBuffTypeId)
221
226
  end
222
227
  local function destroyBuffIfItHasSameUniqueGroup(buff, uniqueGroup)
223
- if buff[103] == uniqueGroup then
228
+ if buff[104] == uniqueGroup then
224
229
  buff:destroy()
225
230
  end
226
231
  end
@@ -228,17 +233,17 @@ local function destroyBuff(buff)
228
233
  buff:destroy()
229
234
  end
230
235
  local function expireBuff(buff)
231
- local remainingDamageOverDuration = buff[112] or 0
232
- local remainingHealingOverDuration = buff[112] or 0
236
+ local remainingDamageOverDuration = buff[113] or 0
237
+ local remainingHealingOverDuration = buff[113] or 0
233
238
  if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
234
239
  buff:flashSpecialEffect()
235
240
  if remainingDamageOverDuration ~= 0 then
236
- (buff[101] or buff[100]):damageTarget(buff[100], remainingDamageOverDuration)
237
- buff[112] = nil
241
+ (buff[102] or buff[101]):damageTarget(buff[101], remainingDamageOverDuration)
242
+ buff[113] = nil
238
243
  end
239
244
  if remainingHealingOverDuration ~= 0 then
240
- (buff[101] or buff[100]):healTarget(buff[100], remainingHealingOverDuration)
241
- buff[117] = nil
245
+ (buff[102] or buff[101]):healTarget(buff[101], remainingHealingOverDuration)
246
+ buff[118] = nil
242
247
  end
243
248
  end
244
249
  Timer:run(destroyBuff, buff)
@@ -246,56 +251,57 @@ local function expireBuff(buff)
246
251
  end
247
252
  local function buffDamageIntervalInitialTimerCallback(buff)
248
253
  buffDamageIntervalTimerCallback(buff)
249
- local timer = buff[113]
250
- local damageInterval = buff[111]
254
+ local timer = buff[114]
255
+ local damageInterval = buff[112]
251
256
  if timer ~= nil and damageInterval ~= nil and damageInterval > 0 then
252
257
  timer:start(damageInterval, true, buffDamageIntervalTimerCallback, buff)
253
258
  end
254
259
  end
255
260
  buffDamageIntervalTimerCallback = function(buff)
256
261
  buff:flashSpecialEffect()
257
- local source = buff[101] or buff[100]
258
- local remainingDamageOverDuration = buff[112] or 0
262
+ local source = buff[102] or buff[101]
263
+ local remainingDamageOverDuration = buff[113] or 0
259
264
  if remainingDamageOverDuration ~= 0 then
260
- local damageInterval = buff[111] or 0
265
+ local damageInterval = buff[112] or 0
261
266
  if damageInterval ~= 0 then
262
267
  local damage = remainingDamageOverDuration / (1 + buff.remainingDuration / damageInterval)
263
- source:damageTarget(buff[100], damage)
264
- buff[112] = remainingDamageOverDuration - damage
268
+ source:damageTarget(buff[101], damage)
269
+ buff[113] = remainingDamageOverDuration - damage
265
270
  end
266
271
  end
267
- local damagePerInterval = buff[110] or 0
272
+ local damagePerInterval = buff[111] or 0
268
273
  if remainingDamageOverDuration == 0 or damagePerInterval ~= 0 then
269
- source:damageTarget(buff[100], damagePerInterval)
274
+ source:damageTarget(buff[101], damagePerInterval)
270
275
  end
271
276
  end
272
277
  local function buffHealingIntervalInitialTimerCallback(buff)
273
278
  buffHealingIntervalTimerCallback(buff)
274
- local timer = buff[118]
275
- local healingInterval = buff[116]
279
+ local timer = buff[119]
280
+ local healingInterval = buff[117]
276
281
  if timer ~= nil and healingInterval ~= nil and healingInterval > 0 then
277
282
  timer:start(healingInterval, true, buffHealingIntervalTimerCallback, buff)
278
283
  end
279
284
  end
280
285
  buffHealingIntervalTimerCallback = function(buff)
281
- if buff[116] ~= buff[111] then
286
+ if buff[117] ~= buff[112] then
282
287
  buff:flashSpecialEffect()
283
288
  end
284
- local source = buff[101] or buff[100]
285
- local remainingHealingOverDuration = buff[117] or 0
289
+ local source = buff[102] or buff[101]
290
+ local remainingHealingOverDuration = buff[118] or 0
286
291
  if remainingHealingOverDuration ~= 0 then
287
- local healingInterval = buff[116] or 0
292
+ local healingInterval = buff[117] or 0
288
293
  if healingInterval ~= 0 then
289
294
  local healing = remainingHealingOverDuration / (1 + buff.remainingDuration / healingInterval)
290
- source:healTarget(buff[100], healing)
291
- buff[117] = remainingHealingOverDuration - healing
295
+ source:healTarget(buff[101], healing)
296
+ buff[118] = remainingHealingOverDuration - healing
292
297
  end
293
298
  end
294
- local healingPerInterval = buff[115] or 0
299
+ local healingPerInterval = buff[116] or 0
295
300
  if remainingHealingOverDuration == 0 or healingPerInterval ~= 0 then
296
- source:healTarget(buff[100], healingPerInterval)
301
+ source:healTarget(buff[101], healingPerInterval)
297
302
  end
298
303
  end
304
+ local buffDestroyEvent = __TS__New(Event)
299
305
  ____exports.Buff = __TS__Class()
300
306
  local Buff = ____exports.Buff
301
307
  Buff.name = "Buff"
@@ -304,7 +310,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
304
310
  UnitBehavior.prototype.____constructor(self, _unit)
305
311
  self._unit = _unit
306
312
  self.parameters = nil
307
- self[100] = _unit
313
+ self[100] = 0
314
+ self[101] = _unit
308
315
  local typeId
309
316
  local polarity
310
317
  local resistanceType
@@ -396,11 +403,11 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
396
403
  self._level = level
397
404
  self._spellStealPriority = spellStealPriority
398
405
  self._learnLevelMinimum = learnLevelMinimum
399
- self[101] = source
400
- self[102] = duration or 0
401
- self[103] = uniqueGroup
402
- self[104] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
403
- self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
406
+ self[102] = source
407
+ self[103] = duration or 0
408
+ self[104] = uniqueGroup
409
+ self[105] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_EFFECT, 0)
410
+ self[106] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
404
411
  if parameters ~= nil or (next(defaultParameters)) ~= nil then
405
412
  for ____, buffBooleanParameter in ipairs(buffBooleanParameters) do
406
413
  local ____ability_22 = ability
@@ -425,11 +432,11 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
425
432
  end
426
433
  local maximumDuration = parameters and parameters.maximumDuration or defaultParameters.maximumDuration
427
434
  if maximumDuration ~= nil then
428
- self[107] = resolveNumberValue(ability, level, maximumDuration)
435
+ self[108] = resolveNumberValue(ability, level, maximumDuration)
429
436
  end
430
437
  local maximumRemainingDuration = parameters and parameters.maximumRemainingDuration or defaultParameters.maximumRemainingDuration
431
438
  if maximumRemainingDuration ~= nil then
432
- self[108] = resolveNumberValue(ability, level, maximumRemainingDuration)
439
+ self[109] = resolveNumberValue(ability, level, maximumRemainingDuration)
433
440
  end
434
441
  local parametersAbilityTypeIds = parameters and parameters.abilityTypeIds or defaultParameters.abilityTypeIds
435
442
  if parametersAbilityTypeIds ~= nil then
@@ -487,6 +494,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
487
494
  self._timer = timer
488
495
  end
489
496
  self:onCreate()
497
+ self[100] = 1
490
498
  end
491
499
  function Buff.prototype.getUnitBonus(self, bonusType)
492
500
  local ____opt_36 = self._bonusIdByBonusType
@@ -503,13 +511,13 @@ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
503
511
  end
504
512
  function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
505
513
  if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
506
- Effect:flash(self[104], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
514
+ Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
507
515
  else
508
516
  local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
509
517
  local ____Effect_40 = Effect
510
518
  local ____Effect_flash_41 = Effect.flash
511
519
  local ____array_39 = __TS__SparseArrayNew(
512
- self[104],
520
+ self[105],
513
521
  isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
514
522
  stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
515
523
  )
@@ -531,7 +539,7 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
531
539
  local ____Effect_44 = Effect
532
540
  local ____Effect_flash_45 = Effect.flash
533
541
  local ____array_43 = __TS__SparseArrayNew(
534
- self[105],
542
+ self[106],
535
543
  isWidgetProvided and widgetOrDuration or self._unit,
536
544
  stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
537
545
  )
@@ -550,20 +558,22 @@ end
550
558
  function Buff.prototype.onCreate(self)
551
559
  end
552
560
  function Buff.prototype.onDestroy(self)
561
+ check(self[100] ~= 0, "Cannot destroy a buff that has not finished creating yet.")
562
+ self[100] = 2
553
563
  local unit = self._unit
554
564
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
555
565
  removeBuff(unit.handle, self.typeId)
556
566
  end
557
567
  buffByTypeIdByUnit[unit][self.typeId] = nil
558
- local healingIntervalTimer = self[118]
568
+ local healingIntervalTimer = self[119]
559
569
  if healingIntervalTimer ~= nil then
560
570
  healingIntervalTimer:destroy()
561
- self[118] = nil
571
+ self[119] = nil
562
572
  end
563
- local damageIntervalTimer = self[113]
573
+ local damageIntervalTimer = self[114]
564
574
  if damageIntervalTimer ~= nil then
565
575
  damageIntervalTimer:destroy()
566
- self[113] = nil
576
+ self[114] = nil
567
577
  end
568
578
  if self._timer ~= nil then
569
579
  self._timer:destroy()
@@ -573,11 +583,11 @@ function Buff.prototype.onDestroy(self)
573
583
  behavior:destroy()
574
584
  end
575
585
  end
576
- if self[136] then
586
+ if self[137] then
577
587
  unit:decrementDisableAutoAttackCounter()
578
588
  end
579
- if self[134] then
580
- if self[135] then
589
+ if self[135] then
590
+ if self[136] then
581
591
  unit:decrementStunCounter()
582
592
  end
583
593
  unit:decrementStunCounter()
@@ -592,6 +602,8 @@ function Buff.prototype.onDestroy(self)
592
602
  removeUnitBonus(unit, bonusType, bonusId)
593
603
  end
594
604
  end
605
+ Event.invoke(buffDestroyEvent, self)
606
+ self[100] = 3
595
607
  return UnitBehavior.prototype.onDestroy(self)
596
608
  end
597
609
  function Buff.apply(self, ...)
@@ -628,72 +640,72 @@ function Buff.getByTypeId(self, unit, typeId)
628
640
  end
629
641
  function Buff.prototype.onExpiration(self)
630
642
  local unit = self.unit
631
- if self[119] ~= nil then
632
- (self[101] or unit):damageTarget(unit, self[119] or 0)
633
- end
634
643
  if self[120] ~= nil then
635
- (self[101] or unit):healTarget(unit, self[119] or 0)
644
+ (self[102] or unit):damageTarget(unit, self[120] or 0)
645
+ end
646
+ if self[121] ~= nil then
647
+ (self[102] or unit):healTarget(unit, self[120] or 0)
636
648
  end
637
- if self[139] then
649
+ if self[140] then
638
650
  unit:explode()
639
- elseif self[138] then
651
+ elseif self[139] then
640
652
  unit:kill()
641
653
  end
642
654
  end
643
655
  function Buff.prototype.onDeath(self, source)
644
656
  local unit = self.unit
645
- if self[121] ~= nil then
657
+ if self[122] ~= nil then
646
658
  damageArea(
647
- self[101] or unit,
648
- self[121],
659
+ self[102] or unit,
660
+ self[122],
649
661
  unit.x,
650
662
  unit.y,
663
+ self[124] or 0,
651
664
  self[123] or 0,
652
- self[122] or 0,
665
+ self[126] or 0,
653
666
  self[125] or 0,
654
- self[124] or 0,
655
- self[127] or 0,
656
- self[126] or 0
667
+ self[128] or 0,
668
+ self[127] or 0
657
669
  )
658
670
  end
659
671
  end
660
672
  function Buff.prototype.onDamageDealt(self, target, event)
661
673
  if event.isAttack then
662
- if self[106] ~= nil then
663
- local durationIncrease = self[106]
664
- local maximumDuration = self[107] or 0
674
+ if self[107] ~= nil then
675
+ local durationIncrease = self[107]
676
+ local maximumDuration = self[108] or 0
665
677
  if maximumDuration > 0 then
666
678
  durationIncrease = min(
667
679
  durationIncrease,
668
- max(0, maximumDuration - self[102])
680
+ max(0, maximumDuration - self[103])
669
681
  )
670
682
  end
671
683
  local remainingDuration = self.remainingDuration + durationIncrease
672
- local maximumRemainingDuration = self[108] or 0
684
+ local maximumRemainingDuration = self[109] or 0
673
685
  if maximumRemainingDuration > 0 then
674
686
  remainingDuration = min(remainingDuration, maximumRemainingDuration)
675
687
  end
676
688
  self.remainingDuration = remainingDuration
677
689
  end
678
- local autoAttackCount = (self[128] or 0) + 1
679
- self[128] = autoAttackCount
680
- if autoAttackCount == self[129] then
690
+ local autoAttackCount = (self[129] or 0) + 1
691
+ self[129] = autoAttackCount
692
+ if autoAttackCount == self[130] then
681
693
  self:destroy()
682
694
  end
683
695
  end
684
696
  if event.originalAmount ~= 0 then
685
- local damageDealtEventCount = (self[130] or 0) + 1
686
- self[130] = damageDealtEventCount
687
- if damageDealtEventCount == self[131] then
697
+ local damageDealtEventCount = (self[131] or 0) + 1
698
+ self[131] = damageDealtEventCount
699
+ if damageDealtEventCount == self[132] then
688
700
  self:destroy()
689
701
  end
690
702
  end
691
703
  end
692
704
  function Buff.prototype.onDamageReceived(self, source, event)
693
705
  if event.originalAmount ~= 0 then
694
- local damageReceivedEventCount = (self[132] or 0) + 1
695
- self[132] = damageReceivedEventCount
696
- if damageReceivedEventCount == self[133] then
706
+ local damageReceivedEventCount = (self[133] or 0) + 1
707
+ self[133] = damageReceivedEventCount
708
+ if damageReceivedEventCount == self[134] then
697
709
  self:destroy()
698
710
  end
699
711
  end
@@ -703,7 +715,7 @@ __TS__SetDescriptor(
703
715
  Buff.prototype,
704
716
  "source",
705
717
  {get = function(self)
706
- return self[101] or self._unit
718
+ return self[102] or self._unit
707
719
  end},
708
720
  true
709
721
  )
@@ -720,13 +732,13 @@ __TS__SetDescriptor(
720
732
  "remainingDamageOverDuration",
721
733
  {
722
734
  get = function(self)
723
- return self[112] or 0
735
+ return self[113] or 0
724
736
  end,
725
737
  set = function(self, remainingDamageOverDuration)
726
- local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[112] or 0)
727
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
728
- local damageOverDuration = (self[109] or 0) + remainingDamageOverDurationDelta
729
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
738
+ local remainingDamageOverDurationDelta = remainingDamageOverDuration - (self[113] or 0)
739
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
740
+ local damageOverDuration = (self[110] or 0) + remainingDamageOverDurationDelta
741
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
730
742
  end
731
743
  },
732
744
  true
@@ -736,13 +748,13 @@ __TS__SetDescriptor(
736
748
  "damageOverDuration",
737
749
  {
738
750
  get = function(self)
739
- return self[109] or 0
751
+ return self[110] or 0
740
752
  end,
741
753
  set = function(self, damageOverDuration)
742
- local damageOverDurationDelta = damageOverDuration - (self[109] or 0)
743
- self[109] = damageOverDuration ~= 0 and damageOverDuration or nil
744
- local remainingDamageOverDuration = (self[112] or 0) + damageOverDurationDelta
745
- self[112] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
754
+ local damageOverDurationDelta = damageOverDuration - (self[110] or 0)
755
+ self[110] = damageOverDuration ~= 0 and damageOverDuration or nil
756
+ local remainingDamageOverDuration = (self[113] or 0) + damageOverDurationDelta
757
+ self[113] = remainingDamageOverDuration ~= 0 and remainingDamageOverDuration or nil
746
758
  end
747
759
  },
748
760
  true
@@ -752,10 +764,10 @@ __TS__SetDescriptor(
752
764
  "damagePerInterval",
753
765
  {
754
766
  get = function(self)
755
- return self[110] or 0
767
+ return self[111] or 0
756
768
  end,
757
769
  set = function(self, damagePerInterval)
758
- self[110] = damagePerInterval ~= 0 and damagePerInterval or nil
770
+ self[111] = damagePerInterval ~= 0 and damagePerInterval or nil
759
771
  end
760
772
  },
761
773
  true
@@ -765,25 +777,25 @@ __TS__SetDescriptor(
765
777
  "damageInterval",
766
778
  {
767
779
  get = function(self)
768
- return self[111] or 0
780
+ return self[112] or 0
769
781
  end,
770
782
  set = function(self, damageInterval)
771
783
  if damageInterval <= 0 then
772
- self[111] = damageInterval ~= 0 and damageInterval or nil
773
- local timer = self[113]
784
+ self[112] = damageInterval ~= 0 and damageInterval or nil
785
+ local timer = self[114]
774
786
  if timer ~= nil then
775
787
  timer:destroy()
776
- self[113] = nil
788
+ self[114] = nil
777
789
  end
778
790
  return
779
791
  end
780
- self[111] = damageInterval
792
+ self[112] = damageInterval
781
793
  local ____opt_48 = self._timer
782
794
  local elapsed = ____opt_48 and ____opt_48.elapsed or 0
783
- local timer = self[113]
795
+ local timer = self[114]
784
796
  if timer == nil then
785
797
  timer = Timer:create()
786
- self[113] = timer
798
+ self[114] = timer
787
799
  end
788
800
  local initialDelay = damageInterval - (elapsed >= damageInterval and math.fmod(elapsed, damageInterval) or elapsed)
789
801
  if initialDelay == damageInterval then
@@ -800,13 +812,13 @@ __TS__SetDescriptor(
800
812
  "remainingHealingOverDuration",
801
813
  {
802
814
  get = function(self)
803
- return self[117] or 0
815
+ return self[118] or 0
804
816
  end,
805
817
  set = function(self, remainingHealingOverDuration)
806
- local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[117] or 0)
807
- self[112] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
808
- local healingOverDuration = (self[114] or 0) + remainingHealingOverDurationDelta
809
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
818
+ local remainingHealingOverDurationDelta = remainingHealingOverDuration - (self[118] or 0)
819
+ self[113] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
820
+ local healingOverDuration = (self[115] or 0) + remainingHealingOverDurationDelta
821
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
810
822
  end
811
823
  },
812
824
  true
@@ -816,13 +828,13 @@ __TS__SetDescriptor(
816
828
  "healingOverDuration",
817
829
  {
818
830
  get = function(self)
819
- return self[114] or 0
831
+ return self[115] or 0
820
832
  end,
821
833
  set = function(self, healingOverDuration)
822
- local healingOverDurationDelta = healingOverDuration - (self[114] or 0)
823
- self[114] = healingOverDuration ~= 0 and healingOverDuration or nil
824
- local remainingHealingOverDuration = (self[117] or 0) + healingOverDurationDelta
825
- self[117] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
834
+ local healingOverDurationDelta = healingOverDuration - (self[115] or 0)
835
+ self[115] = healingOverDuration ~= 0 and healingOverDuration or nil
836
+ local remainingHealingOverDuration = (self[118] or 0) + healingOverDurationDelta
837
+ self[118] = remainingHealingOverDuration ~= 0 and remainingHealingOverDuration or nil
826
838
  end
827
839
  },
828
840
  true
@@ -832,10 +844,10 @@ __TS__SetDescriptor(
832
844
  "healingPerInterval",
833
845
  {
834
846
  get = function(self)
835
- return self[115] or 0
847
+ return self[116] or 0
836
848
  end,
837
849
  set = function(self, healingPerInterval)
838
- self[115] = healingPerInterval ~= 0 and healingPerInterval or nil
850
+ self[116] = healingPerInterval ~= 0 and healingPerInterval or nil
839
851
  end
840
852
  },
841
853
  true
@@ -845,25 +857,25 @@ __TS__SetDescriptor(
845
857
  "healingInterval",
846
858
  {
847
859
  get = function(self)
848
- return self[116] or 0
860
+ return self[117] or 0
849
861
  end,
850
862
  set = function(self, healingInterval)
851
863
  if healingInterval <= 0 then
852
- self[116] = healingInterval ~= 0 and healingInterval or nil
853
- local timer = self[118]
864
+ self[117] = healingInterval ~= 0 and healingInterval or nil
865
+ local timer = self[119]
854
866
  if timer ~= nil then
855
867
  timer:destroy()
856
- self[118] = nil
868
+ self[119] = nil
857
869
  end
858
870
  return
859
871
  end
860
- self[116] = healingInterval
872
+ self[117] = healingInterval
861
873
  local ____opt_50 = self._timer
862
874
  local elapsed = ____opt_50 and ____opt_50.elapsed or 0
863
- local timer = self[118]
875
+ local timer = self[119]
864
876
  if timer == nil then
865
877
  timer = Timer:create()
866
- self[118] = timer
878
+ self[119] = timer
867
879
  end
868
880
  local initialDelay = healingInterval - (elapsed >= healingInterval and math.fmod(elapsed, healingInterval) or elapsed)
869
881
  if initialDelay == healingInterval then
@@ -880,10 +892,10 @@ __TS__SetDescriptor(
880
892
  "damageOnExpiration",
881
893
  {
882
894
  get = function(self)
883
- return self[119] or 0
895
+ return self[120] or 0
884
896
  end,
885
897
  set = function(self, damageOnExpiration)
886
- self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
898
+ self[120] = damageOnExpiration ~= 0 and damageOnExpiration or nil
887
899
  end
888
900
  },
889
901
  true
@@ -893,10 +905,10 @@ __TS__SetDescriptor(
893
905
  "healingOnExpiration",
894
906
  {
895
907
  get = function(self)
896
- return self[120] or 0
908
+ return self[121] or 0
897
909
  end,
898
910
  set = function(self, healingOnExpiration)
899
- self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
911
+ self[121] = healingOnExpiration ~= 0 and healingOnExpiration or nil
900
912
  end
901
913
  },
902
914
  true
@@ -945,25 +957,25 @@ __TS__SetDescriptor(
945
957
  "stuns",
946
958
  {
947
959
  get = function(self)
948
- local ____self__134_52 = self[134]
949
- if ____self__134_52 == nil then
950
- ____self__134_52 = false
960
+ local ____self__135_52 = self[135]
961
+ if ____self__135_52 == nil then
962
+ ____self__135_52 = false
951
963
  end
952
- return ____self__134_52
964
+ return ____self__135_52
953
965
  end,
954
966
  set = function(self, stuns)
955
- if not stuns and self[134] then
956
- if self[135] then
967
+ if not stuns and self[135] then
968
+ if self[136] then
957
969
  self.object:decrementStunCounter()
958
970
  end
959
971
  self.object:decrementStunCounter()
960
- self[134] = nil
961
- elseif stuns and not self[134] then
962
- if self[135] then
972
+ self[135] = nil
973
+ elseif stuns and not self[135] then
974
+ if self[136] then
963
975
  self.object:incrementStunCounter()
964
976
  end
965
977
  self.object:incrementStunCounter()
966
- self[134] = true
978
+ self[135] = true
967
979
  end
968
980
  end
969
981
  },
@@ -974,23 +986,23 @@ __TS__SetDescriptor(
974
986
  "ignoresStunImmunity",
975
987
  {
976
988
  get = function(self)
977
- local ____self__135_53 = self[135]
978
- if ____self__135_53 == nil then
979
- ____self__135_53 = false
989
+ local ____self__136_53 = self[136]
990
+ if ____self__136_53 == nil then
991
+ ____self__136_53 = false
980
992
  end
981
- return ____self__135_53
993
+ return ____self__136_53
982
994
  end,
983
995
  set = function(self, ignoresStunImmunity)
984
- if not ignoresStunImmunity and self[135] then
985
- if self[134] then
996
+ if not ignoresStunImmunity and self[136] then
997
+ if self[135] then
986
998
  self.object:decrementStunCounter()
987
999
  end
988
- self[135] = nil
989
- elseif ignoresStunImmunity and not self[135] then
990
- if self[134] then
1000
+ self[136] = nil
1001
+ elseif ignoresStunImmunity and not self[136] then
1002
+ if self[135] then
991
1003
  self.object:incrementStunCounter()
992
1004
  end
993
- self[135] = true
1005
+ self[136] = true
994
1006
  end
995
1007
  end
996
1008
  },
@@ -1001,19 +1013,19 @@ __TS__SetDescriptor(
1001
1013
  "disablesAutoAttack",
1002
1014
  {
1003
1015
  get = function(self)
1004
- local ____self__136_54 = self[136]
1005
- if ____self__136_54 == nil then
1006
- ____self__136_54 = false
1016
+ local ____self__137_54 = self[137]
1017
+ if ____self__137_54 == nil then
1018
+ ____self__137_54 = false
1007
1019
  end
1008
- return ____self__136_54
1020
+ return ____self__137_54
1009
1021
  end,
1010
1022
  set = function(self, disablesAutoAttack)
1011
- if not disablesAutoAttack and self[136] then
1023
+ if not disablesAutoAttack and self[137] then
1012
1024
  self.object:decrementDisableAutoAttackCounter()
1013
- self[136] = nil
1014
- elseif disablesAutoAttack and not self[136] then
1025
+ self[137] = nil
1026
+ elseif disablesAutoAttack and not self[137] then
1015
1027
  self.object:incrementDisableAutoAttackCounter()
1016
- self[136] = true
1028
+ self[137] = true
1017
1029
  end
1018
1030
  end
1019
1031
  },
@@ -1024,19 +1036,19 @@ __TS__SetDescriptor(
1024
1036
  "providesInvulnerability",
1025
1037
  {
1026
1038
  get = function(self)
1027
- local ____self__137_55 = self[137]
1028
- if ____self__137_55 == nil then
1029
- ____self__137_55 = false
1039
+ local ____self__138_55 = self[138]
1040
+ if ____self__138_55 == nil then
1041
+ ____self__138_55 = false
1030
1042
  end
1031
- return ____self__137_55
1043
+ return ____self__138_55
1032
1044
  end,
1033
1045
  set = function(self, providesInvulnerability)
1034
- if not providesInvulnerability and self[137] then
1046
+ if not providesInvulnerability and self[138] then
1035
1047
  self.object:decrementInvulnerabilityCounter()
1036
- self[137] = nil
1037
- elseif providesInvulnerability and not self[137] then
1048
+ self[138] = nil
1049
+ elseif providesInvulnerability and not self[138] then
1038
1050
  self.object:incrementInvulnerabilityCounter()
1039
- self[137] = true
1051
+ self[138] = true
1040
1052
  end
1041
1053
  end
1042
1054
  },
@@ -1047,17 +1059,17 @@ __TS__SetDescriptor(
1047
1059
  "killsOnExpiration",
1048
1060
  {
1049
1061
  get = function(self)
1050
- local ____self__138_56 = self[138]
1051
- if ____self__138_56 == nil then
1052
- ____self__138_56 = false
1062
+ local ____self__139_56 = self[139]
1063
+ if ____self__139_56 == nil then
1064
+ ____self__139_56 = false
1053
1065
  end
1054
- return ____self__138_56
1066
+ return ____self__139_56
1055
1067
  end,
1056
1068
  set = function(self, killsOnExpiration)
1057
- if not killsOnExpiration and self[138] then
1058
- self[138] = nil
1059
- elseif killsOnExpiration and not self[138] then
1060
- self[138] = true
1069
+ if not killsOnExpiration and self[139] then
1070
+ self[139] = nil
1071
+ elseif killsOnExpiration and not self[139] then
1072
+ self[139] = true
1061
1073
  end
1062
1074
  end
1063
1075
  },
@@ -1068,17 +1080,17 @@ __TS__SetDescriptor(
1068
1080
  "explodesOnExpiration",
1069
1081
  {
1070
1082
  get = function(self)
1071
- local ____self__139_57 = self[139]
1072
- if ____self__139_57 == nil then
1073
- ____self__139_57 = false
1083
+ local ____self__140_57 = self[140]
1084
+ if ____self__140_57 == nil then
1085
+ ____self__140_57 = false
1074
1086
  end
1075
- return ____self__139_57
1087
+ return ____self__140_57
1076
1088
  end,
1077
1089
  set = function(self, killsOnExpiration)
1078
- if not killsOnExpiration and self[139] then
1079
- self[139] = nil
1080
- elseif killsOnExpiration and not self[139] then
1081
- self[139] = true
1090
+ if not killsOnExpiration and self[140] then
1091
+ self[140] = nil
1092
+ elseif killsOnExpiration and not self[140] then
1093
+ self[140] = true
1082
1094
  end
1083
1095
  end
1084
1096
  },
@@ -1089,13 +1101,13 @@ __TS__SetDescriptor(
1089
1101
  "maximumDamageDealtEventCount",
1090
1102
  {
1091
1103
  get = function(self)
1092
- return self[131] or 0
1104
+ return self[132] or 0
1093
1105
  end,
1094
1106
  set = function(self, maximumDamageDealtEventCount)
1095
1107
  if maximumDamageDealtEventCount == 0 then
1096
- self[131] = nil
1108
+ self[132] = nil
1097
1109
  else
1098
- self[131] = maximumDamageDealtEventCount
1110
+ self[132] = maximumDamageDealtEventCount
1099
1111
  end
1100
1112
  end
1101
1113
  },
@@ -1106,13 +1118,13 @@ __TS__SetDescriptor(
1106
1118
  "maximumDamageReceivedEventCount",
1107
1119
  {
1108
1120
  get = function(self)
1109
- return self[133] or 0
1121
+ return self[134] or 0
1110
1122
  end,
1111
1123
  set = function(self, maximumDamageReceivedEventCount)
1112
1124
  if maximumDamageReceivedEventCount == 0 then
1113
- self[133] = nil
1125
+ self[134] = nil
1114
1126
  else
1115
- self[133] = maximumDamageReceivedEventCount
1127
+ self[134] = maximumDamageReceivedEventCount
1116
1128
  end
1117
1129
  end
1118
1130
  },
@@ -1123,13 +1135,13 @@ __TS__SetDescriptor(
1123
1135
  "maximumAutoAttackCount",
1124
1136
  {
1125
1137
  get = function(self)
1126
- return self[129] or 0
1138
+ return self[130] or 0
1127
1139
  end,
1128
1140
  set = function(self, maximumAutoAttackCount)
1129
1141
  if maximumAutoAttackCount == 0 then
1130
- self[129] = nil
1142
+ self[130] = nil
1131
1143
  else
1132
- self[129] = maximumAutoAttackCount
1144
+ self[130] = maximumAutoAttackCount
1133
1145
  end
1134
1146
  end
1135
1147
  },
@@ -1140,10 +1152,10 @@ __TS__SetDescriptor(
1140
1152
  "durationIncreaseOnAutoAttack",
1141
1153
  {
1142
1154
  get = function(self)
1143
- return self[106] or 0
1155
+ return self[107] or 0
1144
1156
  end,
1145
1157
  set = function(self, durationIncreaseOnAutoAttack)
1146
- self[106] = durationIncreaseOnAutoAttack
1158
+ self[107] = durationIncreaseOnAutoAttack
1147
1159
  end
1148
1160
  },
1149
1161
  true
@@ -1174,11 +1186,24 @@ __TS__SetDescriptor(
1174
1186
  },
1175
1187
  true
1176
1188
  )
1189
+ __TS__SetDescriptor(
1190
+ Buff.prototype,
1191
+ "evasionProbability",
1192
+ {
1193
+ get = function(self)
1194
+ return self:getUnitBonus(UnitBonusType.EVASION_PROBABILITY)
1195
+ end,
1196
+ set = function(self, evasionProbability)
1197
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.EVASION_PROBABILITY, evasionProbability)
1198
+ end
1199
+ },
1200
+ true
1201
+ )
1177
1202
  __TS__SetDescriptor(
1178
1203
  Buff.prototype,
1179
1204
  "duration",
1180
1205
  {get = function(self)
1181
- return self[102]
1206
+ return self[103]
1182
1207
  end},
1183
1208
  true
1184
1209
  )
@@ -1195,7 +1220,7 @@ __TS__SetDescriptor(
1195
1220
  local ____opt_60 = self._timer
1196
1221
  local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1197
1222
  if remainingDurationDelta ~= 0 then
1198
- self[102] = self[102] + remainingDurationDelta
1223
+ self[103] = self[103] + remainingDurationDelta
1199
1224
  if remainingDuration <= 0 then
1200
1225
  Timer:run(destroyBuff, self)
1201
1226
  else
@@ -1221,10 +1246,11 @@ __TS__SetDescriptor(
1221
1246
  end
1222
1247
  },
1223
1248
  true
1224
- );
1249
+ )
1250
+ Buff.destroyEvent = buffDestroyEvent;
1225
1251
  (function(self)
1226
1252
  local function destroyBuffIfNeeded(buff)
1227
- if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1253
+ if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
1228
1254
  buff:destroy()
1229
1255
  end
1230
1256
  end