warscript 0.0.1-dev.b34a02b → 0.0.1-dev.b37c533
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/core/types/effect.d.ts +13 -3
- package/core/types/effect.lua +116 -17
- package/core/types/frame.d.ts +3 -0
- package/core/types/frame.lua +59 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +28 -0
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability.d.ts +14 -3
- package/engine/behaviour/ability.lua +79 -33
- package/engine/buff.d.ts +6 -1
- package/engine/buff.lua +29 -18
- package/engine/internal/ability.d.ts +15 -2
- package/engine/internal/ability.lua +86 -4
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +1 -0
- package/engine/internal/unit/item.lua +56 -2
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit.d.ts +12 -2
- package/engine/internal/unit.lua +80 -53
- package/engine/internal/utility.lua +12 -0
- package/engine/local-client.lua +2 -1
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/entry/ability-type.lua +8 -12
- package/engine/object-data/entry/item-type.d.ts +2 -0
- package/engine/object-data/entry/item-type.lua +13 -0
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +9 -3
- package/engine/object-field/ability.lua +3 -0
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +4 -0
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +1 -1
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +34 -3
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
|
@@ -256,6 +256,19 @@ __TS__SetDescriptor(
|
|
|
256
256
|
},
|
|
257
257
|
true
|
|
258
258
|
)
|
|
259
|
+
__TS__SetDescriptor(
|
|
260
|
+
ItemType.prototype,
|
|
261
|
+
"cooldownGroupId",
|
|
262
|
+
{
|
|
263
|
+
get = function(self)
|
|
264
|
+
return self:getObjectDataEntryIdField("icid")
|
|
265
|
+
end,
|
|
266
|
+
set = function(self, cooldownGroupId)
|
|
267
|
+
self:setObjectDataEntryIdField("icid", cooldownGroupId)
|
|
268
|
+
end
|
|
269
|
+
},
|
|
270
|
+
true
|
|
271
|
+
)
|
|
259
272
|
__TS__SetDescriptor(
|
|
260
273
|
ItemType.prototype,
|
|
261
274
|
"goldCost",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
4
|
local ____exports = {}
|
|
4
5
|
local ____preconditions = require("utility.preconditions")
|
|
5
6
|
local checkNotNull = ____preconditions.checkNotNull
|
|
@@ -60,4 +61,10 @@ function ObjectDataEntryIdGenerator.prototype.next(self)
|
|
|
60
61
|
self.id = id
|
|
61
62
|
return id
|
|
62
63
|
end
|
|
64
|
+
---
|
|
65
|
+
-- @internal For use by internal systems only.
|
|
66
|
+
____exports.abilityTypeIdGenerator = __TS__New(
|
|
67
|
+
____exports.ObjectDataEntryIdGenerator,
|
|
68
|
+
fourCC("A000")
|
|
69
|
+
)
|
|
63
70
|
return ____exports
|
|
@@ -45,9 +45,10 @@ export declare class AbilityStringField extends AbilityField<string, jabilitystr
|
|
|
45
45
|
protected setNativeFieldValue(instance: Ability, value: string): boolean;
|
|
46
46
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<AbilityStringField>;
|
|
47
47
|
}
|
|
48
|
-
export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType =
|
|
48
|
+
export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectArrayField<AbilityType, Ability, ValueType, NativeFieldType> {
|
|
49
49
|
protected get instanceClass(): typeof Ability;
|
|
50
50
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
51
|
+
protected hasNativeFieldValue(instance: Ability): boolean;
|
|
51
52
|
}
|
|
52
53
|
export declare class AbilityStringArrayField extends AbilityArrayField<string, jabilitystringlevelfield> {
|
|
53
54
|
protected get defaultValue(): string;
|
|
@@ -130,5 +131,10 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
|
|
|
130
131
|
protected getNativeFieldValue(instance: Ability, level: number): CombatClassifications;
|
|
131
132
|
protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
|
|
132
133
|
}
|
|
133
|
-
export type
|
|
134
|
-
export
|
|
134
|
+
export type ReadonlySubscribableAbilityDependentValue<ValueType extends boolean | number | string> = ValueType | ReadonlyObjectFieldType<AbilityField<ValueType>> | ReadonlyObjectLevelFieldType<AbilityLevelField<ValueType>>;
|
|
135
|
+
export type SubscribableAbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType>;
|
|
136
|
+
export type AbilityDependentValue<ValueType extends boolean | number | string> = SubscribableAbilityDependentValue<ValueType> | ((ability: Ability) => ValueType);
|
|
137
|
+
export declare const resolveCurrentAbilityDependentValue: {
|
|
138
|
+
<ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>): ValueType;
|
|
139
|
+
<ValueType extends boolean | number | string>(ability: Ability, value?: AbilityDependentValue<ValueType>): ValueType | undefined;
|
|
140
|
+
};
|
|
@@ -197,6 +197,9 @@ __TS__ClassExtends(AbilityArrayField, ObjectArrayField)
|
|
|
197
197
|
function AbilityArrayField.prototype.getObjectDataEntryId(self, instance)
|
|
198
198
|
return instance.typeId
|
|
199
199
|
end
|
|
200
|
+
function AbilityArrayField.prototype.hasNativeFieldValue(self, instance)
|
|
201
|
+
return instance:hasField(self.nativeField)
|
|
202
|
+
end
|
|
200
203
|
__TS__SetDescriptor(
|
|
201
204
|
AbilityArrayField.prototype,
|
|
202
205
|
"instanceClass",
|
package/engine/object-field.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEnt
|
|
|
16
16
|
readonly id: ObjectFieldId;
|
|
17
17
|
protected abstract getNativeFieldById(id: number): NativeFieldType;
|
|
18
18
|
protected abstract getObjectDataEntryId(instance: InstanceType): ObjectDataEntryIdType<ObjectDataEntryType>;
|
|
19
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
20
|
+
hasValue(instance: InstanceType): boolean;
|
|
19
21
|
constructor(id: number);
|
|
20
22
|
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number): T & symbol;
|
|
21
23
|
static of<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldAbstractConstructor<T>, id: number): T | undefined;
|
|
@@ -35,7 +37,6 @@ export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> =
|
|
|
35
37
|
type ReadonlyObjectFieldConstructor<T extends ObjectField> = OmitConstructor<typeof ObjectField> & (abstract new (...args: any[]) => ReadonlyObjectFieldType<T>);
|
|
36
38
|
export declare abstract class ObjectField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType, NativeFieldType> {
|
|
37
39
|
protected abstract readonly defaultValue: ValueType;
|
|
38
|
-
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
39
40
|
protected abstract getNativeFieldValue(instance: InstanceType): ValueType;
|
|
40
41
|
protected abstract setNativeFieldValue(instance: InstanceType, value: ValueType): boolean;
|
|
41
42
|
getValue(entry: ObjectDataEntryType | InstanceType): ValueType;
|
|
@@ -71,7 +72,6 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
71
72
|
}
|
|
72
73
|
export declare abstract class ObjectLevelField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType[], NativeFieldType> {
|
|
73
74
|
protected abstract readonly defaultValue: ValueType;
|
|
74
|
-
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
75
75
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
76
76
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|
|
77
77
|
protected abstract getLevelCount(entry: ObjectDataEntryType | InstanceType): number;
|
package/engine/object-field.lua
CHANGED
|
@@ -46,6 +46,10 @@ end
|
|
|
46
46
|
function ObjectFieldBase.prototype.supports(self, instance)
|
|
47
47
|
return __TS__InstanceOf(instance, self.instanceClass)
|
|
48
48
|
end
|
|
49
|
+
function ObjectFieldBase.prototype.hasValue(self, instance)
|
|
50
|
+
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
51
|
+
return defaultValueByObjectDataEntryId ~= nil and defaultValueByObjectDataEntryId[self:getObjectDataEntryId(instance)] ~= nil or self:hasNativeFieldValue(instance)
|
|
52
|
+
end
|
|
49
53
|
function ObjectFieldBase.create(self, id)
|
|
50
54
|
return __TS__New(
|
|
51
55
|
self,
|
|
@@ -687,6 +687,8 @@ export declare const DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD: Abilit
|
|
|
687
687
|
export declare const ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD: AbilityBooleanLevelField & symbol;
|
|
688
688
|
export declare const ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD: AbilityStringLevelField & symbol;
|
|
689
689
|
export declare const CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
690
|
+
export declare const CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
691
|
+
export declare const CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
690
692
|
export declare const TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
691
693
|
export declare const TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
692
694
|
export declare const TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
@@ -698,6 +698,8 @@ ____exports.DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBoolean
|
|
|
698
698
|
____exports.ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBooleanLevelField:create(fourCC("Ntm4"))
|
|
699
699
|
____exports.ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD = AbilityStringLevelField:create(fourCC("aart"))
|
|
700
700
|
____exports.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("acat"))
|
|
701
|
+
____exports.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("acap"))
|
|
702
|
+
____exports.CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("aca1"))
|
|
701
703
|
____exports.TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("atat"))
|
|
702
704
|
____exports.TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata0"))
|
|
703
705
|
____exports.TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata1"))
|
package/engine/unit.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import "./internal/unit-missile-launch";
|
|
|
16
16
|
import "./internal/unit/ghost-counter";
|
|
17
17
|
import "./internal/unit/invulnerability-counter";
|
|
18
18
|
import "./internal/unit/detach-missiles";
|
|
19
|
+
import "./internal/unit/main-selected";
|
|
19
20
|
import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
|
|
20
21
|
export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
|
|
21
22
|
export * from "./internal/unit+damage";
|
package/engine/unit.lua
CHANGED
|
@@ -16,6 +16,7 @@ require("engine.internal.unit-missile-launch")
|
|
|
16
16
|
require("engine.internal.unit.ghost-counter")
|
|
17
17
|
require("engine.internal.unit.invulnerability-counter")
|
|
18
18
|
require("engine.internal.unit.detach-missiles")
|
|
19
|
+
require("engine.internal.unit.main-selected")
|
|
19
20
|
require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
|
|
20
21
|
do
|
|
21
22
|
local ____unit = require("engine.internal.unit")
|
package/package.json
CHANGED
package/utility/arrays.d.ts
CHANGED
|
@@ -32,7 +32,10 @@ export declare const flatMapToLuaSet: {
|
|
|
32
32
|
};
|
|
33
33
|
export declare const mapIndexed: <T, R>(array: readonly T[], transform: (index: number, value: T) => R) => R[];
|
|
34
34
|
export declare const associate: <T, K extends AnyNotNil, V>(array: readonly T[], keySelector: (value: T) => K, valueSelector: (value: T) => V) => LuaMap<K, V>;
|
|
35
|
-
export declare const associateBy:
|
|
35
|
+
export declare const associateBy: {
|
|
36
|
+
<K extends AnyNotNil, V>(array: readonly V[], keySelector: (value: V) => K): LuaMap<K, V>;
|
|
37
|
+
<K extends KeysOfType<V, AnyNotNil>, V>(array: readonly V[], keySelector: K): LuaMap<V[K] extends AnyNotNil ? V[K] : never, V>;
|
|
38
|
+
};
|
|
36
39
|
export declare const associateByIndexed: <K extends AnyNotNil, V>(array: readonly V[], keySelector: (index: number, value: V) => K) => LuaMap<K, V>;
|
|
37
40
|
export declare const associateWith: <K extends AnyNotNil, V>(array: readonly K[], valueSelector: (value: K) => V) => LuaMap<K, V>;
|
|
38
41
|
export declare const associateWithIndexed: <K extends AnyNotNil, V>(array: readonly K[], valueSelector: (index: number, value: K) => V) => LuaMap<K, V>;
|
|
@@ -41,6 +44,10 @@ export declare const average: (array: readonly number[]) => number;
|
|
|
41
44
|
export declare const sum: (array: readonly number[]) => number;
|
|
42
45
|
export declare const product: (array: readonly number[]) => number;
|
|
43
46
|
export declare const max: (array: readonly number[]) => number;
|
|
47
|
+
export declare const maxBy: {
|
|
48
|
+
<T, Args extends any[]>(array: readonly T[], selector: (value: T, ...args: Args) => number, ...args: Args): T | undefined;
|
|
49
|
+
<T, K extends KeysOfType<T, number>>(array: readonly T[], key: K): T | undefined;
|
|
50
|
+
};
|
|
44
51
|
export declare const intersperse: <T>(array: readonly T[], delimiter: T) => T[];
|
|
45
52
|
export declare const zip: <T, R, V>(array: readonly T[], otherArray: readonly R[], transform: (value: T, otherValue: R) => V) => V[];
|
|
46
53
|
export declare const chunked: <T>(array: readonly T[], size: number) => T[][];
|
package/utility/arrays.lua
CHANGED
|
@@ -178,9 +178,16 @@ ____exports.associate = function(array, keySelector, valueSelector)
|
|
|
178
178
|
end
|
|
179
179
|
____exports.associateBy = function(array, keySelector)
|
|
180
180
|
local result = {}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
if type(keySelector) == "function" then
|
|
182
|
+
for i = 1, #array do
|
|
183
|
+
local value = array[i]
|
|
184
|
+
result[keySelector(value)] = value
|
|
185
|
+
end
|
|
186
|
+
else
|
|
187
|
+
for i = 1, #array do
|
|
188
|
+
local value = array[i]
|
|
189
|
+
result[value[keySelector]] = value
|
|
190
|
+
end
|
|
184
191
|
end
|
|
185
192
|
return result
|
|
186
193
|
end
|
|
@@ -251,6 +258,30 @@ ____exports.max = function(array)
|
|
|
251
258
|
end
|
|
252
259
|
return mathMax(table.unpack(array))
|
|
253
260
|
end
|
|
261
|
+
____exports.maxBy = function(array, selector, ...)
|
|
262
|
+
local result = nil
|
|
263
|
+
local maxValue = -math.huge
|
|
264
|
+
if type(selector) == "function" then
|
|
265
|
+
for i = 1, #array do
|
|
266
|
+
local element = array[i]
|
|
267
|
+
local value = selector(element, ...)
|
|
268
|
+
if value > maxValue then
|
|
269
|
+
result = element
|
|
270
|
+
maxValue = value
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
else
|
|
274
|
+
for i = 1, #array do
|
|
275
|
+
local element = array[i]
|
|
276
|
+
local value = element[selector]
|
|
277
|
+
if value > maxValue then
|
|
278
|
+
result = element
|
|
279
|
+
maxValue = value
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
return result
|
|
284
|
+
end
|
|
254
285
|
____exports.intersperse = function(array, delimiter)
|
|
255
286
|
local result = {}
|
|
256
287
|
local length = #array
|
package/utility/lazy.lua
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local rawset = _G.rawset
|
|
3
|
+
local setmetatable = _G.setmetatable
|
|
4
|
+
____exports.lazyRecord = function(initializer)
|
|
5
|
+
return setmetatable(
|
|
6
|
+
{},
|
|
7
|
+
{__index = function(self, key)
|
|
8
|
+
local value = initializer(key)
|
|
9
|
+
rawset(self, key, value)
|
|
10
|
+
return value
|
|
11
|
+
end}
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
return ____exports
|