warscript 0.0.1-dev.ee2345e → 0.0.1-dev.f48f7bb

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 (143) hide show
  1. package/attributes.d.ts +0 -1
  2. package/binaryreader.d.ts +1 -0
  3. package/binaryreader.lua +3 -0
  4. package/core/types/effect.d.ts +13 -3
  5. package/core/types/effect.lua +116 -17
  6. package/core/types/frame.d.ts +8 -1
  7. package/core/types/frame.lua +93 -1
  8. package/core/types/group.d.ts +0 -1
  9. package/core/types/image.d.ts +0 -1
  10. package/core/types/missile.d.ts +2 -2
  11. package/core/types/missile.lua +8 -2
  12. package/core/types/unit.lua +8 -0
  13. package/core/util.d.ts +1 -1
  14. package/core/util.lua +12 -0
  15. package/decl/index.d.ts +1 -0
  16. package/engine/ability.d.ts +1 -1
  17. package/engine/behavior.d.ts +10 -10
  18. package/engine/behavior.lua +6 -6
  19. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  20. package/engine/behaviour/ability/always-enabled.lua +31 -0
  21. package/engine/behaviour/ability/apply-buff.d.ts +3 -5
  22. package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
  23. package/engine/behaviour/ability/damage.d.ts +33 -11
  24. package/engine/behaviour/ability/damage.lua +89 -31
  25. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  26. package/engine/behaviour/ability/emulate-impact.lua +28 -0
  27. package/engine/behaviour/ability/heal.d.ts +33 -6
  28. package/engine/behaviour/ability/heal.lua +89 -10
  29. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  30. package/engine/behaviour/ability/instant-impact.lua +4 -15
  31. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  32. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  33. package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
  34. package/engine/behaviour/ability/remove-buffs.lua +28 -0
  35. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  36. package/engine/behaviour/ability/restore-mana.lua +29 -0
  37. package/engine/behaviour/ability.d.ts +21 -3
  38. package/engine/behaviour/ability.lua +120 -12
  39. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  40. package/engine/behaviour/unit.d.ts +8 -2
  41. package/engine/behaviour/unit.lua +27 -0
  42. package/engine/buff.d.ts +68 -21
  43. package/engine/buff.lua +276 -90
  44. package/engine/game-map.d.ts +7 -0
  45. package/engine/game-map.lua +32 -0
  46. package/engine/internal/ability.d.ts +16 -13
  47. package/engine/internal/ability.lua +82 -76
  48. package/engine/internal/item/ability.lua +106 -0
  49. package/engine/internal/item+owner.lua +2 -2
  50. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  51. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  52. package/engine/internal/unit/ability.d.ts +10 -1
  53. package/engine/internal/unit/ability.lua +36 -14
  54. package/engine/internal/unit/bonus.d.ts +9 -8
  55. package/engine/internal/unit/bonus.lua +6 -1
  56. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  57. package/engine/internal/unit/ignore-events-items.lua +5 -0
  58. package/engine/internal/unit/item.d.ts +24 -0
  59. package/engine/internal/unit/item.lua +123 -0
  60. package/engine/internal/unit/main-selected.d.ts +13 -0
  61. package/engine/internal/unit/main-selected.lua +51 -0
  62. package/engine/internal/unit+ability.lua +2 -2
  63. package/engine/internal/unit+transport.lua +4 -10
  64. package/engine/internal/unit-missile-launch.lua +25 -6
  65. package/engine/internal/unit.d.ts +58 -16
  66. package/engine/internal/unit.lua +364 -132
  67. package/engine/internal/utility.lua +12 -0
  68. package/engine/local-client.d.ts +7 -2
  69. package/engine/local-client.lua +82 -0
  70. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  71. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  72. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  73. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  74. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  75. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  76. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  77. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  78. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  79. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  80. package/engine/object-data/entry/ability-type.d.ts +0 -1
  81. package/engine/object-data/entry/ability-type.lua +8 -12
  82. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  83. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  84. package/engine/object-data/entry/buff-type.d.ts +0 -1
  85. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  86. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  87. package/engine/object-data/entry/item-type.d.ts +14 -1
  88. package/engine/object-data/entry/item-type.lua +91 -0
  89. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  90. package/engine/object-data/entry/unit-type.d.ts +37 -2
  91. package/engine/object-data/entry/unit-type.lua +333 -49
  92. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  93. package/engine/object-data/entry/upgrade.d.ts +0 -1
  94. package/engine/object-data/entry.d.ts +2 -3
  95. package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
  96. package/engine/object-field/ability.d.ts +26 -3
  97. package/engine/object-field/ability.lua +54 -1
  98. package/engine/object-field.d.ts +2 -3
  99. package/engine/object-field.lua +4 -0
  100. package/engine/random.d.ts +1 -0
  101. package/engine/random.lua +9 -0
  102. package/engine/standard/entries/unit-type.d.ts +39 -1
  103. package/engine/standard/entries/unit-type.lua +39 -1
  104. package/engine/standard/fields/ability.d.ts +3 -1
  105. package/engine/standard/fields/ability.lua +3 -1
  106. package/engine/unit.d.ts +2 -0
  107. package/engine/unit.lua +11 -2
  108. package/event.d.ts +2 -3
  109. package/event.lua +9 -5
  110. package/index.d.ts +1 -0
  111. package/index.lua +1 -0
  112. package/lualib_bundle.lua +146 -42
  113. package/math/vec2.d.ts +2 -9
  114. package/math.d.ts +0 -2
  115. package/net/socket.d.ts +7 -1
  116. package/net/socket.lua +45 -4
  117. package/network.d.ts +1 -0
  118. package/network.lua +3 -2
  119. package/objutil/ability.d.ts +0 -1
  120. package/objutil/buff.d.ts +0 -1
  121. package/objutil/buff.lua +1 -1
  122. package/objutil/object.d.ts +0 -1
  123. package/objutil/unit.d.ts +0 -1
  124. package/package.json +13 -14
  125. package/patch-lua.d.ts +0 -0
  126. package/patch-lua.lua +10 -0
  127. package/property.d.ts +55 -0
  128. package/property.lua +374 -0
  129. package/string.d.ts +30 -0
  130. package/string.lua +14 -0
  131. package/util/stream.d.ts +0 -1
  132. package/utility/arrays.d.ts +11 -5
  133. package/utility/arrays.lua +34 -3
  134. package/utility/bit-set.d.ts +0 -2
  135. package/utility/lazy.d.ts +2 -0
  136. package/utility/lazy.lua +14 -0
  137. package/utility/linked-set.d.ts +11 -3
  138. package/utility/linked-set.lua +5 -2
  139. package/utility/lua-maps.d.ts +1 -2
  140. package/utility/lua-sets.d.ts +1 -2
  141. package/utility/types.d.ts +1 -0
  142. package/core/mapbounds.d.ts +0 -8
  143. package/core/mapbounds.lua +0 -12
package/engine/buff.lua CHANGED
@@ -46,6 +46,10 @@ local ____arrays = require("utility.arrays")
46
46
  local forEach = ____arrays.forEach
47
47
  local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
48
48
  local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
49
+ local ____item = require("engine.internal.item")
50
+ local Item = ____item.Item
51
+ local ____destructable = require("core.types.destructable")
52
+ local Destructable = ____destructable.Destructable
49
53
  local getUnitAbility = BlzGetUnitAbility
50
54
  local stringValueByBuffTypeIdByFieldId = postcompile(function()
51
55
  local stringValueByBuffTypeIdByFieldId = {}
@@ -94,6 +98,7 @@ local buffParametersKeys = {
94
98
  armorIncreaseFactor = true,
95
99
  attackSpeedIncreaseFactor = true,
96
100
  movementSpeedIncreaseFactor = true,
101
+ damageFactor = true,
97
102
  receivedDamageFactor = true,
98
103
  receivedMagicDamageFactor = true,
99
104
  durationIncreaseOnAutoAttack = true,
@@ -107,8 +112,26 @@ local buffParametersKeys = {
107
112
  disablesAutoAttack = true,
108
113
  destroysOnDamage = true,
109
114
  maximumAutoAttackCount = true,
110
- uniqueGroup = true
115
+ maximumDamageDealtEventCount = true,
116
+ maximumDamageReceivedEventCount = true,
117
+ uniqueGroup = true,
118
+ damageOnExpiration = true,
119
+ healingOnExpiration = true,
120
+ killsOnExpiration = true,
121
+ explodesOnExpiration = true
111
122
  }
123
+ local function resolveEnumValue(ability, level, value)
124
+ if value == nil or type(value) == "number" then
125
+ return value
126
+ end
127
+ if ability == nil then
128
+ error(
129
+ __TS__New(IllegalArgumentException),
130
+ 0
131
+ )
132
+ end
133
+ return value:getValue(ability, level or ability.level)
134
+ end
112
135
  local function resolveNumberValue(ability, level, value)
113
136
  if value == nil or type(value) == "number" then
114
137
  return value
@@ -145,20 +168,32 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
145
168
  buff[property] = resolvedValue
146
169
  end
147
170
  end
148
- local buffBooleanParameters = {"stuns", "ignoresStunImmunity", "disablesAutoAttack", "providesInvulnerability"}
171
+ local buffBooleanParameters = {
172
+ "stuns",
173
+ "ignoresStunImmunity",
174
+ "disablesAutoAttack",
175
+ "providesInvulnerability",
176
+ "killsOnExpiration",
177
+ "explodesOnExpiration"
178
+ }
149
179
  local buffNumberParameters = {
150
180
  "durationIncreaseOnAutoAttack",
151
181
  "attackSpeedIncreaseFactor",
152
182
  "movementSpeedIncreaseFactor",
153
183
  "armorIncrease",
184
+ "damageFactor",
154
185
  "receivedDamageFactor",
155
186
  "maximumAutoAttackCount",
187
+ "maximumDamageDealtEventCount",
188
+ "maximumDamageReceivedEventCount",
156
189
  "damageInterval",
157
190
  "damagePerInterval",
158
191
  "damageOverDuration",
159
192
  "healingInterval",
160
193
  "healingPerInterval",
161
- "healingOverDuration"
194
+ "healingOverDuration",
195
+ "damageOnExpiration",
196
+ "healingOnExpiration"
162
197
  }
163
198
  local unsuccessfulApplicationMarker = {}
164
199
  local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
@@ -207,6 +242,7 @@ local function expireBuff(buff)
207
242
  end
208
243
  end
209
244
  Timer:run(destroyBuff, buff)
245
+ buff:onExpiration()
210
246
  end
211
247
  local function buffDamageIntervalInitialTimerCallback(buff)
212
248
  buffDamageIntervalTimerCallback(buff)
@@ -296,8 +332,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
296
332
  end
297
333
  end
298
334
  self.typeId = typeId
299
- self.polarity = polarity
300
- self.resistanceType = resistanceType
301
335
  if not __TS__InstanceOf(ability, Ability) then
302
336
  parameters = ability
303
337
  ability = nil
@@ -324,6 +358,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
324
358
  learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
325
359
  duration = duration or getAbilityDuration(ability, _unit)
326
360
  end
361
+ self.polarity = resolveEnumValue(ability, level, polarity)
362
+ self.resistanceType = resolveEnumValue(ability, level, resistanceType)
327
363
  local buffByTypeId = buffByTypeIdByUnit[_unit]
328
364
  if buffByTypeId == nil then
329
365
  buffByTypeId = {}
@@ -340,8 +376,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
340
376
  if not internalApplyBuff(
341
377
  _unit,
342
378
  typeId,
343
- polarity,
344
- resistanceType,
379
+ self.polarity,
380
+ self.resistanceType,
345
381
  level,
346
382
  duration,
347
383
  spellStealPriority,
@@ -450,6 +486,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
450
486
  timer:start(duration, false, expireBuff, self)
451
487
  self._timer = timer
452
488
  end
489
+ self:onCreate()
453
490
  end
454
491
  function Buff.prototype.getUnitBonus(self, bonusType)
455
492
  local ____opt_36 = self._bonusIdByBonusType
@@ -464,26 +501,30 @@ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
464
501
  end
465
502
  bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
466
503
  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
504
+ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
505
+ if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
506
+ Effect:flash(self[104], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
479
507
  else
480
- ____isWidgetProvided_38 = widgetOrDuration
508
+ local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
509
+ local ____Effect_40 = Effect
510
+ local ____Effect_flash_41 = Effect.flash
511
+ local ____array_39 = __TS__SparseArrayNew(
512
+ self[104],
513
+ isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
514
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
515
+ )
516
+ local ____isWidgetProvided_38
517
+ if isWidgetProvided then
518
+ ____isWidgetProvided_38 = yOrParametersOrDuration
519
+ else
520
+ ____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
521
+ end
522
+ __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
523
+ ____Effect_flash_41(
524
+ ____Effect_40,
525
+ __TS__SparseArraySpread(____array_39)
526
+ )
481
527
  end
482
- __TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
483
- ____Effect_flash_41(
484
- ____Effect_40,
485
- __TS__SparseArraySpread(____array_39)
486
- )
487
528
  end
488
529
  function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
489
530
  local isWidgetProvided = type(widgetOrDuration) == "table"
@@ -506,6 +547,8 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
506
547
  __TS__SparseArraySpread(____array_43)
507
548
  )
508
549
  end
550
+ function Buff.prototype.onCreate(self)
551
+ end
509
552
  function Buff.prototype.onDestroy(self)
510
553
  local unit = self._unit
511
554
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
@@ -530,11 +573,11 @@ function Buff.prototype.onDestroy(self)
530
573
  behavior:destroy()
531
574
  end
532
575
  end
533
- if self[130] then
576
+ if self[136] then
534
577
  unit:decrementDisableAutoAttackCounter()
535
578
  end
536
- if self[128] then
537
- if self[129] then
579
+ if self[134] then
580
+ if self[135] then
538
581
  unit:decrementStunCounter()
539
582
  end
540
583
  unit:decrementStunCounter()
@@ -583,20 +626,34 @@ function Buff.getByTypeId(self, unit, typeId)
583
626
  end
584
627
  return nil
585
628
  end
586
- function Buff.prototype.onDeath(self, source)
629
+ function Buff.prototype.onExpiration(self)
587
630
  local unit = self.unit
588
631
  if self[119] ~= nil then
632
+ (self[101] or unit):damageTarget(unit, self[119] or 0)
633
+ end
634
+ if self[120] ~= nil then
635
+ (self[101] or unit):healTarget(unit, self[119] or 0)
636
+ end
637
+ if self[139] then
638
+ unit:explode()
639
+ elseif self[138] then
640
+ unit:kill()
641
+ end
642
+ end
643
+ function Buff.prototype.onDeath(self, source)
644
+ local unit = self.unit
645
+ if self[121] ~= nil then
589
646
  damageArea(
590
647
  self[101] or unit,
591
- self[119],
648
+ self[121],
592
649
  unit.x,
593
650
  unit.y,
594
- self[121] or 0,
595
- self[120] or 0,
596
651
  self[123] or 0,
597
652
  self[122] or 0,
598
653
  self[125] or 0,
599
- self[124] or 0
654
+ self[124] or 0,
655
+ self[127] or 0,
656
+ self[126] or 0
600
657
  )
601
658
  end
602
659
  end
@@ -618,9 +675,25 @@ function Buff.prototype.onDamageDealt(self, target, event)
618
675
  end
619
676
  self.remainingDuration = remainingDuration
620
677
  end
621
- local autoAttackCount = (self[126] or 0) + 1
622
- self[126] = autoAttackCount
623
- if autoAttackCount == self[127] then
678
+ local autoAttackCount = (self[128] or 0) + 1
679
+ self[128] = autoAttackCount
680
+ if autoAttackCount == self[129] then
681
+ self:destroy()
682
+ end
683
+ end
684
+ if event.originalAmount ~= 0 then
685
+ local damageDealtEventCount = (self[130] or 0) + 1
686
+ self[130] = damageDealtEventCount
687
+ if damageDealtEventCount == self[131] then
688
+ self:destroy()
689
+ end
690
+ end
691
+ end
692
+ function Buff.prototype.onDamageReceived(self, source, event)
693
+ if event.originalAmount ~= 0 then
694
+ local damageReceivedEventCount = (self[132] or 0) + 1
695
+ self[132] = damageReceivedEventCount
696
+ if damageReceivedEventCount == self[133] then
624
697
  self:destroy()
625
698
  end
626
699
  end
@@ -802,6 +875,45 @@ __TS__SetDescriptor(
802
875
  },
803
876
  true
804
877
  )
878
+ __TS__SetDescriptor(
879
+ Buff.prototype,
880
+ "damageOnExpiration",
881
+ {
882
+ get = function(self)
883
+ return self[119] or 0
884
+ end,
885
+ set = function(self, damageOnExpiration)
886
+ self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
887
+ end
888
+ },
889
+ true
890
+ )
891
+ __TS__SetDescriptor(
892
+ Buff.prototype,
893
+ "healingOnExpiration",
894
+ {
895
+ get = function(self)
896
+ return self[120] or 0
897
+ end,
898
+ set = function(self, healingOnExpiration)
899
+ self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
900
+ end
901
+ },
902
+ true
903
+ )
904
+ __TS__SetDescriptor(
905
+ Buff.prototype,
906
+ "damageFactor",
907
+ {
908
+ get = function(self)
909
+ return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
910
+ end,
911
+ set = function(self, damageFactor)
912
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
913
+ end
914
+ },
915
+ true
916
+ )
805
917
  __TS__SetDescriptor(
806
918
  Buff.prototype,
807
919
  "receivedDamageFactor",
@@ -833,25 +945,25 @@ __TS__SetDescriptor(
833
945
  "stuns",
834
946
  {
835
947
  get = function(self)
836
- local ____self__128_52 = self[128]
837
- if ____self__128_52 == nil then
838
- ____self__128_52 = false
948
+ local ____self__134_52 = self[134]
949
+ if ____self__134_52 == nil then
950
+ ____self__134_52 = false
839
951
  end
840
- return ____self__128_52
952
+ return ____self__134_52
841
953
  end,
842
954
  set = function(self, stuns)
843
- if not stuns and self[128] then
844
- if self[129] then
955
+ if not stuns and self[134] then
956
+ if self[135] then
845
957
  self.object:decrementStunCounter()
846
958
  end
847
959
  self.object:decrementStunCounter()
848
- self[128] = nil
849
- elseif stuns and not self[128] then
850
- if self[129] then
960
+ self[134] = nil
961
+ elseif stuns and not self[134] then
962
+ if self[135] then
851
963
  self.object:incrementStunCounter()
852
964
  end
853
965
  self.object:incrementStunCounter()
854
- self[128] = true
966
+ self[134] = true
855
967
  end
856
968
  end
857
969
  },
@@ -862,23 +974,23 @@ __TS__SetDescriptor(
862
974
  "ignoresStunImmunity",
863
975
  {
864
976
  get = function(self)
865
- local ____self__129_53 = self[129]
866
- if ____self__129_53 == nil then
867
- ____self__129_53 = false
977
+ local ____self__135_53 = self[135]
978
+ if ____self__135_53 == nil then
979
+ ____self__135_53 = false
868
980
  end
869
- return ____self__129_53
981
+ return ____self__135_53
870
982
  end,
871
983
  set = function(self, ignoresStunImmunity)
872
- if not ignoresStunImmunity and self[129] then
873
- if self[128] then
984
+ if not ignoresStunImmunity and self[135] then
985
+ if self[134] then
874
986
  self.object:decrementStunCounter()
875
987
  end
876
- self[129] = nil
877
- elseif ignoresStunImmunity and not self[129] then
878
- if self[128] then
988
+ self[135] = nil
989
+ elseif ignoresStunImmunity and not self[135] then
990
+ if self[134] then
879
991
  self.object:incrementStunCounter()
880
992
  end
881
- self[129] = true
993
+ self[135] = true
882
994
  end
883
995
  end
884
996
  },
@@ -889,19 +1001,19 @@ __TS__SetDescriptor(
889
1001
  "disablesAutoAttack",
890
1002
  {
891
1003
  get = function(self)
892
- local ____self__130_54 = self[130]
893
- if ____self__130_54 == nil then
894
- ____self__130_54 = false
1004
+ local ____self__136_54 = self[136]
1005
+ if ____self__136_54 == nil then
1006
+ ____self__136_54 = false
895
1007
  end
896
- return ____self__130_54
1008
+ return ____self__136_54
897
1009
  end,
898
1010
  set = function(self, disablesAutoAttack)
899
- if not disablesAutoAttack and self[130] then
1011
+ if not disablesAutoAttack and self[136] then
900
1012
  self.object:decrementDisableAutoAttackCounter()
901
- self[130] = nil
902
- elseif disablesAutoAttack and not self[130] then
1013
+ self[136] = nil
1014
+ elseif disablesAutoAttack and not self[136] then
903
1015
  self.object:incrementDisableAutoAttackCounter()
904
- self[130] = true
1016
+ self[136] = true
905
1017
  end
906
1018
  end
907
1019
  },
@@ -912,19 +1024,95 @@ __TS__SetDescriptor(
912
1024
  "providesInvulnerability",
913
1025
  {
914
1026
  get = function(self)
915
- local ____self__131_55 = self[131]
916
- if ____self__131_55 == nil then
917
- ____self__131_55 = false
1027
+ local ____self__137_55 = self[137]
1028
+ if ____self__137_55 == nil then
1029
+ ____self__137_55 = false
918
1030
  end
919
- return ____self__131_55
1031
+ return ____self__137_55
920
1032
  end,
921
1033
  set = function(self, providesInvulnerability)
922
- if not providesInvulnerability and self[131] then
1034
+ if not providesInvulnerability and self[137] then
923
1035
  self.object:decrementInvulnerabilityCounter()
924
- self[131] = nil
925
- elseif providesInvulnerability and not self[131] then
1036
+ self[137] = nil
1037
+ elseif providesInvulnerability and not self[137] then
926
1038
  self.object:incrementInvulnerabilityCounter()
927
- self[131] = true
1039
+ self[137] = true
1040
+ end
1041
+ end
1042
+ },
1043
+ true
1044
+ )
1045
+ __TS__SetDescriptor(
1046
+ Buff.prototype,
1047
+ "killsOnExpiration",
1048
+ {
1049
+ get = function(self)
1050
+ local ____self__138_56 = self[138]
1051
+ if ____self__138_56 == nil then
1052
+ ____self__138_56 = false
1053
+ end
1054
+ return ____self__138_56
1055
+ end,
1056
+ set = function(self, killsOnExpiration)
1057
+ if not killsOnExpiration and self[138] then
1058
+ self[138] = nil
1059
+ elseif killsOnExpiration and not self[138] then
1060
+ self[138] = true
1061
+ end
1062
+ end
1063
+ },
1064
+ true
1065
+ )
1066
+ __TS__SetDescriptor(
1067
+ Buff.prototype,
1068
+ "explodesOnExpiration",
1069
+ {
1070
+ get = function(self)
1071
+ local ____self__139_57 = self[139]
1072
+ if ____self__139_57 == nil then
1073
+ ____self__139_57 = false
1074
+ end
1075
+ return ____self__139_57
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
+ "maximumDamageDealtEventCount",
1090
+ {
1091
+ get = function(self)
1092
+ return self[131] or 0
1093
+ end,
1094
+ set = function(self, maximumDamageDealtEventCount)
1095
+ if maximumDamageDealtEventCount == 0 then
1096
+ self[131] = nil
1097
+ else
1098
+ self[131] = maximumDamageDealtEventCount
1099
+ end
1100
+ end
1101
+ },
1102
+ true
1103
+ )
1104
+ __TS__SetDescriptor(
1105
+ Buff.prototype,
1106
+ "maximumDamageReceivedEventCount",
1107
+ {
1108
+ get = function(self)
1109
+ return self[133] or 0
1110
+ end,
1111
+ set = function(self, maximumDamageReceivedEventCount)
1112
+ if maximumDamageReceivedEventCount == 0 then
1113
+ self[133] = nil
1114
+ else
1115
+ self[133] = maximumDamageReceivedEventCount
928
1116
  end
929
1117
  end
930
1118
  },
@@ -935,13 +1123,13 @@ __TS__SetDescriptor(
935
1123
  "maximumAutoAttackCount",
936
1124
  {
937
1125
  get = function(self)
938
- return self[127] or 0
1126
+ return self[129] or 0
939
1127
  end,
940
1128
  set = function(self, maximumAutoAttackCount)
941
1129
  if maximumAutoAttackCount == 0 then
942
- self[127] = nil
1130
+ self[129] = nil
943
1131
  else
944
- self[127] = maximumAutoAttackCount
1132
+ self[129] = maximumAutoAttackCount
945
1133
  end
946
1134
  end
947
1135
  },
@@ -999,13 +1187,13 @@ __TS__SetDescriptor(
999
1187
  "remainingDuration",
1000
1188
  {
1001
1189
  get = function(self)
1002
- local ____opt_56 = self._timer
1003
- return ____opt_56 and ____opt_56.remaining or 0
1190
+ local ____opt_58 = self._timer
1191
+ return ____opt_58 and ____opt_58.remaining or 0
1004
1192
  end,
1005
1193
  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)
1194
+ local ____remainingDuration_62 = remainingDuration
1195
+ local ____opt_60 = self._timer
1196
+ local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1009
1197
  if remainingDurationDelta ~= 0 then
1010
1198
  self[102] = self[102] + remainingDurationDelta
1011
1199
  if remainingDuration <= 0 then
@@ -1035,24 +1223,22 @@ __TS__SetDescriptor(
1035
1223
  true
1036
1224
  );
1037
1225
  (function(self)
1226
+ local function destroyBuffIfNeeded(buff)
1227
+ if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1228
+ buff:destroy()
1229
+ end
1230
+ end
1038
1231
  ____exports.checkBuff = function(unit, buffTypeId)
1039
1232
  local buffByTypeId = buffByTypeIdByUnit[unit]
1040
1233
  if buffByTypeId ~= nil then
1041
1234
  local buff = buffByTypeId[buffTypeId]
1042
- if buff ~= nil and getUnitAbility(unit.handle, buffTypeId) ~= buff.handle then
1043
- buff:destroy()
1235
+ if buff ~= nil then
1236
+ destroyBuffIfNeeded(buff)
1044
1237
  end
1045
1238
  end
1046
1239
  end
1047
1240
  ____exports.checkBuffs = function(unit)
1048
- local buffByTypeId = buffByTypeIdByUnit[unit]
1049
- if buffByTypeId ~= nil then
1050
- for ____, buff in pairs(buffByTypeId) do
1051
- if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
1052
- buff:destroy()
1053
- end
1054
- end
1055
- end
1241
+ ____exports.Buff:forAll(unit, destroyBuffIfNeeded)
1056
1242
  end
1057
1243
  Unit.abilityChannelingStartEvent:addListener(
1058
1244
  0,
@@ -0,0 +1,7 @@
1
+ /** @noSelfInFile */
2
+ import { Rect } from "../core/types/rect";
3
+ import { Region } from "../core/types/region";
4
+ export declare class GameMap {
5
+ static get worldBoundsRect(): Rect;
6
+ static get worldBoundsRegion(): Region;
7
+ }
@@ -0,0 +1,32 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
4
+ local ____exports = {}
5
+ local ____rect = require("core.types.rect")
6
+ local Rect = ____rect.Rect
7
+ local ____region = require("core.types.region")
8
+ local Region = ____region.Region
9
+ ____exports.GameMap = __TS__Class()
10
+ local GameMap = ____exports.GameMap
11
+ GameMap.name = "GameMap"
12
+ function GameMap.prototype.____constructor(self)
13
+ end
14
+ __TS__ObjectDefineProperty(
15
+ GameMap,
16
+ "worldBoundsRect",
17
+ {get = function(self)
18
+ local rect = Rect:of(GetWorldBounds())
19
+ rawset(self, "worldBoundsRect", rect)
20
+ return rect
21
+ end}
22
+ )
23
+ __TS__ObjectDefineProperty(
24
+ GameMap,
25
+ "worldBoundsRegion",
26
+ {get = function(self)
27
+ local region = Region:create(self.worldBoundsRect)
28
+ rawset(self, "worldBoundsRegion", region)
29
+ return region
30
+ end}
31
+ )
32
+ return ____exports
@@ -4,14 +4,6 @@ import { Event } from "../../event";
4
4
  import type { Item } from "../../core/types/item";
5
5
  import type { Unit } from "./unit";
6
6
  import type { AbilityTypeId } from "../object-data/entry/ability-type";
7
- interface Fields<K, V> {
8
- set(field: K, value: V): boolean;
9
- get(field: K): V;
10
- has(field: K): boolean;
11
- }
12
- interface AbilityLevel {
13
- realFields: Fields<jabilityreallevelfield, number>;
14
- }
15
7
  export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
16
8
  export declare class AbilitySnapshot {
17
9
  }
@@ -20,7 +12,8 @@ export declare abstract class Ability extends Handle<jability> {
20
12
  protected constructor(handle: jability, typeId: number);
21
13
  toString(): string;
22
14
  get parentTypeId(): number;
23
- get orderId(): number;
15
+ get orderTypeStringId(): string;
16
+ get orderTypeId(): number;
24
17
  abstract readonly owner: Unit | Item;
25
18
  getSnapshot(): AbilitySnapshot;
26
19
  hasField(field: jabilityfield | number): boolean;
@@ -40,9 +33,11 @@ export declare abstract class Ability extends Handle<jability> {
40
33
  setField(field: jabilityintegerlevelfield | jabilityreallevelfield, level: number, value: number): boolean;
41
34
  setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
42
35
  setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
43
- get realFields(): Fields<jabilityrealfield, number>;
44
- get levels(): readonly AbilityLevel[];
36
+ get levelCount(): number;
45
37
  abstract get level(): number;
38
+ abstract get cooldownRemaining(): number;
39
+ abstract set cooldownRemaining(cooldownRemaining: number);
40
+ abstract interruptCast(): void;
46
41
  static get onCreate(): Event<[Ability]>;
47
42
  static get destroyEvent(): Event<[Ability]>;
48
43
  }
@@ -53,15 +48,21 @@ export declare class UnrecognizedAbility extends Ability {
53
48
  readonly owner: Unit;
54
49
  constructor(typeId: number, owner: Unit);
55
50
  get level(): number;
51
+ get cooldownRemaining(): number;
52
+ set cooldownRemaining(_: number);
53
+ interruptCast(): void;
56
54
  }
57
55
  export declare class UnitAbility extends Ability {
58
56
  readonly owner: Unit;
59
57
  private readonly u;
60
58
  constructor(handle: jability, typeId: number, owner: Unit);
59
+ incrementHideCounter(): void;
60
+ decrementHideCounter(): void;
61
61
  get level(): number;
62
62
  set level(v: number);
63
63
  get cooldownRemaining(): number;
64
- set cooldownRemaining(v: number);
64
+ set cooldownRemaining(cooldownRemaining: number);
65
+ interruptCast(): void;
65
66
  static get onCreate(): Event<[UnitAbility]>;
66
67
  static get onDestroy(): Event<[UnitAbility]>;
67
68
  }
@@ -85,7 +86,9 @@ export declare class ItemAbility extends Ability {
85
86
  setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
86
87
  setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
87
88
  get level(): number;
89
+ get cooldownRemaining(): number;
90
+ set cooldownRemaining(cooldownRemaining: number);
91
+ interruptCast(): void;
88
92
  static get onCreate(): Event<[ItemAbility]>;
89
93
  static get onDestroy(): Event<[ItemAbility]>;
90
94
  }
91
- export {};