warscript 0.0.1-dev.6f7008d → 0.0.1-dev.6fc443a
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/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/tileCell.d.ts +2 -1
- package/core/types/tileCell.lua +5 -0
- package/engine/behavior.d.ts +7 -1
- package/engine/behavior.lua +88 -65
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +6 -4
- package/engine/behaviour/unit/stun-immunity.lua +1 -1
- package/engine/behaviour/unit.d.ts +6 -3
- package/engine/behaviour/unit.lua +87 -22
- package/engine/buff.d.ts +10 -1
- package/engine/buff.lua +60 -7
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit-missile-launch.lua +4 -1
- package/engine/internal/unit.d.ts +11 -10
- package/engine/internal/unit.lua +63 -54
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-field/unit.d.ts +13 -1
- package/engine/object-field/unit.lua +57 -0
- package/engine/object-field.d.ts +7 -1
- package/engine/object-field.lua +199 -112
- package/engine/standard/fields/unit.d.ts +3 -1
- package/engine/standard/fields/unit.lua +4 -0
- package/engine/text-tag.lua +2 -1
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/package.json +1 -1
|
@@ -22,35 +22,53 @@ local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
|
22
22
|
local getUnitBonus = ____bonus.getUnitBonus
|
|
23
23
|
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
24
24
|
local safeCall = warpack.safeCall
|
|
25
|
-
local
|
|
26
|
-
local
|
|
27
|
-
local
|
|
28
|
-
local
|
|
25
|
+
local createBehaviorFunctionsByUnitTypeId = {}
|
|
26
|
+
local behaviorsByOwningPlayerEvent = {}
|
|
27
|
+
local listenerByBehaviorByOwningPlayerEvent = {}
|
|
28
|
+
local owningPlayerEventsByBehavior = {}
|
|
29
|
+
local behaviorsByInRangeUnitEvent = {}
|
|
30
|
+
local rangeByBehaviorByInRangeUnitEvent = {}
|
|
31
|
+
local listenerByBehaviorByInRangeUnitEvent = {}
|
|
32
|
+
local inRangeUnitEventsByBehavior = {}
|
|
29
33
|
____exports.UnitBehavior = __TS__Class()
|
|
30
34
|
local UnitBehavior = ____exports.UnitBehavior
|
|
31
35
|
UnitBehavior.name = "UnitBehavior"
|
|
32
36
|
__TS__ClassExtends(UnitBehavior, Behavior)
|
|
33
|
-
function UnitBehavior.prototype.____constructor(self, unit)
|
|
34
|
-
Behavior.prototype.____constructor(self, unit)
|
|
37
|
+
function UnitBehavior.prototype.____constructor(self, unit, priority)
|
|
38
|
+
Behavior.prototype.____constructor(self, unit, priority)
|
|
35
39
|
end
|
|
36
40
|
function UnitBehavior.prototype.onDestroy(self)
|
|
37
|
-
local
|
|
38
|
-
if
|
|
39
|
-
for event in pairs(
|
|
40
|
-
local ____opt_0 =
|
|
41
|
+
local owningPlayerEvents = owningPlayerEventsByBehavior[self]
|
|
42
|
+
if owningPlayerEvents ~= nil then
|
|
43
|
+
for event in pairs(owningPlayerEvents) do
|
|
44
|
+
local ____opt_0 = behaviorsByOwningPlayerEvent[event]
|
|
41
45
|
if ____opt_0 ~= nil then
|
|
42
46
|
____opt_0:remove(self)
|
|
43
47
|
end
|
|
44
|
-
local ____opt_2 =
|
|
48
|
+
local ____opt_2 = listenerByBehaviorByOwningPlayerEvent[event]
|
|
45
49
|
if ____opt_2 ~= nil then
|
|
46
50
|
____opt_2[self] = nil
|
|
47
51
|
end
|
|
48
|
-
|
|
52
|
+
end
|
|
53
|
+
owningPlayerEventsByBehavior[self] = nil
|
|
54
|
+
end
|
|
55
|
+
local inRangeUnitEvents = inRangeUnitEventsByBehavior[self]
|
|
56
|
+
if inRangeUnitEvents ~= nil then
|
|
57
|
+
for event in pairs(inRangeUnitEvents) do
|
|
58
|
+
local ____opt_4 = behaviorsByInRangeUnitEvent[event]
|
|
49
59
|
if ____opt_4 ~= nil then
|
|
50
|
-
____opt_4
|
|
60
|
+
____opt_4:remove(self)
|
|
61
|
+
end
|
|
62
|
+
local ____opt_6 = rangeByBehaviorByInRangeUnitEvent[event]
|
|
63
|
+
if ____opt_6 ~= nil then
|
|
64
|
+
____opt_6[self] = nil
|
|
65
|
+
end
|
|
66
|
+
local ____opt_8 = listenerByBehaviorByInRangeUnitEvent[event]
|
|
67
|
+
if ____opt_8 ~= nil then
|
|
68
|
+
____opt_8[self] = nil
|
|
51
69
|
end
|
|
52
70
|
end
|
|
53
|
-
|
|
71
|
+
inRangeUnitEventsByBehavior[self] = nil
|
|
54
72
|
end
|
|
55
73
|
if self._bonusIdByBonusType ~= nil then
|
|
56
74
|
for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
|
|
@@ -60,8 +78,8 @@ function UnitBehavior.prototype.onDestroy(self)
|
|
|
60
78
|
return Behavior.prototype.onDestroy(self)
|
|
61
79
|
end
|
|
62
80
|
function UnitBehavior.prototype.getUnitBonus(self, bonusType)
|
|
63
|
-
local
|
|
64
|
-
local bonusId =
|
|
81
|
+
local ____opt_10 = self._bonusIdByBonusType
|
|
82
|
+
local bonusId = ____opt_10 and ____opt_10[bonusType]
|
|
65
83
|
return bonusId == nil and 0 or getUnitBonus(self.object, bonusType, bonusId)
|
|
66
84
|
end
|
|
67
85
|
function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
@@ -72,16 +90,40 @@ function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, va
|
|
|
72
90
|
end
|
|
73
91
|
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self.object, bonusType, bonusIdByBonusType[bonusType], value)
|
|
74
92
|
end
|
|
93
|
+
function UnitBehavior.prototype.registerOwningPlayerEvent(self, event, extractPlayer, listener)
|
|
94
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByOwningPlayerEvent, event, mutableLuaMap)
|
|
95
|
+
listenerByBehavior[self] = listener
|
|
96
|
+
getOrPut(inRangeUnitEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
97
|
+
local behaviors = behaviorsByOwningPlayerEvent[event]
|
|
98
|
+
if behaviors == nil then
|
|
99
|
+
event:addListener(function(...)
|
|
100
|
+
local behaviors = behaviorsByOwningPlayerEvent[event]
|
|
101
|
+
if behaviors ~= nil then
|
|
102
|
+
local player = extractPlayer(...)
|
|
103
|
+
if player ~= nil then
|
|
104
|
+
for behavior in pairs(behaviors) do
|
|
105
|
+
if behavior.unit.owner == player then
|
|
106
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end)
|
|
112
|
+
behaviors = __TS__New(LinkedSet)
|
|
113
|
+
behaviorsByOwningPlayerEvent[event] = behaviors
|
|
114
|
+
end
|
|
115
|
+
behaviors:add(self)
|
|
116
|
+
end
|
|
75
117
|
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUnit, range, listener)
|
|
76
|
-
local rangeByBehavior = getOrPut(
|
|
118
|
+
local rangeByBehavior = getOrPut(rangeByBehaviorByInRangeUnitEvent, event, mutableLuaMap)
|
|
77
119
|
rangeByBehavior[self] = range
|
|
78
|
-
local listenerByBehavior = getOrPut(
|
|
120
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByInRangeUnitEvent, event, mutableLuaMap)
|
|
79
121
|
listenerByBehavior[self] = listener
|
|
80
|
-
getOrPut(
|
|
81
|
-
local behaviors =
|
|
122
|
+
getOrPut(inRangeUnitEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
123
|
+
local behaviors = behaviorsByInRangeUnitEvent[event]
|
|
82
124
|
if behaviors == nil then
|
|
83
125
|
event:addListener(function(...)
|
|
84
|
-
local behaviors =
|
|
126
|
+
local behaviors = behaviorsByInRangeUnitEvent[event]
|
|
85
127
|
if behaviors ~= nil then
|
|
86
128
|
local unit = extractUnit(...)
|
|
87
129
|
if unit ~= nil then
|
|
@@ -95,7 +137,7 @@ function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUni
|
|
|
95
137
|
end
|
|
96
138
|
end)
|
|
97
139
|
behaviors = __TS__New(LinkedSet)
|
|
98
|
-
|
|
140
|
+
behaviorsByInRangeUnitEvent[event] = behaviors
|
|
99
141
|
end
|
|
100
142
|
behaviors:add(self)
|
|
101
143
|
end
|
|
@@ -167,6 +209,21 @@ function UnitBehavior.prototype.onDeath(self, source)
|
|
|
167
209
|
end
|
|
168
210
|
function UnitBehavior.prototype.onOwnerChange(self, previousOwner)
|
|
169
211
|
end
|
|
212
|
+
function UnitBehavior.bindUnitType(self, unitTypeId, ...)
|
|
213
|
+
local args = {...}
|
|
214
|
+
local createBehaviorFunctions = createBehaviorFunctionsByUnitTypeId[unitTypeId]
|
|
215
|
+
if createBehaviorFunctions == nil then
|
|
216
|
+
createBehaviorFunctions = {}
|
|
217
|
+
createBehaviorFunctionsByUnitTypeId[unitTypeId] = createBehaviorFunctions
|
|
218
|
+
end
|
|
219
|
+
createBehaviorFunctions[#createBehaviorFunctions + 1] = function(unit)
|
|
220
|
+
return __TS__New(
|
|
221
|
+
self,
|
|
222
|
+
unit,
|
|
223
|
+
table.unpack(args)
|
|
224
|
+
)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
170
227
|
__TS__SetDescriptor(
|
|
171
228
|
UnitBehavior.prototype,
|
|
172
229
|
"unit",
|
|
@@ -282,6 +339,14 @@ __TS__SetDescriptor(
|
|
|
282
339
|
____exports.UnitBehavior:forAll(unit, "onOwnerChange", previousOwner)
|
|
283
340
|
end)
|
|
284
341
|
end)(UnitBehavior)
|
|
342
|
+
Unit.onCreate:addListener(function(unit)
|
|
343
|
+
local createBehaviorFunctions = createBehaviorFunctionsByUnitTypeId[unit.typeId]
|
|
344
|
+
if createBehaviorFunctions ~= nil then
|
|
345
|
+
for ____, createBehavior in ipairs(createBehaviorFunctions) do
|
|
346
|
+
createBehavior(unit)
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
end)
|
|
285
350
|
Unit.destroyEvent:addListener(function(unit)
|
|
286
351
|
____exports.UnitBehavior:forAll(unit, "destroy")
|
|
287
352
|
end)
|
package/engine/buff.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
79
79
|
healingOnExpiration?: NumberParameterValueType;
|
|
80
80
|
killsOnExpiration?: BooleanParameterValueType;
|
|
81
81
|
explodesOnExpiration?: BooleanParameterValueType;
|
|
82
|
+
abilityCooldownFactor?: NumberParameterValueType;
|
|
82
83
|
uniqueGroup?: BuffUniqueGroup;
|
|
83
84
|
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
84
85
|
declare const enum BuffPropertyKey {
|
|
@@ -124,7 +125,9 @@ declare const enum BuffPropertyKey {
|
|
|
124
125
|
PROVIDES_INVULNERABILITY = 139,
|
|
125
126
|
KILLS_ON_EXPIRATION = 140,
|
|
126
127
|
EXPLODES_ON_EXPIRATION = 141,
|
|
127
|
-
MISS_PROBABILITY = 142
|
|
128
|
+
MISS_PROBABILITY = 142,
|
|
129
|
+
ABILITY_COOLDOWN_FACTOR = 143,
|
|
130
|
+
ABILITY_COOLDOWN_MODIFIER = 144
|
|
128
131
|
}
|
|
129
132
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
130
133
|
LEAST_DURATION = 0
|
|
@@ -187,6 +190,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
187
190
|
private [BuffPropertyKey.PROVIDES_INVULNERABILITY]?;
|
|
188
191
|
private [BuffPropertyKey.KILLS_ON_EXPIRATION]?;
|
|
189
192
|
private [BuffPropertyKey.EXPLODES_ON_EXPIRATION]?;
|
|
193
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_FACTOR]?;
|
|
194
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_MODIFIER]?;
|
|
190
195
|
protected static readonly defaultParameters: BuffParameters;
|
|
191
196
|
get source(): Unit;
|
|
192
197
|
readonly typeId: ApplicableBuffTypeId;
|
|
@@ -262,6 +267,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
262
267
|
get duration(): number;
|
|
263
268
|
get remainingDuration(): number;
|
|
264
269
|
set remainingDuration(remainingDuration: number);
|
|
270
|
+
get abilityCooldownFactor(): number;
|
|
271
|
+
set abilityCooldownFactor(abilityCooldownFactor: number);
|
|
272
|
+
onAbilityGained(ability: Ability): void;
|
|
273
|
+
onAbilityLost(ability: Ability): void;
|
|
265
274
|
flashEffect(...parameters: [
|
|
266
275
|
...widgetOrXY: [] | [Widget] | [x: number, x: number],
|
|
267
276
|
...parametersOrDuration: [] | [EffectParameters] | [number]
|
package/engine/buff.lua
CHANGED
|
@@ -16,6 +16,7 @@ local internalApplyBuff = ____applicable.internalApplyBuff
|
|
|
16
16
|
local removeBuff = ____applicable.removeBuff
|
|
17
17
|
local ____ability = require("engine.internal.ability")
|
|
18
18
|
local Ability = ____ability.Ability
|
|
19
|
+
local UnitAbility = ____ability.UnitAbility
|
|
19
20
|
local ____ability = require("engine.object-field.ability")
|
|
20
21
|
local AbilityBooleanField = ____ability.AbilityBooleanField
|
|
21
22
|
local AbilityNumberField = ____ability.AbilityNumberField
|
|
@@ -50,6 +51,8 @@ local ____item = require("engine.internal.item")
|
|
|
50
51
|
local Item = ____item.Item
|
|
51
52
|
local ____destructable = require("core.types.destructable")
|
|
52
53
|
local Destructable = ____destructable.Destructable
|
|
54
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
55
|
+
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
53
56
|
local getUnitAbility = BlzGetUnitAbility
|
|
54
57
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
55
58
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -121,7 +124,8 @@ local buffParametersKeys = {
|
|
|
121
124
|
damageOnExpiration = true,
|
|
122
125
|
healingOnExpiration = true,
|
|
123
126
|
killsOnExpiration = true,
|
|
124
|
-
explodesOnExpiration = true
|
|
127
|
+
explodesOnExpiration = true,
|
|
128
|
+
abilityCooldownFactor = true
|
|
125
129
|
}
|
|
126
130
|
local function resolveEnumValue(ability, level, value)
|
|
127
131
|
if value == nil or type(value) == "number" then
|
|
@@ -198,7 +202,8 @@ local buffNumberParameters = {
|
|
|
198
202
|
"healingPerInterval",
|
|
199
203
|
"healingOverDuration",
|
|
200
204
|
"damageOnExpiration",
|
|
201
|
-
"healingOnExpiration"
|
|
205
|
+
"healingOnExpiration",
|
|
206
|
+
"abilityCooldownFactor"
|
|
202
207
|
}
|
|
203
208
|
local unsuccessfulApplicationMarker = {}
|
|
204
209
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -506,6 +511,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
511
|
self[100] = 1
|
|
507
512
|
Event.invoke(buffCreatedEvent, self)
|
|
508
513
|
end
|
|
514
|
+
function Buff.prototype.onAbilityGained(self, ability)
|
|
515
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
516
|
+
local abilityCooldownModifier = self[144]
|
|
517
|
+
if abilityCooldownModifier then
|
|
518
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
|
|
519
|
+
end
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
function Buff.prototype.onAbilityLost(self, ability)
|
|
523
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
524
|
+
local abilityCooldownModifier = self[144]
|
|
525
|
+
if abilityCooldownModifier then
|
|
526
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
end
|
|
509
530
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
510
531
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
511
532
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
@@ -580,6 +601,12 @@ function Buff.prototype.onDestroy(self)
|
|
|
580
601
|
behavior:destroy()
|
|
581
602
|
end
|
|
582
603
|
end
|
|
604
|
+
local previousAbilityCooldownModifier = self[144]
|
|
605
|
+
if previousAbilityCooldownModifier then
|
|
606
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
607
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
608
|
+
end
|
|
609
|
+
end
|
|
583
610
|
if self[139] then
|
|
584
611
|
unit:decrementInvulnerabilityCounter()
|
|
585
612
|
end
|
|
@@ -588,7 +615,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
588
615
|
end
|
|
589
616
|
if self[136] then
|
|
590
617
|
if self[137] then
|
|
591
|
-
unit:
|
|
618
|
+
unit:decrementForceStunCounter()
|
|
592
619
|
end
|
|
593
620
|
unit:decrementStunCounter()
|
|
594
621
|
end
|
|
@@ -987,13 +1014,13 @@ __TS__SetDescriptor(
|
|
|
987
1014
|
set = function(self, stuns)
|
|
988
1015
|
if not stuns and self[136] then
|
|
989
1016
|
if self[137] then
|
|
990
|
-
self.object:
|
|
1017
|
+
self.object:decrementForceStunCounter()
|
|
991
1018
|
end
|
|
992
1019
|
self.object:decrementStunCounter()
|
|
993
1020
|
self[136] = nil
|
|
994
1021
|
elseif stuns and not self[136] then
|
|
995
1022
|
if self[137] then
|
|
996
|
-
self.object:
|
|
1023
|
+
self.object:incrementForceStunCounter()
|
|
997
1024
|
end
|
|
998
1025
|
self.object:incrementStunCounter()
|
|
999
1026
|
self[136] = true
|
|
@@ -1016,12 +1043,12 @@ __TS__SetDescriptor(
|
|
|
1016
1043
|
set = function(self, ignoresStunImmunity)
|
|
1017
1044
|
if not ignoresStunImmunity and self[137] then
|
|
1018
1045
|
if self[136] then
|
|
1019
|
-
self.object:
|
|
1046
|
+
self.object:decrementForceStunCounter()
|
|
1020
1047
|
end
|
|
1021
1048
|
self[137] = nil
|
|
1022
1049
|
elseif ignoresStunImmunity and not self[137] then
|
|
1023
1050
|
if self[136] then
|
|
1024
|
-
self.object:
|
|
1051
|
+
self.object:incrementForceStunCounter()
|
|
1025
1052
|
end
|
|
1026
1053
|
self[137] = true
|
|
1027
1054
|
end
|
|
@@ -1269,6 +1296,32 @@ __TS__SetDescriptor(
|
|
|
1269
1296
|
},
|
|
1270
1297
|
true
|
|
1271
1298
|
)
|
|
1299
|
+
__TS__SetDescriptor(
|
|
1300
|
+
Buff.prototype,
|
|
1301
|
+
"abilityCooldownFactor",
|
|
1302
|
+
{
|
|
1303
|
+
get = function(self)
|
|
1304
|
+
return self[143] or 1
|
|
1305
|
+
end,
|
|
1306
|
+
set = function(self, abilityCooldownFactor)
|
|
1307
|
+
local previousAbilityCooldownModifier = self[144]
|
|
1308
|
+
if previousAbilityCooldownModifier then
|
|
1309
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1310
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
1311
|
+
end
|
|
1312
|
+
end
|
|
1313
|
+
local function modifier(ability, level, cooldown)
|
|
1314
|
+
return cooldown * abilityCooldownFactor
|
|
1315
|
+
end
|
|
1316
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1317
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
|
|
1318
|
+
end
|
|
1319
|
+
self[144] = modifier
|
|
1320
|
+
self[143] = abilityCooldownFactor
|
|
1321
|
+
end
|
|
1322
|
+
},
|
|
1323
|
+
true
|
|
1324
|
+
)
|
|
1272
1325
|
Buff.createdEvent = buffCreatedEvent
|
|
1273
1326
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1274
1327
|
(function(self)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____unit = require("engine.internal.unit")
|
|
5
|
+
local Unit = ____unit.Unit
|
|
6
|
+
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
+
local FLY_HEIGHT_UNIT_FLOAT_FIELD = ____unit.FLY_HEIGHT_UNIT_FLOAT_FIELD
|
|
8
|
+
__TS__ObjectDefineProperty(
|
|
9
|
+
Unit.prototype,
|
|
10
|
+
"flyHeight",
|
|
11
|
+
{
|
|
12
|
+
get = function(self)
|
|
13
|
+
return FLY_HEIGHT_UNIT_FLOAT_FIELD:getValue(self)
|
|
14
|
+
end,
|
|
15
|
+
set = function(self, value)
|
|
16
|
+
FLY_HEIGHT_UNIT_FLOAT_FIELD:setValue(self, value)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
return ____exports
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____unit = require("engine.internal.unit")
|
|
5
|
+
local Unit = ____unit.Unit
|
|
6
|
+
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
+
local SCALING_VALUE_UNIT_FLOAT_FIELD = ____unit.SCALING_VALUE_UNIT_FLOAT_FIELD
|
|
8
|
+
__TS__ObjectDefineProperty(
|
|
9
|
+
Unit.prototype,
|
|
10
|
+
"scale",
|
|
11
|
+
{
|
|
12
|
+
get = function(self)
|
|
13
|
+
return SCALING_VALUE_UNIT_FLOAT_FIELD:getValue(self)
|
|
14
|
+
end,
|
|
15
|
+
set = function(self, value)
|
|
16
|
+
SCALING_VALUE_UNIT_FLOAT_FIELD:setValue(self, value)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
return ____exports
|
|
@@ -13,6 +13,8 @@ local ____attributes = require("attributes")
|
|
|
13
13
|
local attribute = ____attributes.attribute
|
|
14
14
|
local ____linked_2Dset = require("utility.linked-set")
|
|
15
15
|
local LinkedSet = ____linked_2Dset.LinkedSet
|
|
16
|
+
local ____math = require("math")
|
|
17
|
+
local ceil = ____math.ceil
|
|
16
18
|
local autoAttackFinishEvent = __TS__New(Event)
|
|
17
19
|
rawset(Unit, "autoAttackFinishEvent", autoAttackFinishEvent)
|
|
18
20
|
local units = __TS__New(LinkedSet)
|
|
@@ -55,7 +57,8 @@ local function invokeEvent(unit)
|
|
|
55
57
|
end
|
|
56
58
|
local function checkUnit(unit)
|
|
57
59
|
local passedTime = unit[passedTimeAttribute] + timerPeriod
|
|
58
|
-
|
|
60
|
+
local impactDelay = unit[impactDelayAttribute]
|
|
61
|
+
if passedTime >= impactDelay and ceil(passedTime / 0.02) >= ceil(impactDelay / 0.02) then
|
|
59
62
|
invokeEvent(unit)
|
|
60
63
|
else
|
|
61
64
|
unit[passedTimeAttribute] = passedTime
|
|
@@ -109,12 +109,13 @@ declare const enum UnitPropertyKey {
|
|
|
109
109
|
SYNC_ID = 100,
|
|
110
110
|
IS_PAUSED = 101,
|
|
111
111
|
STUN_COUNTER = 102,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
FORCE_STUN_COUNTER = 103,
|
|
113
|
+
DELAY_HEALTH_CHECKS_COUNTER = 104,
|
|
114
|
+
DELAY_HEALTH_CHECKS_HEALTH_BONUS = 105,
|
|
115
|
+
PREVENT_DEATH_HEALTH_BONUS = 106,
|
|
116
|
+
IS_TEAM_GLOW_HIDDEN = 107,
|
|
117
|
+
LAST_X = 108,
|
|
118
|
+
LAST_Y = 109
|
|
118
119
|
}
|
|
119
120
|
export type UnitSyncId = number & {
|
|
120
121
|
readonly __unitSyncId: unique symbol;
|
|
@@ -123,6 +124,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
123
124
|
readonly syncId: UnitSyncId;
|
|
124
125
|
private [UnitPropertyKey.IS_PAUSED]?;
|
|
125
126
|
private [UnitPropertyKey.STUN_COUNTER]?;
|
|
127
|
+
private [UnitPropertyKey.FORCE_STUN_COUNTER]?;
|
|
126
128
|
private [UnitPropertyKey.DELAY_HEALTH_CHECKS_COUNTER]?;
|
|
127
129
|
private [UnitPropertyKey.DELAY_HEALTH_CHECKS_HEALTH_BONUS]?;
|
|
128
130
|
private [UnitPropertyKey.PREVENT_DEATH_HEALTH_BONUS]?;
|
|
@@ -218,8 +220,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
218
220
|
set facing(v: number);
|
|
219
221
|
get speed(): number;
|
|
220
222
|
set speed(v: number);
|
|
221
|
-
get flyHeight(): number;
|
|
222
|
-
set flyHeight(v: number);
|
|
223
223
|
get x(): number;
|
|
224
224
|
set x(v: number);
|
|
225
225
|
get y(): number;
|
|
@@ -243,8 +243,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
243
243
|
get isInvulnerable(): boolean;
|
|
244
244
|
get vertexColor(): Color;
|
|
245
245
|
set vertexColor(v: Color);
|
|
246
|
-
get scale(): number;
|
|
247
|
-
set scale(v: number);
|
|
248
246
|
get timeScale(): number;
|
|
249
247
|
set timeScale(v: number);
|
|
250
248
|
get collisionSize(): number;
|
|
@@ -294,6 +292,8 @@ export declare class Unit extends Handle<junit> {
|
|
|
294
292
|
unpauseEx(): void;
|
|
295
293
|
incrementStunCounter(): void;
|
|
296
294
|
decrementStunCounter(): void;
|
|
295
|
+
incrementForceStunCounter(): void;
|
|
296
|
+
decrementForceStunCounter(): void;
|
|
297
297
|
set waygateActive(v: boolean);
|
|
298
298
|
get waygateActive(): boolean;
|
|
299
299
|
set waygateDestination(v: Vec2);
|
|
@@ -375,5 +375,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
375
375
|
setField(field: junitstringfield, value: string): boolean;
|
|
376
376
|
toString(): string;
|
|
377
377
|
static getBySyncId(syncId: UnitSyncId): Unit | undefined;
|
|
378
|
+
static synchronize: (player: Player, object: Unit | undefined) => Promise<Unit | undefined>;
|
|
378
379
|
}
|
|
379
380
|
export {};
|