warscript 0.0.1-dev.c59dd14 → 0.0.1-dev.c8224f3
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 +0 -1
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/effect.d.ts +13 -3
- package/core/types/effect.lua +116 -17
- package/core/types/frame.d.ts +8 -1
- package/core/types/frame.lua +93 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +3 -5
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +28 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- 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/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +14 -3
- package/engine/behaviour/ability.lua +79 -33
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +8 -2
- package/engine/behaviour/unit.lua +27 -0
- package/engine/buff.d.ts +68 -21
- package/engine/buff.lua +276 -90
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +16 -13
- package/engine/internal/ability.lua +80 -76
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item+owner.lua +2 -2
- 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/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +50 -0
- package/engine/internal/unit/bonus.d.ts +9 -8
- package/engine/internal/unit/bonus.lua +6 -1
- 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 +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +27 -12
- package/engine/internal/unit.lua +175 -86
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +8 -2
- package/engine/lightning.lua +27 -2
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/ability-type.lua +8 -12
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +14 -1
- package/engine/object-data/entry/item-type.lua +91 -0
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +0 -1
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +26 -3
- package/engine/object-field/ability.lua +54 -1
- package/engine/object-field.d.ts +2 -3
- package/engine/object-field.lua +4 -0
- package/engine/random.d.ts +1 -5
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +12 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +1 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -13
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +16 -0
- package/string.lua +5 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +11 -5
- package/utility/arrays.lua +34 -3
- package/utility/bit-set.d.ts +0 -2
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +11 -3
- package/utility/linked-set.lua +5 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Item } from "../item";
|
|
3
|
+
export interface UnitItems extends ReadonlyArray<Item | undefined> {
|
|
4
|
+
readonly length: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
[0]: Item | undefined;
|
|
6
|
+
[1]: Item | undefined;
|
|
7
|
+
[2]: Item | undefined;
|
|
8
|
+
[3]: Item | undefined;
|
|
9
|
+
[4]: Item | undefined;
|
|
10
|
+
[5]: Item | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare class UnitItems {
|
|
13
|
+
constructor(handle: junit);
|
|
14
|
+
findSlot(item: Item): 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
15
|
+
protected __newindex(slot: number, item: Item | undefined): void;
|
|
16
|
+
protected __index(key: string | number): unknown;
|
|
17
|
+
protected __len(): number;
|
|
18
|
+
protected __ipairs(): LuaIterator<LuaMultiReturn<[number, Item | undefined]>, junit>;
|
|
19
|
+
}
|
|
20
|
+
declare module "../unit" {
|
|
21
|
+
interface Unit {
|
|
22
|
+
readonly items: UnitItems;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____item = require("engine.internal.item")
|
|
7
|
+
local Item = ____item.Item
|
|
8
|
+
local ____unit = require("engine.internal.unit")
|
|
9
|
+
local Unit = ____unit.Unit
|
|
10
|
+
local ____utility = require("engine.internal.utility")
|
|
11
|
+
local findUnitItemSlot = ____utility.findUnitItemSlot
|
|
12
|
+
local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slot")
|
|
13
|
+
local unitAddItemToSlot = ____add_2Ditem_2Dto_2Dslot.unitAddItemToSlot
|
|
14
|
+
local rawset = _G.rawset
|
|
15
|
+
local ____type = _G.type
|
|
16
|
+
local isItemPowerup = IsItemPowerup
|
|
17
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
18
|
+
local unitInventorySize = UnitInventorySize
|
|
19
|
+
local unitItemInSlot = UnitItemInSlot
|
|
20
|
+
local unitRemoveItemFromSlot = UnitRemoveItemFromSlot
|
|
21
|
+
local handleByUnitItems = setmetatable({}, {__mode = "k"})
|
|
22
|
+
local function unitItemsNext(handle, index)
|
|
23
|
+
local slot = index & 7
|
|
24
|
+
if index >> 3 == slot then
|
|
25
|
+
return nil, nil
|
|
26
|
+
end
|
|
27
|
+
return index + 1, Item:of(unitItemInSlot(handle, slot))
|
|
28
|
+
end
|
|
29
|
+
____exports.UnitItems = __TS__Class()
|
|
30
|
+
local UnitItems = ____exports.UnitItems
|
|
31
|
+
UnitItems.name = "UnitItems"
|
|
32
|
+
function UnitItems.prototype.____constructor(self, handle)
|
|
33
|
+
handleByUnitItems[self] = handle
|
|
34
|
+
end
|
|
35
|
+
function UnitItems.prototype.findSlot(self, item)
|
|
36
|
+
return findUnitItemSlot(handleByUnitItems[self], item.handle)
|
|
37
|
+
end
|
|
38
|
+
function UnitItems.prototype.__newindex(self, slot, item)
|
|
39
|
+
local handle = handleByUnitItems[self]
|
|
40
|
+
if slot < 1 or slot > unitInventorySize(handle) then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
unitRemoveItemFromSlot(handle, slot - 1)
|
|
44
|
+
if item ~= nil then
|
|
45
|
+
local itemHandle = item.handle
|
|
46
|
+
local isPowerup = isItemPowerup(itemHandle)
|
|
47
|
+
if isPowerup then
|
|
48
|
+
setItemBooleanField(itemHandle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
49
|
+
end
|
|
50
|
+
unitAddItemToSlot(handle, itemHandle, slot - 1)
|
|
51
|
+
if isPowerup then
|
|
52
|
+
setItemBooleanField(itemHandle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
function UnitItems.prototype.__index(self, key)
|
|
57
|
+
if ____type(key) == "number" then
|
|
58
|
+
return Item:of(unitItemInSlot(handleByUnitItems[self], key - 1))
|
|
59
|
+
end
|
|
60
|
+
return rawget(____exports.UnitItems.prototype, key)
|
|
61
|
+
end
|
|
62
|
+
function UnitItems.prototype.__len(self)
|
|
63
|
+
return unitInventorySize(handleByUnitItems[self])
|
|
64
|
+
end
|
|
65
|
+
function UnitItems.prototype.__ipairs(self)
|
|
66
|
+
local handle = handleByUnitItems[self]
|
|
67
|
+
return unitItemsNext, handle, unitInventorySize(handle) << 3
|
|
68
|
+
end
|
|
69
|
+
__TS__ObjectDefineProperty(
|
|
70
|
+
Unit.prototype,
|
|
71
|
+
"items",
|
|
72
|
+
{get = function(self)
|
|
73
|
+
local items = __TS__New(____exports.UnitItems, self.handle)
|
|
74
|
+
rawset(self, "items", items)
|
|
75
|
+
return items
|
|
76
|
+
end}
|
|
77
|
+
)
|
|
78
|
+
return ____exports
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Player } from "../../../core/types/player";
|
|
3
|
+
import { Event } from "../../../event";
|
|
4
|
+
declare module "../unit" {
|
|
5
|
+
namespace Unit {
|
|
6
|
+
const mainSelectedUnitChangeEvent: Event<[Player]>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare module "../unit" {
|
|
10
|
+
namespace Unit {
|
|
11
|
+
const getMainSelectedOf: (player: Player) => Unit | undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____player = require("core.types.player")
|
|
5
|
+
local Player = ____player.Player
|
|
6
|
+
local ____math = require("math")
|
|
7
|
+
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
8
|
+
local MINIMUM_INTEGER = ____math.MINIMUM_INTEGER
|
|
9
|
+
local ____local_2Dclient = require("engine.local-client")
|
|
10
|
+
local LocalClient = ____local_2Dclient.LocalClient
|
|
11
|
+
local ____unit = require("engine.internal.unit")
|
|
12
|
+
local Unit = ____unit.Unit
|
|
13
|
+
local ____event = require("event")
|
|
14
|
+
local Event = ____event.Event
|
|
15
|
+
local mainSelectedUnitChangeEvent = __TS__New(Event)
|
|
16
|
+
rawset(Unit, "mainSelectedUnitChangeEvent", mainSelectedUnitChangeEvent)
|
|
17
|
+
local mainSelectedUnitByPlayer = {}
|
|
18
|
+
local syncSlider = BlzCreateFrameByType(
|
|
19
|
+
"SLIDER",
|
|
20
|
+
"UnitSyncId",
|
|
21
|
+
BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0),
|
|
22
|
+
"",
|
|
23
|
+
0
|
|
24
|
+
)
|
|
25
|
+
BlzFrameSetMinMaxValue(syncSlider, MINIMUM_INTEGER, MAXIMUM_INTEGER)
|
|
26
|
+
LocalClient.mainSelectedUnitChangeEvent:addListener(function()
|
|
27
|
+
local ____opt_0 = LocalClient.mainSelectedUnit
|
|
28
|
+
local syncId = ____opt_0 and ____opt_0.syncId
|
|
29
|
+
BlzFrameSetValue(syncSlider, syncId or 0)
|
|
30
|
+
end)
|
|
31
|
+
local trg = CreateTrigger()
|
|
32
|
+
BlzTriggerRegisterFrameEvent(trg, syncSlider, FRAMEEVENT_SLIDER_VALUE_CHANGED)
|
|
33
|
+
TriggerAddAction(
|
|
34
|
+
trg,
|
|
35
|
+
function()
|
|
36
|
+
local player = Player:of(GetTriggerPlayer())
|
|
37
|
+
local mainSelectedUnit = Unit:getBySyncId(BlzGetTriggerFrameValue())
|
|
38
|
+
if mainSelectedUnit ~= mainSelectedUnitByPlayer[player] then
|
|
39
|
+
mainSelectedUnitByPlayer[player] = mainSelectedUnit
|
|
40
|
+
Event.invoke(mainSelectedUnitChangeEvent, player)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
)
|
|
44
|
+
rawset(
|
|
45
|
+
Unit,
|
|
46
|
+
"getMainSelectedOf",
|
|
47
|
+
function(player)
|
|
48
|
+
return mainSelectedUnitByPlayer[player]
|
|
49
|
+
end
|
|
50
|
+
)
|
|
51
|
+
return ____exports
|
|
@@ -40,7 +40,7 @@ ItemAbility.onCreate:addListener(
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
)
|
|
43
|
-
Unit.
|
|
43
|
+
Unit.itemPickedUpEvent:addListener(
|
|
44
44
|
0,
|
|
45
45
|
function(unit, item)
|
|
46
46
|
for ____, ability in ipairs(item.abilities) do
|
|
@@ -48,7 +48,7 @@ Unit.onItemPickup:addListener(
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
)
|
|
51
|
-
Unit.
|
|
51
|
+
Unit.itemDroppedEvent:addListener(
|
|
52
52
|
4,
|
|
53
53
|
function(unit, item)
|
|
54
54
|
for ____, ability in ipairs(item.abilities) do
|
|
@@ -6,9 +6,8 @@ local ____unit = require("engine.internal.unit")
|
|
|
6
6
|
local Unit = ____unit.Unit
|
|
7
7
|
local ____event = require("event")
|
|
8
8
|
local Event = ____event.Event
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local boundRegion = ____mapbounds.boundRegion
|
|
9
|
+
local ____game_2Dmap = require("engine.game-map")
|
|
10
|
+
local GameMap = ____game_2Dmap.GameMap
|
|
12
11
|
local eventInvoke = Event.invoke
|
|
13
12
|
local tableRemove = table.remove
|
|
14
13
|
local ____assert = _G.assert
|
|
@@ -58,8 +57,8 @@ triggerAddCondition(
|
|
|
58
57
|
deboard(unit)
|
|
59
58
|
end
|
|
60
59
|
if not unitAlive(handle) then
|
|
61
|
-
unit.x =
|
|
62
|
-
unit.y =
|
|
60
|
+
unit.x = GameMap.worldBoundsRect.maxX
|
|
61
|
+
unit.y = GameMap.worldBoundsRect.maxY
|
|
63
62
|
end
|
|
64
63
|
local transport = Unit:of(getTransportUnit())
|
|
65
64
|
transportByUnit[unit] = transport
|
|
@@ -68,11 +67,6 @@ triggerAddCondition(
|
|
|
68
67
|
eventInvoke(onBoardEvent, unit, transport)
|
|
69
68
|
end)
|
|
70
69
|
)
|
|
71
|
-
boundRegion.onUnitEnter:addListener(function(unit)
|
|
72
|
-
if transportByUnit[unit] ~= nil and not isUnitLoaded(unit.handle) then
|
|
73
|
-
deboard(unit)
|
|
74
|
-
end
|
|
75
|
-
end)
|
|
76
70
|
Unit.deathEvent:addListener(function(unit)
|
|
77
71
|
if transportByUnit[unit] ~= nil then
|
|
78
72
|
deboard(unit)
|
|
@@ -7,14 +7,33 @@ local ____event = require("event")
|
|
|
7
7
|
local Event = ____event.Event
|
|
8
8
|
local ____timer = require("core.types.timer")
|
|
9
9
|
local Timer = ____timer.Timer
|
|
10
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
11
|
+
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
10
12
|
local autoAttackFinishEvent = __TS__New(Event)
|
|
11
13
|
rawset(Unit, "autoAttackFinishEvent", autoAttackFinishEvent)
|
|
12
14
|
local eventTimerByUnit = {}
|
|
13
|
-
local
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
local instantOrderIds = luaSetOf(
|
|
16
|
+
orderId("avatar"),
|
|
17
|
+
orderId("berserk"),
|
|
18
|
+
orderId("divineshield"),
|
|
19
|
+
orderId("immolation"),
|
|
20
|
+
orderId("moveslot0"),
|
|
21
|
+
orderId("moveslot1"),
|
|
22
|
+
orderId("moveslot2"),
|
|
23
|
+
orderId("moveslot3"),
|
|
24
|
+
orderId("moveslot4"),
|
|
25
|
+
orderId("moveslot5"),
|
|
26
|
+
orderId("unavatar"),
|
|
27
|
+
orderId("undivineshield"),
|
|
28
|
+
orderId("unimmolation")
|
|
29
|
+
)
|
|
30
|
+
local function reset(source, orderId)
|
|
31
|
+
if not (instantOrderIds[orderId] ~= nil) then
|
|
32
|
+
local eventTimer = eventTimerByUnit[source]
|
|
33
|
+
if eventTimer then
|
|
34
|
+
eventTimer:destroy()
|
|
35
|
+
eventTimerByUnit[source] = nil
|
|
36
|
+
end
|
|
18
37
|
end
|
|
19
38
|
end
|
|
20
39
|
Unit.onImmediateOrder:addListener(reset)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
4
3
|
import { Player } from "../../core/types/player";
|
|
@@ -43,6 +42,7 @@ export interface DamagingEvent {
|
|
|
43
42
|
damageType: jdamagetype;
|
|
44
43
|
weaponType: jweapontype;
|
|
45
44
|
readonly isAttack: boolean;
|
|
45
|
+
readonly originalAmount: number;
|
|
46
46
|
}
|
|
47
47
|
export type DamageEvent = DamagingEvent & {
|
|
48
48
|
preventDeath<P extends any[]>(this: DamageEvent, callback: (this: void, ...parameters: P) => any, ...parameters: P): void;
|
|
@@ -94,14 +94,19 @@ export declare class UnitWeapon {
|
|
|
94
94
|
set missileSpeed(missileSpeed: number);
|
|
95
95
|
}
|
|
96
96
|
declare const enum UnitPropertyKey {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
SYNC_ID = 100,
|
|
98
|
+
IS_PAUSED = 101,
|
|
99
|
+
STUN_COUNTER = 102,
|
|
100
|
+
DELAY_HEALTH_CHECKS_COUNTER = 103,
|
|
101
|
+
DELAY_HEALTH_CHECKS_HEALTH_BONUS = 104,
|
|
102
|
+
PREVENT_DEATH_HEALTH_BONUS = 105,
|
|
103
|
+
IS_TEAM_GLOW_HIDDEN = 106
|
|
103
104
|
}
|
|
105
|
+
export type UnitSyncId = number & {
|
|
106
|
+
readonly __unitSyncId: unique symbol;
|
|
107
|
+
};
|
|
104
108
|
export declare class Unit extends Handle<junit> {
|
|
109
|
+
readonly syncId: UnitSyncId;
|
|
105
110
|
private [UnitPropertyKey.IS_PAUSED]?;
|
|
106
111
|
private [UnitPropertyKey.STUN_COUNTER]?;
|
|
107
112
|
private [UnitPropertyKey.DELAY_HEALTH_CHECKS_COUNTER]?;
|
|
@@ -128,6 +133,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
128
133
|
get isAlive(): boolean;
|
|
129
134
|
get isDead(): boolean;
|
|
130
135
|
get isIllusion(): boolean;
|
|
136
|
+
get isStunned(): boolean;
|
|
131
137
|
get combatClassifications(): CombatClassifications;
|
|
132
138
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
133
139
|
hasCombatClassification(combatClassification: CombatClassification): boolean;
|
|
@@ -228,7 +234,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
228
234
|
isSelected(player: Player): boolean;
|
|
229
235
|
explode(): void;
|
|
230
236
|
kill(): void;
|
|
231
|
-
revive(
|
|
237
|
+
revive(x: number, y: number, doEffect?: boolean): void;
|
|
232
238
|
healTarget(target: Widget, amount: number): void;
|
|
233
239
|
useItem(item: Item): boolean;
|
|
234
240
|
issueImmediateOrder(order: number): boolean;
|
|
@@ -288,7 +294,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
288
294
|
static getInRange(x: number, y: number, range: number, predicate?: (unit: Unit) => boolean): Unit[];
|
|
289
295
|
static getInCollisionRange(x: number, y: number, range: number, predicate?: (unit: Unit) => boolean): Unit[];
|
|
290
296
|
static getInSector(pos: Vec2, range: number, offsetAngle: number, centralAngle: number): Unit[];
|
|
291
|
-
static getSelectionOf(player: Player): Unit[];
|
|
297
|
+
static getSelectionOf(player: Player, target?: Unit[]): Unit[];
|
|
292
298
|
static readonly deathEvent: UnitTriggerEvent<[Unit]>;
|
|
293
299
|
static readonly onDecay: UnitTriggerEvent<[]>;
|
|
294
300
|
static readonly onResurrect: InitializingEvent<[Unit], void>;
|
|
@@ -323,9 +329,17 @@ export declare class Unit extends Handle<junit> {
|
|
|
323
329
|
static readonly autoAttackStartEvent: UnitTriggerEvent<[Unit]>;
|
|
324
330
|
static readonly onDamaging: Event<[source: Unit | undefined, target: Unit, event: DamagingEvent]>;
|
|
325
331
|
static readonly onDamage: InitializingEvent<[source: Unit | undefined, target: Unit, event: DamageEvent], jtrigger>;
|
|
326
|
-
static
|
|
327
|
-
static
|
|
328
|
-
static
|
|
332
|
+
static itemDroppedEvent: UnitTriggerEvent<[Item]>;
|
|
333
|
+
static itemPickedUpEvent: UnitTriggerEvent<[Item]>;
|
|
334
|
+
static itemUsedEvent: UnitTriggerEvent<[Item]>;
|
|
335
|
+
static itemStackedEvent: UnitTriggerEvent<[Item]>;
|
|
336
|
+
static get itemUseOrderEvent(): Event<[unit: Unit, item: Item]>;
|
|
337
|
+
static get itemMoveOrderEvent(): Event<[
|
|
338
|
+
unit: Unit,
|
|
339
|
+
item: Item,
|
|
340
|
+
slotFrom: 0 | 1 | 2 | 3 | 4 | 5,
|
|
341
|
+
slotTo: 0 | 1 | 2 | 3 | 4 | 5
|
|
342
|
+
]>;
|
|
329
343
|
static get onCreate(): EventDispatcher<[Unit], [Unit]>;
|
|
330
344
|
static get destroyEvent(): EventDispatcher<[Unit], [Unit]>;
|
|
331
345
|
getField(field: junitintegerfield | junitrealfield): number;
|
|
@@ -336,5 +350,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
336
350
|
setField(field: junitbooleanfield, value: boolean): boolean;
|
|
337
351
|
setField(field: junitstringfield, value: string): boolean;
|
|
338
352
|
toString(): string;
|
|
353
|
+
static getBySyncId(syncId: UnitSyncId): Unit | undefined;
|
|
339
354
|
}
|
|
340
355
|
export {};
|