warscript 0.0.1-dev.fae1c72 → 0.0.1-dev.fcc9d08

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