warscript 0.0.1-dev.ea69747 → 0.0.1-dev.ee2345e
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 +13 -0
- package/attributes.lua +16 -0
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +8 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- package/engine/internal/ability.d.ts +1 -1
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type.d.ts +1 -0
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- package/engine/object-data/entry/unit-type.d.ts +5 -0
- package/engine/object-data/entry/unit-type.lua +88 -44
- package/engine/object-field/ability.d.ts +7 -5
- package/engine/object-field/ability.lua +6 -0
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +6 -3
- package/engine/object-field.lua +38 -12
- package/engine/standard/entries/unit-type.d.ts +3 -0
- package/engine/standard/entries/unit-type.lua +3 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/exception.d.ts +2 -0
- package/exception.lua +4 -0
- package/global/vec2.lua +1 -0
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -1
- package/utility/arrays.lua +4 -1
- package/utility/linked-set.d.ts +20 -6
- package/utility/linked-set.lua +16 -0
- package/utility/types.d.ts +2 -2
package/attributes.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
+
/** @noSelfInFile */
|
|
3
|
+
export type Attribute<T> = {
|
|
4
|
+
readonly __attribute: unique symbol;
|
|
5
|
+
readonly __type: T;
|
|
6
|
+
} & symbol;
|
|
7
|
+
export declare namespace Attribute {
|
|
8
|
+
const create: <T>() => Attribute<T>;
|
|
9
|
+
}
|
|
10
|
+
export declare class AttributesHolder {
|
|
11
|
+
readonly get: (<T>(attribute: Attribute<T>) => T | undefined) & LuaExtension<"TableGetMethod">;
|
|
12
|
+
readonly set: (<T>(attribute: Attribute<T>, value: T | undefined) => void) & LuaExtension<"TableSetMethod">;
|
|
13
|
+
}
|
package/attributes.lua
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
____exports.Attribute = {}
|
|
5
|
+
local Attribute = ____exports.Attribute
|
|
6
|
+
do
|
|
7
|
+
Attribute.create = function()
|
|
8
|
+
return {}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
____exports.AttributesHolder = __TS__Class()
|
|
12
|
+
local AttributesHolder = ____exports.AttributesHolder
|
|
13
|
+
AttributesHolder.name = "AttributesHolder"
|
|
14
|
+
function AttributesHolder.prototype.____constructor(self)
|
|
15
|
+
end
|
|
16
|
+
return ____exports
|
package/core/types/handle.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Event } from "../../event";
|
|
3
|
+
import { AttributesHolder } from "../../attributes";
|
|
3
4
|
export type HandleConstructor<H extends jhandle, T extends Handle<H>, Args extends any[]> = new (handle: H, ...args: Args) => T;
|
|
4
5
|
export type HandleDestructor = {
|
|
5
6
|
readonly __handleDestructor: unique symbol;
|
|
@@ -11,7 +12,7 @@ type NoOverride = {
|
|
|
11
12
|
declare const enum HandlePropertyKey {
|
|
12
13
|
STATE = 0
|
|
13
14
|
}
|
|
14
|
-
export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> implements Destroyable {
|
|
15
|
+
export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> extends AttributesHolder implements Destroyable {
|
|
15
16
|
readonly handle: H;
|
|
16
17
|
private [HandlePropertyKey.STATE]?;
|
|
17
18
|
private onDestroyEvent?;
|
package/core/types/handle.lua
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
3
4
|
local __TS__New = ____lualib.__TS__New
|
|
4
5
|
local __TS__Delete = ____lualib.__TS__Delete
|
|
5
6
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
@@ -12,13 +13,17 @@ local getClass = ____reflection.getClass
|
|
|
12
13
|
local getSuperclass = ____reflection.getSuperclass
|
|
13
14
|
local ____exception = require("exception")
|
|
14
15
|
local IllegalStateException = ____exception.IllegalStateException
|
|
16
|
+
local ____attributes = require("attributes")
|
|
17
|
+
local AttributesHolder = ____attributes.AttributesHolder
|
|
15
18
|
local getHandleId = GetHandleId
|
|
16
19
|
local onCreateEventByHandleConstructor = {}
|
|
17
20
|
local onDestroyEventByHandleConstructor = {}
|
|
18
21
|
____exports.Handle = __TS__Class()
|
|
19
22
|
local Handle = ____exports.Handle
|
|
20
23
|
Handle.name = "Handle"
|
|
24
|
+
__TS__ClassExtends(Handle, AttributesHolder)
|
|
21
25
|
function Handle.prototype.____constructor(self, handle)
|
|
26
|
+
AttributesHolder.prototype.____constructor(self)
|
|
22
27
|
self[0] = 0
|
|
23
28
|
local id = getHandleId(handle)
|
|
24
29
|
local clazz = self.constructor
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { AbilityBehavior } from "../ability";
|
|
3
3
|
import { Ability } from "../../internal/ability";
|
|
4
|
-
import {
|
|
4
|
+
import { UnitBehavior } from "../unit";
|
|
5
5
|
import { Unit } from "../../internal/unit";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { AbilityDependentValue } from "../../object-field/ability";
|
|
7
|
+
export declare class ApplyUnitBehaviorAbilityBehavior<T extends UnitBehavior> extends AbilityBehavior {
|
|
8
|
+
private readonly unitBehaviorConstructor;
|
|
9
|
+
private readonly parameters?;
|
|
10
|
+
private readonly keys?;
|
|
8
11
|
private unitBehavior?;
|
|
9
|
-
constructor(ability: Ability, unitBehaviorConstructor:
|
|
12
|
+
constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?: Partial<{ [K in keyof T & { [P in keyof T]-?: (<T_1>() => T_1 extends { [Q in P]: T[P]; } ? 1 : 2) extends <T_2>() => T_2 extends { -readonly [Q_1 in P]: T[P]; } ? 1 : 2 ? P : never; }[keyof T] & KeysOfType<T, string | number | boolean>]: T[K] extends string | number | boolean ? AbilityDependentValue<T[K]> : never; }> | undefined);
|
|
13
|
+
update(): void;
|
|
10
14
|
onUnitGainAbility(unit: Unit): void;
|
|
11
15
|
onUnitLoseAbility(): void;
|
|
12
16
|
}
|
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
5
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
4
6
|
local __TS__New = ____lualib.__TS__New
|
|
5
7
|
local ____exports = {}
|
|
6
8
|
local ____ability = require("engine.behaviour.ability")
|
|
7
9
|
local AbilityBehavior = ____ability.AbilityBehavior
|
|
10
|
+
local ____ability = require("engine.object-field.ability")
|
|
11
|
+
local AbilityField = ____ability.AbilityField
|
|
12
|
+
local AbilityLevelField = ____ability.AbilityLevelField
|
|
8
13
|
____exports.ApplyUnitBehaviorAbilityBehavior = __TS__Class()
|
|
9
14
|
local ApplyUnitBehaviorAbilityBehavior = ____exports.ApplyUnitBehaviorAbilityBehavior
|
|
10
15
|
ApplyUnitBehaviorAbilityBehavior.name = "ApplyUnitBehaviorAbilityBehavior"
|
|
11
16
|
__TS__ClassExtends(ApplyUnitBehaviorAbilityBehavior, AbilityBehavior)
|
|
12
|
-
function ApplyUnitBehaviorAbilityBehavior.prototype.____constructor(self, ability, unitBehaviorConstructor,
|
|
13
|
-
local args = {...}
|
|
17
|
+
function ApplyUnitBehaviorAbilityBehavior.prototype.____constructor(self, ability, unitBehaviorConstructor, parameters)
|
|
14
18
|
AbilityBehavior.prototype.____constructor(self, ability)
|
|
15
|
-
self.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
self.unitBehaviorConstructor = unitBehaviorConstructor
|
|
20
|
+
self.parameters = parameters
|
|
21
|
+
if parameters ~= nil then
|
|
22
|
+
self.keys = __TS__ArraySort(__TS__ObjectKeys(parameters))
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
function ApplyUnitBehaviorAbilityBehavior.prototype.update(self)
|
|
26
|
+
local unitBehavior = self.unitBehavior
|
|
27
|
+
local parameters = self.parameters
|
|
28
|
+
local keys = self.keys
|
|
29
|
+
if unitBehavior ~= nil and parameters ~= nil and keys ~= nil then
|
|
30
|
+
for ____, key in ipairs(keys) do
|
|
31
|
+
local value = parameters[key]
|
|
32
|
+
if value ~= nil then
|
|
33
|
+
unitBehavior[key] = self:resolveCurrentAbilityDependentValue(value)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
21
36
|
end
|
|
22
37
|
end
|
|
23
38
|
function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitGainAbility(self, unit)
|
|
@@ -25,7 +40,8 @@ function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitGainAbility(self, unit
|
|
|
25
40
|
if ____opt_0 ~= nil then
|
|
26
41
|
____opt_0:destroy()
|
|
27
42
|
end
|
|
28
|
-
self.unitBehavior = self
|
|
43
|
+
self.unitBehavior = __TS__New(self.unitBehaviorConstructor, unit)
|
|
44
|
+
self:update()
|
|
29
45
|
end
|
|
30
46
|
function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitLoseAbility(self)
|
|
31
47
|
local ____opt_2 = self.unitBehavior
|
|
@@ -33,4 +49,10 @@ function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitLoseAbility(self)
|
|
|
33
49
|
____opt_2:destroy()
|
|
34
50
|
end
|
|
35
51
|
end
|
|
52
|
+
AbilityField.valueChangeEvent:addListener(function(ability)
|
|
53
|
+
____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
|
|
54
|
+
end)
|
|
55
|
+
AbilityLevelField.valueChangeEvent:addListener(function(ability)
|
|
56
|
+
____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
|
|
57
|
+
end)
|
|
36
58
|
return ____exports
|
|
@@ -12,7 +12,7 @@ interface Fields<K, V> {
|
|
|
12
12
|
interface AbilityLevel {
|
|
13
13
|
realFields: Fields<jabilityreallevelfield, number>;
|
|
14
14
|
}
|
|
15
|
-
type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
15
|
+
export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
16
16
|
export declare class AbilitySnapshot {
|
|
17
17
|
}
|
|
18
18
|
export declare abstract class Ability extends Handle<jability> {
|
|
@@ -4,6 +4,8 @@ local UnitClassification = ____unit.UnitClassification
|
|
|
4
4
|
local ____ability = require("engine.standard.fields.ability")
|
|
5
5
|
local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
|
|
6
6
|
local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
|
|
7
|
+
---
|
|
8
|
+
-- @internal For use by internal systems only.
|
|
7
9
|
____exports.getAbilityDuration = function(ability, target)
|
|
8
10
|
local level = ability.level
|
|
9
11
|
return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
3
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
4
|
+
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
5
|
+
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
6
|
+
local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
|
|
7
|
+
local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
|
|
8
|
+
local ____preconditions = require("utility.preconditions")
|
|
9
|
+
local checkNotNull = ____preconditions.checkNotNull
|
|
10
|
+
local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
|
|
11
|
+
local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
|
|
12
|
+
local ____arrays = require("utility.arrays")
|
|
13
|
+
local map = ____arrays.map
|
|
14
|
+
local toLuaSet = ____arrays.toLuaSet
|
|
15
|
+
local createItem = CreateItem
|
|
16
|
+
local getAbilityId = BlzGetAbilityId
|
|
17
|
+
local getItemAbility = BlzGetItemAbility
|
|
18
|
+
local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
|
|
19
|
+
local itemAddAbility = BlzItemAddAbility
|
|
20
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
21
|
+
local removeItem = RemoveItem
|
|
22
|
+
local unitAddAbility = UnitAddAbility
|
|
23
|
+
local unitAddItem = UnitAddItem
|
|
24
|
+
local unitDropItemSlot = UnitDropItemSlot
|
|
25
|
+
local unitInventorySize = UnitInventorySize
|
|
26
|
+
local unitRemoveAbility = UnitRemoveAbility
|
|
27
|
+
local unitRemoveItemFromSlot = UnitRemoveItemFromSlot
|
|
28
|
+
local INVENTORY_ABILITY_TYPE_IDS = postcompile(function()
|
|
29
|
+
return toLuaSet(AbilityType:getAllIdsByBaseIds(map({
|
|
30
|
+
"AInv",
|
|
31
|
+
"Aihn",
|
|
32
|
+
"Aien",
|
|
33
|
+
"Aion",
|
|
34
|
+
"Aiun"
|
|
35
|
+
}, fourCC)))
|
|
36
|
+
end)
|
|
37
|
+
---
|
|
38
|
+
-- @internal For use by internal systems only.
|
|
39
|
+
____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ...)
|
|
40
|
+
local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
|
|
41
|
+
unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
|
|
42
|
+
itemAddAbility(nativeItem, abilityTypeId)
|
|
43
|
+
local nativeAbility = checkNotNull(getItemAbility(nativeItem, abilityTypeId))
|
|
44
|
+
if prepareAbility ~= nil then
|
|
45
|
+
prepareAbility(nativeAbility, ...)
|
|
46
|
+
end
|
|
47
|
+
setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
|
|
48
|
+
setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
49
|
+
local success
|
|
50
|
+
if unitAddItem(nativeUnit, nativeItem) then
|
|
51
|
+
success = true
|
|
52
|
+
else
|
|
53
|
+
local latestInventoryAbilityTypeId = 0
|
|
54
|
+
local nativeItemBySlot = {}
|
|
55
|
+
local inventorySize = unitInventorySize(nativeUnit)
|
|
56
|
+
if inventorySize ~= 0 then
|
|
57
|
+
for slot = 0, inventorySize - 1 do
|
|
58
|
+
nativeItemBySlot[slot] = unitRemoveItemFromSlot(nativeUnit, slot)
|
|
59
|
+
end
|
|
60
|
+
local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
|
|
61
|
+
local i = 1
|
|
62
|
+
while unitNativeAbility ~= nil do
|
|
63
|
+
local abilityTypeId = getAbilityId(unitNativeAbility)
|
|
64
|
+
if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
|
|
65
|
+
latestInventoryAbilityTypeId = abilityTypeId
|
|
66
|
+
end
|
|
67
|
+
unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
|
|
68
|
+
i = i + 1
|
|
69
|
+
end
|
|
70
|
+
unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
71
|
+
end
|
|
72
|
+
unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
73
|
+
success = unitAddItem(nativeUnit, nativeItem)
|
|
74
|
+
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
75
|
+
if latestInventoryAbilityTypeId ~= 0 then
|
|
76
|
+
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
77
|
+
for slot, nativeItem in pairs(nativeItemBySlot) do
|
|
78
|
+
unitAddItem(nativeUnit, nativeItem)
|
|
79
|
+
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
removeItem(nativeItem)
|
|
84
|
+
return success
|
|
85
|
+
end
|
|
86
|
+
return ____exports
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.internal.unit")
|
|
3
|
+
local Unit = ____unit.Unit
|
|
4
|
+
local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
|
|
5
|
+
local castAbility = ____cast_2Dability.castAbility
|
|
6
|
+
local ____blink = require("engine.object-data.entry.ability-type.blink")
|
|
7
|
+
local BlinkAbilityType = ____blink.BlinkAbilityType
|
|
8
|
+
local ____math = require("math")
|
|
9
|
+
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
10
|
+
local getUnitX = GetUnitX
|
|
11
|
+
local getUnitY = GetUnitY
|
|
12
|
+
local setUnitX = SetUnitX
|
|
13
|
+
local setUnitY = SetUnitY
|
|
14
|
+
local BLINK_ABILITY_TYPE_ID = compiletime(function()
|
|
15
|
+
local abilityType = BlinkAbilityType:create()
|
|
16
|
+
abilityType.minimumRange = 0
|
|
17
|
+
abilityType.maximumRange = MAXIMUM_INTEGER
|
|
18
|
+
abilityType.manaCost = 0
|
|
19
|
+
abilityType.cooldown = 0
|
|
20
|
+
return abilityType.id
|
|
21
|
+
end)
|
|
22
|
+
Unit.prototype.detachMissiles = function(self)
|
|
23
|
+
local nativeUnit = self.handle
|
|
24
|
+
local x = getUnitX(nativeUnit)
|
|
25
|
+
local y = getUnitY(nativeUnit)
|
|
26
|
+
castAbility(nativeUnit, BLINK_ABILITY_TYPE_ID)
|
|
27
|
+
setUnitX(nativeUnit, x)
|
|
28
|
+
setUnitY(nativeUnit, y)
|
|
29
|
+
end
|
|
30
|
+
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityType, AbilityTypeId } from "../ability-type";
|
|
3
|
+
import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
|
|
4
|
+
export declare class BlinkAbilityType extends AbilityType {
|
|
5
|
+
static readonly BASE_ID: AbilityTypeId;
|
|
6
|
+
get maximumRange(): number[];
|
|
7
|
+
set maximumRange(maximumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
|
+
get minimumRange(): number[];
|
|
9
|
+
set minimumRange(minimumRange: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
7
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
8
|
+
____exports.BlinkAbilityType = __TS__Class()
|
|
9
|
+
local BlinkAbilityType = ____exports.BlinkAbilityType
|
|
10
|
+
BlinkAbilityType.name = "BlinkAbilityType"
|
|
11
|
+
__TS__ClassExtends(BlinkAbilityType, AbilityType)
|
|
12
|
+
BlinkAbilityType.BASE_ID = fourCC("AEbl")
|
|
13
|
+
__TS__SetDescriptor(
|
|
14
|
+
BlinkAbilityType.prototype,
|
|
15
|
+
"maximumRange",
|
|
16
|
+
{
|
|
17
|
+
get = function(self)
|
|
18
|
+
return self:getNumberLevelField("Ebl1")
|
|
19
|
+
end,
|
|
20
|
+
set = function(self, maximumRange)
|
|
21
|
+
self:setNumberLevelField("Ebl1", maximumRange)
|
|
22
|
+
end
|
|
23
|
+
},
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
__TS__SetDescriptor(
|
|
27
|
+
BlinkAbilityType.prototype,
|
|
28
|
+
"minimumRange",
|
|
29
|
+
{
|
|
30
|
+
get = function(self)
|
|
31
|
+
return self:getNumberLevelField("Ebl2")
|
|
32
|
+
end,
|
|
33
|
+
set = function(self, minimumRange)
|
|
34
|
+
self:setNumberLevelField("Ebl2", minimumRange)
|
|
35
|
+
end
|
|
36
|
+
},
|
|
37
|
+
true
|
|
38
|
+
)
|
|
39
|
+
return ____exports
|
|
@@ -7,7 +7,7 @@ local ____exports = {}
|
|
|
7
7
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
8
8
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
9
9
|
local ____arrays = require("utility.arrays")
|
|
10
|
-
local
|
|
10
|
+
local emptyArray = ____arrays.emptyArray
|
|
11
11
|
local map = ____arrays.map
|
|
12
12
|
local ____buff_2Dtype = require("engine.object-data.entry.buff-type")
|
|
13
13
|
local BuffType = ____buff_2Dtype.BuffType
|
|
@@ -78,7 +78,7 @@ __TS__SetDescriptor(
|
|
|
78
78
|
function(levelAbilityUpgrades)
|
|
79
79
|
return levelAbilityUpgrades[i + 1]
|
|
80
80
|
end
|
|
81
|
-
) or (abilityUpgrades[i + 1] or
|
|
81
|
+
) or (abilityUpgrades[i + 1] or emptyArray())
|
|
82
82
|
)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="warpack-types/warpack" />
|
|
2
2
|
/** @noSelfInFile */
|
|
3
|
+
import "../../internal/unit/ability";
|
|
3
4
|
import { TupleOf } from "../../../utility/types";
|
|
4
5
|
import { AnimationName } from "../auxiliary/animation-name";
|
|
5
6
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
@@ -6,6 +6,7 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
|
6
6
|
local ____exports = {}
|
|
7
7
|
local ____unit = require("engine.internal.unit")
|
|
8
8
|
local Unit = ____unit.Unit
|
|
9
|
+
require("engine.internal.unit.ability")
|
|
9
10
|
local ____timer = require("core.types.timer")
|
|
10
11
|
local Timer = ____timer.Timer
|
|
11
12
|
local ____effect = require("core.types.effect")
|
|
@@ -7,6 +7,7 @@ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
|
7
7
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
8
8
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
9
|
local ____exports = {}
|
|
10
|
+
local preparePhysicalPositiveApplicatorAbility
|
|
10
11
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
11
12
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
12
13
|
local ____cripple = require("engine.object-data.entry.ability-type.cripple")
|
|
@@ -34,20 +35,14 @@ local ____blood_2Dlust = require("engine.object-data.entry.ability-type.blood-lu
|
|
|
34
35
|
local BloodLustAbilityType = ____blood_2Dlust.BloodLustAbilityType
|
|
35
36
|
local ____berserk = require("engine.object-data.entry.ability-type.berserk")
|
|
36
37
|
local BerserkAbilityType = ____berserk.BerserkAbilityType
|
|
37
|
-
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
38
|
-
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
39
|
-
local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
|
|
40
|
-
local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
|
|
41
38
|
local ____blank = require("engine.object-data.entry.upgrade.blank")
|
|
42
39
|
local BlankUpgrade = ____blank.BlankUpgrade
|
|
43
|
-
local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
|
|
44
|
-
local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
|
|
45
|
-
local ____preconditions = require("utility.preconditions")
|
|
46
|
-
local checkNotNull = ____preconditions.checkNotNull
|
|
47
40
|
local ____unit_2Dtype = require("engine.object-data.entry.unit-type")
|
|
48
41
|
local UnitType = ____unit_2Dtype.UnitType
|
|
49
42
|
local ____permanent_2Dimmolation = require("engine.object-data.entry.ability-type.permanent-immolation")
|
|
50
43
|
local PermanentImmolationAbilityType = ____permanent_2Dimmolation.PermanentImmolationAbilityType
|
|
44
|
+
local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
|
|
45
|
+
local castAbility = ____cast_2Dability.castAbility
|
|
51
46
|
local createItem = CreateItem
|
|
52
47
|
local getAbilityId = BlzGetAbilityId
|
|
53
48
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -260,75 +255,25 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
260
255
|
return unitAddAbility(unit.handle, applicatorAbilityTypeId)
|
|
261
256
|
end
|
|
262
257
|
if applicatorType == 852100 then
|
|
263
|
-
local
|
|
264
|
-
|
|
265
|
-
local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
|
|
266
|
-
unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
|
|
267
|
-
itemAddAbility(nativeItem, applicatorAbilityTypeId)
|
|
268
|
-
local applicatorAbility = checkNotNull(getItemAbility(nativeItem, applicatorAbilityTypeId))
|
|
269
|
-
if level == nil then
|
|
270
|
-
level = 0
|
|
271
|
-
setAbilityIntegerField(applicatorAbility, ABILITY_IF_LEVELS, 1)
|
|
272
|
-
end
|
|
273
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_NORMAL, level, duration or 0)
|
|
274
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_HERO, level, duration or 0)
|
|
275
|
-
if movementSpeedIncreaseFactor ~= nil then
|
|
276
|
-
setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
277
|
-
end
|
|
278
|
-
setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
|
|
279
|
-
setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
280
|
-
if level > 0 then
|
|
258
|
+
local nativePlayer = unit.owner.handle
|
|
259
|
+
if level ~= nil and level > 0 then
|
|
281
260
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
282
261
|
if upgradeId ~= nil then
|
|
283
|
-
setPlayerTechResearched(
|
|
284
|
-
getOwningPlayer(nativeUnit),
|
|
285
|
-
upgradeId,
|
|
286
|
-
level
|
|
287
|
-
)
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
if not unitAddItem(nativeUnit, nativeItem) then
|
|
291
|
-
local latestInventoryAbilityTypeId = 0
|
|
292
|
-
local nativeItemBySlot = {}
|
|
293
|
-
local inventorySize = unitInventorySize(nativeUnit)
|
|
294
|
-
if inventorySize ~= 0 then
|
|
295
|
-
for slot = 0, inventorySize - 1 do
|
|
296
|
-
nativeItemBySlot[slot] = UnitRemoveItemFromSlot(nativeUnit, slot)
|
|
297
|
-
end
|
|
298
|
-
local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
|
|
299
|
-
local i = 1
|
|
300
|
-
while unitNativeAbility ~= nil do
|
|
301
|
-
local abilityTypeId = getAbilityId(unitNativeAbility)
|
|
302
|
-
if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
|
|
303
|
-
latestInventoryAbilityTypeId = abilityTypeId
|
|
304
|
-
end
|
|
305
|
-
unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
|
|
306
|
-
i = i + 1
|
|
307
|
-
end
|
|
308
|
-
unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
262
|
+
setPlayerTechResearched(nativePlayer, upgradeId, level)
|
|
309
263
|
end
|
|
310
|
-
unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
311
|
-
success = unitAddItem(nativeUnit, nativeItem)
|
|
312
|
-
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
313
|
-
if latestInventoryAbilityTypeId ~= 0 then
|
|
314
|
-
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
315
|
-
for slot, nativeItem in pairs(nativeItemBySlot) do
|
|
316
|
-
unitAddItem(nativeUnit, nativeItem)
|
|
317
|
-
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
318
|
-
end
|
|
319
|
-
end
|
|
320
|
-
else
|
|
321
|
-
success = true
|
|
322
264
|
end
|
|
323
|
-
|
|
324
|
-
|
|
265
|
+
local success = castAbility(
|
|
266
|
+
unit.handle,
|
|
267
|
+
applicatorAbilityTypeId,
|
|
268
|
+
preparePhysicalPositiveApplicatorAbility,
|
|
269
|
+
level,
|
|
270
|
+
duration or 0,
|
|
271
|
+
movementSpeedIncreaseFactor
|
|
272
|
+
)
|
|
273
|
+
if level ~= nil and level > 0 then
|
|
325
274
|
local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
|
|
326
275
|
if upgradeId ~= nil then
|
|
327
|
-
setPlayerTechResearched(
|
|
328
|
-
getOwningPlayer(nativeUnit),
|
|
329
|
-
upgradeId,
|
|
330
|
-
0
|
|
331
|
-
)
|
|
276
|
+
setPlayerTechResearched(nativePlayer, upgradeId, 0)
|
|
332
277
|
end
|
|
333
278
|
end
|
|
334
279
|
return success
|
|
@@ -364,6 +309,17 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
|
|
|
364
309
|
end
|
|
365
310
|
return success
|
|
366
311
|
end
|
|
312
|
+
preparePhysicalPositiveApplicatorAbility = function(ability, level, duration, movementSpeedIncreaseFactor)
|
|
313
|
+
if level == nil then
|
|
314
|
+
setAbilityIntegerField(ability, ABILITY_IF_LEVELS, 1)
|
|
315
|
+
level = 1
|
|
316
|
+
end
|
|
317
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_NORMAL, level, duration)
|
|
318
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_HERO, level, duration)
|
|
319
|
+
if movementSpeedIncreaseFactor ~= nil then
|
|
320
|
+
setAbilityRealLevelField(ability, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
367
323
|
---
|
|
368
324
|
-- @internal For use by internal systems only.
|
|
369
325
|
____exports.removeBuff = function(unit, applicableBuffTypeId)
|
|
@@ -13,6 +13,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
|
|
|
13
13
|
import type { AbilityTypeId } from "./ability-type";
|
|
14
14
|
import type { UpgradeId } from "./upgrade";
|
|
15
15
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
16
|
+
import { AttackType } from "../auxiliary/attack-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -23,12 +24,16 @@ export declare class UnitTypeWeapon {
|
|
|
23
24
|
private readonly unitType;
|
|
24
25
|
private readonly index;
|
|
25
26
|
private constructor();
|
|
27
|
+
get attackType(): AttackType;
|
|
28
|
+
set attackType(attackType: AttackType);
|
|
26
29
|
get backSwingDuration(): number;
|
|
27
30
|
set backSwingDuration(backSwingDuration: number);
|
|
28
31
|
get impactDelay(): number;
|
|
29
32
|
set impactDelay(impactDelay: number);
|
|
30
33
|
get missileModelPath(): string;
|
|
31
34
|
set missileModelPath(missileModelPath: string);
|
|
35
|
+
get range(): number;
|
|
36
|
+
set range(range: number);
|
|
32
37
|
get soundType(): WeaponSoundType;
|
|
33
38
|
set soundType(soundType: WeaponSoundType);
|
|
34
39
|
get soundTypeSD(): WeaponSoundType;
|
|
@@ -28,21 +28,21 @@ function UnitTypeWeapon.prototype.____constructor(self, unitType, index)
|
|
|
28
28
|
end
|
|
29
29
|
__TS__SetDescriptor(
|
|
30
30
|
UnitTypeWeapon.prototype,
|
|
31
|
-
"
|
|
31
|
+
"attackType",
|
|
32
32
|
{
|
|
33
33
|
get = function(self)
|
|
34
34
|
local ____self_0 = self.unitType
|
|
35
|
-
return ____self_0.
|
|
35
|
+
return ____self_0.getStringField(
|
|
36
36
|
____self_0,
|
|
37
|
-
"
|
|
37
|
+
("ua" .. tostring(self.index)) .. "t"
|
|
38
38
|
)
|
|
39
39
|
end,
|
|
40
|
-
set = function(self,
|
|
40
|
+
set = function(self, attackType)
|
|
41
41
|
local ____self_1 = self.unitType
|
|
42
|
-
____self_1.
|
|
42
|
+
____self_1.setStringField(
|
|
43
43
|
____self_1,
|
|
44
|
-
"
|
|
45
|
-
|
|
44
|
+
("ua" .. tostring(self.index)) .. "t",
|
|
45
|
+
attackType
|
|
46
46
|
)
|
|
47
47
|
end
|
|
48
48
|
},
|
|
@@ -50,21 +50,21 @@ __TS__SetDescriptor(
|
|
|
50
50
|
)
|
|
51
51
|
__TS__SetDescriptor(
|
|
52
52
|
UnitTypeWeapon.prototype,
|
|
53
|
-
"
|
|
53
|
+
"backSwingDuration",
|
|
54
54
|
{
|
|
55
55
|
get = function(self)
|
|
56
56
|
local ____self_2 = self.unitType
|
|
57
57
|
return ____self_2.getNumberField(
|
|
58
58
|
____self_2,
|
|
59
|
-
"
|
|
59
|
+
"ubs" .. tostring(self.index)
|
|
60
60
|
)
|
|
61
61
|
end,
|
|
62
|
-
set = function(self,
|
|
62
|
+
set = function(self, backSwingDuration)
|
|
63
63
|
local ____self_3 = self.unitType
|
|
64
64
|
____self_3.setNumberField(
|
|
65
65
|
____self_3,
|
|
66
|
-
"
|
|
67
|
-
|
|
66
|
+
"ubs" .. tostring(self.index),
|
|
67
|
+
backSwingDuration
|
|
68
68
|
)
|
|
69
69
|
end
|
|
70
70
|
},
|
|
@@ -72,21 +72,21 @@ __TS__SetDescriptor(
|
|
|
72
72
|
)
|
|
73
73
|
__TS__SetDescriptor(
|
|
74
74
|
UnitTypeWeapon.prototype,
|
|
75
|
-
"
|
|
75
|
+
"impactDelay",
|
|
76
76
|
{
|
|
77
77
|
get = function(self)
|
|
78
78
|
local ____self_4 = self.unitType
|
|
79
|
-
return ____self_4.
|
|
79
|
+
return ____self_4.getNumberField(
|
|
80
80
|
____self_4,
|
|
81
|
-
|
|
81
|
+
"udp" .. tostring(self.index)
|
|
82
82
|
)
|
|
83
83
|
end,
|
|
84
|
-
set = function(self,
|
|
84
|
+
set = function(self, impactDelay)
|
|
85
85
|
local ____self_5 = self.unitType
|
|
86
|
-
____self_5.
|
|
86
|
+
____self_5.setNumberField(
|
|
87
87
|
____self_5,
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
"udp" .. tostring(self.index),
|
|
89
|
+
impactDelay
|
|
90
90
|
)
|
|
91
91
|
end
|
|
92
92
|
},
|
|
@@ -94,21 +94,21 @@ __TS__SetDescriptor(
|
|
|
94
94
|
)
|
|
95
95
|
__TS__SetDescriptor(
|
|
96
96
|
UnitTypeWeapon.prototype,
|
|
97
|
-
"
|
|
97
|
+
"missileModelPath",
|
|
98
98
|
{
|
|
99
99
|
get = function(self)
|
|
100
100
|
local ____self_6 = self.unitType
|
|
101
101
|
return ____self_6.getStringField(
|
|
102
102
|
____self_6,
|
|
103
|
-
"
|
|
103
|
+
("ua" .. tostring(self.index)) .. "m"
|
|
104
104
|
)
|
|
105
105
|
end,
|
|
106
|
-
set = function(self,
|
|
106
|
+
set = function(self, missileModelPath)
|
|
107
107
|
local ____self_7 = self.unitType
|
|
108
108
|
____self_7.setStringField(
|
|
109
109
|
____self_7,
|
|
110
|
-
"
|
|
111
|
-
|
|
110
|
+
("ua" .. tostring(self.index)) .. "m",
|
|
111
|
+
missileModelPath
|
|
112
112
|
)
|
|
113
113
|
end
|
|
114
114
|
},
|
|
@@ -116,21 +116,21 @@ __TS__SetDescriptor(
|
|
|
116
116
|
)
|
|
117
117
|
__TS__SetDescriptor(
|
|
118
118
|
UnitTypeWeapon.prototype,
|
|
119
|
-
"
|
|
119
|
+
"range",
|
|
120
120
|
{
|
|
121
121
|
get = function(self)
|
|
122
122
|
local ____self_8 = self.unitType
|
|
123
|
-
return ____self_8.
|
|
123
|
+
return ____self_8.getNumberField(
|
|
124
124
|
____self_8,
|
|
125
|
-
("
|
|
125
|
+
("ua" .. tostring(self.index)) .. "r"
|
|
126
126
|
)
|
|
127
127
|
end,
|
|
128
|
-
set = function(self,
|
|
128
|
+
set = function(self, range)
|
|
129
129
|
local ____self_9 = self.unitType
|
|
130
|
-
____self_9.
|
|
130
|
+
____self_9.setNumberField(
|
|
131
131
|
____self_9,
|
|
132
|
-
("
|
|
133
|
-
|
|
132
|
+
("ua" .. tostring(self.index)) .. "r",
|
|
133
|
+
range
|
|
134
134
|
)
|
|
135
135
|
end
|
|
136
136
|
},
|
|
@@ -138,19 +138,63 @@ __TS__SetDescriptor(
|
|
|
138
138
|
)
|
|
139
139
|
__TS__SetDescriptor(
|
|
140
140
|
UnitTypeWeapon.prototype,
|
|
141
|
-
"
|
|
141
|
+
"soundType",
|
|
142
142
|
{
|
|
143
143
|
get = function(self)
|
|
144
144
|
local ____self_10 = self.unitType
|
|
145
145
|
return ____self_10.getStringField(
|
|
146
146
|
____self_10,
|
|
147
|
-
|
|
147
|
+
"ucs" .. tostring(self.index)
|
|
148
148
|
)
|
|
149
149
|
end,
|
|
150
|
-
set = function(self,
|
|
150
|
+
set = function(self, soundType)
|
|
151
151
|
local ____self_11 = self.unitType
|
|
152
152
|
____self_11.setStringField(
|
|
153
153
|
____self_11,
|
|
154
|
+
"ucs" .. tostring(self.index),
|
|
155
|
+
soundType
|
|
156
|
+
)
|
|
157
|
+
end
|
|
158
|
+
},
|
|
159
|
+
true
|
|
160
|
+
)
|
|
161
|
+
__TS__SetDescriptor(
|
|
162
|
+
UnitTypeWeapon.prototype,
|
|
163
|
+
"soundTypeSD",
|
|
164
|
+
{
|
|
165
|
+
get = function(self)
|
|
166
|
+
local ____self_12 = self.unitType
|
|
167
|
+
return ____self_12.getStringField(
|
|
168
|
+
____self_12,
|
|
169
|
+
("ucs" .. tostring(self.index)) .. ":sd"
|
|
170
|
+
)
|
|
171
|
+
end,
|
|
172
|
+
set = function(self, soundTypeSD)
|
|
173
|
+
local ____self_13 = self.unitType
|
|
174
|
+
____self_13.setStringField(
|
|
175
|
+
____self_13,
|
|
176
|
+
("ucs" .. tostring(self.index)) .. ":sd",
|
|
177
|
+
soundTypeSD
|
|
178
|
+
)
|
|
179
|
+
end
|
|
180
|
+
},
|
|
181
|
+
true
|
|
182
|
+
)
|
|
183
|
+
__TS__SetDescriptor(
|
|
184
|
+
UnitTypeWeapon.prototype,
|
|
185
|
+
"soundTypeHD",
|
|
186
|
+
{
|
|
187
|
+
get = function(self)
|
|
188
|
+
local ____self_14 = self.unitType
|
|
189
|
+
return ____self_14.getStringField(
|
|
190
|
+
____self_14,
|
|
191
|
+
("ucs" .. tostring(self.index)) .. ":hd"
|
|
192
|
+
)
|
|
193
|
+
end,
|
|
194
|
+
set = function(self, soundTypeHD)
|
|
195
|
+
local ____self_15 = self.unitType
|
|
196
|
+
____self_15.setStringField(
|
|
197
|
+
____self_15,
|
|
154
198
|
("ucs" .. tostring(self.index)) .. ":hd",
|
|
155
199
|
soundTypeHD
|
|
156
200
|
)
|
|
@@ -1262,11 +1306,11 @@ __TS__SetDescriptor(
|
|
|
1262
1306
|
implementReadonlyNumberIndexSupplier(
|
|
1263
1307
|
____exports.UnitType,
|
|
1264
1308
|
function(id)
|
|
1265
|
-
local
|
|
1266
|
-
|
|
1267
|
-
__TS__ClassExtends(
|
|
1268
|
-
|
|
1269
|
-
return
|
|
1309
|
+
local ____class_16 = __TS__Class()
|
|
1310
|
+
____class_16.name = ____class_16.name
|
|
1311
|
+
__TS__ClassExtends(____class_16, ____exports.UnitType)
|
|
1312
|
+
____class_16.BASE_ID = id
|
|
1313
|
+
return ____class_16
|
|
1270
1314
|
end
|
|
1271
1315
|
)
|
|
1272
1316
|
____exports.HeroUnitType = __TS__Class()
|
|
@@ -1296,11 +1340,11 @@ __TS__SetDescriptor(
|
|
|
1296
1340
|
implementReadonlyNumberIndexSupplier(
|
|
1297
1341
|
____exports.HeroUnitType,
|
|
1298
1342
|
function(id)
|
|
1299
|
-
local
|
|
1300
|
-
|
|
1301
|
-
__TS__ClassExtends(
|
|
1302
|
-
|
|
1303
|
-
return
|
|
1343
|
+
local ____class_17 = __TS__Class()
|
|
1344
|
+
____class_17.name = ____class_17.name
|
|
1345
|
+
__TS__ClassExtends(____class_17, ____exports.HeroUnitType)
|
|
1346
|
+
____class_17.BASE_ID = id
|
|
1347
|
+
return ____class_17
|
|
1304
1348
|
end
|
|
1305
1349
|
)
|
|
1306
1350
|
return ____exports
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import { Ability } from "../internal/ability";
|
|
2
|
+
import { Ability, jabilityfield } from "../internal/ability";
|
|
3
3
|
import { ObjectArrayField, ObjectField, ObjectFieldValueChangeEvent, ObjectLevelField, ObjectLevelFieldValueChangeEvent, ReadonlyObjectFieldType, ReadonlyObjectLevelFieldType } from "../object-field";
|
|
4
4
|
import { AbilityType, AbilityTypeId } from "../object-data/entry/ability-type";
|
|
5
5
|
import { ObjectDataEntryId } from "../object-data/entry";
|
|
6
6
|
import { LightningTypeId } from "../object-data/entry/lightning-type";
|
|
7
7
|
import { CombatClassifications } from "../object-data/auxiliary/combat-classification";
|
|
8
8
|
import { UnitTypeId } from "../object-data/entry/unit-type";
|
|
9
|
-
export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType =
|
|
9
|
+
export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
|
|
10
10
|
protected get instanceClass(): typeof Ability;
|
|
11
11
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
12
|
+
protected hasNativeFieldValue(instance: Ability): boolean;
|
|
12
13
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<AbilityField>>;
|
|
13
14
|
}
|
|
14
15
|
export declare class AbilityBooleanField extends AbilityField<boolean, jabilitybooleanfield> {
|
|
@@ -18,7 +19,7 @@ export declare class AbilityBooleanField extends AbilityField<boolean, jabilityb
|
|
|
18
19
|
protected setNativeFieldValue(instance: Ability, value: boolean): boolean;
|
|
19
20
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<AbilityBooleanField>;
|
|
20
21
|
}
|
|
21
|
-
export declare abstract class AbilityNumberField<NativeFieldType =
|
|
22
|
+
export declare abstract class AbilityNumberField<NativeFieldType extends jabilityfield = jabilityfield> extends AbilityField<number, NativeFieldType> {
|
|
22
23
|
protected get defaultValue(): number;
|
|
23
24
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<AbilityNumberField>;
|
|
24
25
|
}
|
|
@@ -59,10 +60,11 @@ export declare abstract class AbilityObjectDataEntryIdArrayField<T extends Objec
|
|
|
59
60
|
}
|
|
60
61
|
export declare class AbilityLightningTypeIdArrayField extends AbilityObjectDataEntryIdArrayField<LightningTypeId> {
|
|
61
62
|
}
|
|
62
|
-
export declare abstract class AbilityLevelField<ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType =
|
|
63
|
+
export declare abstract class AbilityLevelField<ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectLevelField<AbilityType, Ability, ValueType, InputValueType, NativeFieldType> {
|
|
63
64
|
protected get instanceClass(): typeof Ability;
|
|
64
65
|
protected getLevelCount(entry: AbilityType | Ability): number;
|
|
65
66
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
67
|
+
protected hasNativeFieldValue(instance: Ability): boolean;
|
|
66
68
|
static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<ReadonlyObjectLevelFieldType<AbilityLevelField>>;
|
|
67
69
|
}
|
|
68
70
|
export declare class AbilityBooleanLevelField extends AbilityLevelField<boolean, boolean, jabilityintegerlevelfield> {
|
|
@@ -72,7 +74,7 @@ export declare class AbilityBooleanLevelField extends AbilityLevelField<boolean,
|
|
|
72
74
|
protected setNativeFieldValue(instance: Ability, level: number, value: boolean): boolean;
|
|
73
75
|
static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityBooleanLevelField>;
|
|
74
76
|
}
|
|
75
|
-
export declare abstract class AbilityNumberLevelField<NativeFieldType =
|
|
77
|
+
export declare abstract class AbilityNumberLevelField<NativeFieldType extends jabilityfield = jabilityfield> extends AbilityLevelField<number, number, NativeFieldType> {
|
|
76
78
|
protected get defaultValue(): number;
|
|
77
79
|
static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityNumberLevelField>;
|
|
78
80
|
}
|
|
@@ -27,6 +27,9 @@ __TS__ClassExtends(AbilityField, ObjectField)
|
|
|
27
27
|
function AbilityField.prototype.getObjectDataEntryId(self, instance)
|
|
28
28
|
return instance.typeId
|
|
29
29
|
end
|
|
30
|
+
function AbilityField.prototype.hasNativeFieldValue(self, instance)
|
|
31
|
+
return instance:hasField(self.nativeField)
|
|
32
|
+
end
|
|
30
33
|
__TS__SetDescriptor(
|
|
31
34
|
AbilityField.prototype,
|
|
32
35
|
"instanceClass",
|
|
@@ -261,6 +264,9 @@ end
|
|
|
261
264
|
function AbilityLevelField.prototype.getObjectDataEntryId(self, instance)
|
|
262
265
|
return instance.typeId
|
|
263
266
|
end
|
|
267
|
+
function AbilityLevelField.prototype.hasNativeFieldValue(self, instance)
|
|
268
|
+
return instance:hasField(self.nativeField)
|
|
269
|
+
end
|
|
264
270
|
__TS__SetDescriptor(
|
|
265
271
|
AbilityLevelField.prototype,
|
|
266
272
|
"instanceClass",
|
|
@@ -9,6 +9,7 @@ export declare abstract class UnitField<ValueType extends number | string | bool
|
|
|
9
9
|
export declare class UnitStringField extends UnitField<string, junitstringfield> {
|
|
10
10
|
protected get defaultValue(): string;
|
|
11
11
|
protected getNativeFieldById(id: number): junitstringfield;
|
|
12
|
+
protected hasNativeFieldValue(): boolean;
|
|
12
13
|
protected getNativeFieldValue(instance: Unit): string;
|
|
13
14
|
protected getObjectDataEntryId(instance: Unit): UnitTypeId;
|
|
14
15
|
protected setNativeFieldValue(instance: Unit, value: string): boolean;
|
|
@@ -29,6 +29,9 @@ __TS__ClassExtends(UnitStringField, ____exports.UnitField)
|
|
|
29
29
|
function UnitStringField.prototype.getNativeFieldById(self, id)
|
|
30
30
|
return ConvertUnitStringField(id)
|
|
31
31
|
end
|
|
32
|
+
function UnitStringField.prototype.hasNativeFieldValue(self)
|
|
33
|
+
return true
|
|
34
|
+
end
|
|
32
35
|
function UnitStringField.prototype.getNativeFieldValue(self, instance)
|
|
33
36
|
return instance:getField(self.nativeField)
|
|
34
37
|
end
|
package/engine/object-field.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type ObjectFieldId = number & {
|
|
|
9
9
|
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number) => T);
|
|
10
10
|
export type ObjectFieldAbstractConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (abstract new (id: number) => T);
|
|
11
11
|
declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEntry, InstanceType extends AnyNotNil, ValueType, NativeFieldType> {
|
|
12
|
-
protected readonly valueByInstance: LuaMap<InstanceType, ValueType>;
|
|
13
12
|
protected abstract readonly instanceClass: AbstractConstructor<InstanceType> | Function;
|
|
14
13
|
supports(instance: AnyNotNil): instance is InstanceType & {
|
|
15
14
|
readonly __oneSidedTypeGuard: unique symbol;
|
|
@@ -33,21 +32,23 @@ export type ObjectFieldValueChangeEvent<T extends ObjectField<any, any, any, any
|
|
|
33
32
|
previousValue: ValueType,
|
|
34
33
|
newValue: ValueType
|
|
35
34
|
]> : never;
|
|
36
|
-
export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> = Omit<T, "setValue" | "removeValue">;
|
|
35
|
+
export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> = Omit<T, "setValue" | "removeValue" | "trySetValue">;
|
|
37
36
|
type ReadonlyObjectFieldConstructor<T extends ObjectField> = OmitConstructor<typeof ObjectField> & (abstract new (...args: any[]) => ReadonlyObjectFieldType<T>);
|
|
38
37
|
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> {
|
|
39
38
|
protected abstract readonly defaultValue: ValueType;
|
|
39
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
40
40
|
protected abstract getNativeFieldValue(instance: InstanceType): ValueType;
|
|
41
41
|
protected abstract setNativeFieldValue(instance: InstanceType, value: ValueType): boolean;
|
|
42
42
|
getValue(entry: ObjectDataEntryType | InstanceType): ValueType;
|
|
43
43
|
setValue(entry: ObjectDataEntryType | InstanceType, value: ValueType): boolean;
|
|
44
44
|
removeValue(entry: ObjectDataEntryType): boolean;
|
|
45
|
+
trySetValue(entry: ObjectDataEntryType | InstanceType, value: unknown): boolean;
|
|
45
46
|
private invokeValueChangeEvent;
|
|
46
47
|
private invokeValueChangeEventRecursive;
|
|
47
48
|
protected static getOrCreateValueChangeEvent<T extends ObjectField, R extends ReadonlyObjectFieldType<T>>(this: ReadonlyObjectFieldConstructor<T>): ObjectFieldValueChangeEvent<R>;
|
|
48
49
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<ObjectField>>;
|
|
49
50
|
}
|
|
50
|
-
export type ReadonlyObjectLevelFieldType<T extends ObjectLevelField<any, any, any, any>> = Omit<T, "setValue">;
|
|
51
|
+
export type ReadonlyObjectLevelFieldType<T extends ObjectLevelField<any, any, any, any>> = Omit<T, "setValue" | "trySetValue">;
|
|
51
52
|
export type ObjectLevelFieldValueChangeEvent<T extends ObjectLevelField<any, any, any, any> | ReadonlyObjectLevelFieldType<ObjectLevelField<any, any, any, any>>> = T extends ObjectLevelField<any, infer InstanceType, infer ValueType, any, any> ? DispatchingEvent<[
|
|
52
53
|
instance: InstanceType,
|
|
53
54
|
field: T,
|
|
@@ -71,11 +72,13 @@ 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;
|
|
75
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
74
76
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
75
77
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|
|
76
78
|
protected abstract getLevelCount(entry: ObjectDataEntryType | InstanceType): number;
|
|
77
79
|
getValue<LevelType extends [number] | []>(entry: ObjectDataEntryType | InstanceType, ...[level]: LevelType): LevelType extends [number] ? ValueType : ValueType[];
|
|
78
80
|
setValue(entry: ObjectDataEntryType | InstanceType, ...[levelOrValue, value]: [value: ObjectDataEntryLevelFieldValueSupplier<InputValueType, ValueType>] | [level: number, value: InputValueType]): boolean;
|
|
81
|
+
trySetValue(entry: ObjectDataEntryType | InstanceType, levelOrValue: number | unknown, value?: unknown): boolean;
|
|
79
82
|
private invokeValueChangeEvent;
|
|
80
83
|
private invokeValueChangeEventRecursive;
|
|
81
84
|
protected static getOrCreateValueChangeEvent<T extends ObjectLevelField, R extends ReadonlyObjectLevelFieldType<T>>(this: ReadonlyObjectLevelFieldConstructor<T>): ObjectLevelFieldValueChangeEvent<R>;
|
package/engine/object-field.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
4
4
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
6
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
7
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
7
8
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ____event = require("event")
|
|
@@ -131,13 +132,15 @@ function ObjectField.prototype.setValue(self, entry, value)
|
|
|
131
132
|
return true
|
|
132
133
|
end
|
|
133
134
|
end
|
|
135
|
+
if not self:hasNativeFieldValue(entry) then
|
|
136
|
+
return false
|
|
137
|
+
end
|
|
134
138
|
local previousValue = self:getNativeFieldValue(entry)
|
|
135
139
|
if value ~= previousValue then
|
|
136
|
-
if self:setNativeFieldValue(entry, value) then
|
|
137
|
-
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
138
|
-
else
|
|
140
|
+
if not self:setNativeFieldValue(entry, value) then
|
|
139
141
|
return false
|
|
140
142
|
end
|
|
143
|
+
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
141
144
|
end
|
|
142
145
|
return true
|
|
143
146
|
end
|
|
@@ -155,6 +158,12 @@ function ObjectField.prototype.removeValue(self, entry)
|
|
|
155
158
|
end
|
|
156
159
|
return false
|
|
157
160
|
end
|
|
161
|
+
function ObjectField.prototype.trySetValue(self, entry, value)
|
|
162
|
+
if __TS__TypeOf(value) ~= __TS__TypeOf(self.defaultValue) then
|
|
163
|
+
return false
|
|
164
|
+
end
|
|
165
|
+
return self:setValue(entry, value)
|
|
166
|
+
end
|
|
158
167
|
function ObjectField.prototype.invokeValueChangeEvent(self, ...)
|
|
159
168
|
self:invokeValueChangeEventRecursive(
|
|
160
169
|
getClass(self),
|
|
@@ -383,22 +392,39 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
383
392
|
return true
|
|
384
393
|
end
|
|
385
394
|
end
|
|
395
|
+
if not self:hasNativeFieldValue(entry) then
|
|
396
|
+
return false
|
|
397
|
+
end
|
|
386
398
|
local previousValue = self:getNativeFieldValue(entry, level)
|
|
387
399
|
if value ~= previousValue then
|
|
388
|
-
if self:setNativeFieldValue(entry, level, value) then
|
|
389
|
-
self:invokeValueChangeEvent(
|
|
390
|
-
entry,
|
|
391
|
-
self,
|
|
392
|
-
level,
|
|
393
|
-
previousValue,
|
|
394
|
-
value
|
|
395
|
-
)
|
|
396
|
-
else
|
|
400
|
+
if not self:setNativeFieldValue(entry, level, value) then
|
|
397
401
|
return false
|
|
398
402
|
end
|
|
403
|
+
self:invokeValueChangeEvent(
|
|
404
|
+
entry,
|
|
405
|
+
self,
|
|
406
|
+
level,
|
|
407
|
+
previousValue,
|
|
408
|
+
value
|
|
409
|
+
)
|
|
399
410
|
end
|
|
400
411
|
return true
|
|
401
412
|
end
|
|
413
|
+
function ObjectLevelField.prototype.trySetValue(self, entry, levelOrValue, value)
|
|
414
|
+
if value ~= nil then
|
|
415
|
+
if __TS__TypeOf(value) ~= __TS__TypeOf(self.defaultValue) then
|
|
416
|
+
return false
|
|
417
|
+
end
|
|
418
|
+
if type(levelOrValue) ~= "number" then
|
|
419
|
+
return false
|
|
420
|
+
end
|
|
421
|
+
return self:setValue(entry, levelOrValue, value)
|
|
422
|
+
end
|
|
423
|
+
if __TS__TypeOf(levelOrValue) ~= __TS__TypeOf(self.defaultValue) then
|
|
424
|
+
return false
|
|
425
|
+
end
|
|
426
|
+
return self:setValue(entry, levelOrValue)
|
|
427
|
+
end
|
|
402
428
|
function ObjectLevelField.prototype.invokeValueChangeEvent(self, ...)
|
|
403
429
|
self:invokeValueChangeEventRecursive(
|
|
404
430
|
getClass(self),
|
|
@@ -30,6 +30,9 @@ export declare const DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID: StandardHeroUnit
|
|
|
30
30
|
export declare const ABOMINATION_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
31
31
|
export declare const GHOUL_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
32
32
|
export declare const DEATH_KNIGHT_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
33
|
+
export declare const ZOMBIE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
34
|
+
export declare const ZOMBIE_FEMALE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
35
|
+
export declare const ARTHAS_EVIL_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
33
36
|
export declare const DIRE_MAMMOTH_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
34
37
|
export declare const ELDER_JUNGLE_STALKER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
35
38
|
export declare const ENRAGED_ELEMENTAL_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
@@ -29,6 +29,9 @@ ____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
|
|
|
29
29
|
____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
|
|
30
30
|
____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
|
|
31
31
|
____exports.DEATH_KNIGHT_HERO_UNIT_TYPE_ID = fourCC("Udea")
|
|
32
|
+
____exports.ZOMBIE_UNIT_TYPE_ID = fourCC("nzom")
|
|
33
|
+
____exports.ZOMBIE_FEMALE_UNIT_TYPE_ID = fourCC("nzof")
|
|
34
|
+
____exports.ARTHAS_EVIL_HERO_UNIT_TYPE_ID = fourCC("Uear")
|
|
32
35
|
____exports.DIRE_MAMMOTH_UNIT_TYPE_ID = fourCC("nmdr")
|
|
33
36
|
____exports.ELDER_JUNGLE_STALKER_UNIT_TYPE_ID = fourCC("njga")
|
|
34
37
|
____exports.ENRAGED_ELEMENTAL_UNIT_TYPE_ID = fourCC("nele")
|
package/engine/unit.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import "./internal/unit/missile";
|
|
|
14
14
|
import "./internal/unit-missile-launch";
|
|
15
15
|
import "./internal/unit/ghost-counter";
|
|
16
16
|
import "./internal/unit/invulnerability-counter";
|
|
17
|
+
import "./internal/unit/detach-missiles";
|
|
17
18
|
import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
|
|
18
19
|
export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
|
|
19
20
|
export * from "./internal/unit+damage";
|
package/engine/unit.lua
CHANGED
|
@@ -14,6 +14,7 @@ require("engine.internal.unit.missile")
|
|
|
14
14
|
require("engine.internal.unit-missile-launch")
|
|
15
15
|
require("engine.internal.unit.ghost-counter")
|
|
16
16
|
require("engine.internal.unit.invulnerability-counter")
|
|
17
|
+
require("engine.internal.unit.detach-missiles")
|
|
17
18
|
require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
|
|
18
19
|
do
|
|
19
20
|
local ____unit = require("engine.internal.unit")
|
package/exception.d.ts
CHANGED
package/exception.lua
CHANGED
|
@@ -50,4 +50,8 @@ ____exports.CancellationException = __TS__Class()
|
|
|
50
50
|
local CancellationException = ____exports.CancellationException
|
|
51
51
|
CancellationException.name = "CancellationException"
|
|
52
52
|
__TS__ClassExtends(CancellationException, ____exports.Exception)
|
|
53
|
+
____exports.UnsupportedOperationException = __TS__Class()
|
|
54
|
+
local UnsupportedOperationException = ____exports.UnsupportedOperationException
|
|
55
|
+
UnsupportedOperationException.name = "UnsupportedOperationException"
|
|
56
|
+
__TS__ClassExtends(UnsupportedOperationException, ____exports.Exception)
|
|
53
57
|
return ____exports
|
package/global/vec2.lua
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "warscript",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.ee2345e",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.2",
|
|
26
26
|
"typescript-to-lua": "^1.24.1",
|
|
27
27
|
"lua-types": "^2.13.1",
|
|
28
28
|
"warpack": "0.0.1-dev.5bdabe5"
|
package/utility/arrays.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/** @noSelfInFile */
|
|
3
3
|
import { TupleOf } from "./types";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const emptyArray: <T>() => readonly T[];
|
|
5
5
|
export declare const joinToString: <T>(array: readonly T[], separator: string, transform?: (element: T) => string) => string;
|
|
6
6
|
export declare const arrayOfNotNull: <T>(...elements: readonly (T | null | undefined)[]) => T[];
|
|
7
7
|
export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
|
package/utility/arrays.lua
CHANGED
|
@@ -8,7 +8,10 @@ local mathMin = math.min
|
|
|
8
8
|
local select = _G.select
|
|
9
9
|
local tableConcat = table.concat
|
|
10
10
|
local tableSort = table.sort
|
|
11
|
-
|
|
11
|
+
local EMPTY_ARRAY = {}
|
|
12
|
+
____exports.emptyArray = function()
|
|
13
|
+
return EMPTY_ARRAY
|
|
14
|
+
end
|
|
12
15
|
____exports.joinToString = function(array, separator, transform)
|
|
13
16
|
if transform == nil then
|
|
14
17
|
transform = tostring
|
package/utility/linked-set.d.ts
CHANGED
|
@@ -4,10 +4,25 @@ type IteratorState<T extends AnyNotNil> = {
|
|
|
4
4
|
t: LuaMap<T, T>;
|
|
5
5
|
n?: T;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
readonly
|
|
7
|
+
type OneSidedTypeGuard = {
|
|
8
|
+
readonly __oneSidedTypeGuard: unique symbol;
|
|
9
|
+
};
|
|
10
|
+
export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
11
|
+
copyOf(): LinkedSet<T>;
|
|
12
|
+
first(): T | undefined;
|
|
13
|
+
last(): T | undefined;
|
|
14
|
+
next(key: T): T | undefined;
|
|
15
|
+
previous(key: T): T | undefined;
|
|
16
|
+
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
17
|
+
size: number;
|
|
18
|
+
forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
|
|
19
|
+
toArray(): T[];
|
|
20
|
+
sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
|
|
21
|
+
}
|
|
22
|
+
export interface LinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
23
|
+
readonly __linkedSet: unique symbol;
|
|
9
24
|
}
|
|
10
|
-
export declare class LinkedSet<T extends AnyNotNil> {
|
|
25
|
+
export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet<T> {
|
|
11
26
|
private n;
|
|
12
27
|
private p;
|
|
13
28
|
private f?;
|
|
@@ -20,9 +35,7 @@ export declare class LinkedSet<T extends AnyNotNil> {
|
|
|
20
35
|
previous(key: T): T | undefined;
|
|
21
36
|
add(key: T): boolean;
|
|
22
37
|
remove(key: T): boolean;
|
|
23
|
-
contains(key: AnyNotNil): key is T &
|
|
24
|
-
readonly __oneSidedTypeGuard: unique symbol;
|
|
25
|
-
};
|
|
38
|
+
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
26
39
|
clear(): void;
|
|
27
40
|
get size(): number;
|
|
28
41
|
forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
|
|
@@ -31,6 +44,7 @@ export declare class LinkedSet<T extends AnyNotNil> {
|
|
|
31
44
|
sortBy<R>(selector: ((value: T) => R) | KeysOfType<T, R>): void;
|
|
32
45
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
33
46
|
}
|
|
47
|
+
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
34
48
|
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LinkedSet<T>;
|
|
35
49
|
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | null | undefined)[]) => LinkedSet<T>;
|
|
36
50
|
export {};
|
package/utility/linked-set.lua
CHANGED
|
@@ -2,9 +2,12 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____arrays = require("utility.arrays")
|
|
7
8
|
local sortBy = ____arrays.sortBy
|
|
9
|
+
local ____exception = require("exception")
|
|
10
|
+
local UnsupportedOperationException = ____exception.UnsupportedOperationException
|
|
8
11
|
local function linkedSetNext(state)
|
|
9
12
|
local n = state.n
|
|
10
13
|
state.n = state.t[n]
|
|
@@ -161,6 +164,19 @@ __TS__SetDescriptor(
|
|
|
161
164
|
end},
|
|
162
165
|
true
|
|
163
166
|
)
|
|
167
|
+
local EmptyLinkedSet = __TS__Class()
|
|
168
|
+
EmptyLinkedSet.name = "EmptyLinkedSet"
|
|
169
|
+
__TS__ClassExtends(EmptyLinkedSet, ____exports.LinkedSet)
|
|
170
|
+
function EmptyLinkedSet.prototype.add(self)
|
|
171
|
+
error(
|
|
172
|
+
__TS__New(UnsupportedOperationException),
|
|
173
|
+
0
|
|
174
|
+
)
|
|
175
|
+
end
|
|
176
|
+
local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
177
|
+
____exports.emptyLinkedSet = function()
|
|
178
|
+
return EMPTY_LINKED_SET
|
|
179
|
+
end
|
|
164
180
|
____exports.linkedSetOf = function(...)
|
|
165
181
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
166
182
|
for i = 1, select("#", ...) do
|
package/utility/types.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ export type ValueOf<T> = T[keyof T];
|
|
|
12
12
|
export type EntryOf<T> = ValueOf<{
|
|
13
13
|
[K in keyof T]: [K, T[K]];
|
|
14
14
|
}>;
|
|
15
|
-
export type MutableKeys<T extends object> = {
|
|
15
|
+
export type MutableKeys<T extends object> = keyof T & {
|
|
16
16
|
[P in keyof T]-?: IfEquals<{
|
|
17
17
|
[Q in P]: T[P];
|
|
18
18
|
}, {
|
|
19
19
|
-readonly [Q in P]: T[P];
|
|
20
20
|
}, P>;
|
|
21
21
|
}[keyof T];
|
|
22
|
-
export type ReadonlyKeys<T extends object> = {
|
|
22
|
+
export type ReadonlyKeys<T extends object> = keyof T & {
|
|
23
23
|
[P in keyof T]-?: IfEquals<{
|
|
24
24
|
[Q in P]: T[P];
|
|
25
25
|
}, {
|