warscript 0.0.1-dev.b530e1f → 0.0.1-dev.b9bd489
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 +12 -0
- package/attributes.lua +16 -0
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/effect.d.ts +12 -3
- package/core/types/effect.lua +56 -7
- 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/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- 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 +13 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- 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 +30 -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 -15
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +18 -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 +16 -2
- package/engine/behaviour/ability.lua +88 -12
- 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 +6 -13
- package/engine/internal/ability.lua +13 -74
- package/engine/internal/item+owner.lua +2 -2
- 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/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/bonus.d.ts +9 -8
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +84 -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 +25 -6
- package/engine/internal/unit.d.ts +58 -16
- package/engine/internal/unit.lua +334 -122
- 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/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- 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 +12 -1
- package/engine/object-data/entry/item-type.lua +78 -0
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +42 -2
- package/engine/object-data/entry/unit-type.lua +378 -50
- 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-field/ability.d.ts +28 -6
- package/engine/object-field/ability.lua +57 -1
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +2 -1
- package/engine/object-field.lua +16 -12
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +42 -1
- package/engine/standard/entries/unit-type.lua +42 -1
- package/engine/standard/fields/ability.d.ts +3 -1
- package/engine/standard/fields/ability.lua +3 -1
- 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/global/vec2.lua +1 -0
- 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 -14
- 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 +30 -0
- package/string.lua +14 -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 +3 -2
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/local-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "../core/types/unit";
|
|
3
3
|
import { Async } from "../core/types/async";
|
|
4
|
-
import { TriggerEvent } from "../event";
|
|
4
|
+
import { Event, TriggerEvent } from "../event";
|
|
5
5
|
import { GraphicsMode } from "./index";
|
|
6
6
|
export declare class LocalClient {
|
|
7
7
|
private constructor();
|
|
@@ -11,6 +11,11 @@ export declare class LocalClient {
|
|
|
11
11
|
static get isHD(): boolean;
|
|
12
12
|
static get graphicsMode(): GraphicsMode;
|
|
13
13
|
static get isActive(): boolean;
|
|
14
|
-
static get mouseFocusUnit(): Async<Unit
|
|
14
|
+
static get mouseFocusUnit(): Async<Unit> | undefined;
|
|
15
|
+
static get mainSelectedUnit(): Async<Unit> | undefined;
|
|
16
|
+
static get mainSelectedUnitChangeEvent(): Event<[
|
|
17
|
+
previousMainSelectedUnit: Unit | undefined,
|
|
18
|
+
newMainSelectedUnit: Unit | undefined
|
|
19
|
+
]>;
|
|
15
20
|
static readonly onDisconnect: TriggerEvent<[]>;
|
|
16
21
|
}
|
package/engine/local-client.lua
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
2
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
4
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
4
5
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -6,13 +7,25 @@ local ____exports = {}
|
|
|
6
7
|
local ____unit = require("core.types.unit")
|
|
7
8
|
local Unit = ____unit.Unit
|
|
8
9
|
local ____event = require("event")
|
|
10
|
+
local Event = ____event.Event
|
|
9
11
|
local TriggerEvent = ____event.TriggerEvent
|
|
12
|
+
local ____frame = require("core.types.frame")
|
|
13
|
+
local Frame = ____frame.Frame
|
|
14
|
+
local ____player = require("core.types.player")
|
|
15
|
+
local Player = ____player.Player
|
|
16
|
+
local ____timer = require("core.types.timer")
|
|
17
|
+
local Timer = ____timer.Timer
|
|
10
18
|
local loadTOCFile = BlzLoadTOCFile
|
|
11
19
|
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
12
20
|
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
13
21
|
local isLocalClientActive = BlzIsLocalClientActive
|
|
22
|
+
local isHeroUnitId = IsHeroUnitId
|
|
23
|
+
local getHandleId = GetHandleId
|
|
14
24
|
local getMouseFocusUnit = BlzGetMouseFocusUnit
|
|
25
|
+
local getUnitRealField = BlzGetUnitRealField
|
|
26
|
+
local getUnitTypeId = GetUnitTypeId
|
|
15
27
|
local getLocale = BlzGetLocale
|
|
28
|
+
local tableSort = table.sort
|
|
16
29
|
local tocPath = "_warscript\\IsHD.toc"
|
|
17
30
|
compiletime(function()
|
|
18
31
|
if currentMap then
|
|
@@ -21,6 +34,29 @@ compiletime(function()
|
|
|
21
34
|
currentMap:addFileString("_HD.w3mod\\" .. tocPath, fdfPath .. "\r\n")
|
|
22
35
|
end
|
|
23
36
|
end)
|
|
37
|
+
local selectionButtons
|
|
38
|
+
Timer:run(function()
|
|
39
|
+
selectionButtons = __TS__ArrayMap(
|
|
40
|
+
Frame:byName("SimpleInfoPanelUnitDetail").parent:getChild(5):getChild(0).children,
|
|
41
|
+
function(____, frame) return frame:getChild(1) end
|
|
42
|
+
)
|
|
43
|
+
end)
|
|
44
|
+
local localSelectedUnits = {}
|
|
45
|
+
local indexByLocalSelectedUnit = {}
|
|
46
|
+
local function compareUnitsSelectionPriority(a, b)
|
|
47
|
+
local aHandle = a.handle
|
|
48
|
+
local bHandle = b.handle
|
|
49
|
+
local priorityDelta = getUnitRealField(bHandle, UNIT_RF_PRIORITY) - getUnitRealField(aHandle, UNIT_RF_PRIORITY)
|
|
50
|
+
if priorityDelta ~= 0 then
|
|
51
|
+
return priorityDelta < 0
|
|
52
|
+
end
|
|
53
|
+
local aTypeId = getUnitTypeId(aHandle)
|
|
54
|
+
local bTypeId = getUnitTypeId(bHandle)
|
|
55
|
+
local orderDelta = (isHeroUnitId(aTypeId) and getHandleId(aHandle) or aTypeId) - (isHeroUnitId(bTypeId) and getHandleId(bHandle) or bTypeId)
|
|
56
|
+
return (orderDelta ~= 0 and orderDelta or indexByLocalSelectedUnit[a] - indexByLocalSelectedUnit[b]) < 0
|
|
57
|
+
end
|
|
58
|
+
local mainSelectedUnitChangeEvent
|
|
59
|
+
local previousMainSelectedUnit
|
|
24
60
|
____exports.LocalClient = __TS__Class()
|
|
25
61
|
local LocalClient = ____exports.LocalClient
|
|
26
62
|
LocalClient.name = "LocalClient"
|
|
@@ -69,6 +105,52 @@ __TS__ObjectDefineProperty(
|
|
|
69
105
|
return Unit:of(getMouseFocusUnit())
|
|
70
106
|
end}
|
|
71
107
|
)
|
|
108
|
+
__TS__ObjectDefineProperty(
|
|
109
|
+
LocalClient,
|
|
110
|
+
"mainSelectedUnit",
|
|
111
|
+
{get = function(self)
|
|
112
|
+
Unit:getSelectionOf(Player["local"], localSelectedUnits)
|
|
113
|
+
for i = 1, #localSelectedUnits do
|
|
114
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = i
|
|
115
|
+
end
|
|
116
|
+
tableSort(localSelectedUnits, compareUnitsSelectionPriority)
|
|
117
|
+
local mainSelectedUnitIndex
|
|
118
|
+
if selectionButtons and #localSelectedUnits > 1 then
|
|
119
|
+
local maxButtonWidth = 0
|
|
120
|
+
for i = 0, #selectionButtons - 1 do
|
|
121
|
+
local width = selectionButtons[i + 1].width
|
|
122
|
+
if width > maxButtonWidth then
|
|
123
|
+
maxButtonWidth = width
|
|
124
|
+
mainSelectedUnitIndex = i
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
local mainSelectedUnit = localSelectedUnits[(mainSelectedUnitIndex or 0) + 1]
|
|
129
|
+
for i = 1, #localSelectedUnits do
|
|
130
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = nil
|
|
131
|
+
localSelectedUnits[i] = nil
|
|
132
|
+
end
|
|
133
|
+
if mainSelectedUnitChangeEvent ~= nil and mainSelectedUnit ~= previousMainSelectedUnit then
|
|
134
|
+
local previousPreviousMainSelectedUnit = previousMainSelectedUnit
|
|
135
|
+
previousMainSelectedUnit = mainSelectedUnit
|
|
136
|
+
Event.invoke(mainSelectedUnitChangeEvent, previousPreviousMainSelectedUnit, previousMainSelectedUnit)
|
|
137
|
+
end
|
|
138
|
+
return mainSelectedUnit
|
|
139
|
+
end}
|
|
140
|
+
)
|
|
141
|
+
__TS__ObjectDefineProperty(
|
|
142
|
+
LocalClient,
|
|
143
|
+
"mainSelectedUnitChangeEvent",
|
|
144
|
+
{get = function(self)
|
|
145
|
+
if mainSelectedUnitChangeEvent == nil then
|
|
146
|
+
mainSelectedUnitChangeEvent = __TS__New(Event)
|
|
147
|
+
Timer.onPeriod[1 / 64]:addListener(function()
|
|
148
|
+
local _ = ____exports.LocalClient.mainSelectedUnit
|
|
149
|
+
end)
|
|
150
|
+
end
|
|
151
|
+
return mainSelectedUnitChangeEvent
|
|
152
|
+
end}
|
|
153
|
+
)
|
|
72
154
|
LocalClient.onDisconnect = __TS__New(
|
|
73
155
|
TriggerEvent,
|
|
74
156
|
function(trigger)
|
|
@@ -4,5 +4,9 @@ export declare const enum SoundPresetName {
|
|
|
4
4
|
ABOMINATION_PISSED = "AbominationPissed",
|
|
5
5
|
ABOMINATION_READY = "AbominationReady",
|
|
6
6
|
ABOMINATION_WAR_CRY = "AbominationWarcry",
|
|
7
|
-
AXE_MEDIUM_CHOP_WOOD = "AxeMediumChopWood"
|
|
7
|
+
AXE_MEDIUM_CHOP_WOOD = "AxeMediumChopWood",
|
|
8
|
+
IMPALE = "Impale",
|
|
9
|
+
IMPALE_HIT = "ImpaleHit",
|
|
10
|
+
IMPALE_LAND = "ImpaleLand",
|
|
11
|
+
IMPALE_CAST = "ImpaleCast"
|
|
8
12
|
}
|
|
@@ -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
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityType, AbilityTypeId } from "../ability-type";
|
|
3
|
+
import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
|
|
4
|
+
export declare class MineAbilityType extends AbilityType {
|
|
5
|
+
static readonly BASE_ID: AbilityTypeId;
|
|
6
|
+
get activationDelay(): number[];
|
|
7
|
+
set activationDelay(activationDelay: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
|
+
get invisibilityDelay(): number[];
|
|
9
|
+
set invisibilityDelay(invisibilityDelay: 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.MineAbilityType = __TS__Class()
|
|
9
|
+
local MineAbilityType = ____exports.MineAbilityType
|
|
10
|
+
MineAbilityType.name = "MineAbilityType"
|
|
11
|
+
__TS__ClassExtends(MineAbilityType, AbilityType)
|
|
12
|
+
MineAbilityType.BASE_ID = fourCC("Amin")
|
|
13
|
+
__TS__SetDescriptor(
|
|
14
|
+
MineAbilityType.prototype,
|
|
15
|
+
"activationDelay",
|
|
16
|
+
{
|
|
17
|
+
get = function(self)
|
|
18
|
+
return self:getNumberLevelField("Min1")
|
|
19
|
+
end,
|
|
20
|
+
set = function(self, activationDelay)
|
|
21
|
+
self:setNumberLevelField("Min1", activationDelay)
|
|
22
|
+
end
|
|
23
|
+
},
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
__TS__SetDescriptor(
|
|
27
|
+
MineAbilityType.prototype,
|
|
28
|
+
"invisibilityDelay",
|
|
29
|
+
{
|
|
30
|
+
get = function(self)
|
|
31
|
+
return self:getNumberLevelField("Min2")
|
|
32
|
+
end,
|
|
33
|
+
set = function(self, invisibilityDelay)
|
|
34
|
+
self:setNumberLevelField("Min2", invisibilityDelay)
|
|
35
|
+
end
|
|
36
|
+
},
|
|
37
|
+
true
|
|
38
|
+
)
|
|
39
|
+
return ____exports
|
|
@@ -7,8 +7,8 @@ export declare class SpiritTouchAbilityType extends AbilityType {
|
|
|
7
7
|
set manaGain(manaGain: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
8
|
get manaRequirement(): number[];
|
|
9
9
|
set manaRequirement(manaRequirement: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
10
|
-
get maximumTargetCount(): number[];
|
|
11
|
-
set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
12
10
|
get maximumManaCostFactor(): number[];
|
|
13
11
|
set maximumManaCostFactor(maximumManaCostFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
12
|
+
get maximumTargetCount(): number[];
|
|
13
|
+
set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
14
14
|
}
|
|
@@ -38,26 +38,26 @@ __TS__SetDescriptor(
|
|
|
38
38
|
)
|
|
39
39
|
__TS__SetDescriptor(
|
|
40
40
|
SpiritTouchAbilityType.prototype,
|
|
41
|
-
"
|
|
41
|
+
"maximumManaCostFactor",
|
|
42
42
|
{
|
|
43
43
|
get = function(self)
|
|
44
44
|
return self:getNumberLevelField("Rpb5")
|
|
45
45
|
end,
|
|
46
|
-
set = function(self,
|
|
47
|
-
self:setNumberLevelField("Rpb5",
|
|
46
|
+
set = function(self, maximumManaCostFactor)
|
|
47
|
+
self:setNumberLevelField("Rpb5", maximumManaCostFactor)
|
|
48
48
|
end
|
|
49
49
|
},
|
|
50
50
|
true
|
|
51
51
|
)
|
|
52
52
|
__TS__SetDescriptor(
|
|
53
53
|
SpiritTouchAbilityType.prototype,
|
|
54
|
-
"
|
|
54
|
+
"maximumTargetCount",
|
|
55
55
|
{
|
|
56
56
|
get = function(self)
|
|
57
57
|
return self:getNumberLevelField("Rpb6")
|
|
58
58
|
end,
|
|
59
|
-
set = function(self,
|
|
60
|
-
self:setNumberLevelField("Rpb6",
|
|
59
|
+
set = function(self, maximumTargetCount)
|
|
60
|
+
self:setNumberLevelField("Rpb6", maximumTargetCount)
|
|
61
61
|
end
|
|
62
62
|
},
|
|
63
63
|
true
|
|
@@ -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)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="warpack-types/warpack" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { ArmorSoundType } from "../auxiliary/armor-sound-type";
|
|
4
3
|
import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
|
|
@@ -46,4 +45,16 @@ export declare class ItemType extends ObjectDataEntry<ItemTypeId> {
|
|
|
46
45
|
set tooltipText(tooltipText: string);
|
|
47
46
|
get tooltipExtendedText(): string;
|
|
48
47
|
set tooltipExtendedText(tooltipText: string);
|
|
48
|
+
get goldCost(): number;
|
|
49
|
+
set goldCost(goldCost: number);
|
|
50
|
+
get lumberCost(): number;
|
|
51
|
+
set lumberCost(lumberCost: number);
|
|
52
|
+
get activelyUsed(): boolean;
|
|
53
|
+
set activelyUsed(activelyUsed: boolean);
|
|
54
|
+
get perishable(): boolean;
|
|
55
|
+
set perishable(perishable: boolean);
|
|
56
|
+
get initialStackSize(): number;
|
|
57
|
+
set initialStackSize(initialStackSize: number);
|
|
58
|
+
get maximumStackSize(): number;
|
|
59
|
+
set maximumStackSize(maximumStackSize: number);
|
|
49
60
|
}
|
|
@@ -256,4 +256,82 @@ __TS__SetDescriptor(
|
|
|
256
256
|
},
|
|
257
257
|
true
|
|
258
258
|
)
|
|
259
|
+
__TS__SetDescriptor(
|
|
260
|
+
ItemType.prototype,
|
|
261
|
+
"goldCost",
|
|
262
|
+
{
|
|
263
|
+
get = function(self)
|
|
264
|
+
return self:getNumberField("igol")
|
|
265
|
+
end,
|
|
266
|
+
set = function(self, goldCost)
|
|
267
|
+
self:setNumberField("igol", goldCost)
|
|
268
|
+
end
|
|
269
|
+
},
|
|
270
|
+
true
|
|
271
|
+
)
|
|
272
|
+
__TS__SetDescriptor(
|
|
273
|
+
ItemType.prototype,
|
|
274
|
+
"lumberCost",
|
|
275
|
+
{
|
|
276
|
+
get = function(self)
|
|
277
|
+
return self:getNumberField("ilum")
|
|
278
|
+
end,
|
|
279
|
+
set = function(self, lumberCost)
|
|
280
|
+
self:setNumberField("ilum", lumberCost)
|
|
281
|
+
end
|
|
282
|
+
},
|
|
283
|
+
true
|
|
284
|
+
)
|
|
285
|
+
__TS__SetDescriptor(
|
|
286
|
+
ItemType.prototype,
|
|
287
|
+
"activelyUsed",
|
|
288
|
+
{
|
|
289
|
+
get = function(self)
|
|
290
|
+
return self:getBooleanField("iusa")
|
|
291
|
+
end,
|
|
292
|
+
set = function(self, activelyUsed)
|
|
293
|
+
self:setBooleanField("iusa", activelyUsed)
|
|
294
|
+
end
|
|
295
|
+
},
|
|
296
|
+
true
|
|
297
|
+
)
|
|
298
|
+
__TS__SetDescriptor(
|
|
299
|
+
ItemType.prototype,
|
|
300
|
+
"perishable",
|
|
301
|
+
{
|
|
302
|
+
get = function(self)
|
|
303
|
+
return self:getBooleanField("iper")
|
|
304
|
+
end,
|
|
305
|
+
set = function(self, perishable)
|
|
306
|
+
self:setBooleanField("iper", perishable)
|
|
307
|
+
end
|
|
308
|
+
},
|
|
309
|
+
true
|
|
310
|
+
)
|
|
311
|
+
__TS__SetDescriptor(
|
|
312
|
+
ItemType.prototype,
|
|
313
|
+
"initialStackSize",
|
|
314
|
+
{
|
|
315
|
+
get = function(self)
|
|
316
|
+
return self:getNumberField("iuse")
|
|
317
|
+
end,
|
|
318
|
+
set = function(self, initialStackSize)
|
|
319
|
+
self:setNumberField("iuse", initialStackSize)
|
|
320
|
+
end
|
|
321
|
+
},
|
|
322
|
+
true
|
|
323
|
+
)
|
|
324
|
+
__TS__SetDescriptor(
|
|
325
|
+
ItemType.prototype,
|
|
326
|
+
"maximumStackSize",
|
|
327
|
+
{
|
|
328
|
+
get = function(self)
|
|
329
|
+
return self:getNumberField("ista")
|
|
330
|
+
end,
|
|
331
|
+
set = function(self, maximumStackSize)
|
|
332
|
+
self:setNumberField("ista", maximumStackSize)
|
|
333
|
+
end
|
|
334
|
+
},
|
|
335
|
+
true
|
|
336
|
+
)
|
|
259
337
|
return ____exports
|