warscript 0.0.1-dev.2af030d → 0.0.1-dev.38157d0
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/frame.d.ts +4 -1
- package/core/types/frame.lua +22 -1
- package/core/types/group.d.ts +0 -1
- 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/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- 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/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.lua +4 -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 +8 -1
- package/engine/behaviour/ability.lua +62 -0
- 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 +62 -20
- package/engine/buff.lua +247 -72
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/unit/bonus.d.ts +9 -8
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit.d.ts +18 -5
- package/engine/internal/unit.lua +97 -33
- 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/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/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/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 +0 -1
- 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-field/ability.d.ts +18 -1
- package/engine/object-field/ability.lua +50 -0
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +18 -0
- package/engine/standard/entries/unit-type.lua +18 -0
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- package/engine/unit.lua +9 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- 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/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 +3 -4
- package/utility/bit-set.d.ts +0 -2
- 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
|
@@ -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;
|
|
@@ -68,6 +68,16 @@ declare const modifiers: {
|
|
|
68
68
|
speed: (unit: junit, value: number) => void;
|
|
69
69
|
armor: (unit: junit, value: number) => void;
|
|
70
70
|
};
|
|
71
|
+
export interface UnitItems extends Array<Item | undefined> {
|
|
72
|
+
readonly length: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
73
|
+
}
|
|
74
|
+
export declare class UnitItems {
|
|
75
|
+
private readonly handle;
|
|
76
|
+
constructor(handle: junit);
|
|
77
|
+
protected __newindex(slot: number, item: Item | undefined): void;
|
|
78
|
+
protected __index(slot: number): Item | undefined;
|
|
79
|
+
protected __len(): number;
|
|
80
|
+
}
|
|
71
81
|
export declare class UnitWeapon {
|
|
72
82
|
readonly unit: Unit;
|
|
73
83
|
readonly index: 0 | 1;
|
|
@@ -228,7 +238,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
228
238
|
isSelected(player: Player): boolean;
|
|
229
239
|
explode(): void;
|
|
230
240
|
kill(): void;
|
|
231
|
-
revive(
|
|
241
|
+
revive(x: number, y: number, doEffect?: boolean): void;
|
|
232
242
|
healTarget(target: Widget, amount: number): void;
|
|
233
243
|
useItem(item: Item): boolean;
|
|
234
244
|
issueImmediateOrder(order: number): boolean;
|
|
@@ -241,6 +251,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
241
251
|
dropItemTarget(item: Item, target: Widget): boolean;
|
|
242
252
|
dropItemSlot(item: Item, slot: number): boolean;
|
|
243
253
|
itemInSlot(slot: number): Item | null;
|
|
254
|
+
get items(): UnitItems;
|
|
244
255
|
addAbility(abilityId: number): UnitAbility | null;
|
|
245
256
|
makeAbilityPermanent(abilityId: number, permanent: true): boolean;
|
|
246
257
|
setAbilityLevel(abilityId: number, level: number): number;
|
|
@@ -249,6 +260,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
249
260
|
getAbilityById(abilityId: number): UnitAbility | undefined;
|
|
250
261
|
removeAbility(abilityId: number): boolean;
|
|
251
262
|
hideAbility(abilityId: number, flag: boolean): void;
|
|
263
|
+
getAbilityRemainingCooldown(abilityId: number): number;
|
|
252
264
|
startAbilityCooldown(abilityId: number, cooldown: number): void;
|
|
253
265
|
endAbilityCooldown(abilityId: number): void;
|
|
254
266
|
interruptAttack(): void;
|
|
@@ -322,9 +334,10 @@ export declare class Unit extends Handle<junit> {
|
|
|
322
334
|
static readonly autoAttackStartEvent: UnitTriggerEvent<[Unit]>;
|
|
323
335
|
static readonly onDamaging: Event<[source: Unit | undefined, target: Unit, event: DamagingEvent]>;
|
|
324
336
|
static readonly onDamage: InitializingEvent<[source: Unit | undefined, target: Unit, event: DamageEvent], jtrigger>;
|
|
325
|
-
static
|
|
326
|
-
static
|
|
327
|
-
static
|
|
337
|
+
static itemDroppedEvent: UnitTriggerEvent<[Item]>;
|
|
338
|
+
static itemPickedUpEvent: UnitTriggerEvent<[Item]>;
|
|
339
|
+
static itemUsedEvent: UnitTriggerEvent<[Item]>;
|
|
340
|
+
static itemStackedEvent: UnitTriggerEvent<[Item]>;
|
|
328
341
|
static get onCreate(): EventDispatcher<[Unit], [Unit]>;
|
|
329
342
|
static get destroyEvent(): EventDispatcher<[Unit], [Unit]>;
|
|
330
343
|
getField(field: junitintegerfield | junitrealfield): number;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -7,11 +7,15 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
8
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
9
9
|
local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
|
|
10
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
11
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
12
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
10
13
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
11
14
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
12
15
|
local Set = ____lualib.Set
|
|
13
16
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
14
17
|
local ____exports = {}
|
|
18
|
+
local unitInventorySize, unitItemInSlot, unitDropItemSlot, unitRemoveItemFromSlot, unitAddItem, isItemPowerup, setItemBooleanField
|
|
15
19
|
local ____handle = require("core.types.handle")
|
|
16
20
|
local Handle = ____handle.Handle
|
|
17
21
|
local ____player = require("core.types.player")
|
|
@@ -279,16 +283,14 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
|
|
|
279
283
|
end
|
|
280
284
|
local function dispatch(event, idGetter, argsGetter)
|
|
281
285
|
local initialized = false
|
|
282
|
-
local x = {}
|
|
283
286
|
return setmetatable(
|
|
284
|
-
|
|
287
|
+
{},
|
|
285
288
|
{
|
|
286
289
|
__index = function(self, id)
|
|
287
290
|
if type(id) ~= "number" then
|
|
288
291
|
return event[id]
|
|
289
292
|
end
|
|
290
293
|
if not initialized then
|
|
291
|
-
local invoke = Event.invoke
|
|
292
294
|
event:addListener(function(...)
|
|
293
295
|
local id = idGetter(...)
|
|
294
296
|
local dispatched = rawget(self, id)
|
|
@@ -326,7 +328,6 @@ local function dispatchAbility(event)
|
|
|
326
328
|
return event[id]
|
|
327
329
|
end
|
|
328
330
|
if not initialized then
|
|
329
|
-
local invoke = Event.invoke
|
|
330
331
|
event:addListener(function(unit, ability, ...)
|
|
331
332
|
local dispatched = rawget(self, ability.typeId)
|
|
332
333
|
if dispatched ~= nil then
|
|
@@ -391,6 +392,37 @@ local getters = {
|
|
|
391
392
|
return BlzGetUnitArmor(unit)
|
|
392
393
|
end
|
|
393
394
|
}
|
|
395
|
+
____exports.UnitItems = __TS__Class()
|
|
396
|
+
local UnitItems = ____exports.UnitItems
|
|
397
|
+
UnitItems.name = "UnitItems"
|
|
398
|
+
function UnitItems.prototype.____constructor(self, handle)
|
|
399
|
+
self.handle = handle
|
|
400
|
+
end
|
|
401
|
+
function UnitItems.prototype.__newindex(self, slot, item)
|
|
402
|
+
local handle = self.handle
|
|
403
|
+
if slot < 0 or slot >= unitInventorySize(handle) then
|
|
404
|
+
return
|
|
405
|
+
end
|
|
406
|
+
unitRemoveItemFromSlot(handle, slot)
|
|
407
|
+
if item ~= nil then
|
|
408
|
+
local itemHandle = item.handle
|
|
409
|
+
local isPowerup = isItemPowerup(itemHandle)
|
|
410
|
+
if isPowerup then
|
|
411
|
+
setItemBooleanField(itemHandle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
412
|
+
end
|
|
413
|
+
unitAddItem(handle, itemHandle)
|
|
414
|
+
unitDropItemSlot(handle, itemHandle, slot)
|
|
415
|
+
if isPowerup then
|
|
416
|
+
setItemBooleanField(itemHandle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
function UnitItems.prototype.__index(self, slot)
|
|
421
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
422
|
+
end
|
|
423
|
+
function UnitItems.prototype.__len(self)
|
|
424
|
+
return unitInventorySize(self.handle)
|
|
425
|
+
end
|
|
394
426
|
____exports.UnitWeapon = __TS__Class()
|
|
395
427
|
local UnitWeapon = ____exports.UnitWeapon
|
|
396
428
|
UnitWeapon.name = "UnitWeapon"
|
|
@@ -543,8 +575,13 @@ __TS__SetDescriptor(
|
|
|
543
575
|
},
|
|
544
576
|
true
|
|
545
577
|
)
|
|
546
|
-
|
|
547
|
-
|
|
578
|
+
unitInventorySize = UnitInventorySize
|
|
579
|
+
unitItemInSlot = UnitItemInSlot
|
|
580
|
+
unitDropItemSlot = UnitDropItemSlot
|
|
581
|
+
unitRemoveItemFromSlot = UnitRemoveItemFromSlot
|
|
582
|
+
unitAddItem = UnitAddItem
|
|
583
|
+
isItemPowerup = IsItemPowerup
|
|
584
|
+
setItemBooleanField = BlzSetItemBooleanField
|
|
548
585
|
local getItemAbility = BlzGetItemAbility
|
|
549
586
|
local getUnitAbility = BlzGetUnitAbility
|
|
550
587
|
local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
|
|
@@ -817,8 +854,15 @@ end
|
|
|
817
854
|
function Unit.prototype.kill(self)
|
|
818
855
|
killUnit(self.handle)
|
|
819
856
|
end
|
|
820
|
-
function Unit.prototype.revive(self,
|
|
821
|
-
|
|
857
|
+
function Unit.prototype.revive(self, x, y, doEffect)
|
|
858
|
+
local ____ReviveHero_4 = ReviveHero
|
|
859
|
+
local ____array_3 = __TS__SparseArrayNew(self.handle, x, y)
|
|
860
|
+
local ____doEffect_2 = doEffect
|
|
861
|
+
if ____doEffect_2 == nil then
|
|
862
|
+
____doEffect_2 = false
|
|
863
|
+
end
|
|
864
|
+
__TS__SparseArrayPush(____array_3, ____doEffect_2)
|
|
865
|
+
____ReviveHero_4(__TS__SparseArraySpread(____array_3))
|
|
822
866
|
end
|
|
823
867
|
function Unit.prototype.healTarget(self, target, amount)
|
|
824
868
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -858,7 +902,7 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
858
902
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
859
903
|
end
|
|
860
904
|
function Unit.prototype.itemInSlot(self, slot)
|
|
861
|
-
return Item:of(
|
|
905
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
862
906
|
end
|
|
863
907
|
function Unit.prototype.addAbility(self, abilityId)
|
|
864
908
|
if unitAddAbility(self.handle, abilityId) then
|
|
@@ -914,6 +958,9 @@ end
|
|
|
914
958
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
915
959
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
916
960
|
end
|
|
961
|
+
function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
|
|
962
|
+
return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
|
|
963
|
+
end
|
|
917
964
|
function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
|
|
918
965
|
BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
|
|
919
966
|
end
|
|
@@ -1382,13 +1429,13 @@ __TS__SetDescriptor(
|
|
|
1382
1429
|
end,
|
|
1383
1430
|
set = function(self, isTeamGlowVisible)
|
|
1384
1431
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1385
|
-
local
|
|
1432
|
+
local ____temp_5
|
|
1386
1433
|
if not isTeamGlowVisible then
|
|
1387
|
-
|
|
1434
|
+
____temp_5 = true
|
|
1388
1435
|
else
|
|
1389
|
-
|
|
1436
|
+
____temp_5 = nil
|
|
1390
1437
|
end
|
|
1391
|
-
self[105] =
|
|
1438
|
+
self[105] = ____temp_5
|
|
1392
1439
|
end
|
|
1393
1440
|
},
|
|
1394
1441
|
true
|
|
@@ -1806,6 +1853,16 @@ __TS__SetDescriptor(
|
|
|
1806
1853
|
end},
|
|
1807
1854
|
true
|
|
1808
1855
|
)
|
|
1856
|
+
__TS__SetDescriptor(
|
|
1857
|
+
Unit.prototype,
|
|
1858
|
+
"items",
|
|
1859
|
+
{get = function(self)
|
|
1860
|
+
local items = __TS__New(____exports.UnitItems, self.handle)
|
|
1861
|
+
rawset(self, "items", items)
|
|
1862
|
+
return items
|
|
1863
|
+
end},
|
|
1864
|
+
true
|
|
1865
|
+
)
|
|
1809
1866
|
__TS__SetDescriptor(
|
|
1810
1867
|
Unit.prototype,
|
|
1811
1868
|
"buffIds",
|
|
@@ -2052,7 +2109,6 @@ Unit.onDecay = __TS__New(
|
|
|
2052
2109
|
Unit.onResurrect = __TS__New(
|
|
2053
2110
|
InitializingEvent,
|
|
2054
2111
|
function(event)
|
|
2055
|
-
local invoke = Event.invoke
|
|
2056
2112
|
local dead = setmetatable({}, {__mode = "k"})
|
|
2057
2113
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
2058
2114
|
dead[unit] = true
|
|
@@ -2068,10 +2124,15 @@ Unit.onResurrect = __TS__New(
|
|
|
2068
2124
|
Unit.morphEvent = __TS__New(
|
|
2069
2125
|
InitializingEvent,
|
|
2070
2126
|
function(event)
|
|
2127
|
+
local function ifNotLeft(unit)
|
|
2128
|
+
local handle = unit.handle
|
|
2129
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
|
|
2130
|
+
invoke(event, unit)
|
|
2131
|
+
end
|
|
2132
|
+
end
|
|
2071
2133
|
____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
|
|
2072
2134
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
2073
|
-
|
|
2074
|
-
Timer:run(Event.invoke, event, unit)
|
|
2135
|
+
Timer:run(ifNotLeft, unit)
|
|
2075
2136
|
end
|
|
2076
2137
|
end)
|
|
2077
2138
|
end
|
|
@@ -2109,27 +2170,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
|
|
|
2109
2170
|
Unit.onTargetCast = dispatchId(__TS__New(
|
|
2110
2171
|
InitializingEvent,
|
|
2111
2172
|
function(event)
|
|
2112
|
-
local invoke = Event.invoke
|
|
2113
2173
|
local function listener(unit, id)
|
|
2114
|
-
local
|
|
2174
|
+
local ____GetSpellTargetUnit_result_8
|
|
2115
2175
|
if GetSpellTargetUnit() then
|
|
2116
|
-
|
|
2176
|
+
____GetSpellTargetUnit_result_8 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2117
2177
|
else
|
|
2118
|
-
local
|
|
2178
|
+
local ____GetSpellTargetItem_result_7
|
|
2119
2179
|
if GetSpellTargetItem() then
|
|
2120
|
-
|
|
2180
|
+
____GetSpellTargetItem_result_7 = Item:of(GetSpellTargetItem())
|
|
2121
2181
|
else
|
|
2122
|
-
local
|
|
2182
|
+
local ____GetSpellTargetDestructable_result_6
|
|
2123
2183
|
if GetSpellTargetDestructable() then
|
|
2124
|
-
|
|
2184
|
+
____GetSpellTargetDestructable_result_6 = Destructable:of(GetSpellTargetDestructable())
|
|
2125
2185
|
else
|
|
2126
|
-
|
|
2186
|
+
____GetSpellTargetDestructable_result_6 = nil
|
|
2127
2187
|
end
|
|
2128
|
-
|
|
2188
|
+
____GetSpellTargetItem_result_7 = ____GetSpellTargetDestructable_result_6
|
|
2129
2189
|
end
|
|
2130
|
-
|
|
2190
|
+
____GetSpellTargetUnit_result_8 = ____GetSpellTargetItem_result_7
|
|
2131
2191
|
end
|
|
2132
|
-
local target =
|
|
2192
|
+
local target = ____GetSpellTargetUnit_result_8
|
|
2133
2193
|
if target then
|
|
2134
2194
|
invoke(event, unit, id, target)
|
|
2135
2195
|
end
|
|
@@ -2326,7 +2386,6 @@ Unit.autoAttackStartEvent = __TS__New(
|
|
|
2326
2386
|
)
|
|
2327
2387
|
Unit.onDamaging = (function()
|
|
2328
2388
|
local event = __TS__New(Event)
|
|
2329
|
-
local invoke = Event.invoke
|
|
2330
2389
|
local trigger = CreateTrigger()
|
|
2331
2390
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
|
|
2332
2391
|
TriggerAddCondition(
|
|
@@ -2425,7 +2484,6 @@ end)()
|
|
|
2425
2484
|
Unit.onDamage = __TS__New(
|
|
2426
2485
|
InitializingEvent,
|
|
2427
2486
|
function(event)
|
|
2428
|
-
local invoke = Event.invoke
|
|
2429
2487
|
local trigger = CreateTrigger()
|
|
2430
2488
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
|
|
2431
2489
|
TriggerAddCondition(
|
|
@@ -2441,6 +2499,7 @@ Unit.onDamage = __TS__New(
|
|
|
2441
2499
|
damageType = BlzGetEventDamageType(),
|
|
2442
2500
|
weaponType = BlzGetEventWeaponType(),
|
|
2443
2501
|
isAttack = BlzGetEventIsAttack(),
|
|
2502
|
+
originalAmount = GetEventDamage(),
|
|
2444
2503
|
preventDeath = damageEventPreventDeath
|
|
2445
2504
|
}
|
|
2446
2505
|
local evData = setmetatable(
|
|
@@ -2491,7 +2550,7 @@ Unit.onDamage = __TS__New(
|
|
|
2491
2550
|
DestroyTrigger(trigger)
|
|
2492
2551
|
end
|
|
2493
2552
|
)
|
|
2494
|
-
Unit.
|
|
2553
|
+
Unit.itemDroppedEvent = __TS__New(
|
|
2495
2554
|
____exports.UnitTriggerEvent,
|
|
2496
2555
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2497
2556
|
function()
|
|
@@ -2502,7 +2561,7 @@ Unit.onItemDrop = __TS__New(
|
|
|
2502
2561
|
return IgnoreEvent
|
|
2503
2562
|
end
|
|
2504
2563
|
)
|
|
2505
|
-
Unit.
|
|
2564
|
+
Unit.itemPickedUpEvent = __TS__New(
|
|
2506
2565
|
____exports.UnitTriggerEvent,
|
|
2507
2566
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2508
2567
|
function()
|
|
@@ -2513,10 +2572,15 @@ Unit.onItemPickup = __TS__New(
|
|
|
2513
2572
|
return IgnoreEvent
|
|
2514
2573
|
end
|
|
2515
2574
|
)
|
|
2516
|
-
Unit.
|
|
2575
|
+
Unit.itemUsedEvent = __TS__New(
|
|
2517
2576
|
____exports.UnitTriggerEvent,
|
|
2518
2577
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2519
|
-
function() return ____exports.Unit:of(
|
|
2578
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2579
|
+
)
|
|
2580
|
+
Unit.itemStackedEvent = __TS__New(
|
|
2581
|
+
____exports.UnitTriggerEvent,
|
|
2582
|
+
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2583
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2520
2584
|
)
|
|
2521
2585
|
__TS__ObjectDefineProperty(
|
|
2522
2586
|
Unit,
|
|
@@ -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
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="warpack-types/warpack" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { AttachmentPreset, AttachmentPresetInput } from "./auxiliary/attachment-preset";
|
|
4
3
|
import { MutableKeys } from "../../utility/types";
|
|
@@ -10,8 +9,8 @@ export type ObjectDataEntryConstructor<T extends ObjectDataEntry> = OmitConstruc
|
|
|
10
9
|
export type ObjectDataEntryAbstractConstructor<T extends ObjectDataEntry> = OmitConstructor<typeof ObjectDataEntry> & (abstract new (object: WarObject) => T);
|
|
11
10
|
export type ObjectDataEntryProperties<T extends ObjectDataEntry> = Partial<T[MutableKeys<T>]>;
|
|
12
11
|
export type ObjectDataEntryLevelFieldValueSupplier<ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType> = ValueType | readonly ValueType[] | ((level: number, currentValue: InputValueType) => ValueType);
|
|
13
|
-
export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | Record<string, any
|
|
14
|
-
export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | Record<string, any
|
|
12
|
+
export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType>(supplier: ObjectDataEntryLevelFieldValueSupplier<ValueType, InputValueType>, level: number, currentValue: InputValueType) => ValueType;
|
|
13
|
+
export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | undefined | Record<string, any>, S extends T[]>(supplier: ObjectDataEntryLevelFieldValueSupplier<S>, level: number, currentValue: S) => S;
|
|
15
14
|
export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = ObjectDataEntryId> {
|
|
16
15
|
protected readonly object: WarObject;
|
|
17
16
|
static readonly BASE_ID: ObjectDataEntryId;
|
|
@@ -6,6 +6,9 @@ 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
|
+
import { BuffResistanceType } from "../object-data/auxiliary/buff-resistance-type";
|
|
10
|
+
import { BuffPolarity } from "../object-data/auxiliary/buff-polarity";
|
|
11
|
+
import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
|
|
9
12
|
export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
|
|
10
13
|
protected get instanceClass(): typeof Ability;
|
|
11
14
|
protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
|
|
@@ -107,6 +110,20 @@ export declare class AbilityAbilityTypeIdLevelField extends AbilityObjectDataEnt
|
|
|
107
110
|
}
|
|
108
111
|
export declare class AbilityUnitTypeIdLevelField extends AbilityObjectDataEntryIdLevelField<UnitTypeId> {
|
|
109
112
|
}
|
|
113
|
+
export declare abstract class AbilityEnumLevelField<T extends number> extends AbilityLevelField<T, T, jabilityintegerlevelfield> {
|
|
114
|
+
protected abstract values: ReadonlyNonEmptyLinkedSet<T>;
|
|
115
|
+
protected get defaultValue(): T;
|
|
116
|
+
protected getNativeFieldById(id: number): jabilityintegerlevelfield;
|
|
117
|
+
protected getNativeFieldValue(instance: Ability, level: number): T;
|
|
118
|
+
protected setNativeFieldValue(instance: Ability, level: number, value: T): boolean;
|
|
119
|
+
static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityBooleanLevelField>;
|
|
120
|
+
}
|
|
121
|
+
export declare class AbilityBuffPolarityLevelField extends AbilityEnumLevelField<BuffPolarity> {
|
|
122
|
+
protected values: ReadonlyNonEmptyLinkedSet<BuffPolarity>;
|
|
123
|
+
}
|
|
124
|
+
export declare class AbilityBuffResistanceTypeLevelField extends AbilityEnumLevelField<BuffResistanceType> {
|
|
125
|
+
protected values: ReadonlyNonEmptyLinkedSet<BuffResistanceType>;
|
|
126
|
+
}
|
|
110
127
|
export declare class AbilityCombatClassificationsLevelField extends AbilityLevelField<CombatClassifications, CombatClassifications, jabilityintegerlevelfield> {
|
|
111
128
|
protected get defaultValue(): CombatClassifications;
|
|
112
129
|
protected getNativeFieldById(id: number): jabilityintegerlevelfield;
|
|
@@ -114,4 +131,4 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
|
|
|
114
131
|
protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
|
|
115
132
|
}
|
|
116
133
|
export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
|
|
117
|
-
export declare const resolveCurrentAbilityDependentValue: <ValueType extends
|
|
134
|
+
export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
|