warscript 0.0.1-dev.ff2a62d → 0.0.1-dev.ff5dbcd

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