warscript 0.0.1-dev.617708 → 0.0.1-dev.620c0fa

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/attributes.d.ts +0 -1
  2. package/binaryreader.d.ts +1 -0
  3. package/binaryreader.lua +3 -0
  4. package/core/types/frame.d.ts +8 -1
  5. package/core/types/frame.lua +93 -1
  6. package/core/types/group.d.ts +0 -1
  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/core/util.d.ts +1 -1
  12. package/core/util.lua +6 -0
  13. package/decl/index.d.ts +1 -0
  14. package/engine/ability.d.ts +1 -1
  15. package/engine/behavior.d.ts +10 -10
  16. package/engine/behavior.lua +6 -6
  17. package/engine/behaviour/ability/apply-buff.d.ts +3 -5
  18. package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
  19. package/engine/behaviour/ability/damage.d.ts +33 -11
  20. package/engine/behaviour/ability/damage.lua +89 -31
  21. package/engine/behaviour/ability/heal.d.ts +33 -6
  22. package/engine/behaviour/ability/heal.lua +89 -10
  23. package/engine/behaviour/ability/instant-impact.lua +4 -0
  24. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  25. package/engine/behaviour/ability/restore-mana.lua +29 -0
  26. package/engine/behaviour/ability.d.ts +8 -1
  27. package/engine/behaviour/ability.lua +62 -0
  28. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  29. package/engine/behaviour/unit.d.ts +8 -2
  30. package/engine/behaviour/unit.lua +27 -0
  31. package/engine/buff.d.ts +63 -20
  32. package/engine/buff.lua +250 -72
  33. package/engine/game-map.d.ts +7 -0
  34. package/engine/game-map.lua +32 -0
  35. package/engine/internal/ability.d.ts +3 -11
  36. package/engine/internal/ability.lua +9 -78
  37. package/engine/internal/item+owner.lua +2 -2
  38. package/engine/internal/unit/ability.lua +0 -14
  39. package/engine/internal/unit/bonus.d.ts +9 -8
  40. package/engine/internal/unit/bonus.lua +6 -1
  41. package/engine/internal/unit/item.d.ts +24 -0
  42. package/engine/internal/unit/item.lua +84 -0
  43. package/engine/internal/unit/main-selected.d.ts +13 -0
  44. package/engine/internal/unit/main-selected.lua +51 -0
  45. package/engine/internal/unit+ability.lua +2 -2
  46. package/engine/internal/unit+transport.lua +4 -10
  47. package/engine/internal/unit-missile-launch.lua +25 -6
  48. package/engine/internal/unit.d.ts +57 -16
  49. package/engine/internal/unit.lua +313 -122
  50. package/engine/local-client.d.ts +7 -2
  51. package/engine/local-client.lua +82 -0
  52. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  53. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  54. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  55. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  56. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  57. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  58. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  59. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  60. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  61. package/engine/object-data/entry/ability-type.d.ts +0 -1
  62. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  63. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  64. package/engine/object-data/entry/buff-type.d.ts +0 -1
  65. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  66. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  67. package/engine/object-data/entry/item-type.d.ts +12 -1
  68. package/engine/object-data/entry/item-type.lua +78 -0
  69. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  70. package/engine/object-data/entry/unit-type.d.ts +21 -2
  71. package/engine/object-data/entry/unit-type.lua +223 -49
  72. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  73. package/engine/object-data/entry/upgrade.d.ts +0 -1
  74. package/engine/object-data/entry.d.ts +2 -3
  75. package/engine/object-field/ability.d.ts +18 -1
  76. package/engine/object-field/ability.lua +51 -1
  77. package/engine/object-field.d.ts +0 -1
  78. package/engine/random.d.ts +1 -0
  79. package/engine/random.lua +9 -0
  80. package/engine/standard/entries/unit-type.d.ts +18 -0
  81. package/engine/standard/entries/unit-type.lua +18 -0
  82. package/engine/standard/fields/ability.d.ts +1 -1
  83. package/engine/standard/fields/ability.lua +1 -1
  84. package/engine/unit.d.ts +2 -0
  85. package/engine/unit.lua +11 -2
  86. package/event.d.ts +2 -3
  87. package/event.lua +9 -5
  88. package/index.d.ts +1 -0
  89. package/index.lua +1 -0
  90. package/lualib_bundle.lua +146 -42
  91. package/math/vec2.d.ts +2 -9
  92. package/math.d.ts +0 -2
  93. package/net/socket.d.ts +7 -1
  94. package/net/socket.lua +45 -4
  95. package/network.d.ts +1 -0
  96. package/network.lua +3 -2
  97. package/objutil/ability.d.ts +0 -1
  98. package/objutil/buff.d.ts +0 -1
  99. package/objutil/buff.lua +1 -1
  100. package/objutil/object.d.ts +0 -1
  101. package/objutil/unit.d.ts +0 -1
  102. package/package.json +13 -13
  103. package/patch-lua.d.ts +0 -0
  104. package/patch-lua.lua +10 -0
  105. package/property.d.ts +55 -0
  106. package/property.lua +374 -0
  107. package/string.d.ts +16 -0
  108. package/string.lua +5 -0
  109. package/util/stream.d.ts +0 -1
  110. package/utility/arrays.d.ts +11 -5
  111. package/utility/arrays.lua +34 -3
  112. package/utility/bit-set.d.ts +0 -2
  113. package/utility/linked-set.d.ts +11 -3
  114. package/utility/linked-set.lua +5 -2
  115. package/utility/lua-maps.d.ts +1 -2
  116. package/utility/lua-sets.d.ts +1 -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
@@ -94,6 +94,7 @@ local buffParametersKeys = {
94
94
  armorIncreaseFactor = true,
95
95
  attackSpeedIncreaseFactor = true,
96
96
  movementSpeedIncreaseFactor = true,
97
+ damageFactor = true,
97
98
  receivedDamageFactor = true,
98
99
  receivedMagicDamageFactor = true,
99
100
  durationIncreaseOnAutoAttack = true,
@@ -107,8 +108,26 @@ local buffParametersKeys = {
107
108
  disablesAutoAttack = true,
108
109
  destroysOnDamage = true,
109
110
  maximumAutoAttackCount = true,
110
- uniqueGroup = true
111
+ maximumDamageDealtEventCount = true,
112
+ maximumDamageReceivedEventCount = true,
113
+ uniqueGroup = true,
114
+ damageOnExpiration = true,
115
+ healingOnExpiration = true,
116
+ killsOnExpiration = true,
117
+ explodesOnExpiration = true
111
118
  }
119
+ local function resolveEnumValue(ability, level, value)
120
+ if value == nil or type(value) == "number" then
121
+ return value
122
+ end
123
+ if ability == nil then
124
+ error(
125
+ __TS__New(IllegalArgumentException),
126
+ 0
127
+ )
128
+ end
129
+ return value:getValue(ability, level or ability.level)
130
+ end
112
131
  local function resolveNumberValue(ability, level, value)
113
132
  if value == nil or type(value) == "number" then
114
133
  return value
@@ -145,20 +164,32 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
145
164
  buff[property] = resolvedValue
146
165
  end
147
166
  end
148
- local buffBooleanParameters = {"stuns", "ignoresStunImmunity", "disablesAutoAttack", "providesInvulnerability"}
167
+ local buffBooleanParameters = {
168
+ "stuns",
169
+ "ignoresStunImmunity",
170
+ "disablesAutoAttack",
171
+ "providesInvulnerability",
172
+ "killsOnExpiration",
173
+ "explodesOnExpiration"
174
+ }
149
175
  local buffNumberParameters = {
150
176
  "durationIncreaseOnAutoAttack",
151
177
  "attackSpeedIncreaseFactor",
152
178
  "movementSpeedIncreaseFactor",
153
179
  "armorIncrease",
180
+ "damageFactor",
154
181
  "receivedDamageFactor",
155
182
  "maximumAutoAttackCount",
183
+ "maximumDamageDealtEventCount",
184
+ "maximumDamageReceivedEventCount",
156
185
  "damageInterval",
157
186
  "damagePerInterval",
158
187
  "damageOverDuration",
159
188
  "healingInterval",
160
189
  "healingPerInterval",
161
- "healingOverDuration"
190
+ "healingOverDuration",
191
+ "damageOnExpiration",
192
+ "healingOnExpiration"
162
193
  }
163
194
  local unsuccessfulApplicationMarker = {}
164
195
  local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
@@ -207,6 +238,7 @@ local function expireBuff(buff)
207
238
  end
208
239
  end
209
240
  Timer:run(destroyBuff, buff)
241
+ buff:onExpiration()
210
242
  end
211
243
  local function buffDamageIntervalInitialTimerCallback(buff)
212
244
  buffDamageIntervalTimerCallback(buff)
@@ -296,8 +328,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
296
328
  end
297
329
  end
298
330
  self.typeId = typeId
299
- self.polarity = polarity
300
- self.resistanceType = resistanceType
301
331
  if not __TS__InstanceOf(ability, Ability) then
302
332
  parameters = ability
303
333
  ability = nil
@@ -324,6 +354,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
324
354
  learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
325
355
  duration = duration or getAbilityDuration(ability, _unit)
326
356
  end
357
+ self.polarity = resolveEnumValue(ability, level, polarity)
358
+ self.resistanceType = resolveEnumValue(ability, level, resistanceType)
327
359
  local buffByTypeId = buffByTypeIdByUnit[_unit]
328
360
  if buffByTypeId == nil then
329
361
  buffByTypeId = {}
@@ -340,8 +372,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
340
372
  if not internalApplyBuff(
341
373
  _unit,
342
374
  typeId,
343
- polarity,
344
- resistanceType,
375
+ self.polarity,
376
+ self.resistanceType,
345
377
  level,
346
378
  duration,
347
379
  spellStealPriority,
@@ -450,6 +482,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
450
482
  timer:start(duration, false, expireBuff, self)
451
483
  self._timer = timer
452
484
  end
485
+ self:onCreate()
453
486
  end
454
487
  function Buff.prototype.getUnitBonus(self, bonusType)
455
488
  local ____opt_36 = self._bonusIdByBonusType
@@ -506,6 +539,8 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
506
539
  __TS__SparseArraySpread(____array_43)
507
540
  )
508
541
  end
542
+ function Buff.prototype.onCreate(self)
543
+ end
509
544
  function Buff.prototype.onDestroy(self)
510
545
  local unit = self._unit
511
546
  if getUnitAbility(unit.handle, self.typeId) == self.handle then
@@ -530,11 +565,11 @@ function Buff.prototype.onDestroy(self)
530
565
  behavior:destroy()
531
566
  end
532
567
  end
533
- if self[130] then
568
+ if self[136] then
534
569
  unit:decrementDisableAutoAttackCounter()
535
570
  end
536
- if self[128] then
537
- if self[129] then
571
+ if self[134] then
572
+ if self[135] then
538
573
  unit:decrementStunCounter()
539
574
  end
540
575
  unit:decrementStunCounter()
@@ -583,20 +618,34 @@ function Buff.getByTypeId(self, unit, typeId)
583
618
  end
584
619
  return nil
585
620
  end
586
- function Buff.prototype.onDeath(self, source)
621
+ function Buff.prototype.onExpiration(self)
587
622
  local unit = self.unit
588
623
  if self[119] ~= nil then
624
+ (self[101] or unit):damageTarget(unit, self[119] or 0)
625
+ end
626
+ if self[120] ~= nil then
627
+ (self[101] or unit):healTarget(unit, self[119] or 0)
628
+ end
629
+ if self[139] then
630
+ unit:explode()
631
+ elseif self[138] then
632
+ unit:kill()
633
+ end
634
+ end
635
+ function Buff.prototype.onDeath(self, source)
636
+ local unit = self.unit
637
+ if self[121] ~= nil then
589
638
  damageArea(
590
639
  self[101] or unit,
591
- self[119],
640
+ self[121],
592
641
  unit.x,
593
642
  unit.y,
594
- self[121] or 0,
595
- self[120] or 0,
596
643
  self[123] or 0,
597
644
  self[122] or 0,
598
645
  self[125] or 0,
599
- self[124] or 0
646
+ self[124] or 0,
647
+ self[127] or 0,
648
+ self[126] or 0
600
649
  )
601
650
  end
602
651
  end
@@ -618,9 +667,25 @@ function Buff.prototype.onDamageDealt(self, target, event)
618
667
  end
619
668
  self.remainingDuration = remainingDuration
620
669
  end
621
- local autoAttackCount = (self[126] or 0) + 1
622
- self[126] = autoAttackCount
623
- if autoAttackCount == self[127] then
670
+ local autoAttackCount = (self[128] or 0) + 1
671
+ self[128] = autoAttackCount
672
+ if autoAttackCount == self[129] then
673
+ self:destroy()
674
+ end
675
+ end
676
+ if event.originalAmount ~= 0 then
677
+ local damageDealtEventCount = (self[130] or 0) + 1
678
+ self[130] = damageDealtEventCount
679
+ if damageDealtEventCount == self[131] then
680
+ self:destroy()
681
+ end
682
+ end
683
+ end
684
+ function Buff.prototype.onDamageReceived(self, source, event)
685
+ if event.originalAmount ~= 0 then
686
+ local damageReceivedEventCount = (self[132] or 0) + 1
687
+ self[132] = damageReceivedEventCount
688
+ if damageReceivedEventCount == self[133] then
624
689
  self:destroy()
625
690
  end
626
691
  end
@@ -802,6 +867,45 @@ __TS__SetDescriptor(
802
867
  },
803
868
  true
804
869
  )
870
+ __TS__SetDescriptor(
871
+ Buff.prototype,
872
+ "damageOnExpiration",
873
+ {
874
+ get = function(self)
875
+ return self[119] or 0
876
+ end,
877
+ set = function(self, damageOnExpiration)
878
+ self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
879
+ end
880
+ },
881
+ true
882
+ )
883
+ __TS__SetDescriptor(
884
+ Buff.prototype,
885
+ "healingOnExpiration",
886
+ {
887
+ get = function(self)
888
+ return self[120] or 0
889
+ end,
890
+ set = function(self, healingOnExpiration)
891
+ self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
892
+ end
893
+ },
894
+ true
895
+ )
896
+ __TS__SetDescriptor(
897
+ Buff.prototype,
898
+ "damageFactor",
899
+ {
900
+ get = function(self)
901
+ return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
902
+ end,
903
+ set = function(self, damageFactor)
904
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
905
+ end
906
+ },
907
+ true
908
+ )
805
909
  __TS__SetDescriptor(
806
910
  Buff.prototype,
807
911
  "receivedDamageFactor",
@@ -833,25 +937,25 @@ __TS__SetDescriptor(
833
937
  "stuns",
834
938
  {
835
939
  get = function(self)
836
- local ____self__128_52 = self[128]
837
- if ____self__128_52 == nil then
838
- ____self__128_52 = false
940
+ local ____self__134_52 = self[134]
941
+ if ____self__134_52 == nil then
942
+ ____self__134_52 = false
839
943
  end
840
- return ____self__128_52
944
+ return ____self__134_52
841
945
  end,
842
946
  set = function(self, stuns)
843
- if not stuns and self[128] then
844
- if self[129] then
947
+ if not stuns and self[134] then
948
+ if self[135] then
845
949
  self.object:decrementStunCounter()
846
950
  end
847
951
  self.object:decrementStunCounter()
848
- self[128] = nil
849
- elseif stuns and not self[128] then
850
- if self[129] then
952
+ self[134] = nil
953
+ elseif stuns and not self[134] then
954
+ if self[135] then
851
955
  self.object:incrementStunCounter()
852
956
  end
853
957
  self.object:incrementStunCounter()
854
- self[128] = true
958
+ self[134] = true
855
959
  end
856
960
  end
857
961
  },
@@ -862,23 +966,23 @@ __TS__SetDescriptor(
862
966
  "ignoresStunImmunity",
863
967
  {
864
968
  get = function(self)
865
- local ____self__129_53 = self[129]
866
- if ____self__129_53 == nil then
867
- ____self__129_53 = false
969
+ local ____self__135_53 = self[135]
970
+ if ____self__135_53 == nil then
971
+ ____self__135_53 = false
868
972
  end
869
- return ____self__129_53
973
+ return ____self__135_53
870
974
  end,
871
975
  set = function(self, ignoresStunImmunity)
872
- if not ignoresStunImmunity and self[129] then
873
- if self[128] then
976
+ if not ignoresStunImmunity and self[135] then
977
+ if self[134] then
874
978
  self.object:decrementStunCounter()
875
979
  end
876
- self[129] = nil
877
- elseif ignoresStunImmunity and not self[129] then
878
- if self[128] then
980
+ self[135] = nil
981
+ elseif ignoresStunImmunity and not self[135] then
982
+ if self[134] then
879
983
  self.object:incrementStunCounter()
880
984
  end
881
- self[129] = true
985
+ self[135] = true
882
986
  end
883
987
  end
884
988
  },
@@ -889,19 +993,19 @@ __TS__SetDescriptor(
889
993
  "disablesAutoAttack",
890
994
  {
891
995
  get = function(self)
892
- local ____self__130_54 = self[130]
893
- if ____self__130_54 == nil then
894
- ____self__130_54 = false
996
+ local ____self__136_54 = self[136]
997
+ if ____self__136_54 == nil then
998
+ ____self__136_54 = false
895
999
  end
896
- return ____self__130_54
1000
+ return ____self__136_54
897
1001
  end,
898
1002
  set = function(self, disablesAutoAttack)
899
- if not disablesAutoAttack and self[130] then
1003
+ if not disablesAutoAttack and self[136] then
900
1004
  self.object:decrementDisableAutoAttackCounter()
901
- self[130] = nil
902
- elseif disablesAutoAttack and not self[130] then
1005
+ self[136] = nil
1006
+ elseif disablesAutoAttack and not self[136] then
903
1007
  self.object:incrementDisableAutoAttackCounter()
904
- self[130] = true
1008
+ self[136] = true
905
1009
  end
906
1010
  end
907
1011
  },
@@ -912,19 +1016,95 @@ __TS__SetDescriptor(
912
1016
  "providesInvulnerability",
913
1017
  {
914
1018
  get = function(self)
915
- local ____self__131_55 = self[131]
916
- if ____self__131_55 == nil then
917
- ____self__131_55 = false
1019
+ local ____self__137_55 = self[137]
1020
+ if ____self__137_55 == nil then
1021
+ ____self__137_55 = false
918
1022
  end
919
- return ____self__131_55
1023
+ return ____self__137_55
920
1024
  end,
921
1025
  set = function(self, providesInvulnerability)
922
- if not providesInvulnerability and self[131] then
1026
+ if not providesInvulnerability and self[137] then
923
1027
  self.object:decrementInvulnerabilityCounter()
924
- self[131] = nil
925
- elseif providesInvulnerability and not self[131] then
1028
+ self[137] = nil
1029
+ elseif providesInvulnerability and not self[137] then
926
1030
  self.object:incrementInvulnerabilityCounter()
927
- self[131] = true
1031
+ self[137] = true
1032
+ end
1033
+ end
1034
+ },
1035
+ true
1036
+ )
1037
+ __TS__SetDescriptor(
1038
+ Buff.prototype,
1039
+ "killsOnExpiration",
1040
+ {
1041
+ get = function(self)
1042
+ local ____self__138_56 = self[138]
1043
+ if ____self__138_56 == nil then
1044
+ ____self__138_56 = false
1045
+ end
1046
+ return ____self__138_56
1047
+ end,
1048
+ set = function(self, killsOnExpiration)
1049
+ if not killsOnExpiration and self[138] then
1050
+ self[138] = nil
1051
+ elseif killsOnExpiration and not self[138] then
1052
+ self[138] = true
1053
+ end
1054
+ end
1055
+ },
1056
+ true
1057
+ )
1058
+ __TS__SetDescriptor(
1059
+ Buff.prototype,
1060
+ "explodesOnExpiration",
1061
+ {
1062
+ get = function(self)
1063
+ local ____self__139_57 = self[139]
1064
+ if ____self__139_57 == nil then
1065
+ ____self__139_57 = false
1066
+ end
1067
+ return ____self__139_57
1068
+ end,
1069
+ set = function(self, killsOnExpiration)
1070
+ if not killsOnExpiration and self[139] then
1071
+ self[139] = nil
1072
+ elseif killsOnExpiration and not self[139] then
1073
+ self[139] = true
1074
+ end
1075
+ end
1076
+ },
1077
+ true
1078
+ )
1079
+ __TS__SetDescriptor(
1080
+ Buff.prototype,
1081
+ "maximumDamageDealtEventCount",
1082
+ {
1083
+ get = function(self)
1084
+ return self[131] or 0
1085
+ end,
1086
+ set = function(self, maximumDamageDealtEventCount)
1087
+ if maximumDamageDealtEventCount == 0 then
1088
+ self[131] = nil
1089
+ else
1090
+ self[131] = maximumDamageDealtEventCount
1091
+ end
1092
+ end
1093
+ },
1094
+ true
1095
+ )
1096
+ __TS__SetDescriptor(
1097
+ Buff.prototype,
1098
+ "maximumDamageReceivedEventCount",
1099
+ {
1100
+ get = function(self)
1101
+ return self[133] or 0
1102
+ end,
1103
+ set = function(self, maximumDamageReceivedEventCount)
1104
+ if maximumDamageReceivedEventCount == 0 then
1105
+ self[133] = nil
1106
+ else
1107
+ self[133] = maximumDamageReceivedEventCount
928
1108
  end
929
1109
  end
930
1110
  },
@@ -935,13 +1115,13 @@ __TS__SetDescriptor(
935
1115
  "maximumAutoAttackCount",
936
1116
  {
937
1117
  get = function(self)
938
- return self[127] or 0
1118
+ return self[129] or 0
939
1119
  end,
940
1120
  set = function(self, maximumAutoAttackCount)
941
1121
  if maximumAutoAttackCount == 0 then
942
- self[127] = nil
1122
+ self[129] = nil
943
1123
  else
944
- self[127] = maximumAutoAttackCount
1124
+ self[129] = maximumAutoAttackCount
945
1125
  end
946
1126
  end
947
1127
  },
@@ -999,13 +1179,13 @@ __TS__SetDescriptor(
999
1179
  "remainingDuration",
1000
1180
  {
1001
1181
  get = function(self)
1002
- local ____opt_56 = self._timer
1003
- return ____opt_56 and ____opt_56.remaining or 0
1182
+ local ____opt_58 = self._timer
1183
+ return ____opt_58 and ____opt_58.remaining or 0
1004
1184
  end,
1005
1185
  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)
1186
+ local ____remainingDuration_62 = remainingDuration
1187
+ local ____opt_60 = self._timer
1188
+ local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
1009
1189
  if remainingDurationDelta ~= 0 then
1010
1190
  self[102] = self[102] + remainingDurationDelta
1011
1191
  if remainingDuration <= 0 then
@@ -1035,24 +1215,22 @@ __TS__SetDescriptor(
1035
1215
  true
1036
1216
  );
1037
1217
  (function(self)
1218
+ local function destroyBuffIfNeeded(buff)
1219
+ if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
1220
+ buff:destroy()
1221
+ end
1222
+ end
1038
1223
  ____exports.checkBuff = function(unit, buffTypeId)
1039
1224
  local buffByTypeId = buffByTypeIdByUnit[unit]
1040
1225
  if buffByTypeId ~= nil then
1041
1226
  local buff = buffByTypeId[buffTypeId]
1042
- if buff ~= nil and getUnitAbility(unit.handle, buffTypeId) ~= buff.handle then
1043
- buff:destroy()
1227
+ if buff ~= nil then
1228
+ destroyBuffIfNeeded(buff)
1044
1229
  end
1045
1230
  end
1046
1231
  end
1047
1232
  ____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
1233
+ ____exports.Buff:forAll(unit, destroyBuffIfNeeded)
1056
1234
  end
1057
1235
  Unit.abilityChannelingStartEvent:addListener(
1058
1236
  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
  }
@@ -40,8 +32,7 @@ export declare abstract class Ability extends Handle<jability> {
40
32
  setField(field: jabilityintegerlevelfield | jabilityreallevelfield, level: number, value: number): boolean;
41
33
  setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
42
34
  setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
43
- get realFields(): Fields<jabilityrealfield, number>;
44
- get levels(): readonly AbilityLevel[];
35
+ get levelCount(): number;
45
36
  abstract get level(): number;
46
37
  static get onCreate(): Event<[Ability]>;
47
38
  static get destroyEvent(): Event<[Ability]>;
@@ -58,6 +49,8 @@ export declare class UnitAbility extends Ability {
58
49
  readonly owner: Unit;
59
50
  private readonly u;
60
51
  constructor(handle: jability, typeId: number, owner: Unit);
52
+ incrementHideCounter(): void;
53
+ decrementHideCounter(): void;
61
54
  get level(): number;
62
55
  set level(v: number);
63
56
  get cooldownRemaining(): number;
@@ -88,4 +81,3 @@ export declare class ItemAbility extends Ability {
88
81
  static get onCreate(): Event<[ItemAbility]>;
89
82
  static get onDestroy(): Event<[ItemAbility]>;
90
83
  }
91
- export {};