warscript 0.0.1-dev.f48f7bb → 0.0.1-dev.f9321c0

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