warscript 0.0.1-dev.724bf08 → 0.0.1-dev.7821093
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/types/effect.d.ts +1 -0
- package/core/types/effect.lua +80 -30
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +5 -0
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/emulate-impact.lua +5 -7
- package/engine/behaviour/ability/on-command-impact.lua +7 -0
- package/engine/behaviour/ability.d.ts +8 -2
- package/engine/behaviour/ability.lua +52 -3
- package/engine/buff.d.ts +5 -0
- package/engine/buff.lua +21 -1
- package/engine/internal/ability.d.ts +11 -1
- package/engine/internal/ability.lua +67 -2
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item.d.ts +2 -2
- package/engine/internal/item.lua +56 -25
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- 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 +52 -0
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +17 -0
- 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.lua +6 -12
- package/engine/internal/unit.d.ts +3 -1
- package/engine/internal/unit.lua +63 -13
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +8 -2
- package/engine/lightning.lua +27 -2
- package/engine/object-data/entry/ability-type.lua +8 -12
- package/engine/object-data/entry/item-type.d.ts +2 -0
- package/engine/object-data/entry/item-type.lua +13 -0
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +5 -2
- package/engine/object-field/ability.lua +3 -0
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +4 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +2 -2
package/engine/internal/unit.lua
CHANGED
|
@@ -51,6 +51,8 @@ local ____arrays = require("utility.arrays")
|
|
|
51
51
|
local forEach = ____arrays.forEach
|
|
52
52
|
local ____math = require("math")
|
|
53
53
|
local min = ____math.min
|
|
54
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
54
56
|
local match = string.match
|
|
55
57
|
local ____tostring = _G.tostring
|
|
56
58
|
local setUnitAnimation = SetUnitAnimation
|
|
@@ -75,6 +77,7 @@ local setUnitScale = SetUnitScale
|
|
|
75
77
|
local setUnitPosition = SetUnitPosition
|
|
76
78
|
local setUnitTimeScale = SetUnitTimeScale
|
|
77
79
|
local getHandleId = GetHandleId
|
|
80
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
78
81
|
local createUnit = CreateUnit
|
|
79
82
|
local killUnit = KillUnit
|
|
80
83
|
local setUnitExploded = SetUnitExploded
|
|
@@ -929,8 +932,15 @@ function Unit.prototype.interruptAttack(self)
|
|
|
929
932
|
unitInterruptAttack(self.handle)
|
|
930
933
|
end
|
|
931
934
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
932
|
-
|
|
933
|
-
unitDisableAbility(
|
|
935
|
+
local handle = self.handle
|
|
936
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
937
|
+
Timer:run(
|
|
938
|
+
unitDisableAbility,
|
|
939
|
+
handle,
|
|
940
|
+
abilityId,
|
|
941
|
+
false,
|
|
942
|
+
false
|
|
943
|
+
)
|
|
934
944
|
end
|
|
935
945
|
function Unit.prototype.getDistanceTo(self, target)
|
|
936
946
|
local handle = self.handle
|
|
@@ -1195,6 +1205,14 @@ __TS__SetDescriptor(
|
|
|
1195
1205
|
end},
|
|
1196
1206
|
true
|
|
1197
1207
|
)
|
|
1208
|
+
__TS__SetDescriptor(
|
|
1209
|
+
Unit.prototype,
|
|
1210
|
+
"isStunned",
|
|
1211
|
+
{get = function(self)
|
|
1212
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1213
|
+
end},
|
|
1214
|
+
true
|
|
1215
|
+
)
|
|
1198
1216
|
__TS__SetDescriptor(
|
|
1199
1217
|
Unit.prototype,
|
|
1200
1218
|
"combatClassifications",
|
|
@@ -2315,10 +2333,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2315
2333
|
____exports.UnitTriggerEvent,
|
|
2316
2334
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2317
2335
|
function()
|
|
2318
|
-
local
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2336
|
+
local handle = getOrderedUnit()
|
|
2337
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2338
|
+
local unit = ____exports.Unit:of(handle)
|
|
2339
|
+
if unit.state == 1 then
|
|
2340
|
+
return unit, getIssuedOrderId()
|
|
2341
|
+
end
|
|
2322
2342
|
end
|
|
2323
2343
|
return IgnoreEvent
|
|
2324
2344
|
end
|
|
@@ -2509,8 +2529,9 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2509
2529
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2510
2530
|
function()
|
|
2511
2531
|
local unit = getTriggerUnit()
|
|
2512
|
-
|
|
2513
|
-
|
|
2532
|
+
local item = getManipulatedItem()
|
|
2533
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2534
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2514
2535
|
end
|
|
2515
2536
|
return IgnoreEvent
|
|
2516
2537
|
end
|
|
@@ -2520,8 +2541,9 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2520
2541
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2521
2542
|
function()
|
|
2522
2543
|
local unit = getTriggerUnit()
|
|
2523
|
-
|
|
2524
|
-
|
|
2544
|
+
local item = getManipulatedItem()
|
|
2545
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2546
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2525
2547
|
end
|
|
2526
2548
|
return IgnoreEvent
|
|
2527
2549
|
end
|
|
@@ -2529,7 +2551,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2529
2551
|
Unit.itemUsedEvent = __TS__New(
|
|
2530
2552
|
____exports.UnitTriggerEvent,
|
|
2531
2553
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2532
|
-
function()
|
|
2554
|
+
function()
|
|
2555
|
+
local unit = getTriggerUnit()
|
|
2556
|
+
local item = getManipulatedItem()
|
|
2557
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2558
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2559
|
+
end
|
|
2560
|
+
return IgnoreEvent
|
|
2561
|
+
end
|
|
2533
2562
|
)
|
|
2534
2563
|
Unit.itemStackedEvent = __TS__New(
|
|
2535
2564
|
____exports.UnitTriggerEvent,
|
|
@@ -2538,7 +2567,28 @@ Unit.itemStackedEvent = __TS__New(
|
|
|
2538
2567
|
)
|
|
2539
2568
|
__TS__ObjectDefineProperty(
|
|
2540
2569
|
Unit,
|
|
2541
|
-
"
|
|
2570
|
+
"itemUseOrderEvent",
|
|
2571
|
+
{get = function(self)
|
|
2572
|
+
local event = __TS__New(Event)
|
|
2573
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2574
|
+
local slot = order - orderId("useslot0")
|
|
2575
|
+
local function listener(unit)
|
|
2576
|
+
local item = unit.items[slot + 1]
|
|
2577
|
+
if item ~= nil then
|
|
2578
|
+
invoke(event, unit, item)
|
|
2579
|
+
end
|
|
2580
|
+
end
|
|
2581
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2582
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2583
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2584
|
+
end
|
|
2585
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2586
|
+
return event
|
|
2587
|
+
end}
|
|
2588
|
+
)
|
|
2589
|
+
__TS__ObjectDefineProperty(
|
|
2590
|
+
Unit,
|
|
2591
|
+
"itemMoveOrderEvent",
|
|
2542
2592
|
{get = function(self)
|
|
2543
2593
|
local event = __TS__New(Event)
|
|
2544
2594
|
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
@@ -2556,7 +2606,7 @@ __TS__ObjectDefineProperty(
|
|
|
2556
2606
|
end
|
|
2557
2607
|
end)
|
|
2558
2608
|
end
|
|
2559
|
-
rawset(self, "
|
|
2609
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2560
2610
|
return event
|
|
2561
2611
|
end}
|
|
2562
2612
|
)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local getUnitAbility = BlzGetUnitAbility
|
|
3
3
|
local unitAddAbility = UnitAddAbility
|
|
4
|
+
local unitInventorySize = UnitInventorySize
|
|
5
|
+
local unitItemInSlot = UnitItemInSlot
|
|
4
6
|
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
5
7
|
---
|
|
6
8
|
-- @internal For use by internal systems only.
|
|
@@ -10,4 +12,14 @@ ____exports.addInternalAbility = function(unit, abilityTypeId)
|
|
|
10
12
|
end
|
|
11
13
|
return getUnitAbility(unit, abilityTypeId)
|
|
12
14
|
end
|
|
15
|
+
---
|
|
16
|
+
-- @internal For use by internal systems only.
|
|
17
|
+
____exports.findUnitItemSlot = function(unit, item)
|
|
18
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
19
|
+
if item == unitItemInSlot(unit, slot) then
|
|
20
|
+
return slot
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
13
25
|
return ____exports
|
package/engine/lightning.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ declare const enum LightningPropertyKey {
|
|
|
12
12
|
TARGET_X = 106,
|
|
13
13
|
TARGET_Y = 107,
|
|
14
14
|
TARGET_Z = 108,
|
|
15
|
-
DURATION = 109
|
|
15
|
+
DURATION = 109,
|
|
16
|
+
FADING = 110
|
|
16
17
|
}
|
|
17
18
|
export type LightningConstructor<T extends Lightning> = typeof Lightning & (new (handle: jlightning, typeId: LightningTypeId) => T);
|
|
18
19
|
export declare class Lightning extends Handle<jlightning> {
|
|
@@ -27,6 +28,7 @@ export declare class Lightning extends Handle<jlightning> {
|
|
|
27
28
|
private [LightningPropertyKey.TARGET_Y]?;
|
|
28
29
|
private [LightningPropertyKey.TARGET_Z]?;
|
|
29
30
|
private [LightningPropertyKey.DURATION]?;
|
|
31
|
+
private [LightningPropertyKey.FADING]?;
|
|
30
32
|
constructor(handle: jlightning, typeId: LightningTypeId);
|
|
31
33
|
protected onDestroy(): HandleDestructor;
|
|
32
34
|
static create<T extends Lightning>(this: LightningConstructor<T>, typeId: LightningTypeId, ...parameters: [
|
|
@@ -46,6 +48,10 @@ export declare class Lightning extends Handle<jlightning> {
|
|
|
46
48
|
target: Unit
|
|
47
49
|
]
|
|
48
50
|
]): T;
|
|
49
|
-
static flash(...parameters: [
|
|
51
|
+
static flash(...parameters: [
|
|
52
|
+
...parameters: Parameters<(typeof Lightning)["create"]>,
|
|
53
|
+
duration: number,
|
|
54
|
+
fading?: boolean
|
|
55
|
+
]): void;
|
|
50
56
|
}
|
|
51
57
|
export {};
|
package/engine/lightning.lua
CHANGED
|
@@ -27,6 +27,11 @@ local getUnitZ = BlzGetUnitZ
|
|
|
27
27
|
local getUnitFlyHeight = GetUnitFlyHeight
|
|
28
28
|
local getLocationZ = GetLocationZ
|
|
29
29
|
local moveLocation = MoveLocation
|
|
30
|
+
local getLightningColorA = GetLightningColorA
|
|
31
|
+
local getLightningColorR = GetLightningColorR
|
|
32
|
+
local getLightningColorG = GetLightningColorG
|
|
33
|
+
local getLightningColorB = GetLightningColorB
|
|
34
|
+
local setLightningColor = SetLightningColor
|
|
30
35
|
local location = Location(0, 0)
|
|
31
36
|
local unitToUnitLightnings = setmetatable({}, {__mode = "k"})
|
|
32
37
|
local unitToPointLightnings = setmetatable({}, {__mode = "k"})
|
|
@@ -225,9 +230,19 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
225
230
|
return lightning
|
|
226
231
|
end
|
|
227
232
|
function Lightning.flash(self, ...)
|
|
228
|
-
local
|
|
233
|
+
local parameterOrDuration, durationOrFading = select(-2, ...)
|
|
234
|
+
local hasFading = ____type(durationOrFading) ~= "number"
|
|
235
|
+
local parametersToForwardCount = select("#", ...) - (hasFading and 2 or 1)
|
|
229
236
|
local lightning = forwardByN[parametersToForwardCount](____exports.Lightning.create, self, ...)
|
|
230
|
-
local duration
|
|
237
|
+
local duration
|
|
238
|
+
if hasFading then
|
|
239
|
+
duration = parameterOrDuration
|
|
240
|
+
if durationOrFading then
|
|
241
|
+
lightning[110] = true
|
|
242
|
+
end
|
|
243
|
+
else
|
|
244
|
+
duration = durationOrFading
|
|
245
|
+
end
|
|
231
246
|
lightning[109] = duration
|
|
232
247
|
temporaryLightningsCount = temporaryLightningsCount + 1
|
|
233
248
|
temporaryLightnings[temporaryLightningsCount] = lightning
|
|
@@ -295,6 +310,16 @@ Timer.onPeriod[UPDATE_PERIOD]:addListener(function()
|
|
|
295
310
|
temporaryLightnings[temporaryLightningsCount] = nil
|
|
296
311
|
temporaryLightningsCount = temporaryLightningsCount - 1
|
|
297
312
|
else
|
|
313
|
+
if lightning[110] then
|
|
314
|
+
local handle = lightning.handle
|
|
315
|
+
setLightningColor(
|
|
316
|
+
handle,
|
|
317
|
+
getLightningColorR(handle),
|
|
318
|
+
getLightningColorG(handle),
|
|
319
|
+
getLightningColorB(handle),
|
|
320
|
+
getLightningColorA(handle) * (1 - UPDATE_PERIOD / duration)
|
|
321
|
+
)
|
|
322
|
+
end
|
|
298
323
|
lightning[109] = duration - UPDATE_PERIOD
|
|
299
324
|
i = i + 1
|
|
300
325
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
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__New = ____lualib.__TS__New
|
|
5
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
5
|
local ____exports = {}
|
|
7
6
|
local ____unit = require("engine.internal.unit")
|
|
@@ -31,7 +30,7 @@ local ____entry = require("engine.object-data.entry")
|
|
|
31
30
|
local extractObjectDataEntryLevelFieldValue = ____entry.extractObjectDataEntryLevelFieldValue
|
|
32
31
|
local ObjectDataEntry = ____entry.ObjectDataEntry
|
|
33
32
|
local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.utility.object-data-entry-id-generator")
|
|
34
|
-
local
|
|
33
|
+
local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilityTypeIdGenerator
|
|
35
34
|
local ____upgrade = require("engine.object-data.entry.upgrade")
|
|
36
35
|
local Upgrade = ____upgrade.Upgrade
|
|
37
36
|
local castAnimationFQNByAbilityTypeId = {}
|
|
@@ -53,10 +52,7 @@ end
|
|
|
53
52
|
function AbilityType.getObjectData(self, map)
|
|
54
53
|
return map.objects.ability
|
|
55
54
|
end
|
|
56
|
-
AbilityType.idGenerator =
|
|
57
|
-
ObjectDataEntryIdGenerator,
|
|
58
|
-
fourCC("A000")
|
|
59
|
-
)
|
|
55
|
+
AbilityType.idGenerator = abilityTypeIdGenerator
|
|
60
56
|
__TS__SetDescriptor(
|
|
61
57
|
AbilityType.prototype,
|
|
62
58
|
"channelingAnimation",
|
|
@@ -999,7 +995,7 @@ local function handleAbilityCastingStartEvent(caster, ability)
|
|
|
999
995
|
end
|
|
1000
996
|
casterCastingEffectsByCaster[caster] = effects
|
|
1001
997
|
end
|
|
1002
|
-
local function
|
|
998
|
+
local function handleAbilityStopCastingEvent(caster)
|
|
1003
999
|
local effects = casterCastingEffectsByCaster[caster]
|
|
1004
1000
|
if effects ~= nil then
|
|
1005
1001
|
for i = 1, #effects do
|
|
@@ -1010,8 +1006,8 @@ local function handleAbilityStopEvent(caster)
|
|
|
1010
1006
|
end
|
|
1011
1007
|
for abilityTypeId in pairs(casterCastingEffectModelPathsByAbilityTypeId) do
|
|
1012
1008
|
Unit.abilityCastingStartEvent[abilityTypeId]:addListener(4, handleAbilityCastingStartEvent)
|
|
1013
|
-
Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4,
|
|
1014
|
-
Unit.abilityStopEvent[abilityTypeId]:addListener(4,
|
|
1009
|
+
Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
|
|
1010
|
+
Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
|
|
1015
1011
|
end
|
|
1016
1012
|
local casterChannelingEffectModelPathsByAbilityTypeId = postcompile(function()
|
|
1017
1013
|
return mapValues(
|
|
@@ -1042,7 +1038,7 @@ local function handleAbilityChannelingStartEvent(caster, ability)
|
|
|
1042
1038
|
end
|
|
1043
1039
|
casterChannelingEffectsByCaster[caster] = effects
|
|
1044
1040
|
end
|
|
1045
|
-
local function
|
|
1041
|
+
local function handleAbilityStopChannelingEvent(caster)
|
|
1046
1042
|
local effects = casterChannelingEffectsByCaster[caster]
|
|
1047
1043
|
if effects ~= nil then
|
|
1048
1044
|
for i = 1, #effects do
|
|
@@ -1053,7 +1049,7 @@ local function handleAbilityStopEventV2(caster)
|
|
|
1053
1049
|
end
|
|
1054
1050
|
for abilityTypeId in pairs(casterChannelingEffectModelPathsByAbilityTypeId) do
|
|
1055
1051
|
Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityChannelingStartEvent)
|
|
1056
|
-
Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4,
|
|
1057
|
-
Unit.abilityStopEvent[abilityTypeId]:addListener(4,
|
|
1052
|
+
Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
|
|
1053
|
+
Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
|
|
1058
1054
|
end
|
|
1059
1055
|
return ____exports
|
|
@@ -45,6 +45,8 @@ export declare class ItemType extends ObjectDataEntry<ItemTypeId> {
|
|
|
45
45
|
set tooltipText(tooltipText: string);
|
|
46
46
|
get tooltipExtendedText(): string;
|
|
47
47
|
set tooltipExtendedText(tooltipText: string);
|
|
48
|
+
get cooldownGroupId(): number;
|
|
49
|
+
set cooldownGroupId(cooldownGroupId: number);
|
|
48
50
|
get goldCost(): number;
|
|
49
51
|
set goldCost(goldCost: number);
|
|
50
52
|
get lumberCost(): number;
|
|
@@ -256,6 +256,19 @@ __TS__SetDescriptor(
|
|
|
256
256
|
},
|
|
257
257
|
true
|
|
258
258
|
)
|
|
259
|
+
__TS__SetDescriptor(
|
|
260
|
+
ItemType.prototype,
|
|
261
|
+
"cooldownGroupId",
|
|
262
|
+
{
|
|
263
|
+
get = function(self)
|
|
264
|
+
return self:getObjectDataEntryIdField("icid")
|
|
265
|
+
end,
|
|
266
|
+
set = function(self, cooldownGroupId)
|
|
267
|
+
self:setObjectDataEntryIdField("icid", cooldownGroupId)
|
|
268
|
+
end
|
|
269
|
+
},
|
|
270
|
+
true
|
|
271
|
+
)
|
|
259
272
|
__TS__SetDescriptor(
|
|
260
273
|
ItemType.prototype,
|
|
261
274
|
"goldCost",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
4
|
local ____exports = {}
|
|
4
5
|
local ____preconditions = require("utility.preconditions")
|
|
5
6
|
local checkNotNull = ____preconditions.checkNotNull
|
|
@@ -60,4 +61,10 @@ function ObjectDataEntryIdGenerator.prototype.next(self)
|
|
|
60
61
|
self.id = id
|
|
61
62
|
return id
|
|
62
63
|
end
|
|
64
|
+
---
|
|
65
|
+
-- @internal For use by internal systems only.
|
|
66
|
+
____exports.abilityTypeIdGenerator = __TS__New(
|
|
67
|
+
____exports.ObjectDataEntryIdGenerator,
|
|
68
|
+
fourCC("A000")
|
|
69
|
+
)
|
|
63
70
|
return ____exports
|
|
@@ -45,9 +45,10 @@ export declare class AbilityStringField extends AbilityField<string, jabilitystr
|
|
|
45
45
|
protected setNativeFieldValue(instance: Ability, value: string): boolean;
|
|
46
46
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<AbilityStringField>;
|
|
47
47
|
}
|
|
48
|
-
export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType =
|
|
48
|
+
export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectArrayField<AbilityType, Ability, ValueType, NativeFieldType> {
|
|
49
49
|
protected get instanceClass(): typeof Ability;
|
|
50
50
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
51
|
+
protected hasNativeFieldValue(instance: Ability): boolean;
|
|
51
52
|
}
|
|
52
53
|
export declare class AbilityStringArrayField extends AbilityArrayField<string, jabilitystringlevelfield> {
|
|
53
54
|
protected get defaultValue(): string;
|
|
@@ -130,7 +131,9 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
|
|
|
130
131
|
protected getNativeFieldValue(instance: Ability, level: number): CombatClassifications;
|
|
131
132
|
protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
|
|
132
133
|
}
|
|
133
|
-
export type
|
|
134
|
+
export type ReadonlySubscribableAbilityDependentValue<ValueType extends boolean | number | string> = ValueType | ReadonlyObjectFieldType<AbilityField<ValueType>> | ReadonlyObjectLevelFieldType<AbilityLevelField<ValueType>>;
|
|
135
|
+
export type SubscribableAbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType>;
|
|
136
|
+
export type AbilityDependentValue<ValueType extends boolean | number | string> = SubscribableAbilityDependentValue<ValueType> | ((ability: Ability) => ValueType);
|
|
134
137
|
export declare const resolveCurrentAbilityDependentValue: {
|
|
135
138
|
<ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>): ValueType;
|
|
136
139
|
<ValueType extends boolean | number | string>(ability: Ability, value?: AbilityDependentValue<ValueType>): ValueType | undefined;
|
|
@@ -197,6 +197,9 @@ __TS__ClassExtends(AbilityArrayField, ObjectArrayField)
|
|
|
197
197
|
function AbilityArrayField.prototype.getObjectDataEntryId(self, instance)
|
|
198
198
|
return instance.typeId
|
|
199
199
|
end
|
|
200
|
+
function AbilityArrayField.prototype.hasNativeFieldValue(self, instance)
|
|
201
|
+
return instance:hasField(self.nativeField)
|
|
202
|
+
end
|
|
200
203
|
__TS__SetDescriptor(
|
|
201
204
|
AbilityArrayField.prototype,
|
|
202
205
|
"instanceClass",
|
package/engine/object-field.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEnt
|
|
|
16
16
|
readonly id: ObjectFieldId;
|
|
17
17
|
protected abstract getNativeFieldById(id: number): NativeFieldType;
|
|
18
18
|
protected abstract getObjectDataEntryId(instance: InstanceType): ObjectDataEntryIdType<ObjectDataEntryType>;
|
|
19
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
20
|
+
hasValue(instance: InstanceType): boolean;
|
|
19
21
|
constructor(id: number);
|
|
20
22
|
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number): T & symbol;
|
|
21
23
|
static of<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldAbstractConstructor<T>, id: number): T | undefined;
|
|
@@ -35,7 +37,6 @@ export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> =
|
|
|
35
37
|
type ReadonlyObjectFieldConstructor<T extends ObjectField> = OmitConstructor<typeof ObjectField> & (abstract new (...args: any[]) => ReadonlyObjectFieldType<T>);
|
|
36
38
|
export declare abstract class ObjectField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType, NativeFieldType> {
|
|
37
39
|
protected abstract readonly defaultValue: ValueType;
|
|
38
|
-
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
39
40
|
protected abstract getNativeFieldValue(instance: InstanceType): ValueType;
|
|
40
41
|
protected abstract setNativeFieldValue(instance: InstanceType, value: ValueType): boolean;
|
|
41
42
|
getValue(entry: ObjectDataEntryType | InstanceType): ValueType;
|
|
@@ -71,7 +72,6 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
71
72
|
}
|
|
72
73
|
export declare abstract class ObjectLevelField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType[], NativeFieldType> {
|
|
73
74
|
protected abstract readonly defaultValue: ValueType;
|
|
74
|
-
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
75
75
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
76
76
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|
|
77
77
|
protected abstract getLevelCount(entry: ObjectDataEntryType | InstanceType): number;
|
package/engine/object-field.lua
CHANGED
|
@@ -46,6 +46,10 @@ end
|
|
|
46
46
|
function ObjectFieldBase.prototype.supports(self, instance)
|
|
47
47
|
return __TS__InstanceOf(instance, self.instanceClass)
|
|
48
48
|
end
|
|
49
|
+
function ObjectFieldBase.prototype.hasValue(self, instance)
|
|
50
|
+
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
51
|
+
return defaultValueByObjectDataEntryId ~= nil and defaultValueByObjectDataEntryId[self:getObjectDataEntryId(instance)] ~= nil or self:hasNativeFieldValue(instance)
|
|
52
|
+
end
|
|
49
53
|
function ObjectFieldBase.create(self, id)
|
|
50
54
|
return __TS__New(
|
|
51
55
|
self,
|
package/engine/unit.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import "./internal/unit/ghost-counter";
|
|
|
17
17
|
import "./internal/unit/invulnerability-counter";
|
|
18
18
|
import "./internal/unit/detach-missiles";
|
|
19
19
|
import "./internal/unit/main-selected";
|
|
20
|
+
import "./internal/unit/add-item-to-slot-init";
|
|
20
21
|
import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
|
|
21
22
|
export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
|
|
22
23
|
export * from "./internal/unit+damage";
|
package/engine/unit.lua
CHANGED
|
@@ -17,6 +17,7 @@ require("engine.internal.unit.ghost-counter")
|
|
|
17
17
|
require("engine.internal.unit.invulnerability-counter")
|
|
18
18
|
require("engine.internal.unit.detach-missiles")
|
|
19
19
|
require("engine.internal.unit.main-selected")
|
|
20
|
+
require("engine.internal.unit.add-item-to-slot-init")
|
|
20
21
|
require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
|
|
21
22
|
do
|
|
22
23
|
local ____unit = require("engine.internal.unit")
|
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.7821093",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
25
|
"@warscript/tstl-plugin": "^0.0.4",
|
|
26
26
|
"lua-types": "^2.13.1",
|
|
27
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.1830aad"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|