warscript 0.0.1-dev.e5e97e8 → 0.0.1-dev.e698bed
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 +1 -0
- package/core/types/player.lua +4 -1
- 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/apply-buff.lua +12 -4
- 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 +7 -3
- package/engine/behaviour/unit.lua +89 -22
- package/engine/buff.d.ts +10 -1
- package/engine/buff.lua +58 -2
- 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.d.ts +0 -4
- package/engine/internal/unit.lua +0 -27
- package/engine/object-data/entry/unit-type.d.ts +4 -0
- package/engine/object-data/entry/unit-type.lua +76 -32
- package/engine/object-field/unit.d.ts +13 -1
- package/engine/object-field/unit.lua +57 -0
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +57 -59
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +3 -1
- package/engine/standard/fields/unit.lua +4 -0
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/package.json +1 -1
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
|
|
@@ -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)
|
|
@@ -1327,5 +1380,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1327
1380
|
buffCreatedEvent:addListener(function(buff)
|
|
1328
1381
|
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1329
1382
|
end)
|
|
1383
|
+
buffBeingDestroyedEvent:addListener(function(buff)
|
|
1384
|
+
UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
|
|
1385
|
+
end)
|
|
1330
1386
|
end)(Buff)
|
|
1331
1387
|
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 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
|
|
@@ -220,8 +220,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
220
220
|
set facing(v: number);
|
|
221
221
|
get speed(): number;
|
|
222
222
|
set speed(v: number);
|
|
223
|
-
get flyHeight(): number;
|
|
224
|
-
set flyHeight(v: number);
|
|
225
223
|
get x(): number;
|
|
226
224
|
set x(v: number);
|
|
227
225
|
get y(): number;
|
|
@@ -245,8 +243,6 @@ export declare class Unit extends Handle<junit> {
|
|
|
245
243
|
get isInvulnerable(): boolean;
|
|
246
244
|
get vertexColor(): Color;
|
|
247
245
|
set vertexColor(v: Color);
|
|
248
|
-
get scale(): number;
|
|
249
|
-
set scale(v: number);
|
|
250
246
|
get timeScale(): number;
|
|
251
247
|
set timeScale(v: number);
|
|
252
248
|
get collisionSize(): number;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -1685,19 +1685,6 @@ __TS__SetDescriptor(
|
|
|
1685
1685
|
},
|
|
1686
1686
|
true
|
|
1687
1687
|
)
|
|
1688
|
-
__TS__SetDescriptor(
|
|
1689
|
-
Unit.prototype,
|
|
1690
|
-
"flyHeight",
|
|
1691
|
-
{
|
|
1692
|
-
get = function(self)
|
|
1693
|
-
return getUnitFlyHeight(self.handle)
|
|
1694
|
-
end,
|
|
1695
|
-
set = function(self, v)
|
|
1696
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1697
|
-
end
|
|
1698
|
-
},
|
|
1699
|
-
true
|
|
1700
|
-
)
|
|
1701
1688
|
__TS__SetDescriptor(
|
|
1702
1689
|
Unit.prototype,
|
|
1703
1690
|
"x",
|
|
@@ -1890,20 +1877,6 @@ __TS__SetDescriptor(
|
|
|
1890
1877
|
},
|
|
1891
1878
|
true
|
|
1892
1879
|
)
|
|
1893
|
-
__TS__SetDescriptor(
|
|
1894
|
-
Unit.prototype,
|
|
1895
|
-
"scale",
|
|
1896
|
-
{
|
|
1897
|
-
get = function(self)
|
|
1898
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1899
|
-
end,
|
|
1900
|
-
set = function(self, v)
|
|
1901
|
-
setUnitScale(self.handle, v, v, v)
|
|
1902
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1903
|
-
end
|
|
1904
|
-
},
|
|
1905
|
-
true
|
|
1906
|
-
)
|
|
1907
1880
|
__TS__SetDescriptor(
|
|
1908
1881
|
Unit.prototype,
|
|
1909
1882
|
"timeScale",
|
|
@@ -42,6 +42,10 @@ export declare class UnitTypeWeapon {
|
|
|
42
42
|
set impactDelay(impactDelay: number);
|
|
43
43
|
get missileModelPath(): string;
|
|
44
44
|
set missileModelPath(missileModelPath: string);
|
|
45
|
+
get missileModelPathSD(): string;
|
|
46
|
+
set missileModelPathSD(missileModelPathSD: string);
|
|
47
|
+
get missileModelPathHD(): string;
|
|
48
|
+
set missileModelPathHD(missileModelPathHD: string);
|
|
45
49
|
get range(): number;
|
|
46
50
|
set range(range: number);
|
|
47
51
|
get soundType(): WeaponSoundType;
|
|
@@ -238,21 +238,21 @@ __TS__SetDescriptor(
|
|
|
238
238
|
)
|
|
239
239
|
__TS__SetDescriptor(
|
|
240
240
|
UnitTypeWeapon.prototype,
|
|
241
|
-
"
|
|
241
|
+
"missileModelPathSD",
|
|
242
242
|
{
|
|
243
243
|
get = function(self)
|
|
244
244
|
local ____self_17 = self.unitType
|
|
245
|
-
return ____self_17.
|
|
245
|
+
return ____self_17.getStringField(
|
|
246
246
|
____self_17,
|
|
247
|
-
("ua" .. tostring(self.index)) .. "
|
|
247
|
+
("ua" .. tostring(self.index)) .. "m:sd"
|
|
248
248
|
)
|
|
249
249
|
end,
|
|
250
|
-
set = function(self,
|
|
250
|
+
set = function(self, missileModelPathSD)
|
|
251
251
|
local ____self_18 = self.unitType
|
|
252
|
-
____self_18.
|
|
252
|
+
____self_18.setStringField(
|
|
253
253
|
____self_18,
|
|
254
|
-
("ua" .. tostring(self.index)) .. "
|
|
255
|
-
|
|
254
|
+
("ua" .. tostring(self.index)) .. "m:sd",
|
|
255
|
+
missileModelPathSD
|
|
256
256
|
)
|
|
257
257
|
end
|
|
258
258
|
},
|
|
@@ -260,21 +260,21 @@ __TS__SetDescriptor(
|
|
|
260
260
|
)
|
|
261
261
|
__TS__SetDescriptor(
|
|
262
262
|
UnitTypeWeapon.prototype,
|
|
263
|
-
"
|
|
263
|
+
"missileModelPathHD",
|
|
264
264
|
{
|
|
265
265
|
get = function(self)
|
|
266
266
|
local ____self_19 = self.unitType
|
|
267
267
|
return ____self_19.getStringField(
|
|
268
268
|
____self_19,
|
|
269
|
-
"
|
|
269
|
+
("ua" .. tostring(self.index)) .. "m:hd"
|
|
270
270
|
)
|
|
271
271
|
end,
|
|
272
|
-
set = function(self,
|
|
272
|
+
set = function(self, missileModelPathHD)
|
|
273
273
|
local ____self_20 = self.unitType
|
|
274
274
|
____self_20.setStringField(
|
|
275
275
|
____self_20,
|
|
276
|
-
"
|
|
277
|
-
|
|
276
|
+
("ua" .. tostring(self.index)) .. "m:hd",
|
|
277
|
+
missileModelPathHD
|
|
278
278
|
)
|
|
279
279
|
end
|
|
280
280
|
},
|
|
@@ -282,21 +282,21 @@ __TS__SetDescriptor(
|
|
|
282
282
|
)
|
|
283
283
|
__TS__SetDescriptor(
|
|
284
284
|
UnitTypeWeapon.prototype,
|
|
285
|
-
"
|
|
285
|
+
"range",
|
|
286
286
|
{
|
|
287
287
|
get = function(self)
|
|
288
288
|
local ____self_21 = self.unitType
|
|
289
|
-
return ____self_21.
|
|
289
|
+
return ____self_21.getNumberField(
|
|
290
290
|
____self_21,
|
|
291
|
-
("
|
|
291
|
+
("ua" .. tostring(self.index)) .. "r"
|
|
292
292
|
)
|
|
293
293
|
end,
|
|
294
|
-
set = function(self,
|
|
294
|
+
set = function(self, range)
|
|
295
295
|
local ____self_22 = self.unitType
|
|
296
|
-
____self_22.
|
|
296
|
+
____self_22.setNumberField(
|
|
297
297
|
____self_22,
|
|
298
|
-
("
|
|
299
|
-
|
|
298
|
+
("ua" .. tostring(self.index)) .. "r",
|
|
299
|
+
range
|
|
300
300
|
)
|
|
301
301
|
end
|
|
302
302
|
},
|
|
@@ -304,19 +304,63 @@ __TS__SetDescriptor(
|
|
|
304
304
|
)
|
|
305
305
|
__TS__SetDescriptor(
|
|
306
306
|
UnitTypeWeapon.prototype,
|
|
307
|
-
"
|
|
307
|
+
"soundType",
|
|
308
308
|
{
|
|
309
309
|
get = function(self)
|
|
310
310
|
local ____self_23 = self.unitType
|
|
311
311
|
return ____self_23.getStringField(
|
|
312
312
|
____self_23,
|
|
313
|
-
|
|
313
|
+
"ucs" .. tostring(self.index)
|
|
314
314
|
)
|
|
315
315
|
end,
|
|
316
|
-
set = function(self,
|
|
316
|
+
set = function(self, soundType)
|
|
317
317
|
local ____self_24 = self.unitType
|
|
318
318
|
____self_24.setStringField(
|
|
319
319
|
____self_24,
|
|
320
|
+
"ucs" .. tostring(self.index),
|
|
321
|
+
soundType
|
|
322
|
+
)
|
|
323
|
+
end
|
|
324
|
+
},
|
|
325
|
+
true
|
|
326
|
+
)
|
|
327
|
+
__TS__SetDescriptor(
|
|
328
|
+
UnitTypeWeapon.prototype,
|
|
329
|
+
"soundTypeSD",
|
|
330
|
+
{
|
|
331
|
+
get = function(self)
|
|
332
|
+
local ____self_25 = self.unitType
|
|
333
|
+
return ____self_25.getStringField(
|
|
334
|
+
____self_25,
|
|
335
|
+
("ucs" .. tostring(self.index)) .. ":sd"
|
|
336
|
+
)
|
|
337
|
+
end,
|
|
338
|
+
set = function(self, soundTypeSD)
|
|
339
|
+
local ____self_26 = self.unitType
|
|
340
|
+
____self_26.setStringField(
|
|
341
|
+
____self_26,
|
|
342
|
+
("ucs" .. tostring(self.index)) .. ":sd",
|
|
343
|
+
soundTypeSD
|
|
344
|
+
)
|
|
345
|
+
end
|
|
346
|
+
},
|
|
347
|
+
true
|
|
348
|
+
)
|
|
349
|
+
__TS__SetDescriptor(
|
|
350
|
+
UnitTypeWeapon.prototype,
|
|
351
|
+
"soundTypeHD",
|
|
352
|
+
{
|
|
353
|
+
get = function(self)
|
|
354
|
+
local ____self_27 = self.unitType
|
|
355
|
+
return ____self_27.getStringField(
|
|
356
|
+
____self_27,
|
|
357
|
+
("ucs" .. tostring(self.index)) .. ":hd"
|
|
358
|
+
)
|
|
359
|
+
end,
|
|
360
|
+
set = function(self, soundTypeHD)
|
|
361
|
+
local ____self_28 = self.unitType
|
|
362
|
+
____self_28.setStringField(
|
|
363
|
+
____self_28,
|
|
320
364
|
("ucs" .. tostring(self.index)) .. ":hd",
|
|
321
365
|
soundTypeHD
|
|
322
366
|
)
|
|
@@ -1680,11 +1724,11 @@ __TS__SetDescriptor(
|
|
|
1680
1724
|
implementReadonlyNumberIndexSupplier(
|
|
1681
1725
|
____exports.UnitType,
|
|
1682
1726
|
function(id)
|
|
1683
|
-
local
|
|
1684
|
-
|
|
1685
|
-
__TS__ClassExtends(
|
|
1686
|
-
|
|
1687
|
-
return
|
|
1727
|
+
local ____class_29 = __TS__Class()
|
|
1728
|
+
____class_29.name = ____class_29.name
|
|
1729
|
+
__TS__ClassExtends(____class_29, ____exports.UnitType)
|
|
1730
|
+
____class_29.BASE_ID = id
|
|
1731
|
+
return ____class_29
|
|
1688
1732
|
end
|
|
1689
1733
|
)
|
|
1690
1734
|
____exports.HeroUnitType = __TS__Class()
|
|
@@ -1745,11 +1789,11 @@ __TS__SetDescriptor(
|
|
|
1745
1789
|
implementReadonlyNumberIndexSupplier(
|
|
1746
1790
|
____exports.HeroUnitType,
|
|
1747
1791
|
function(id)
|
|
1748
|
-
local
|
|
1749
|
-
|
|
1750
|
-
__TS__ClassExtends(
|
|
1751
|
-
|
|
1752
|
-
return
|
|
1792
|
+
local ____class_30 = __TS__Class()
|
|
1793
|
+
____class_30.name = ____class_30.name
|
|
1794
|
+
__TS__ClassExtends(____class_30, ____exports.HeroUnitType)
|
|
1795
|
+
____class_30.BASE_ID = id
|
|
1796
|
+
return ____class_30
|
|
1753
1797
|
end
|
|
1754
1798
|
)
|
|
1755
1799
|
return ____exports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "../internal/unit";
|
|
3
|
-
import { ObjectField, ObjectLevelField, ObjectLevelFieldValueChangeEvent, ReadonlyObjectLevelFieldType } from "../object-field";
|
|
3
|
+
import { ObjectField, ObjectFieldValueChangeEvent, ObjectLevelField, ObjectLevelFieldValueChangeEvent, ReadonlyObjectFieldType, ReadonlyObjectLevelFieldType } from "../object-field";
|
|
4
4
|
import { UnitType, UnitTypeId } from "../object-data/entry/unit-type";
|
|
5
5
|
import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
|
|
6
6
|
import { AttackType } from "../object-data/auxiliary/attack-type";
|
|
@@ -9,30 +9,35 @@ export declare abstract class UnitField<ValueType extends number | string | bool
|
|
|
9
9
|
protected get instanceClass(): typeof Unit;
|
|
10
10
|
protected getObjectDataEntryId(instance: Unit): UnitTypeId;
|
|
11
11
|
protected hasNativeFieldValue(): boolean;
|
|
12
|
+
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitField>>;
|
|
12
13
|
}
|
|
13
14
|
export declare class UnitBooleanField extends UnitField<boolean, junitbooleanfield> {
|
|
14
15
|
protected get defaultValue(): boolean;
|
|
15
16
|
protected getNativeFieldById(id: number): junitbooleanfield;
|
|
16
17
|
protected getNativeFieldValue(instance: Unit): boolean;
|
|
17
18
|
protected setNativeFieldValue(instance: Unit, value: boolean): boolean;
|
|
19
|
+
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitBooleanField>>;
|
|
18
20
|
}
|
|
19
21
|
export declare class UnitFloatField extends UnitField<number, junitrealfield> {
|
|
20
22
|
protected get defaultValue(): number;
|
|
21
23
|
protected getNativeFieldById(id: number): junitrealfield;
|
|
22
24
|
protected getNativeFieldValue(instance: Unit): number;
|
|
23
25
|
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
26
|
+
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitFloatField>>;
|
|
24
27
|
}
|
|
25
28
|
export declare class UnitIntegerField extends UnitField<number, junitintegerfield> {
|
|
26
29
|
protected get defaultValue(): number;
|
|
27
30
|
protected getNativeFieldById(id: number): junitintegerfield;
|
|
28
31
|
protected getNativeFieldValue(instance: Unit): number;
|
|
29
32
|
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
33
|
+
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitIntegerField>>;
|
|
30
34
|
}
|
|
31
35
|
export declare class UnitStringField extends UnitField<string, junitstringfield> {
|
|
32
36
|
protected get defaultValue(): string;
|
|
33
37
|
protected getNativeFieldById(id: number): junitstringfield;
|
|
34
38
|
protected getNativeFieldValue(instance: Unit): string;
|
|
35
39
|
protected setNativeFieldValue(instance: Unit, value: string): boolean;
|
|
40
|
+
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitStringField>>;
|
|
36
41
|
}
|
|
37
42
|
type junitweaponfield = junitweaponbooleanfield | junitweaponintegerfield | junitweaponrealfield | junitweaponstringfield;
|
|
38
43
|
export declare abstract class UnitWeaponField<ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType extends junitweaponfield = junitweaponfield> extends ObjectLevelField<UnitType, Unit, ValueType, InputValueType, NativeFieldType> {
|
|
@@ -63,8 +68,15 @@ export declare class UnitClassificationsField extends UnitField<UnitClassificati
|
|
|
63
68
|
protected getNativeFieldValue(instance: Unit): UnitClassifications;
|
|
64
69
|
protected setNativeFieldValue(instance: Unit, value: UnitClassifications): boolean;
|
|
65
70
|
}
|
|
71
|
+
export declare class UnitFlyHeightField extends UnitFloatField {
|
|
72
|
+
protected getNativeFieldValue(instance: Unit): number;
|
|
73
|
+
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
74
|
+
}
|
|
66
75
|
export declare class UnitPropulsionWindowField extends UnitFloatField {
|
|
67
76
|
protected getNativeFieldValue(instance: Unit): number;
|
|
68
77
|
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
69
78
|
}
|
|
79
|
+
export declare class UnitScalingValueField extends UnitFloatField {
|
|
80
|
+
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
81
|
+
}
|
|
70
82
|
export {};
|
|
@@ -18,8 +18,11 @@ local convertUnitStringField = ConvertUnitStringField
|
|
|
18
18
|
local convertUnitWeaponIntegerField = ConvertUnitWeaponIntegerField
|
|
19
19
|
local getUnitWeaponIntegerField = BlzGetUnitWeaponIntegerField
|
|
20
20
|
local setUnitWeaponIntegerField = BlzSetUnitWeaponIntegerField
|
|
21
|
+
local getUnitFlyHeight = GetUnitFlyHeight
|
|
22
|
+
local setUnitFlyHeight = SetUnitFlyHeight
|
|
21
23
|
local getUnitPropulsionWindow = GetUnitPropWindow
|
|
22
24
|
local setUnitPropulsionWindow = SetUnitPropWindow
|
|
25
|
+
local setUnitScale = SetUnitScale
|
|
23
26
|
____exports.UnitField = __TS__Class()
|
|
24
27
|
local UnitField = ____exports.UnitField
|
|
25
28
|
UnitField.name = "UnitField"
|
|
@@ -38,6 +41,13 @@ __TS__SetDescriptor(
|
|
|
38
41
|
end},
|
|
39
42
|
true
|
|
40
43
|
)
|
|
44
|
+
__TS__ObjectDefineProperty(
|
|
45
|
+
UnitField,
|
|
46
|
+
"valueChangeEvent",
|
|
47
|
+
{get = function(self)
|
|
48
|
+
return self:getOrCreateValueChangeEvent()
|
|
49
|
+
end}
|
|
50
|
+
)
|
|
41
51
|
____exports.UnitBooleanField = __TS__Class()
|
|
42
52
|
local UnitBooleanField = ____exports.UnitBooleanField
|
|
43
53
|
UnitBooleanField.name = "UnitBooleanField"
|
|
@@ -59,6 +69,13 @@ __TS__SetDescriptor(
|
|
|
59
69
|
end},
|
|
60
70
|
true
|
|
61
71
|
)
|
|
72
|
+
__TS__ObjectDefineProperty(
|
|
73
|
+
UnitBooleanField,
|
|
74
|
+
"valueChangeEvent",
|
|
75
|
+
{get = function(self)
|
|
76
|
+
return self:getOrCreateValueChangeEvent()
|
|
77
|
+
end}
|
|
78
|
+
)
|
|
62
79
|
____exports.UnitFloatField = __TS__Class()
|
|
63
80
|
local UnitFloatField = ____exports.UnitFloatField
|
|
64
81
|
UnitFloatField.name = "UnitFloatField"
|
|
@@ -80,6 +97,13 @@ __TS__SetDescriptor(
|
|
|
80
97
|
end},
|
|
81
98
|
true
|
|
82
99
|
)
|
|
100
|
+
__TS__ObjectDefineProperty(
|
|
101
|
+
UnitFloatField,
|
|
102
|
+
"valueChangeEvent",
|
|
103
|
+
{get = function(self)
|
|
104
|
+
return self:getOrCreateValueChangeEvent()
|
|
105
|
+
end}
|
|
106
|
+
)
|
|
83
107
|
____exports.UnitIntegerField = __TS__Class()
|
|
84
108
|
local UnitIntegerField = ____exports.UnitIntegerField
|
|
85
109
|
UnitIntegerField.name = "UnitIntegerField"
|
|
@@ -101,6 +125,13 @@ __TS__SetDescriptor(
|
|
|
101
125
|
end},
|
|
102
126
|
true
|
|
103
127
|
)
|
|
128
|
+
__TS__ObjectDefineProperty(
|
|
129
|
+
UnitIntegerField,
|
|
130
|
+
"valueChangeEvent",
|
|
131
|
+
{get = function(self)
|
|
132
|
+
return self:getOrCreateValueChangeEvent()
|
|
133
|
+
end}
|
|
134
|
+
)
|
|
104
135
|
____exports.UnitStringField = __TS__Class()
|
|
105
136
|
local UnitStringField = ____exports.UnitStringField
|
|
106
137
|
UnitStringField.name = "UnitStringField"
|
|
@@ -122,6 +153,13 @@ __TS__SetDescriptor(
|
|
|
122
153
|
end},
|
|
123
154
|
true
|
|
124
155
|
)
|
|
156
|
+
__TS__ObjectDefineProperty(
|
|
157
|
+
UnitStringField,
|
|
158
|
+
"valueChangeEvent",
|
|
159
|
+
{get = function(self)
|
|
160
|
+
return self:getOrCreateValueChangeEvent()
|
|
161
|
+
end}
|
|
162
|
+
)
|
|
125
163
|
____exports.UnitWeaponField = __TS__Class()
|
|
126
164
|
local UnitWeaponField = ____exports.UnitWeaponField
|
|
127
165
|
UnitWeaponField.name = "UnitWeaponField"
|
|
@@ -238,6 +276,17 @@ __TS__SetDescriptor(
|
|
|
238
276
|
end},
|
|
239
277
|
true
|
|
240
278
|
)
|
|
279
|
+
____exports.UnitFlyHeightField = __TS__Class()
|
|
280
|
+
local UnitFlyHeightField = ____exports.UnitFlyHeightField
|
|
281
|
+
UnitFlyHeightField.name = "UnitFlyHeightField"
|
|
282
|
+
__TS__ClassExtends(UnitFlyHeightField, ____exports.UnitFloatField)
|
|
283
|
+
function UnitFlyHeightField.prototype.getNativeFieldValue(self, instance)
|
|
284
|
+
return getUnitFlyHeight(instance.handle)
|
|
285
|
+
end
|
|
286
|
+
function UnitFlyHeightField.prototype.setNativeFieldValue(self, instance, value)
|
|
287
|
+
setUnitFlyHeight(instance.handle, value, 100000)
|
|
288
|
+
return true
|
|
289
|
+
end
|
|
241
290
|
____exports.UnitPropulsionWindowField = __TS__Class()
|
|
242
291
|
local UnitPropulsionWindowField = ____exports.UnitPropulsionWindowField
|
|
243
292
|
UnitPropulsionWindowField.name = "UnitPropulsionWindowField"
|
|
@@ -249,4 +298,12 @@ function UnitPropulsionWindowField.prototype.setNativeFieldValue(self, instance,
|
|
|
249
298
|
setUnitPropulsionWindow(instance.handle, value)
|
|
250
299
|
return true
|
|
251
300
|
end
|
|
301
|
+
____exports.UnitScalingValueField = __TS__Class()
|
|
302
|
+
local UnitScalingValueField = ____exports.UnitScalingValueField
|
|
303
|
+
UnitScalingValueField.name = "UnitScalingValueField"
|
|
304
|
+
__TS__ClassExtends(UnitScalingValueField, ____exports.UnitFloatField)
|
|
305
|
+
function UnitScalingValueField.prototype.setNativeFieldValue(self, instance, value)
|
|
306
|
+
setUnitScale(instance.handle, value, value, value)
|
|
307
|
+
return UnitScalingValueField.____super.prototype.setNativeFieldValue(self, instance, value)
|
|
308
|
+
end
|
|
252
309
|
return ____exports
|
package/engine/object-field.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export type ObjectFieldValueChangeEvent<T extends ObjectField<any, any, any, any
|
|
|
36
36
|
]> : never;
|
|
37
37
|
export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> = Omit<T, "setValue" | "removeValue" | "trySetValue">;
|
|
38
38
|
type ReadonlyObjectFieldConstructor<T extends ObjectField> = OmitConstructor<typeof ObjectField> & (abstract new (...args: any[]) => ReadonlyObjectFieldType<T>);
|
|
39
|
-
type ObjectFieldModifier<InstanceType extends AnyNotNil, ValueType extends number | string | boolean> = (instance: InstanceType, currentValue: ValueType, originalValue: ValueType) => ValueType;
|
|
40
|
-
type ObjectLevelFieldModifier<InstanceType extends AnyNotNil, ValueType extends number | string | boolean> = (instance: InstanceType, level: number, currentValue: ValueType, originalValue: ValueType) => ValueType;
|
|
39
|
+
export type ObjectFieldModifier<InstanceType extends AnyNotNil, ValueType extends number | string | boolean> = (instance: InstanceType, currentValue: ValueType, originalValue: ValueType) => ValueType;
|
|
40
|
+
export type ObjectLevelFieldModifier<InstanceType extends AnyNotNil, ValueType extends number | string | boolean> = (instance: InstanceType, level: number, currentValue: ValueType, originalValue: ValueType) => ValueType;
|
|
41
41
|
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> {
|
|
42
42
|
protected abstract readonly defaultValue: ValueType;
|
|
43
43
|
protected abstract getNativeFieldValue(instance: InstanceType): ValueType;
|