warscript 0.0.1-dev.632c807 → 0.0.1-dev.63f1d69

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 (99) hide show
  1. package/attributes.d.ts +12 -0
  2. package/attributes.lua +16 -0
  3. package/core/types/frame.d.ts +0 -1
  4. package/core/types/group.d.ts +0 -1
  5. package/core/types/handle.d.ts +2 -1
  6. package/core/types/handle.lua +5 -0
  7. package/core/types/image.d.ts +0 -1
  8. package/core/types/missile.d.ts +2 -2
  9. package/core/types/missile.lua +8 -2
  10. package/core/types/unit.lua +8 -0
  11. package/decl/index.d.ts +1 -0
  12. package/engine/ability.d.ts +1 -1
  13. package/engine/behavior.d.ts +10 -10
  14. package/engine/behaviour/ability/apply-unit-behavior.d.ts +13 -4
  15. package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
  16. package/engine/behaviour/ability/instant-impact.lua +4 -0
  17. package/engine/behaviour/ability.d.ts +8 -1
  18. package/engine/behaviour/ability.lua +62 -0
  19. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  20. package/engine/behaviour/unit.d.ts +3 -2
  21. package/engine/behaviour/unit.lua +7 -0
  22. package/engine/buff.d.ts +2 -2
  23. package/engine/buff.lua +8 -10
  24. package/engine/internal/ability.d.ts +1 -1
  25. package/engine/internal/mechanics/ability-duration.d.ts +1 -3
  26. package/engine/internal/mechanics/ability-duration.lua +2 -0
  27. package/engine/internal/mechanics/cast-ability.d.ts +2 -0
  28. package/engine/internal/mechanics/cast-ability.lua +86 -0
  29. package/engine/internal/unit/bonus.d.ts +5 -6
  30. package/engine/internal/unit/detach-missiles.d.ts +7 -0
  31. package/engine/internal/unit/detach-missiles.lua +30 -0
  32. package/engine/internal/unit-missile-launch.lua +1 -1
  33. package/engine/internal/unit.d.ts +37 -10
  34. package/engine/internal/unit.lua +249 -89
  35. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  36. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  37. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  38. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  39. package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
  40. package/engine/object-data/entry/ability-type/blink.lua +39 -0
  41. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  42. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  43. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  44. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  45. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  46. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  47. package/engine/object-data/entry/ability-type.d.ts +1 -1
  48. package/engine/object-data/entry/ability-type.lua +1 -0
  49. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  50. package/engine/object-data/entry/buff-type/applicable.lua +27 -71
  51. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  52. package/engine/object-data/entry/buff-type.d.ts +0 -1
  53. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  54. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  55. package/engine/object-data/entry/item-type.d.ts +0 -1
  56. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  57. package/engine/object-data/entry/unit-type.d.ts +42 -2
  58. package/engine/object-data/entry/unit-type.lua +378 -50
  59. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  60. package/engine/object-data/entry/upgrade.d.ts +0 -1
  61. package/engine/object-data/entry.d.ts +2 -3
  62. package/engine/object-field/ability.d.ts +8 -6
  63. package/engine/object-field/ability.lua +6 -0
  64. package/engine/object-field/unit.d.ts +1 -0
  65. package/engine/object-field/unit.lua +3 -0
  66. package/engine/object-field.d.ts +6 -4
  67. package/engine/object-field.lua +38 -12
  68. package/engine/random.d.ts +1 -0
  69. package/engine/random.lua +9 -0
  70. package/engine/standard/entries/unit-type.d.ts +42 -1
  71. package/engine/standard/entries/unit-type.lua +42 -1
  72. package/engine/standard/fields/ability.d.ts +1 -1
  73. package/engine/standard/fields/ability.lua +1 -1
  74. package/engine/unit.d.ts +1 -0
  75. package/engine/unit.lua +10 -2
  76. package/event.d.ts +2 -3
  77. package/event.lua +9 -5
  78. package/exception.d.ts +2 -0
  79. package/exception.lua +4 -0
  80. package/global/vec2.lua +1 -0
  81. package/lualib_bundle.lua +139 -40
  82. package/math/vec2.d.ts +2 -9
  83. package/math.d.ts +0 -2
  84. package/objutil/ability.d.ts +0 -1
  85. package/objutil/buff.d.ts +0 -1
  86. package/objutil/object.d.ts +0 -1
  87. package/objutil/unit.d.ts +0 -1
  88. package/package.json +13 -14
  89. package/string.d.ts +30 -0
  90. package/string.lua +14 -0
  91. package/util/stream.d.ts +0 -1
  92. package/utility/arrays.d.ts +4 -5
  93. package/utility/arrays.lua +4 -1
  94. package/utility/bit-set.d.ts +0 -2
  95. package/utility/linked-set.d.ts +21 -8
  96. package/utility/linked-set.lua +16 -0
  97. package/utility/lua-maps.d.ts +1 -2
  98. package/utility/lua-sets.d.ts +1 -2
  99. package/utility/types.d.ts +2 -2
@@ -5,9 +5,12 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
5
5
  local __TS__New = ____lualib.__TS__New
6
6
  local __TS__Class = ____lualib.__TS__Class
7
7
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
8
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
8
9
  local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
10
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
11
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
12
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
9
13
  local __TS__InstanceOf = ____lualib.__TS__InstanceOf
10
- local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
11
14
  local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
12
15
  local Set = ____lualib.Set
13
16
  local __TS__Spread = ____lualib.__TS__Spread
@@ -92,6 +95,10 @@ local isUnitInRangeXY = IsUnitInRangeXY
92
95
  local isUnitInRange = IsUnitInRange
93
96
  local setResourceAmount = SetResourceAmount
94
97
  local getResourceAmount = GetResourceAmount
98
+ local getUnitWeaponRealField = BlzGetUnitWeaponRealField
99
+ local setUnitWeaponRealField = BlzSetUnitWeaponRealField
100
+ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
101
+ local setUnitWeaponStringField = BlzSetUnitWeaponStringField
95
102
  local getUnitAbilityLevel = GetUnitAbilityLevel
96
103
  local unitDisableAbility = BlzUnitDisableAbility
97
104
  local unitInterruptAttack = BlzUnitInterruptAttack
@@ -275,9 +282,8 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
275
282
  end
276
283
  local function dispatch(event, idGetter, argsGetter)
277
284
  local initialized = false
278
- local x = {}
279
285
  return setmetatable(
280
- x,
286
+ {},
281
287
  {
282
288
  __index = function(self, id)
283
289
  if type(id) ~= "number" then
@@ -387,51 +393,158 @@ local getters = {
387
393
  return BlzGetUnitArmor(unit)
388
394
  end
389
395
  }
390
- local weaponGetters = {
391
- index = function(self, handle, index)
392
- return index
393
- end,
394
- cooldown = function(self, handle, index)
395
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, index)
396
- end,
397
- projectileArc = function(self, handle, index)
398
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, index)
399
- end,
400
- projectileArt = function(self, handle, index)
401
- return BlzGetUnitWeaponStringField(handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, index)
402
- end,
403
- projectileSpeed = function(self, handle, index)
404
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, index)
405
- end,
406
- attackPoint = function(self, handle, index)
407
- return BlzGetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, index)
408
- end
409
- }
410
- local weaponSetters = {
411
- cooldown = function(self, handle, index, value)
412
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, index, value))
413
- end,
414
- projectileArc = function(self, handle, index, value)
415
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, index, value))
416
- end,
417
- projectileArt = function(self, handle, index, value)
418
- assert(BlzSetUnitWeaponStringField(handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, index, value))
419
- end,
420
- projectileSpeed = function(self, handle, index, value)
421
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, index, value))
422
- end,
423
- attackPoint = function(self, handle, index, value)
424
- assert(BlzSetUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, index, value))
425
- end
426
- }
427
- local weaponMetatable = {
428
- __index = function(self, key)
429
- return weaponGetters[key](weaponGetters, self.h, self.i)
430
- end,
431
- __newindex = function(self, key, value)
432
- weaponSetters[key](weaponSetters, self.h, self.i, value)
433
- end
434
- }
396
+ ____exports.UnitWeapon = __TS__Class()
397
+ local UnitWeapon = ____exports.UnitWeapon
398
+ UnitWeapon.name = "UnitWeapon"
399
+ function UnitWeapon.prototype.____constructor(self, unit, index)
400
+ self.unit = unit
401
+ self.index = index
402
+ end
403
+ __TS__SetDescriptor(
404
+ UnitWeapon.prototype,
405
+ "cooldown",
406
+ {
407
+ get = function(self)
408
+ return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index)
409
+ end,
410
+ set = function(self, cooldown)
411
+ setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index, cooldown)
412
+ end
413
+ },
414
+ true
415
+ )
416
+ __TS__SetDescriptor(
417
+ UnitWeapon.prototype,
418
+ "damage",
419
+ {
420
+ get = function(self)
421
+ local minimumDamage = self.damageBase + self.damageDiceCount
422
+ local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
423
+ return {minimumDamage, maximumDamage}
424
+ end,
425
+ set = function(self, ____bindingPattern0)
426
+ local maximumDamage
427
+ local minimumDamage
428
+ minimumDamage = ____bindingPattern0[1]
429
+ maximumDamage = ____bindingPattern0[2]
430
+ self.damageBase = minimumDamage - 1
431
+ self.damageDiceCount = 1
432
+ self.damageDiceSideCount = maximumDamage - minimumDamage + 1
433
+ end
434
+ },
435
+ true
436
+ )
437
+ __TS__SetDescriptor(
438
+ UnitWeapon.prototype,
439
+ "damageBase",
440
+ {
441
+ get = function(self)
442
+ return BlzGetUnitBaseDamage(self.unit.handle, self.index)
443
+ end,
444
+ set = function(self, damageBase)
445
+ BlzSetUnitBaseDamage(self.unit.handle, self.index, damageBase)
446
+ end
447
+ },
448
+ true
449
+ )
450
+ __TS__SetDescriptor(
451
+ UnitWeapon.prototype,
452
+ "damageDiceCount",
453
+ {
454
+ get = function(self)
455
+ return BlzGetUnitDiceNumber(self.unit.handle, self.index)
456
+ end,
457
+ set = function(self, damageDiceCount)
458
+ BlzSetUnitDiceNumber(self.unit.handle, self.index, damageDiceCount)
459
+ end
460
+ },
461
+ true
462
+ )
463
+ __TS__SetDescriptor(
464
+ UnitWeapon.prototype,
465
+ "damageDiceSideCount",
466
+ {
467
+ get = function(self)
468
+ return BlzGetUnitDiceSides(self.unit.handle, self.index)
469
+ end,
470
+ set = function(self, damageDiceSideCount)
471
+ BlzSetUnitDiceSides(self.unit.handle, self.index, damageDiceSideCount)
472
+ end
473
+ },
474
+ true
475
+ )
476
+ __TS__SetDescriptor(
477
+ UnitWeapon.prototype,
478
+ "range",
479
+ {
480
+ get = function(self)
481
+ return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_RANGE, self.index)
482
+ end,
483
+ set = function(self, range)
484
+ local handle = self.unit.handle
485
+ local index = self.index
486
+ setUnitWeaponRealField(
487
+ handle,
488
+ UNIT_WEAPON_RF_ATTACK_RANGE,
489
+ index + 1,
490
+ getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1) + (range - getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index))
491
+ )
492
+ end
493
+ },
494
+ true
495
+ )
496
+ __TS__SetDescriptor(
497
+ UnitWeapon.prototype,
498
+ "impactDelay",
499
+ {
500
+ get = function(self)
501
+ return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index)
502
+ end,
503
+ set = function(self, impactDelay)
504
+ setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index, impactDelay)
505
+ end
506
+ },
507
+ true
508
+ )
509
+ __TS__SetDescriptor(
510
+ UnitWeapon.prototype,
511
+ "missileArc",
512
+ {
513
+ get = function(self)
514
+ return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index)
515
+ end,
516
+ set = function(self, missileArc)
517
+ setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index, missileArc)
518
+ end
519
+ },
520
+ true
521
+ )
522
+ __TS__SetDescriptor(
523
+ UnitWeapon.prototype,
524
+ "missileModelPath",
525
+ {
526
+ get = function(self)
527
+ return getUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index)
528
+ end,
529
+ set = function(self, missileModelPath)
530
+ setUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index, missileModelPath)
531
+ end
532
+ },
533
+ true
534
+ )
535
+ __TS__SetDescriptor(
536
+ UnitWeapon.prototype,
537
+ "missileSpeed",
538
+ {
539
+ get = function(self)
540
+ return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index)
541
+ end,
542
+ set = function(self, missileSpeed)
543
+ setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index, missileSpeed)
544
+ end
545
+ },
546
+ true
547
+ )
435
548
  local unitInventorySize = UnitInventorySize
436
549
  local unitItemInSlot = UnitItemInSlot
437
550
  local getItemAbility = BlzGetItemAbility
@@ -442,8 +555,6 @@ local getAbilityName = GetAbilityName
442
555
  local unitAddAbility = UnitAddAbility
443
556
  local getUnitGoldCost = GetUnitGoldCost
444
557
  local getUnitLumberCost = GetUnitWoodCost
445
- local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
446
- local unitAddItem = UnitAddItem
447
558
  local unitRemoveAbility = UnitRemoveAbility
448
559
  local function retrieveAbility(unit, ability, abilityId)
449
560
  if ability == nil then
@@ -520,6 +631,23 @@ for ____, player in ipairs(Player.all) do
520
631
  ShowUnit(dummy, false)
521
632
  dummies[player] = dummy
522
633
  end
634
+ local function delayHealthChecksCallback(unit)
635
+ local counter = (unit[102] or 0) - 1
636
+ if counter ~= 0 then
637
+ unit[102] = counter
638
+ return
639
+ end
640
+ unit[102] = nil
641
+ local healthBonus = unit[103]
642
+ if healthBonus ~= nil then
643
+ unit[103] = nil
644
+ local handle = unit.handle
645
+ BlzSetUnitMaxHP(
646
+ handle,
647
+ BlzGetUnitMaxHP(handle) - healthBonus
648
+ )
649
+ end
650
+ end
523
651
  ____exports.Unit = __TS__Class()
524
652
  local Unit = ____exports.Unit
525
653
  Unit.name = "Unit"
@@ -578,10 +706,7 @@ function Unit.prototype.onDestroy(self)
578
706
  if eventsToDestroy ~= nil then
579
707
  forEach(eventsToDestroy, "destroy")
580
708
  end
581
- if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
582
- unitRemoveAbility(handle, leaveDetectAbilityId)
583
- removeUnit(handle)
584
- end
709
+ removeUnit(handle)
585
710
  return Handle.prototype.onDestroy(self)
586
711
  end
587
712
  function Unit.prototype.addAttackHandler(self, condition, action)
@@ -674,6 +799,10 @@ end
674
799
  function Unit.prototype.queueAnimation(self, animation)
675
800
  queueUnitAnimation(self.handle, animation)
676
801
  end
802
+ function Unit.prototype.delayHealthChecks(self)
803
+ self[102] = (self[102] or 0) + 1
804
+ Timer:run(delayHealthChecksCallback, self)
805
+ end
677
806
  function Unit.prototype.setPosition(self, x, y)
678
807
  setUnitPosition(self.handle, x, y)
679
808
  end
@@ -687,8 +816,15 @@ end
687
816
  function Unit.prototype.kill(self)
688
817
  killUnit(self.handle)
689
818
  end
690
- function Unit.prototype.revive(self, pos, doEffect)
691
- ReviveHero(self.handle, pos.x, pos.y, doEffect)
819
+ function Unit.prototype.revive(self, x, y, doEffect)
820
+ local ____ReviveHero_4 = ReviveHero
821
+ local ____array_3 = __TS__SparseArrayNew(self.handle, x, y)
822
+ local ____doEffect_2 = doEffect
823
+ if ____doEffect_2 == nil then
824
+ ____doEffect_2 = false
825
+ end
826
+ __TS__SparseArrayPush(____array_3, ____doEffect_2)
827
+ ____ReviveHero_4(__TS__SparseArraySpread(____array_3))
692
828
  end
693
829
  function Unit.prototype.healTarget(self, target, amount)
694
830
  if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
@@ -784,6 +920,9 @@ end
784
920
  function Unit.prototype.hideAbility(self, abilityId, flag)
785
921
  BlzUnitHideAbility(self.handle, abilityId, flag)
786
922
  end
923
+ function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
924
+ return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
925
+ end
787
926
  function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
788
927
  BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
789
928
  end
@@ -1071,12 +1210,27 @@ __TS__SetDescriptor(
1071
1210
  Unit.prototype,
1072
1211
  "weapons",
1073
1212
  {get = function(self)
1074
- local weapons = {
1075
- setmetatable({h = self.handle, i = 0}, weaponMetatable),
1076
- setmetatable({h = self.handle, i = 1}, weaponMetatable)
1077
- }
1078
- rawset(self, "weapons", weapons)
1079
- return weapons
1213
+ return {self.firstWeapon, self.secondWeapon}
1214
+ end},
1215
+ true
1216
+ )
1217
+ __TS__SetDescriptor(
1218
+ Unit.prototype,
1219
+ "firstWeapon",
1220
+ {get = function(self)
1221
+ local weapon = __TS__New(____exports.UnitWeapon, self, 0)
1222
+ rawset(self, "firstWeapon", weapon)
1223
+ return weapon
1224
+ end},
1225
+ true
1226
+ )
1227
+ __TS__SetDescriptor(
1228
+ Unit.prototype,
1229
+ "secondWeapon",
1230
+ {get = function(self)
1231
+ local weapon = __TS__New(____exports.UnitWeapon, self, 1)
1232
+ rawset(self, "secondWeapon", weapon)
1233
+ return weapon
1080
1234
  end},
1081
1235
  true
1082
1236
  )
@@ -1233,17 +1387,17 @@ __TS__SetDescriptor(
1233
1387
  "isTeamGlowVisible",
1234
1388
  {
1235
1389
  get = function(self)
1236
- return not self[103]
1390
+ return not self[105]
1237
1391
  end,
1238
1392
  set = function(self, isTeamGlowVisible)
1239
1393
  showUnitTeamGlow(self.handle, isTeamGlowVisible)
1240
- local ____temp_2
1394
+ local ____temp_5
1241
1395
  if not isTeamGlowVisible then
1242
- ____temp_2 = true
1396
+ ____temp_5 = true
1243
1397
  else
1244
- ____temp_2 = nil
1398
+ ____temp_5 = nil
1245
1399
  end
1246
- self[103] = ____temp_2
1400
+ self[105] = ____temp_5
1247
1401
  end
1248
1402
  },
1249
1403
  true
@@ -1253,7 +1407,7 @@ __TS__SetDescriptor(
1253
1407
  "color",
1254
1408
  {set = function(self, color)
1255
1409
  setUnitColor(self.handle, color.handle)
1256
- if self[103] then
1410
+ if self[105] then
1257
1411
  showUnitTeamGlow(self.handle, false)
1258
1412
  end
1259
1413
  end},
@@ -1277,10 +1431,14 @@ __TS__SetDescriptor(
1277
1431
  "maxHealth",
1278
1432
  {
1279
1433
  get = function(self)
1280
- return BlzGetUnitMaxHP(self.handle) - (self[102] or 0)
1434
+ return BlzGetUnitMaxHP(self.handle) - (self[103] or 0) - (self[104] or 0)
1281
1435
  end,
1282
1436
  set = function(self, maxHealth)
1283
- BlzSetUnitMaxHP(self.handle, maxHealth + (self[102] or 0))
1437
+ if maxHealth < 1 and self[102] ~= nil then
1438
+ self[103] = (self[103] or 0) + (1 - maxHealth)
1439
+ maxHealth = 1
1440
+ end
1441
+ BlzSetUnitMaxHP(self.handle, maxHealth + (self[104] or 0))
1284
1442
  end
1285
1443
  },
1286
1444
  true
@@ -1322,10 +1480,10 @@ __TS__SetDescriptor(
1322
1480
  "health",
1323
1481
  {
1324
1482
  get = function(self)
1325
- return GetWidgetLife(self.handle) - (self[102] or 0)
1483
+ return GetWidgetLife(self.handle) - (self[104] or 0)
1326
1484
  end,
1327
1485
  set = function(self, health)
1328
- SetWidgetLife(self.handle, health + (self[102] or 0))
1486
+ SetWidgetLife(self.handle, health + (self[104] or 0))
1329
1487
  end
1330
1488
  },
1331
1489
  true
@@ -1962,25 +2120,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
1962
2120
  function(event)
1963
2121
  local invoke = Event.invoke
1964
2122
  local function listener(unit, id)
1965
- local ____GetSpellTargetUnit_result_5
2123
+ local ____GetSpellTargetUnit_result_8
1966
2124
  if GetSpellTargetUnit() then
1967
- ____GetSpellTargetUnit_result_5 = ____exports.Unit:of(GetSpellTargetUnit())
2125
+ ____GetSpellTargetUnit_result_8 = ____exports.Unit:of(GetSpellTargetUnit())
1968
2126
  else
1969
- local ____GetSpellTargetItem_result_4
2127
+ local ____GetSpellTargetItem_result_7
1970
2128
  if GetSpellTargetItem() then
1971
- ____GetSpellTargetItem_result_4 = Item:of(GetSpellTargetItem())
2129
+ ____GetSpellTargetItem_result_7 = Item:of(GetSpellTargetItem())
1972
2130
  else
1973
- local ____GetSpellTargetDestructable_result_3
2131
+ local ____GetSpellTargetDestructable_result_6
1974
2132
  if GetSpellTargetDestructable() then
1975
- ____GetSpellTargetDestructable_result_3 = Destructable:of(GetSpellTargetDestructable())
2133
+ ____GetSpellTargetDestructable_result_6 = Destructable:of(GetSpellTargetDestructable())
1976
2134
  else
1977
- ____GetSpellTargetDestructable_result_3 = nil
2135
+ ____GetSpellTargetDestructable_result_6 = nil
1978
2136
  end
1979
- ____GetSpellTargetItem_result_4 = ____GetSpellTargetDestructable_result_3
2137
+ ____GetSpellTargetItem_result_7 = ____GetSpellTargetDestructable_result_6
1980
2138
  end
1981
- ____GetSpellTargetUnit_result_5 = ____GetSpellTargetItem_result_4
2139
+ ____GetSpellTargetUnit_result_8 = ____GetSpellTargetItem_result_7
1982
2140
  end
1983
- local target = ____GetSpellTargetUnit_result_5
2141
+ local target = ____GetSpellTargetUnit_result_8
1984
2142
  if target then
1985
2143
  invoke(event, unit, id, target)
1986
2144
  end
@@ -2308,7 +2466,7 @@ Unit.onDamage = __TS__New(
2308
2466
  invoke(event, source, target, evData)
2309
2467
  if evData[0] ~= nil and target.health - evData.amount < 0.405 then
2310
2468
  local bonusHealth = math.ceil(evData.amount)
2311
- target[102] = (target[102] or 0) + bonusHealth
2469
+ target[104] = (target[104] or 0) + bonusHealth
2312
2470
  BlzSetUnitMaxHP(
2313
2471
  target.handle,
2314
2472
  BlzGetUnitMaxHP(target.handle) + bonusHealth
@@ -2322,7 +2480,7 @@ Unit.onDamage = __TS__New(
2322
2480
  evData[0],
2323
2481
  table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
2324
2482
  )
2325
- target[102] = (target[102] or 0) - bonusHealth
2483
+ target[104] = (target[104] or 0) - bonusHealth
2326
2484
  SetWidgetLife(
2327
2485
  target.handle,
2328
2486
  GetWidgetLife(target.handle) - bonusHealth
@@ -2417,13 +2575,15 @@ __TS__ObjectDefineProperty(
2417
2575
  orderId("unimmolation")
2418
2576
  }) do
2419
2577
  ____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
2420
- local handle = unit.handle
2421
- for i = 1, #leaveAbilityIds do
2422
- if getUnitAbilityLevel(handle, leaveAbilityIds[i]) ~= 0 then
2423
- return
2578
+ if unit.state == 1 then
2579
+ local handle = unit.handle
2580
+ for i = 1, #leaveAbilityIds do
2581
+ if getUnitAbilityLevel(handle, leaveAbilityIds[i]) ~= 0 then
2582
+ return
2583
+ end
2424
2584
  end
2585
+ unit:destroy()
2425
2586
  end
2426
- unit:destroy()
2427
2587
  end)
2428
2588
  end
2429
2589
  end)(Unit)
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { ModelNodeName } from "./model-node-name";
4
3
  import { ModelNodeQualifier } from "./model-node-qualifier";
@@ -1,5 +1,3 @@
1
- /// <reference types="@warscript/language-extensions" />
2
- /// <reference types="@typescript-to-lua/language-extensions" />
3
1
  /** @noSelfInFile */
4
2
  export declare const enum CombatClassification {
5
3
  NONE = 1,// 2^0
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ChannelAbilityType, ChannelAbilityTypeTargetingType } from "./channel";
4
3
  import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { DiseaseCloudAbilityType } from "./disease-cloud";
4
3
  export declare class BlankPassiveAbilityType extends DiseaseCloudAbilityType {
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class BlinkAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get maximumRange(): number[];
7
+ set maximumRange(maximumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
8
+ get minimumRange(): number[];
9
+ set minimumRange(minimumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ }
@@ -0,0 +1,39 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ ____exports.BlinkAbilityType = __TS__Class()
9
+ local BlinkAbilityType = ____exports.BlinkAbilityType
10
+ BlinkAbilityType.name = "BlinkAbilityType"
11
+ __TS__ClassExtends(BlinkAbilityType, AbilityType)
12
+ BlinkAbilityType.BASE_ID = fourCC("AEbl")
13
+ __TS__SetDescriptor(
14
+ BlinkAbilityType.prototype,
15
+ "maximumRange",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Ebl1")
19
+ end,
20
+ set = function(self, maximumRange)
21
+ self:setNumberLevelField("Ebl1", maximumRange)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ BlinkAbilityType.prototype,
28
+ "minimumRange",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Ebl2")
32
+ end,
33
+ set = function(self, minimumRange)
34
+ self:setNumberLevelField("Ebl2", minimumRange)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ return ____exports
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { AbilityType, AbilityTypeId } from "../ability-type";
4
3
  import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
@@ -7,7 +7,7 @@ local ____exports = {}
7
7
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
8
8
  local AbilityType = ____ability_2Dtype.AbilityType
9
9
  local ____arrays = require("utility.arrays")
10
- local EMPTY_ARRAY = ____arrays.EMPTY_ARRAY
10
+ local emptyArray = ____arrays.emptyArray
11
11
  local map = ____arrays.map
12
12
  local ____buff_2Dtype = require("engine.object-data.entry.buff-type")
13
13
  local BuffType = ____buff_2Dtype.BuffType
@@ -78,7 +78,7 @@ __TS__SetDescriptor(
78
78
  function(levelAbilityUpgrades)
79
79
  return levelAbilityUpgrades[i + 1]
80
80
  end
81
- ) or (abilityUpgrades[i + 1] or EMPTY_ARRAY)
81
+ ) or (abilityUpgrades[i + 1] or emptyArray())
82
82
  )
83
83
  end
84
84
  end
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class MineAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get activationDelay(): number[];
7
+ set activationDelay(activationDelay: ObjectDataEntryLevelFieldValueSupplier<number>);
8
+ get invisibilityDelay(): number[];
9
+ set invisibilityDelay(invisibilityDelay: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ }
@@ -0,0 +1,39 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ ____exports.MineAbilityType = __TS__Class()
9
+ local MineAbilityType = ____exports.MineAbilityType
10
+ MineAbilityType.name = "MineAbilityType"
11
+ __TS__ClassExtends(MineAbilityType, AbilityType)
12
+ MineAbilityType.BASE_ID = fourCC("Amin")
13
+ __TS__SetDescriptor(
14
+ MineAbilityType.prototype,
15
+ "activationDelay",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Min1")
19
+ end,
20
+ set = function(self, activationDelay)
21
+ self:setNumberLevelField("Min1", activationDelay)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ MineAbilityType.prototype,
28
+ "invisibilityDelay",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Min2")
32
+ end,
33
+ set = function(self, invisibilityDelay)
34
+ self:setNumberLevelField("Min2", invisibilityDelay)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ return ____exports
@@ -7,8 +7,8 @@ export declare class SpiritTouchAbilityType extends AbilityType {
7
7
  set manaGain(manaGain: ObjectDataEntryLevelFieldValueSupplier<number>);
8
8
  get manaRequirement(): number[];
9
9
  set manaRequirement(manaRequirement: ObjectDataEntryLevelFieldValueSupplier<number>);
10
- get maximumTargetCount(): number[];
11
- set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
12
10
  get maximumManaCostFactor(): number[];
13
11
  set maximumManaCostFactor(maximumManaCostFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ get maximumTargetCount(): number[];
13
+ set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
14
14
  }