warscript 0.0.1-dev.87b6c38 → 0.0.1-dev.8895ff6

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 (45) hide show
  1. package/destroyable.d.ts +1 -0
  2. package/destroyable.lua +9 -0
  3. package/engine/behavior.d.ts +4 -2
  4. package/engine/behavior.lua +69 -11
  5. package/engine/behaviour/unit/stun-immunity.d.ts +1 -1
  6. package/engine/behaviour/unit/stun-immunity.lua +5 -4
  7. package/engine/behaviour/unit.lua +13 -3
  8. package/engine/buff.d.ts +7 -2
  9. package/engine/buff.lua +42 -24
  10. package/engine/internal/mechanics/cast-ability.lua +6 -3
  11. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
  12. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
  13. package/engine/internal/unit/attributes.d.ts +17 -0
  14. package/engine/internal/unit/attributes.lua +46 -0
  15. package/engine/internal/unit/bonus.d.ts +2 -0
  16. package/engine/internal/unit/bonus.lua +10 -0
  17. package/engine/internal/unit/fly-height.lua +3 -3
  18. package/engine/internal/unit/interrupts.d.ts +12 -0
  19. package/engine/internal/unit/interrupts.lua +28 -0
  20. package/engine/internal/unit/scale.lua +3 -3
  21. package/engine/internal/unit-missile-launch.lua +12 -5
  22. package/engine/internal/unit.d.ts +1 -8
  23. package/engine/internal/unit.lua +16 -69
  24. package/engine/local-client.d.ts +1 -1
  25. package/engine/local-client.lua +4 -4
  26. package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
  27. package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
  28. package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
  29. package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
  30. package/engine/object-data/entry/destructible-type.d.ts +12 -0
  31. package/engine/object-data/entry/destructible-type.lua +78 -0
  32. package/engine/object-field/unit.d.ts +7 -4
  33. package/engine/object-field/unit.lua +4 -0
  34. package/engine/object-field.d.ts +2 -0
  35. package/engine/object-field.lua +171 -115
  36. package/engine/standard/fields/unit.d.ts +11 -5
  37. package/engine/standard/fields/unit.lua +13 -4
  38. package/engine/unit.d.ts +2 -0
  39. package/engine/unit.lua +2 -0
  40. package/objutil/buff.lua +9 -7
  41. package/package.json +1 -1
  42. package/utility/linked-map.d.ts +26 -0
  43. package/utility/linked-map.lua +66 -0
  44. package/utility/linked-set.lua +4 -0
  45. package/utility/records.lua +20 -1
@@ -0,0 +1,66 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____linked_2Dset = require("utility.linked-set")
7
+ local LinkedSet = ____linked_2Dset.LinkedSet
8
+ local function linkedMapNext(state)
9
+ local n = state.n
10
+ state.n = state.t[n]
11
+ return n, state.v[n]
12
+ end
13
+ ____exports.LinkedMap = __TS__Class()
14
+ local LinkedMap = ____exports.LinkedMap
15
+ LinkedMap.name = "LinkedMap"
16
+ function LinkedMap.prototype.____constructor(self)
17
+ self.k = __TS__New(LinkedSet)
18
+ self.v = {}
19
+ end
20
+ function LinkedMap.prototype.get(self, key)
21
+ return self.v[key]
22
+ end
23
+ function LinkedMap.prototype.getOrPut(self, key, defaultValue)
24
+ local value = self.v[key]
25
+ if value ~= nil then
26
+ return value
27
+ end
28
+ value = defaultValue()
29
+ self.k:add(key)
30
+ self.v[key] = value
31
+ return value
32
+ end
33
+ function LinkedMap.prototype.put(self, key, value)
34
+ self.k:add(key)
35
+ self.v[key] = value
36
+ end
37
+ function LinkedMap.prototype.remove(self, key)
38
+ if self.k:remove(key) then
39
+ self.v[key] = nil
40
+ return true
41
+ end
42
+ return false
43
+ end
44
+ function LinkedMap.prototype.contains(self, key)
45
+ return self.keys:contains(key)
46
+ end
47
+ function LinkedMap.prototype.__pairs(self)
48
+ return linkedMapNext, {n = self.k.f, t = self.k.n, v = self.v}, nil
49
+ end
50
+ __TS__SetDescriptor(
51
+ LinkedMap.prototype,
52
+ "keys",
53
+ {get = function(self)
54
+ return self.k
55
+ end},
56
+ true
57
+ )
58
+ __TS__SetDescriptor(
59
+ LinkedMap.prototype,
60
+ "size",
61
+ {get = function(self)
62
+ return self.keys.size
63
+ end},
64
+ true
65
+ )
66
+ return ____exports
@@ -182,6 +182,7 @@ __TS__SetDescriptor(
182
182
  end},
183
183
  true
184
184
  )
185
+ local emptyIteratorState = {t = {}}
185
186
  local EmptyLinkedSet = __TS__Class()
186
187
  EmptyLinkedSet.name = "EmptyLinkedSet"
187
188
  __TS__ClassExtends(EmptyLinkedSet, ____exports.LinkedSet)
@@ -191,6 +192,9 @@ function EmptyLinkedSet.prototype.add(self)
191
192
  0
192
193
  )
193
194
  end
195
+ function EmptyLinkedSet.prototype.__pairs(self)
196
+ return linkedSetNext, emptyIteratorState, nil
197
+ end
194
198
  local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
195
199
  ____exports.emptyLinkedSet = function()
196
200
  return EMPTY_LINKED_SET
@@ -1,9 +1,28 @@
1
1
  local ____exports = {}
2
+ local ____pairs = _G.pairs
3
+ local tableSort = table.sort
2
4
  ____exports.invertRecord = function(record)
3
5
  local invertRecord = {}
4
- for key, value in pairs(record) do
6
+ for key, value in ____pairs(record) do
5
7
  invertRecord[value] = key
6
8
  end
7
9
  return invertRecord
8
10
  end
11
+ local sortedKeysInternal = {}
12
+ local lastSortedKeysLength = 0
13
+ ---
14
+ -- @internal For use by internal systems only.
15
+ ____exports.sortedKeysUnnested = function(record)
16
+ local length = 0
17
+ for key in ____pairs(record) do
18
+ length = length + 1
19
+ sortedKeysInternal[length] = key
20
+ end
21
+ for i = length + 1, lastSortedKeysLength do
22
+ sortedKeysInternal[i] = nil
23
+ end
24
+ lastSortedKeysLength = length
25
+ tableSort(sortedKeysInternal)
26
+ return sortedKeysInternal
27
+ end
9
28
  return ____exports