warscript 0.0.1-dev.83957b1 → 0.0.1-dev.83ffb73
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/timer.d.ts +2 -1
- package/core/types/timer.lua +7 -2
- package/decl/native.d.ts +4 -2
- package/engine/behavior.d.ts +2 -0
- package/engine/behavior.lua +53 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +2 -1
- package/engine/behaviour/ability.lua +7 -16
- package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
- package/engine/behaviour/unit/stun-immunity.lua +43 -27
- package/engine/behaviour/unit.d.ts +12 -1
- package/engine/behaviour/unit.lua +56 -7
- package/engine/buff.d.ts +2 -1
- package/engine/buff.lua +9 -3
- package/engine/internal/ability.lua +8 -2
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/unit/ability.d.ts +30 -0
- package/engine/internal/unit/ability.lua +48 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit.d.ts +3 -3
- package/engine/internal/unit.lua +70 -57
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/entry/ability-type.lua +1 -3
- package/engine/object-data/entry/unit-type.d.ts +11 -2
- package/engine/object-data/entry/unit-type.lua +59 -1
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.d.ts +2 -0
- package/engine/object-field.lua +76 -69
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +175 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +2 -2
- package/utility/functions.d.ts +5 -0
- package/utility/functions.lua +5 -0
- package/utility/lua-maps.d.ts +1 -0
- package/utility/lua-maps.lua +4 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
|
@@ -136,6 +136,36 @@ declare module "../unit" {
|
|
|
136
136
|
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
declare module "../unit" {
|
|
140
|
+
namespace Unit {
|
|
141
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
declare module "../unit" {
|
|
145
|
+
namespace Unit {
|
|
146
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
declare module "../unit" {
|
|
150
|
+
namespace Unit {
|
|
151
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
declare module "../unit" {
|
|
155
|
+
namespace Unit {
|
|
156
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
declare module "../unit" {
|
|
160
|
+
namespace Unit {
|
|
161
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
declare module "../unit" {
|
|
165
|
+
namespace Unit {
|
|
166
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
139
169
|
declare module "../unit" {
|
|
140
170
|
namespace Unit {
|
|
141
171
|
const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
|
|
@@ -359,6 +359,54 @@ rawset(
|
|
|
359
359
|
extractAbilityTypeId
|
|
360
360
|
)
|
|
361
361
|
)
|
|
362
|
+
rawset(
|
|
363
|
+
Unit,
|
|
364
|
+
"abilityWidgetTargetImpactEvent",
|
|
365
|
+
createDispatchingEvent(
|
|
366
|
+
createWidgetTargetEvent(internalAbilityImpactEvent),
|
|
367
|
+
extractAbilityTypeId
|
|
368
|
+
)
|
|
369
|
+
)
|
|
370
|
+
rawset(
|
|
371
|
+
Unit,
|
|
372
|
+
"abilityUnitTargetImpactEvent",
|
|
373
|
+
createDispatchingEvent(
|
|
374
|
+
createUnitTargetEvent(internalAbilityImpactEvent),
|
|
375
|
+
extractAbilityTypeId
|
|
376
|
+
)
|
|
377
|
+
)
|
|
378
|
+
rawset(
|
|
379
|
+
Unit,
|
|
380
|
+
"abilityItemTargetImpactEvent",
|
|
381
|
+
createDispatchingEvent(
|
|
382
|
+
createItemTargetEvent(internalAbilityImpactEvent),
|
|
383
|
+
extractAbilityTypeId
|
|
384
|
+
)
|
|
385
|
+
)
|
|
386
|
+
rawset(
|
|
387
|
+
Unit,
|
|
388
|
+
"abilityDestructibleTargetImpactEvent",
|
|
389
|
+
createDispatchingEvent(
|
|
390
|
+
createDestructibleTargetEvent(internalAbilityImpactEvent),
|
|
391
|
+
extractAbilityTypeId
|
|
392
|
+
)
|
|
393
|
+
)
|
|
394
|
+
rawset(
|
|
395
|
+
Unit,
|
|
396
|
+
"abilityPointTargetImpactEvent",
|
|
397
|
+
createDispatchingEvent(
|
|
398
|
+
createPointTargetEvent(internalAbilityImpactEvent),
|
|
399
|
+
extractAbilityTypeId
|
|
400
|
+
)
|
|
401
|
+
)
|
|
402
|
+
rawset(
|
|
403
|
+
Unit,
|
|
404
|
+
"abilityNoTargetImpactEvent",
|
|
405
|
+
createDispatchingEvent(
|
|
406
|
+
createNoTargetEvent(internalAbilityImpactEvent),
|
|
407
|
+
extractAbilityTypeId
|
|
408
|
+
)
|
|
409
|
+
)
|
|
362
410
|
rawset(
|
|
363
411
|
Unit,
|
|
364
412
|
"abilityChannelingFinishEvent",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Widget } from "../../../core/types/widget";
|
|
3
|
+
export declare const enum OrderType {
|
|
4
|
+
IMMEDIATE = 0,
|
|
5
|
+
POINT = 1,
|
|
6
|
+
TARGET = 2
|
|
7
|
+
}
|
|
8
|
+
declare module "../unit" {
|
|
9
|
+
interface Unit {
|
|
10
|
+
readonly currentOrderType: OrderType;
|
|
11
|
+
readonly currentOrderId: number;
|
|
12
|
+
readonly currentOrderStartTime: number;
|
|
13
|
+
readonly currentOrderStartX: number;
|
|
14
|
+
readonly currentOrderStartY: number;
|
|
15
|
+
readonly currentOrderTargetX: number;
|
|
16
|
+
readonly currentOrderTargetY: number;
|
|
17
|
+
readonly currentOrderTarget?: Widget;
|
|
18
|
+
issueOrder(...order: [orderType: OrderType.IMMEDIATE, orderId: number] | [orderType: OrderType.POINT, orderId: number, x: number, y: number] | [orderType: OrderType.TARGET, orderId: number, target: Widget]): boolean;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____attributes = require("attributes")
|
|
5
|
+
local attribute = ____attributes.attribute
|
|
6
|
+
local ____unit = require("engine.internal.unit")
|
|
7
|
+
local Unit = ____unit.Unit
|
|
8
|
+
local ____game = require("core.game")
|
|
9
|
+
local elapsedTime = ____game.elapsedTime
|
|
10
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
11
|
+
local issueImmediateOrderById = IssueImmediateOrderById
|
|
12
|
+
local issuePointOrderById = IssuePointOrderById
|
|
13
|
+
local issueTargetOrderById = IssueTargetOrderById
|
|
14
|
+
local unitLastOrderTypeAttribute = attribute()
|
|
15
|
+
local unitLastOrderIdAttribute = attribute()
|
|
16
|
+
local unitLastOrderStartTimeAttribute = attribute()
|
|
17
|
+
local unitLastOrderStartXAttribute = attribute()
|
|
18
|
+
local unitLastOrderStartYAttribute = attribute()
|
|
19
|
+
local unitLastOrderTargetXAttribute = attribute()
|
|
20
|
+
local unitLastOrderTargetYAttribute = attribute()
|
|
21
|
+
local unitLastOrderTargetAttribute = attribute()
|
|
22
|
+
Unit.onImmediateOrder:addListener(
|
|
23
|
+
4,
|
|
24
|
+
function(unit, orderId)
|
|
25
|
+
unit[unitLastOrderTypeAttribute] = 0
|
|
26
|
+
unit[unitLastOrderIdAttribute] = orderId
|
|
27
|
+
unit[unitLastOrderStartTimeAttribute] = elapsedTime()
|
|
28
|
+
unit[unitLastOrderStartXAttribute] = unit.x
|
|
29
|
+
unit[unitLastOrderStartYAttribute] = unit.y
|
|
30
|
+
unit[unitLastOrderTargetXAttribute] = nil
|
|
31
|
+
unit[unitLastOrderTargetYAttribute] = nil
|
|
32
|
+
unit[unitLastOrderTargetAttribute] = nil
|
|
33
|
+
end
|
|
34
|
+
)
|
|
35
|
+
Unit.onPointOrder:addListener(
|
|
36
|
+
4,
|
|
37
|
+
function(unit, orderId, x, y)
|
|
38
|
+
unit[unitLastOrderTypeAttribute] = 1
|
|
39
|
+
unit[unitLastOrderIdAttribute] = orderId
|
|
40
|
+
unit[unitLastOrderStartTimeAttribute] = elapsedTime()
|
|
41
|
+
unit[unitLastOrderStartXAttribute] = unit.x
|
|
42
|
+
unit[unitLastOrderStartYAttribute] = unit.y
|
|
43
|
+
unit[unitLastOrderTargetXAttribute] = x
|
|
44
|
+
unit[unitLastOrderTargetYAttribute] = y
|
|
45
|
+
unit[unitLastOrderTargetAttribute] = nil
|
|
46
|
+
end
|
|
47
|
+
)
|
|
48
|
+
Unit.onTargetOrder:addListener(
|
|
49
|
+
4,
|
|
50
|
+
function(unit, orderId, target)
|
|
51
|
+
unit[unitLastOrderTypeAttribute] = 2
|
|
52
|
+
unit[unitLastOrderIdAttribute] = orderId
|
|
53
|
+
unit[unitLastOrderStartTimeAttribute] = elapsedTime()
|
|
54
|
+
unit[unitLastOrderStartXAttribute] = unit.x
|
|
55
|
+
unit[unitLastOrderStartYAttribute] = unit.y
|
|
56
|
+
unit[unitLastOrderTargetXAttribute] = target.x
|
|
57
|
+
unit[unitLastOrderTargetYAttribute] = target.y
|
|
58
|
+
unit[unitLastOrderTargetAttribute] = target
|
|
59
|
+
end
|
|
60
|
+
)
|
|
61
|
+
local function toUndefinedIfCurrentOrderDoesNotMatchLast(unit, value)
|
|
62
|
+
local currentOrderId = getUnitCurrentOrder(unit.handle)
|
|
63
|
+
local lastOrderId = unit[unitLastOrderIdAttribute]
|
|
64
|
+
local ____temp_0
|
|
65
|
+
if currentOrderId == lastOrderId or currentOrderId == orderId("patrolAI") and lastOrderId == orderId("patrol") then
|
|
66
|
+
____temp_0 = value
|
|
67
|
+
else
|
|
68
|
+
____temp_0 = nil
|
|
69
|
+
end
|
|
70
|
+
return ____temp_0
|
|
71
|
+
end
|
|
72
|
+
__TS__ObjectDefineProperty(
|
|
73
|
+
Unit.prototype,
|
|
74
|
+
"currentOrderType",
|
|
75
|
+
{get = function(self)
|
|
76
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderTypeAttribute]) or 0
|
|
77
|
+
end}
|
|
78
|
+
)
|
|
79
|
+
__TS__ObjectDefineProperty(
|
|
80
|
+
Unit.prototype,
|
|
81
|
+
"currentOrderId",
|
|
82
|
+
{get = function(self)
|
|
83
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderIdAttribute]) or 0
|
|
84
|
+
end}
|
|
85
|
+
)
|
|
86
|
+
__TS__ObjectDefineProperty(
|
|
87
|
+
Unit.prototype,
|
|
88
|
+
"currentOrderStartTime",
|
|
89
|
+
{get = function(self)
|
|
90
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderStartTimeAttribute]) or 0
|
|
91
|
+
end}
|
|
92
|
+
)
|
|
93
|
+
__TS__ObjectDefineProperty(
|
|
94
|
+
Unit.prototype,
|
|
95
|
+
"currentOrderStartX",
|
|
96
|
+
{get = function(self)
|
|
97
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderStartXAttribute]) or 0
|
|
98
|
+
end}
|
|
99
|
+
)
|
|
100
|
+
__TS__ObjectDefineProperty(
|
|
101
|
+
Unit.prototype,
|
|
102
|
+
"currentOrderStartY",
|
|
103
|
+
{get = function(self)
|
|
104
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderStartYAttribute]) or 0
|
|
105
|
+
end}
|
|
106
|
+
)
|
|
107
|
+
__TS__ObjectDefineProperty(
|
|
108
|
+
Unit.prototype,
|
|
109
|
+
"currentOrderTargetX",
|
|
110
|
+
{get = function(self)
|
|
111
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderTargetXAttribute]) or 0
|
|
112
|
+
end}
|
|
113
|
+
)
|
|
114
|
+
__TS__ObjectDefineProperty(
|
|
115
|
+
Unit.prototype,
|
|
116
|
+
"currentOrderTargetY",
|
|
117
|
+
{get = function(self)
|
|
118
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderTargetYAttribute]) or 0
|
|
119
|
+
end}
|
|
120
|
+
)
|
|
121
|
+
__TS__ObjectDefineProperty(
|
|
122
|
+
Unit.prototype,
|
|
123
|
+
"currentOrderTarget",
|
|
124
|
+
{get = function(self)
|
|
125
|
+
return toUndefinedIfCurrentOrderDoesNotMatchLast(self, self[unitLastOrderTargetAttribute])
|
|
126
|
+
end}
|
|
127
|
+
)
|
|
128
|
+
local issueOrderByType = {
|
|
129
|
+
[0] = issueImmediateOrderById,
|
|
130
|
+
[1] = issuePointOrderById,
|
|
131
|
+
[2] = function(unitHandle, orderId, widget) return issueTargetOrderById(unitHandle, orderId, widget.handle) end
|
|
132
|
+
}
|
|
133
|
+
Unit.prototype.issueOrder = function(self, orderType, orderId, xOrTarget, y)
|
|
134
|
+
return issueOrderByType[orderType](self.handle, orderId, xOrTarget, y)
|
|
135
|
+
end
|
|
136
|
+
return ____exports
|
|
@@ -160,8 +160,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
160
160
|
isInRangeOf(unit: Unit, range: number): boolean;
|
|
161
161
|
isAllyOf(unit: Unit): boolean;
|
|
162
162
|
isEnemyOf(unit: Unit): boolean;
|
|
163
|
-
playAnimation(animation: string, rarity?: jraritycontrol): void;
|
|
164
|
-
playAnimation(animation: number): void;
|
|
163
|
+
playAnimation(...parameters: [animation: number] | [animation: string, rarity?: jraritycontrol]): void;
|
|
165
164
|
resetAnimation(): void;
|
|
166
165
|
queueAnimation(animation: string): void;
|
|
167
166
|
get weapons(): [UnitWeapon, UnitWeapon];
|
|
@@ -267,7 +266,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
267
266
|
dropItemTarget(item: Item, target: Widget): boolean;
|
|
268
267
|
dropItemSlot(item: Item, slot: number): boolean;
|
|
269
268
|
itemInSlot(slot: number): Item | null;
|
|
270
|
-
addAbility(abilityId: number): UnitAbility |
|
|
269
|
+
addAbility(abilityId: number): UnitAbility | undefined;
|
|
271
270
|
makeAbilityPermanent(abilityId: number, permanent: true): boolean;
|
|
272
271
|
setAbilityLevel(abilityId: number, level: number): number;
|
|
273
272
|
getAbilityLevel(abilityId: number): number;
|
|
@@ -278,6 +277,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
278
277
|
getAbilityRemainingCooldown(abilityId: number): number;
|
|
279
278
|
startAbilityCooldown(abilityId: number, cooldown: number): void;
|
|
280
279
|
endAbilityCooldown(abilityId: number): void;
|
|
280
|
+
interruptMovement(): void;
|
|
281
281
|
interruptAttack(): void;
|
|
282
282
|
interruptCast(abilityId: number): void;
|
|
283
283
|
getDistanceTo(target: Unit | Vec2): number;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -60,6 +60,8 @@ local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage
|
|
|
60
60
|
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
61
|
local ____attributes = require("attributes")
|
|
62
62
|
local isAttribute = ____attributes.isAttribute
|
|
63
|
+
local ____ability = require("engine.internal.item.ability")
|
|
64
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
63
65
|
local match = string.match
|
|
64
66
|
local ____tostring = _G.tostring
|
|
65
67
|
local setUnitAnimation = SetUnitAnimation
|
|
@@ -123,10 +125,6 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
123
125
|
local getIssuedOrderId = GetIssuedOrderId
|
|
124
126
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
125
127
|
local unitAlive = UnitAlive
|
|
126
|
-
local unitAddType = UnitAddType
|
|
127
|
-
local unitRemoveType = UnitRemoveType
|
|
128
|
-
local isUnitIllusion = IsUnitIllusion
|
|
129
|
-
local isUnitType = IsUnitType
|
|
130
128
|
local isUnitAlly = IsUnitAlly
|
|
131
129
|
local isUnitEnemy = IsUnitEnemy
|
|
132
130
|
local getOwningPlayer = GetOwningPlayer
|
|
@@ -665,15 +663,24 @@ end
|
|
|
665
663
|
local nextSyncId = 1
|
|
666
664
|
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
667
665
|
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
666
|
+
local function addAbility(unit, abilityTypeId)
|
|
667
|
+
local ____unitAddAbility_result_0
|
|
668
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
669
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
670
|
+
else
|
|
671
|
+
____unitAddAbility_result_0 = nil
|
|
672
|
+
end
|
|
673
|
+
return ____unitAddAbility_result_0
|
|
674
|
+
end
|
|
668
675
|
____exports.Unit = __TS__Class()
|
|
669
676
|
local Unit = ____exports.Unit
|
|
670
677
|
Unit.name = "Unit"
|
|
671
678
|
__TS__ClassExtends(Unit, Handle)
|
|
672
679
|
function Unit.prototype.____constructor(self, handle)
|
|
673
680
|
Handle.prototype.____constructor(self, handle)
|
|
674
|
-
local
|
|
675
|
-
nextSyncId =
|
|
676
|
-
self.syncId =
|
|
681
|
+
local ____nextSyncId_1 = nextSyncId
|
|
682
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
683
|
+
self.syncId = ____nextSyncId_1
|
|
677
684
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
678
685
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
679
686
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -774,17 +781,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
774
781
|
end}
|
|
775
782
|
end
|
|
776
783
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
777
|
-
local
|
|
778
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
784
|
+
local ____combatClassification_2 = combatClassification
|
|
785
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
779
786
|
end
|
|
780
787
|
function Unit.prototype.addClassification(self, classification)
|
|
781
|
-
return
|
|
788
|
+
return UnitAddType(self.handle, classification)
|
|
782
789
|
end
|
|
783
790
|
function Unit.prototype.removeClassification(self, classification)
|
|
784
|
-
return
|
|
791
|
+
return UnitRemoveType(self.handle, classification)
|
|
785
792
|
end
|
|
786
793
|
function Unit.prototype.hasClassification(self, classification)
|
|
787
|
-
return
|
|
794
|
+
return IsUnitType(self.handle, classification)
|
|
788
795
|
end
|
|
789
796
|
function Unit.prototype.isVisibleTo(self, player)
|
|
790
797
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -793,13 +800,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
793
800
|
return isUnitInvisible(self.handle, player.handle)
|
|
794
801
|
end
|
|
795
802
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
796
|
-
local
|
|
803
|
+
local ____temp_3
|
|
797
804
|
if type(x) == "number" then
|
|
798
|
-
|
|
805
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
799
806
|
else
|
|
800
|
-
|
|
807
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
801
808
|
end
|
|
802
|
-
return
|
|
809
|
+
return ____temp_3
|
|
803
810
|
end
|
|
804
811
|
function Unit.prototype.isAllyOf(self, unit)
|
|
805
812
|
return isUnitAlly(
|
|
@@ -855,14 +862,14 @@ function Unit.prototype.kill(self)
|
|
|
855
862
|
killUnit(self.handle)
|
|
856
863
|
end
|
|
857
864
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
858
|
-
local
|
|
859
|
-
local
|
|
860
|
-
local
|
|
861
|
-
if
|
|
862
|
-
|
|
865
|
+
local ____ReviveHero_6 = ReviveHero
|
|
866
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
867
|
+
local ____doEffect_4 = doEffect
|
|
868
|
+
if ____doEffect_4 == nil then
|
|
869
|
+
____doEffect_4 = false
|
|
863
870
|
end
|
|
864
|
-
__TS__SparseArrayPush(
|
|
865
|
-
|
|
871
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
872
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
866
873
|
end
|
|
867
874
|
function Unit.prototype.healTarget(self, target, amount)
|
|
868
875
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -905,17 +912,16 @@ function Unit.prototype.itemInSlot(self, slot)
|
|
|
905
912
|
return Item:of(unitItemInSlot(self.handle, slot))
|
|
906
913
|
end
|
|
907
914
|
function Unit.prototype.addAbility(self, abilityId)
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
915
|
+
local ability = UnitAbility:of(
|
|
916
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
917
|
+
abilityId,
|
|
918
|
+
self
|
|
919
|
+
)
|
|
920
|
+
if ability ~= nil then
|
|
914
921
|
local abilities = self.abilities
|
|
915
922
|
abilities[#abilities + 1] = ability
|
|
916
|
-
return ability
|
|
917
923
|
end
|
|
918
|
-
return
|
|
924
|
+
return ability
|
|
919
925
|
end
|
|
920
926
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
921
927
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -930,19 +936,11 @@ function Unit.prototype.hasAbility(self, abilityId)
|
|
|
930
936
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
931
937
|
end
|
|
932
938
|
function Unit.prototype.getAbilityById(self, abilityId)
|
|
933
|
-
local
|
|
934
|
-
|
|
935
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
936
|
-
return nil
|
|
937
|
-
end
|
|
938
|
-
return UnitAbility:of(
|
|
939
|
-
getUnitAbility(self.handle, abilityId),
|
|
940
|
-
abilityId,
|
|
941
|
-
self
|
|
942
|
-
)
|
|
939
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
940
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
943
941
|
end
|
|
944
942
|
function Unit.prototype.removeAbility(self, abilityId)
|
|
945
|
-
if
|
|
943
|
+
if doUnitAbilityAction(self.handle, abilityId, unitRemoveAbility, abilityId) then
|
|
946
944
|
local abilities = self.abilities
|
|
947
945
|
for i = 1, #abilities do
|
|
948
946
|
if abilities[i].typeId == abilityId then
|
|
@@ -967,6 +965,21 @@ end
|
|
|
967
965
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
968
966
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
969
967
|
end
|
|
968
|
+
function Unit.prototype.interruptMovement(self)
|
|
969
|
+
local handle = self.handle
|
|
970
|
+
unitDisableAbility(
|
|
971
|
+
handle,
|
|
972
|
+
fourCC("Amov"),
|
|
973
|
+
true,
|
|
974
|
+
false
|
|
975
|
+
)
|
|
976
|
+
unitDisableAbility(
|
|
977
|
+
handle,
|
|
978
|
+
fourCC("Amov"),
|
|
979
|
+
false,
|
|
980
|
+
false
|
|
981
|
+
)
|
|
982
|
+
end
|
|
970
983
|
function Unit.prototype.interruptAttack(self)
|
|
971
984
|
unitInterruptAttack(self.handle)
|
|
972
985
|
end
|
|
@@ -1240,7 +1253,7 @@ __TS__SetDescriptor(
|
|
|
1240
1253
|
Unit.prototype,
|
|
1241
1254
|
"isIllusion",
|
|
1242
1255
|
{get = function(self)
|
|
1243
|
-
return
|
|
1256
|
+
return IsUnitIllusion(self.handle)
|
|
1244
1257
|
end},
|
|
1245
1258
|
true
|
|
1246
1259
|
)
|
|
@@ -1463,13 +1476,13 @@ __TS__SetDescriptor(
|
|
|
1463
1476
|
end,
|
|
1464
1477
|
set = function(self, isTeamGlowVisible)
|
|
1465
1478
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1466
|
-
local
|
|
1479
|
+
local ____temp_7
|
|
1467
1480
|
if not isTeamGlowVisible then
|
|
1468
|
-
|
|
1481
|
+
____temp_7 = true
|
|
1469
1482
|
else
|
|
1470
|
-
|
|
1483
|
+
____temp_7 = nil
|
|
1471
1484
|
end
|
|
1472
|
-
self[106] =
|
|
1485
|
+
self[106] = ____temp_7
|
|
1473
1486
|
end
|
|
1474
1487
|
},
|
|
1475
1488
|
true
|
|
@@ -2216,25 +2229,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2216
2229
|
InitializingEvent,
|
|
2217
2230
|
function(event)
|
|
2218
2231
|
local function listener(unit, id)
|
|
2219
|
-
local
|
|
2232
|
+
local ____GetSpellTargetUnit_result_10
|
|
2220
2233
|
if GetSpellTargetUnit() then
|
|
2221
|
-
|
|
2234
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2222
2235
|
else
|
|
2223
|
-
local
|
|
2236
|
+
local ____GetSpellTargetItem_result_9
|
|
2224
2237
|
if GetSpellTargetItem() then
|
|
2225
|
-
|
|
2238
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2226
2239
|
else
|
|
2227
|
-
local
|
|
2240
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2228
2241
|
if GetSpellTargetDestructable() then
|
|
2229
|
-
|
|
2242
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2230
2243
|
else
|
|
2231
|
-
|
|
2244
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2232
2245
|
end
|
|
2233
|
-
|
|
2246
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2234
2247
|
end
|
|
2235
|
-
|
|
2248
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2236
2249
|
end
|
|
2237
|
-
local target =
|
|
2250
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2238
2251
|
if target then
|
|
2239
2252
|
invoke(event, unit, id, target)
|
|
2240
2253
|
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____records = require("utility.records")
|
|
3
|
+
local invertRecord = ____records.invertRecord
|
|
4
|
+
local stringByArmorType = {
|
|
5
|
+
[0] = "small",
|
|
6
|
+
[1] = "medium",
|
|
7
|
+
[2] = "large",
|
|
8
|
+
[3] = "fort",
|
|
9
|
+
[4] = "normal",
|
|
10
|
+
[5] = "hero",
|
|
11
|
+
[6] = "divine",
|
|
12
|
+
[7] = "none"
|
|
13
|
+
}
|
|
14
|
+
local armorTypeByString = invertRecord(stringByArmorType)
|
|
15
|
+
local nativeByArmorType = {
|
|
16
|
+
[0] = DEFENSE_TYPE_LIGHT,
|
|
17
|
+
[1] = DEFENSE_TYPE_MEDIUM,
|
|
18
|
+
[2] = DEFENSE_TYPE_LARGE,
|
|
19
|
+
[3] = DEFENSE_TYPE_FORT,
|
|
20
|
+
[4] = DEFENSE_TYPE_NORMAL,
|
|
21
|
+
[5] = DEFENSE_TYPE_HERO,
|
|
22
|
+
[6] = DEFENSE_TYPE_DIVINE,
|
|
23
|
+
[7] = DEFENSE_TYPE_NONE
|
|
24
|
+
}
|
|
25
|
+
local armorTypeByNative = invertRecord(nativeByArmorType)
|
|
26
|
+
---
|
|
27
|
+
-- @internal For use by internal systems only.
|
|
28
|
+
____exports.armorTypeToString = function(armorType)
|
|
29
|
+
return stringByArmorType[armorType]
|
|
30
|
+
end
|
|
31
|
+
---
|
|
32
|
+
-- @internal For use by internal systems only.
|
|
33
|
+
____exports.stringToArmorType = function(____string)
|
|
34
|
+
return armorTypeByString[____string] or 7
|
|
35
|
+
end
|
|
36
|
+
---
|
|
37
|
+
-- @internal For use by internal systems only.
|
|
38
|
+
____exports.armorTypeToNative = function(armorType)
|
|
39
|
+
return nativeByArmorType[armorType]
|
|
40
|
+
end
|
|
41
|
+
---
|
|
42
|
+
-- @internal For use by internal systems only.
|
|
43
|
+
____exports.nativeToArmorType = function(armorType)
|
|
44
|
+
return armorTypeByNative[armorType]
|
|
45
|
+
end
|
|
46
|
+
return ____exports
|
|
@@ -979,9 +979,7 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
|
|
|
979
979
|
4,
|
|
980
980
|
function(caster, ability)
|
|
981
981
|
if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
|
|
982
|
-
Timer:run(
|
|
983
|
-
caster:playAnimation(animationFQN)
|
|
984
|
-
end)
|
|
982
|
+
Timer:run(caster, "playAnimation", animationFQN)
|
|
985
983
|
end
|
|
986
984
|
end
|
|
987
985
|
)
|
|
@@ -13,6 +13,7 @@ import type { AbilityTypeId } from "./ability-type";
|
|
|
13
13
|
import type { UpgradeId } from "./upgrade";
|
|
14
14
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
15
15
|
import { AttackType } from "../auxiliary/attack-type";
|
|
16
|
+
import { ArmorType } from "../auxiliary/armor-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & number & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -144,6 +145,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
144
145
|
set runSpeedSD(runSpeedSD: number);
|
|
145
146
|
get runSpeedHD(): number;
|
|
146
147
|
set runSpeedHD(runSpeedHD: number);
|
|
148
|
+
get selectionCircleHeight(): number;
|
|
149
|
+
set selectionCircleHeight(height: number);
|
|
147
150
|
get selectionCircleScale(): number;
|
|
148
151
|
set selectionCircleScale(selectionCircleScale: number);
|
|
149
152
|
get selectionCircleScaleSD(): number;
|
|
@@ -182,16 +185,20 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
182
185
|
set walkSpeedSD(walkSpeedSD: number);
|
|
183
186
|
get walkSpeedHD(): number;
|
|
184
187
|
set walkSpeedHD(walkSpeedHD: number);
|
|
188
|
+
get armor(): number;
|
|
189
|
+
set armor(armor: number);
|
|
185
190
|
get armorSoundType(): ArmorSoundType;
|
|
186
191
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
187
192
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
188
193
|
set armorSoundTypeSD(armorSoundTypeSD: ArmorSoundType);
|
|
189
194
|
get armorSoundTypeHD(): ArmorSoundType;
|
|
190
195
|
set armorSoundTypeHD(armorSoundTypeHD: ArmorSoundType);
|
|
196
|
+
get armorType(): ArmorType;
|
|
197
|
+
set armorType(armorType: ArmorType);
|
|
191
198
|
get combatClassifications(): CombatClassifications;
|
|
192
199
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
193
|
-
get
|
|
194
|
-
set
|
|
200
|
+
get classifications(): UnitClassifications;
|
|
201
|
+
set classifications(unitClassifications: UnitClassifications);
|
|
195
202
|
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
196
203
|
get firstWeapon(): UnitTypeWeapon;
|
|
197
204
|
get secondWeapon(): UnitTypeWeapon;
|
|
@@ -225,6 +232,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
225
232
|
set goldCost(goldCost: number);
|
|
226
233
|
get healthRegenerationRate(): number;
|
|
227
234
|
set healthRegenerationRate(healthRegenerationRate: number);
|
|
235
|
+
get level(): number;
|
|
236
|
+
set level(level: number);
|
|
228
237
|
get manaRegenerationRate(): number;
|
|
229
238
|
set manaRegenerationRate(manaRegenerationRate: number);
|
|
230
239
|
get maximumHealth(): number;
|