warscript 0.0.1-dev.f5421e8 → 0.0.1-dev.f9166a3
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.
- package/attributes.d.ts +5 -0
- package/attributes.lua +8 -1
- package/core/types/order.d.ts +1 -0
- package/core/types/order.lua +11 -1
- package/core/types/sound.lua +5 -0
- package/decl/native.d.ts +840 -786
- package/engine/behaviour/ability/damage.d.ts +6 -3
- package/engine/behaviour/ability/damage.lua +24 -36
- package/engine/behaviour/ability/emulate-impact.lua +16 -2
- package/engine/behaviour/ability.lua +1 -1
- package/engine/behaviour/unit.d.ts +15 -0
- package/engine/behaviour/unit.lua +114 -4
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +17 -0
- package/engine/internal/item/ability.lua +12 -10
- package/engine/internal/item.d.ts +5 -2
- package/engine/internal/item.lua +75 -3
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/unit/ability.d.ts +5 -0
- package/engine/internal/unit/ability.lua +14 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +20 -3
- package/engine/internal/unit.lua +163 -37
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type.lua +7 -0
- package/engine/object-data/entry/buff-type/applicable.lua +5 -0
- package/engine/object-data/entry/buff-type.d.ts +5 -11
- package/engine/object-data/entry/buff-type.lua +11 -27
- package/engine/object-data/entry/unit-type.d.ts +2 -2
- package/engine/object-data/entry/unit-type.lua +94 -84
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field/unit.d.ts +46 -3
- package/engine/object-field/unit.lua +173 -7
- package/engine/object-field.d.ts +12 -3
- package/engine/object-field.lua +164 -78
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/objutil/buff.lua +1 -2
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +3 -0
- package/utility/lua-maps.lua +16 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
package/utility/arrays.lua
CHANGED
|
@@ -3,6 +3,8 @@ local __TS__New = ____lualib.__TS__New
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____exception = require("exception")
|
|
5
5
|
local IllegalArgumentException = ____exception.IllegalArgumentException
|
|
6
|
+
local ____functions = require("utility.functions")
|
|
7
|
+
local identity = ____functions.identity
|
|
6
8
|
local mathMax = math.max
|
|
7
9
|
local mathMin = math.min
|
|
8
10
|
local select = _G.select
|
|
@@ -120,6 +122,7 @@ ____exports.mapToLuaSet = function(array, transform)
|
|
|
120
122
|
end
|
|
121
123
|
return result
|
|
122
124
|
end
|
|
125
|
+
____exports.flatten = function(array) return ____exports.flatMap(array, identity) end
|
|
123
126
|
____exports.flatMap = function(array, transform)
|
|
124
127
|
local result = {}
|
|
125
128
|
local k = 1
|
package/utility/functions.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export declare const apply: {
|
|
|
3
3
|
<T, ConsumerParameters extends any[]>(object: T, consumer: (value: T, ...parameters: ConsumerParameters) => void, ...parameters: ConsumerParameters): T;
|
|
4
4
|
<T, ConsumerParameters extends any[], K extends KeysOfType<T, (...parameters: ConsumerParameters) => void>>(object: T, key: K, ...parameters: ConsumerParameters): T;
|
|
5
5
|
};
|
|
6
|
+
export declare const identity: <T>(value: T) => T;
|
package/utility/functions.lua
CHANGED
package/utility/linked-set.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
50
50
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
51
51
|
}
|
|
52
52
|
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
53
|
+
export declare const mutableLinkedSet: <T extends AnyNotNil>() => LinkedSet<T>;
|
|
53
54
|
export declare const mutableLinkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => LinkedSet<T>;
|
|
54
55
|
export declare const mutableLinkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LinkedSet<T>;
|
|
55
56
|
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => ReadonlyLinkedSet<T>;
|
package/utility/linked-set.lua
CHANGED
|
@@ -177,6 +177,9 @@ local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
|
177
177
|
____exports.emptyLinkedSet = function()
|
|
178
178
|
return EMPTY_LINKED_SET
|
|
179
179
|
end
|
|
180
|
+
____exports.mutableLinkedSet = function()
|
|
181
|
+
return __TS__New(____exports.LinkedSet)
|
|
182
|
+
end
|
|
180
183
|
____exports.mutableLinkedSetOf = function(...)
|
|
181
184
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
182
185
|
for i = 1, select("#", ...) do
|
package/utility/lua-maps.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Flatten, TupleOf } from "./types";
|
|
3
|
+
export declare const mutableLuaMap: <K extends AnyNotNil, V>() => LuaMap<K, V>;
|
|
4
|
+
export declare const mutableWeakLuaMap: <K extends AnyNotNil, V>() => LuaMap<K, V>;
|
|
3
5
|
export declare const luaMapOf: <K extends AnyNotNil, V>(...pairs: Flatten<TupleOf<[K, V], 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40>>) => LuaMap<K, V>;
|
|
4
6
|
export declare const luaMapInvert: <K extends AnyNotNil, V extends AnyNotNil>(luaMap: LuaMap<K, V>) => LuaMap<V, K>;
|
|
5
7
|
export declare const mapValues: <K extends AnyNotNil, V1, V2>(luaMap: LuaMap<K, V1>, transform: (value: V1) => V2) => LuaMap<K, V2>;
|
|
8
|
+
export declare const getOrPut: <K extends AnyNotNil, V>(luaMap: LuaMap<K, V>, key: K, defaultValue: () => V) => V;
|
package/utility/lua-maps.lua
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local select = _G.select
|
|
3
|
+
local setmetatable = _G.setmetatable
|
|
4
|
+
local weakKeysMetatable = {__mode = "k"}
|
|
5
|
+
____exports.mutableLuaMap = function()
|
|
6
|
+
return {}
|
|
7
|
+
end
|
|
8
|
+
____exports.mutableWeakLuaMap = function()
|
|
9
|
+
return setmetatable({}, weakKeysMetatable)
|
|
10
|
+
end
|
|
3
11
|
____exports.luaMapOf = function(...)
|
|
4
12
|
local luaMap = {}
|
|
5
13
|
for i = 1, select("#", ...), 2 do
|
|
@@ -22,4 +30,12 @@ ____exports.mapValues = function(luaMap, transform)
|
|
|
22
30
|
end
|
|
23
31
|
return result
|
|
24
32
|
end
|
|
33
|
+
____exports.getOrPut = function(luaMap, key, defaultValue)
|
|
34
|
+
local value = luaMap[key]
|
|
35
|
+
if value == nil then
|
|
36
|
+
value = defaultValue()
|
|
37
|
+
luaMap[key] = value
|
|
38
|
+
end
|
|
39
|
+
return value
|
|
40
|
+
end
|
|
25
41
|
return ____exports
|
package/utility/lua-sets.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
export declare const mutableLuaSet: <T extends AnyNotNil>() => LuaSet<T>;
|
|
2
3
|
export declare const luaSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LuaSet<T>;
|
|
3
4
|
export declare const luaSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LuaSet<T>;
|
|
4
5
|
export declare const luaSetIntersection: <T extends AnyNotNil>(firstLuaSet: ReadonlyLuaSet<T>, secondLuaSet: ReadonlyLuaSet<T>) => LuaSet<T>;
|