warscript 0.0.1-dev.9eab2af → 0.0.1-dev.9ee7706

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