warscript 0.0.1-dev.a58cc52 → 0.0.1-dev.a5a2f5e

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 (168) hide show
  1. package/attributes.d.ts +6 -0
  2. package/attributes.lua +17 -1
  3. package/core/types/frame.lua +71 -22
  4. package/core/types/item.d.ts +1 -0
  5. package/core/types/item.lua +1 -0
  6. package/core/types/player.d.ts +17 -1
  7. package/core/types/player.lua +70 -24
  8. package/core/types/playerCamera.d.ts +2 -0
  9. package/core/types/playerCamera.lua +123 -5
  10. package/core/types/sound.lua +1 -1
  11. package/core/types/tileCell.d.ts +11 -1
  12. package/core/types/tileCell.lua +97 -0
  13. package/core/types/timer.d.ts +3 -1
  14. package/core/types/timer.lua +27 -2
  15. package/decl/native.d.ts +6 -4
  16. package/destroyable.d.ts +1 -0
  17. package/destroyable.lua +9 -0
  18. package/engine/behavior.d.ts +14 -1
  19. package/engine/behavior.lua +230 -70
  20. package/engine/behaviour/ability/apply-buff.lua +5 -5
  21. package/engine/behaviour/ability/damage.d.ts +7 -2
  22. package/engine/behaviour/ability/damage.lua +31 -37
  23. package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
  24. package/engine/behaviour/ability/emulate-impact.lua +16 -7
  25. package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
  26. package/engine/behaviour/ability/remove-buffs.lua +21 -0
  27. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  28. package/engine/behaviour/ability/restore-mana.lua +6 -6
  29. package/engine/behaviour/ability.d.ts +11 -6
  30. package/engine/behaviour/ability.lua +38 -17
  31. package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
  32. package/engine/behaviour/unit/stun-immunity.lua +57 -31
  33. package/engine/behaviour/unit.d.ts +39 -3
  34. package/engine/behaviour/unit.lua +269 -6
  35. package/engine/buff.d.ts +67 -22
  36. package/engine/buff.lua +371 -182
  37. package/engine/internal/ability.d.ts +7 -1
  38. package/engine/internal/ability.lua +64 -24
  39. package/engine/internal/item/ability.lua +63 -11
  40. package/engine/internal/item/fields.d.ts +12 -0
  41. package/engine/internal/item/fields.lua +33 -0
  42. package/engine/internal/item+owner.lua +12 -6
  43. package/engine/internal/item.d.ts +12 -16
  44. package/engine/internal/item.lua +118 -69
  45. package/engine/internal/mechanics/cast-ability.lua +6 -3
  46. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  47. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  48. package/engine/internal/misc/frame-coordinates.lua +21 -0
  49. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  50. package/engine/internal/misc/get-terrain-z.lua +11 -0
  51. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  52. package/engine/internal/misc/player-local-handle.lua +5 -0
  53. package/engine/internal/object-data/armor-bonus.d.ts +2 -0
  54. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  55. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  56. package/engine/internal/object-data/health-bonus.lua +16 -0
  57. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  58. package/engine/internal/object-data/mana-bonus.lua +16 -0
  59. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
  60. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
  61. package/engine/internal/unit/ability.d.ts +35 -0
  62. package/engine/internal/unit/ability.lua +98 -9
  63. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  64. package/engine/internal/unit/allowed-targets.lua +9 -1
  65. package/engine/internal/unit/attributes.d.ts +17 -0
  66. package/engine/internal/unit/attributes.lua +46 -0
  67. package/engine/internal/unit/bonus.d.ts +6 -0
  68. package/engine/internal/unit/bonus.lua +33 -3
  69. package/engine/internal/unit/fly-height.d.ts +7 -0
  70. package/engine/internal/unit/fly-height.lua +20 -0
  71. package/engine/internal/unit/interrupts.d.ts +12 -0
  72. package/engine/internal/unit/interrupts.lua +28 -0
  73. package/engine/internal/unit/main-selected.lua +12 -27
  74. package/engine/internal/unit/order.d.ts +20 -0
  75. package/engine/internal/unit/order.lua +136 -0
  76. package/engine/internal/unit/range-event.d.ts +12 -0
  77. package/engine/internal/unit/range-event.lua +90 -0
  78. package/engine/internal/unit/scale.d.ts +7 -0
  79. package/engine/internal/unit/scale.lua +20 -0
  80. package/engine/internal/unit+ability.lua +10 -1
  81. package/engine/internal/unit+bonus.lua +3 -3
  82. package/engine/internal/unit+damage.d.ts +1 -1
  83. package/engine/internal/unit+damage.lua +6 -1
  84. package/engine/internal/unit-missile-launch.lua +52 -14
  85. package/engine/internal/unit.d.ts +32 -26
  86. package/engine/internal/unit.lua +351 -269
  87. package/engine/local-client.d.ts +7 -0
  88. package/engine/local-client.lua +86 -1
  89. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  90. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  91. package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
  92. package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
  93. package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
  94. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
  95. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  96. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  97. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  98. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  99. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  100. package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
  101. package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
  102. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  103. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  104. package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
  105. package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
  106. package/engine/object-data/entry/ability-type.d.ts +2 -0
  107. package/engine/object-data/entry/ability-type.lua +89 -8
  108. package/engine/object-data/entry/buff-type/applicable.lua +113 -109
  109. package/engine/object-data/entry/destructible-type.d.ts +27 -1
  110. package/engine/object-data/entry/destructible-type.lua +155 -0
  111. package/engine/object-data/entry/unit-type.d.ts +15 -2
  112. package/engine/object-data/entry/unit-type.lua +135 -33
  113. package/engine/object-field/ability.d.ts +3 -3
  114. package/engine/object-field/ability.lua +9 -8
  115. package/engine/object-field/item.d.ts +22 -0
  116. package/engine/object-field/item.lua +118 -0
  117. package/engine/object-field/unit.d.ts +31 -5
  118. package/engine/object-field/unit.lua +95 -0
  119. package/engine/object-field.d.ts +18 -7
  120. package/engine/object-field.lua +294 -135
  121. package/engine/random.d.ts +10 -0
  122. package/engine/random.lua +21 -0
  123. package/engine/standard/fields/ability.d.ts +2 -2
  124. package/engine/standard/fields/ability.lua +2 -2
  125. package/engine/standard/fields/item.d.ts +4 -0
  126. package/engine/standard/fields/item.lua +6 -0
  127. package/engine/standard/fields/unit.d.ts +12 -0
  128. package/engine/standard/fields/unit.lua +20 -0
  129. package/engine/synchronization.d.ts +11 -0
  130. package/engine/synchronization.lua +77 -0
  131. package/engine/text-tag.d.ts +36 -2
  132. package/engine/text-tag.lua +250 -10
  133. package/engine/unit.d.ts +6 -0
  134. package/engine/unit.lua +6 -0
  135. package/lualib_bundle.lua +1 -1
  136. package/math.d.ts +2 -0
  137. package/math.lua +14 -0
  138. package/net/socket.lua +1 -1
  139. package/objutil/buff.lua +10 -8
  140. package/objutil/object.lua +1 -1
  141. package/operation.lua +1 -4
  142. package/package.json +5 -5
  143. package/patch-lua.lua +15 -0
  144. package/patch-lualib.lua +1 -1
  145. package/utility/arrays.d.ts +1 -0
  146. package/utility/arrays.lua +8 -0
  147. package/utility/callback-array.d.ts +17 -0
  148. package/utility/callback-array.lua +61 -0
  149. package/utility/functions.d.ts +7 -0
  150. package/utility/functions.lua +12 -0
  151. package/utility/linked-map.d.ts +35 -0
  152. package/utility/linked-map.lua +107 -0
  153. package/utility/linked-set.d.ts +4 -1
  154. package/utility/linked-set.lua +46 -1
  155. package/utility/lua-maps.d.ts +12 -2
  156. package/utility/lua-maps.lua +37 -2
  157. package/utility/lua-sets.d.ts +1 -0
  158. package/utility/lua-sets.lua +4 -0
  159. package/utility/records.lua +20 -1
  160. package/utility/types.d.ts +3 -0
  161. package/utility/unordered-map.d.ts +27 -0
  162. package/utility/unordered-map.lua +99 -0
  163. package/core/types/order.d.ts +0 -25
  164. package/core/types/order.lua +0 -55
  165. /package/engine/internal/{object-data/armor-increase.d.ts → misc/damage-metadata-by-target.d.ts} +0 -0
  166. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  167. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  168. /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
@@ -0,0 +1,99 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
4
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
5
+ local __TS__New = ____lualib.__TS__New
6
+ local ____exports = {}
7
+ local ____exception = require("exception")
8
+ local UnsupportedOperationException = ____exception.UnsupportedOperationException
9
+ ____exports.UnorderedMap = __TS__Class()
10
+ local UnorderedMap = ____exports.UnorderedMap
11
+ UnorderedMap.name = "UnorderedMap"
12
+ function UnorderedMap.prototype.____constructor(self)
13
+ self.v = {}
14
+ self.s = 0
15
+ end
16
+ function UnorderedMap.prototype.get(self, key)
17
+ return self.v[key]
18
+ end
19
+ function UnorderedMap.prototype.getOrPut(self, key, defaultValue)
20
+ local value = self.v[key]
21
+ if value ~= nil then
22
+ return value
23
+ end
24
+ value = defaultValue()
25
+ if value ~= nil then
26
+ self.v[key] = value
27
+ self.s = self.s + 1
28
+ end
29
+ return value
30
+ end
31
+ function UnorderedMap.prototype.put(self, key, value)
32
+ local has = self.v[key] ~= nil
33
+ self.v[key] = value
34
+ if value ~= nil and not has then
35
+ self.s = self.s + 1
36
+ elseif value == nil and has then
37
+ self.s = self.s - 1
38
+ end
39
+ end
40
+ function UnorderedMap.prototype.remove(self, key)
41
+ if self.v[key] ~= nil then
42
+ self.v[key] = nil
43
+ self.s = self.s - 1
44
+ return true
45
+ end
46
+ return false
47
+ end
48
+ function UnorderedMap.prototype.contains(self, key)
49
+ return self.v[key] ~= nil
50
+ end
51
+ function UnorderedMap.prototype.__len(self)
52
+ return self.s
53
+ end
54
+ function UnorderedMap.prototype.__pairs(self)
55
+ return pairs(self.v)
56
+ end
57
+ __TS__SetDescriptor(
58
+ UnorderedMap.prototype,
59
+ "size",
60
+ {get = function(self)
61
+ return self.s
62
+ end},
63
+ true
64
+ )
65
+ local EmptyUnorderedMap = __TS__Class()
66
+ EmptyUnorderedMap.name = "EmptyUnorderedMap"
67
+ __TS__ClassExtends(EmptyUnorderedMap, ____exports.UnorderedMap)
68
+ function EmptyUnorderedMap.prototype.getOrPut(self)
69
+ error(
70
+ __TS__New(UnsupportedOperationException),
71
+ 0
72
+ )
73
+ end
74
+ function EmptyUnorderedMap.prototype.put(self)
75
+ error(
76
+ __TS__New(UnsupportedOperationException),
77
+ 0
78
+ )
79
+ end
80
+ function EmptyUnorderedMap.prototype.remove(self)
81
+ error(
82
+ __TS__New(UnsupportedOperationException),
83
+ 0
84
+ )
85
+ end
86
+ function EmptyUnorderedMap.prototype.__len(self)
87
+ return 0
88
+ end
89
+ function EmptyUnorderedMap.prototype.__pairs(self)
90
+ return pairs(self.v)
91
+ end
92
+ local EMPTY_UNORDERED_MAP = __TS__New(EmptyUnorderedMap)
93
+ ____exports.emptyUnorderedMap = function()
94
+ return EMPTY_UNORDERED_MAP
95
+ end
96
+ ____exports.mutableUnorderedMap = function()
97
+ return __TS__New(____exports.UnorderedMap)
98
+ end
99
+ return ____exports
@@ -1,25 +0,0 @@
1
- /** @noSelfInFile */
2
- import { Unit } from "./unit";
3
- import { Item } from "./item";
4
- import { Destructable } from "./destructable";
5
- export type Order = {
6
- id: number;
7
- startX: number;
8
- startY: number;
9
- } & ({
10
- type: "immediate";
11
- } | {
12
- type: "point";
13
- targetX: number;
14
- targetY: number;
15
- } | {
16
- type: "target";
17
- target: Unit | Item | Destructable;
18
- });
19
- declare module "../../engine/internal/unit" {
20
- interface Unit {
21
- readonly currentOrder: Order;
22
- readonly lastOrder: Order;
23
- issueOrder(order: Order): void;
24
- }
25
- }
@@ -1,55 +0,0 @@
1
- local ____lualib = require("lualib_bundle")
2
- local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
3
- local ____exports = {}
4
- local ____unit = require("core.types.unit")
5
- local Unit = ____unit.Unit
6
- local getUnitCurrentOrder = GetUnitCurrentOrder
7
- local orders = setmetatable({}, {__mode = "k"})
8
- Unit.onImmediateOrder:addListener(function(unit, orderId)
9
- orders[unit] = {id = orderId, startX = unit.x, startY = unit.y, type = "immediate"}
10
- end)
11
- Unit.onPointOrder:addListener(function(unit, orderId, x, y)
12
- orders[unit] = {
13
- id = orderId,
14
- startX = unit.x,
15
- startY = unit.y,
16
- type = "point",
17
- targetX = x,
18
- targetY = y
19
- }
20
- end)
21
- Unit.onTargetOrder:addListener(function(unit, orderId, target)
22
- orders[unit] = {
23
- id = orderId,
24
- startX = unit.x,
25
- startY = unit.y,
26
- type = "target",
27
- target = target
28
- }
29
- end)
30
- __TS__ObjectDefineProperty(
31
- Unit.prototype,
32
- "currentOrder",
33
- {get = function(self)
34
- local currentOrderId = getUnitCurrentOrder(self.handle)
35
- local lastOrder = orders[self]
36
- return lastOrder and (lastOrder.id == currentOrderId or currentOrderId == orderId("patrolAI") and lastOrder.id == orderId("patrol")) and lastOrder or ({id = 0, type = "immediate"})
37
- end}
38
- )
39
- __TS__ObjectDefineProperty(
40
- Unit.prototype,
41
- "lastOrder",
42
- {get = function(self)
43
- return orders[self] or ({id = 0, type = "immediate"})
44
- end}
45
- )
46
- Unit.prototype.issueOrder = function(self, order)
47
- if order.type == "immediate" then
48
- IssueImmediateOrderById(self.handle, order.id)
49
- elseif order.type == "point" then
50
- IssuePointOrderById(self.handle, order.id, order.targetX, order.targetY)
51
- else
52
- IssueTargetOrderById(self.handle, order.id, order.target.handle)
53
- end
54
- end
55
- return ____exports