warscript 0.0.1-dev.b9f7033 → 0.0.1-dev.baa67d8
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 +1 -0
- package/attributes.lua +9 -0
- package/binarywriter.lua +0 -12
- 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/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +8 -2
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +7 -1
- package/engine/behavior.lua +88 -65
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability.d.ts +2 -1
- package/engine/behaviour/ability.lua +2 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +8 -4
- package/engine/behaviour/unit/stun-immunity.lua +12 -3
- package/engine/behaviour/unit.d.ts +9 -3
- package/engine/behaviour/unit.lua +94 -22
- package/engine/buff.d.ts +12 -2
- package/engine/buff.lua +80 -17
- package/engine/internal/item.d.ts +12 -12
- package/engine/internal/item.lua +41 -26
- package/engine/internal/unit/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit-missile-launch.lua +44 -20
- package/engine/internal/unit.d.ts +13 -10
- package/engine/internal/unit.lua +83 -64
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/entry/ability-type.lua +4 -1
- package/engine/object-data/entry/destructible-type.d.ts +17 -1
- package/engine/object-data/entry/destructible-type.lua +90 -0
- 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 +7 -1
- package/engine/object-field.lua +232 -111
- 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/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +3 -2
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +5 -1
- package/utility/callback-array.lua +16 -1
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- package/utility/types.d.ts +3 -0
package/engine/buff.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { UnitBehavior } from "./behaviour/unit";
|
|
|
13
13
|
import type { Widget } from "../core/types/widget";
|
|
14
14
|
import { Destructor } from "../destroyable";
|
|
15
15
|
import { Event } from "../event";
|
|
16
|
+
import { AbilityBehavior } from "./behaviour/ability";
|
|
16
17
|
export type BuffConstructor<T extends Buff<any> = Buff<any>, Args extends any[] = any> = OmitConstructor<typeof Buff<any>> & (new (...args: Args) => T);
|
|
17
18
|
type EnumParameterValueType<T extends number> = T | AbilityEnumLevelField<T>;
|
|
18
19
|
type NumberParameterValueType = number | AbilityNumberField | AbilityNumberLevelField;
|
|
@@ -79,6 +80,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
79
80
|
healingOnExpiration?: NumberParameterValueType;
|
|
80
81
|
killsOnExpiration?: BooleanParameterValueType;
|
|
81
82
|
explodesOnExpiration?: BooleanParameterValueType;
|
|
83
|
+
abilityCooldownFactor?: NumberParameterValueType;
|
|
82
84
|
uniqueGroup?: BuffUniqueGroup;
|
|
83
85
|
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
84
86
|
declare const enum BuffPropertyKey {
|
|
@@ -124,7 +126,9 @@ declare const enum BuffPropertyKey {
|
|
|
124
126
|
PROVIDES_INVULNERABILITY = 139,
|
|
125
127
|
KILLS_ON_EXPIRATION = 140,
|
|
126
128
|
EXPLODES_ON_EXPIRATION = 141,
|
|
127
|
-
MISS_PROBABILITY = 142
|
|
129
|
+
MISS_PROBABILITY = 142,
|
|
130
|
+
ABILITY_COOLDOWN_FACTOR = 143,
|
|
131
|
+
ABILITY_COOLDOWN_MODIFIER = 144
|
|
128
132
|
}
|
|
129
133
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
130
134
|
LEAST_DURATION = 0
|
|
@@ -138,7 +142,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
138
142
|
polarity: BuffPolarityParameterType,
|
|
139
143
|
resistanceType: BuffResistanceTypeParameterType,
|
|
140
144
|
...abilityOrParameters: [
|
|
141
|
-
ability?: Ability,
|
|
145
|
+
ability?: Ability | AbilityBehavior,
|
|
142
146
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
143
147
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
144
148
|
];
|
|
@@ -187,6 +191,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
187
191
|
private [BuffPropertyKey.PROVIDES_INVULNERABILITY]?;
|
|
188
192
|
private [BuffPropertyKey.KILLS_ON_EXPIRATION]?;
|
|
189
193
|
private [BuffPropertyKey.EXPLODES_ON_EXPIRATION]?;
|
|
194
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_FACTOR]?;
|
|
195
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_MODIFIER]?;
|
|
190
196
|
protected static readonly defaultParameters: BuffParameters;
|
|
191
197
|
get source(): Unit;
|
|
192
198
|
readonly typeId: ApplicableBuffTypeId;
|
|
@@ -262,6 +268,10 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
262
268
|
get duration(): number;
|
|
263
269
|
get remainingDuration(): number;
|
|
264
270
|
set remainingDuration(remainingDuration: number);
|
|
271
|
+
get abilityCooldownFactor(): number;
|
|
272
|
+
set abilityCooldownFactor(abilityCooldownFactor: number);
|
|
273
|
+
onAbilityGained(ability: Ability): void;
|
|
274
|
+
onAbilityLost(ability: Ability): void;
|
|
265
275
|
flashEffect(...parameters: [
|
|
266
276
|
...widgetOrXY: [] | [Widget] | [x: number, x: number],
|
|
267
277
|
...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,10 @@ 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
|
|
56
|
+
local ____ability = require("engine.behaviour.ability")
|
|
57
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
53
58
|
local getUnitAbility = BlzGetUnitAbility
|
|
54
59
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
55
60
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -121,7 +126,8 @@ local buffParametersKeys = {
|
|
|
121
126
|
damageOnExpiration = true,
|
|
122
127
|
healingOnExpiration = true,
|
|
123
128
|
killsOnExpiration = true,
|
|
124
|
-
explodesOnExpiration = true
|
|
129
|
+
explodesOnExpiration = true,
|
|
130
|
+
abilityCooldownFactor = true
|
|
125
131
|
}
|
|
126
132
|
local function resolveEnumValue(ability, level, value)
|
|
127
133
|
if value == nil or type(value) == "number" then
|
|
@@ -198,7 +204,8 @@ local buffNumberParameters = {
|
|
|
198
204
|
"healingPerInterval",
|
|
199
205
|
"healingOverDuration",
|
|
200
206
|
"damageOnExpiration",
|
|
201
|
-
"healingOnExpiration"
|
|
207
|
+
"healingOnExpiration",
|
|
208
|
+
"abilityCooldownFactor"
|
|
202
209
|
}
|
|
203
210
|
local unsuccessfulApplicationMarker = {}
|
|
204
211
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -317,33 +324,38 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
317
324
|
local polarity
|
|
318
325
|
local resistanceType
|
|
319
326
|
local ability
|
|
327
|
+
local abilityBehavior
|
|
320
328
|
if type(typeIdOrTypeIds) ~= "number" then
|
|
321
329
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
322
330
|
polarity = resistanceTypeOrPolarity
|
|
323
331
|
resistanceType = abilityOrParametersOrResistanceType
|
|
324
|
-
if __TS__InstanceOf(parametersOrAbility,
|
|
332
|
+
if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
|
|
333
|
+
abilityBehavior = parametersOrAbility
|
|
334
|
+
ability = abilityBehavior.ability
|
|
335
|
+
elseif __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
325
336
|
ability = parametersOrAbility
|
|
326
|
-
|
|
327
|
-
ability = nil
|
|
337
|
+
elseif parametersOrAbility ~= nil then
|
|
328
338
|
parameters = parametersOrAbility
|
|
329
339
|
end
|
|
330
340
|
else
|
|
331
341
|
typeId = typeIdOrTypeIds
|
|
332
342
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
333
343
|
resistanceType = resistanceTypeOrPolarity
|
|
334
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType,
|
|
344
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
|
|
345
|
+
abilityBehavior = abilityOrParametersOrResistanceType
|
|
346
|
+
ability = abilityBehavior.ability
|
|
347
|
+
parameters = parametersOrAbility
|
|
348
|
+
elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
335
349
|
ability = abilityOrParametersOrResistanceType
|
|
336
350
|
parameters = parametersOrAbility
|
|
337
|
-
|
|
338
|
-
ability = nil
|
|
351
|
+
elseif abilityOrParametersOrResistanceType ~= nil then
|
|
339
352
|
parameters = abilityOrParametersOrResistanceType
|
|
353
|
+
else
|
|
354
|
+
parameters = parametersOrAbility
|
|
340
355
|
end
|
|
341
356
|
end
|
|
357
|
+
self.sourceAbilityBehavior = abilityBehavior
|
|
342
358
|
self.typeId = typeId
|
|
343
|
-
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
344
|
-
parameters = ability
|
|
345
|
-
ability = nil
|
|
346
|
-
end
|
|
347
359
|
local defaultParameters = self.constructor.defaultParameters
|
|
348
360
|
local level = parameters and parameters.level or defaultParameters.level
|
|
349
361
|
local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
|
|
@@ -506,6 +518,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
518
|
self[100] = 1
|
|
507
519
|
Event.invoke(buffCreatedEvent, self)
|
|
508
520
|
end
|
|
521
|
+
function Buff.prototype.onAbilityGained(self, ability)
|
|
522
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
523
|
+
local abilityCooldownModifier = self[144]
|
|
524
|
+
if abilityCooldownModifier then
|
|
525
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
function Buff.prototype.onAbilityLost(self, ability)
|
|
530
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
531
|
+
local abilityCooldownModifier = self[144]
|
|
532
|
+
if abilityCooldownModifier then
|
|
533
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
|
|
534
|
+
end
|
|
535
|
+
end
|
|
536
|
+
end
|
|
509
537
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
510
538
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
511
539
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
@@ -580,6 +608,12 @@ function Buff.prototype.onDestroy(self)
|
|
|
580
608
|
behavior:destroy()
|
|
581
609
|
end
|
|
582
610
|
end
|
|
611
|
+
local previousAbilityCooldownModifier = self[144]
|
|
612
|
+
if previousAbilityCooldownModifier then
|
|
613
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
614
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
615
|
+
end
|
|
616
|
+
end
|
|
583
617
|
if self[139] then
|
|
584
618
|
unit:decrementInvulnerabilityCounter()
|
|
585
619
|
end
|
|
@@ -588,7 +622,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
588
622
|
end
|
|
589
623
|
if self[136] then
|
|
590
624
|
if self[137] then
|
|
591
|
-
unit:
|
|
625
|
+
unit:decrementForceStunCounter()
|
|
592
626
|
end
|
|
593
627
|
unit:decrementStunCounter()
|
|
594
628
|
end
|
|
@@ -987,13 +1021,13 @@ __TS__SetDescriptor(
|
|
|
987
1021
|
set = function(self, stuns)
|
|
988
1022
|
if not stuns and self[136] then
|
|
989
1023
|
if self[137] then
|
|
990
|
-
self.object:
|
|
1024
|
+
self.object:decrementForceStunCounter()
|
|
991
1025
|
end
|
|
992
1026
|
self.object:decrementStunCounter()
|
|
993
1027
|
self[136] = nil
|
|
994
1028
|
elseif stuns and not self[136] then
|
|
995
1029
|
if self[137] then
|
|
996
|
-
self.object:
|
|
1030
|
+
self.object:incrementForceStunCounter()
|
|
997
1031
|
end
|
|
998
1032
|
self.object:incrementStunCounter()
|
|
999
1033
|
self[136] = true
|
|
@@ -1016,12 +1050,12 @@ __TS__SetDescriptor(
|
|
|
1016
1050
|
set = function(self, ignoresStunImmunity)
|
|
1017
1051
|
if not ignoresStunImmunity and self[137] then
|
|
1018
1052
|
if self[136] then
|
|
1019
|
-
self.object:
|
|
1053
|
+
self.object:decrementForceStunCounter()
|
|
1020
1054
|
end
|
|
1021
1055
|
self[137] = nil
|
|
1022
1056
|
elseif ignoresStunImmunity and not self[137] then
|
|
1023
1057
|
if self[136] then
|
|
1024
|
-
self.object:
|
|
1058
|
+
self.object:incrementForceStunCounter()
|
|
1025
1059
|
end
|
|
1026
1060
|
self[137] = true
|
|
1027
1061
|
end
|
|
@@ -1269,6 +1303,32 @@ __TS__SetDescriptor(
|
|
|
1269
1303
|
},
|
|
1270
1304
|
true
|
|
1271
1305
|
)
|
|
1306
|
+
__TS__SetDescriptor(
|
|
1307
|
+
Buff.prototype,
|
|
1308
|
+
"abilityCooldownFactor",
|
|
1309
|
+
{
|
|
1310
|
+
get = function(self)
|
|
1311
|
+
return self[143] or 1
|
|
1312
|
+
end,
|
|
1313
|
+
set = function(self, abilityCooldownFactor)
|
|
1314
|
+
local previousAbilityCooldownModifier = self[144]
|
|
1315
|
+
if previousAbilityCooldownModifier then
|
|
1316
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1317
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
1318
|
+
end
|
|
1319
|
+
end
|
|
1320
|
+
local function modifier(ability, level, cooldown)
|
|
1321
|
+
return cooldown * abilityCooldownFactor
|
|
1322
|
+
end
|
|
1323
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1324
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
|
|
1325
|
+
end
|
|
1326
|
+
self[144] = modifier
|
|
1327
|
+
self[143] = abilityCooldownFactor
|
|
1328
|
+
end
|
|
1329
|
+
},
|
|
1330
|
+
true
|
|
1331
|
+
)
|
|
1272
1332
|
Buff.createdEvent = buffCreatedEvent
|
|
1273
1333
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1274
1334
|
(function(self)
|
|
@@ -1327,5 +1387,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1327
1387
|
buffCreatedEvent:addListener(function(buff)
|
|
1328
1388
|
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1329
1389
|
end)
|
|
1390
|
+
buffBeingDestroyedEvent:addListener(function(buff)
|
|
1391
|
+
UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
|
|
1392
|
+
end)
|
|
1330
1393
|
end)(Buff)
|
|
1331
1394
|
return ____exports
|
|
@@ -28,22 +28,22 @@ export declare class Item extends Handle<jitem> {
|
|
|
28
28
|
get extendedTooltip(): string;
|
|
29
29
|
set iconPath(v: string);
|
|
30
30
|
get iconPath(): string;
|
|
31
|
-
set
|
|
32
|
-
get
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
31
|
+
set dropsOnDeath(dropsOnDeath: boolean);
|
|
32
|
+
get dropsOnDeath(): boolean;
|
|
33
|
+
set canBeDropped(canBeDropped: boolean);
|
|
34
|
+
get canBeDropped(): boolean;
|
|
35
|
+
set canBeSold(canBeSold: boolean);
|
|
36
|
+
get canBeSold(): boolean;
|
|
37
|
+
set perishes(perishes: boolean);
|
|
38
|
+
get perishes(): boolean;
|
|
39
|
+
set isPowerUp(isPowerUp: boolean);
|
|
40
|
+
get isPowerUp(): boolean;
|
|
41
41
|
get isAlive(): boolean;
|
|
42
42
|
get isDead(): boolean;
|
|
43
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
44
44
|
get isInvulnerable(): boolean;
|
|
45
|
-
set
|
|
46
|
-
get
|
|
45
|
+
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
+
get isActivelyUsed(): boolean;
|
|
47
47
|
set visible(v: boolean);
|
|
48
48
|
get visible(): boolean;
|
|
49
49
|
set level(v: number);
|
package/engine/internal/item.lua
CHANGED
|
@@ -50,6 +50,13 @@ local unitRemoveItem = UnitRemoveItem
|
|
|
50
50
|
local unitUseItem = UnitUseItem
|
|
51
51
|
local unitUseItemPoint = UnitUseItemPoint
|
|
52
52
|
local unitUseItemTarget = UnitUseItemTarget
|
|
53
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
|
+
local setItemDroppable = SetItemDroppable
|
|
55
|
+
local setItemPawnable = SetItemPawnable
|
|
56
|
+
local isItemPawnable = IsItemPawnable
|
|
57
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
58
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
59
|
+
local getItemBooleanField = BlzGetItemBooleanField
|
|
53
60
|
local tableRemove = table.remove
|
|
54
61
|
_G.SetItemCharges = function(whichItem, charges)
|
|
55
62
|
setItemCharges(whichItem, charges)
|
|
@@ -58,9 +65,6 @@ _G.SetItemCharges = function(whichItem, charges)
|
|
|
58
65
|
____exports.Item:of(whichItem)
|
|
59
66
|
)
|
|
60
67
|
end
|
|
61
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
62
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
63
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
64
68
|
invoke = Event.invoke
|
|
65
69
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
66
70
|
---
|
|
@@ -328,65 +332,68 @@ __TS__SetDescriptor(
|
|
|
328
332
|
)
|
|
329
333
|
__TS__SetDescriptor(
|
|
330
334
|
Item.prototype,
|
|
331
|
-
"
|
|
335
|
+
"dropsOnDeath",
|
|
332
336
|
{
|
|
333
337
|
get = function(self)
|
|
334
|
-
return
|
|
338
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
335
339
|
end,
|
|
336
|
-
set = function(self,
|
|
337
|
-
|
|
340
|
+
set = function(self, dropsOnDeath)
|
|
341
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
338
342
|
end
|
|
339
343
|
},
|
|
340
344
|
true
|
|
341
345
|
)
|
|
342
346
|
__TS__SetDescriptor(
|
|
343
347
|
Item.prototype,
|
|
344
|
-
"
|
|
348
|
+
"canBeDropped",
|
|
345
349
|
{
|
|
346
350
|
get = function(self)
|
|
347
|
-
return
|
|
351
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
348
352
|
end,
|
|
349
|
-
set = function(self,
|
|
350
|
-
|
|
353
|
+
set = function(self, canBeDropped)
|
|
354
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
351
355
|
end
|
|
352
356
|
},
|
|
353
357
|
true
|
|
354
358
|
)
|
|
355
359
|
__TS__SetDescriptor(
|
|
356
360
|
Item.prototype,
|
|
357
|
-
"
|
|
361
|
+
"canBeSold",
|
|
358
362
|
{
|
|
359
363
|
get = function(self)
|
|
360
|
-
return
|
|
364
|
+
return isItemPawnable(self.handle)
|
|
361
365
|
end,
|
|
362
|
-
set = function(self,
|
|
363
|
-
|
|
366
|
+
set = function(self, canBeSold)
|
|
367
|
+
setItemPawnable(self.handle, canBeSold)
|
|
364
368
|
end
|
|
365
369
|
},
|
|
366
370
|
true
|
|
367
371
|
)
|
|
368
372
|
__TS__SetDescriptor(
|
|
369
373
|
Item.prototype,
|
|
370
|
-
"
|
|
374
|
+
"perishes",
|
|
371
375
|
{
|
|
372
376
|
get = function(self)
|
|
373
377
|
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
374
378
|
end,
|
|
375
|
-
set = function(self,
|
|
376
|
-
|
|
379
|
+
set = function(self, perishes)
|
|
380
|
+
local handle = self.handle
|
|
381
|
+
local powerUp = isItemPowerup(handle)
|
|
382
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
383
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
377
384
|
end
|
|
378
385
|
},
|
|
379
386
|
true
|
|
380
387
|
)
|
|
381
388
|
__TS__SetDescriptor(
|
|
382
389
|
Item.prototype,
|
|
383
|
-
"
|
|
390
|
+
"isPowerUp",
|
|
384
391
|
{
|
|
385
392
|
get = function(self)
|
|
386
393
|
return isItemPowerup(self.handle)
|
|
387
394
|
end,
|
|
388
|
-
set = function(self,
|
|
389
|
-
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED,
|
|
395
|
+
set = function(self, isPowerUp)
|
|
396
|
+
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, isPowerUp)
|
|
390
397
|
end
|
|
391
398
|
},
|
|
392
399
|
true
|
|
@@ -422,16 +429,24 @@ __TS__SetDescriptor(
|
|
|
422
429
|
)
|
|
423
430
|
__TS__SetDescriptor(
|
|
424
431
|
Item.prototype,
|
|
425
|
-
"
|
|
432
|
+
"isActivelyUsed",
|
|
426
433
|
{
|
|
427
434
|
get = function(self)
|
|
428
435
|
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
429
436
|
end,
|
|
430
|
-
set = function(self,
|
|
437
|
+
set = function(self, isActivelyUsed)
|
|
431
438
|
local handle = self.handle
|
|
432
|
-
local
|
|
433
|
-
|
|
434
|
-
|
|
439
|
+
local powerUp = isItemPowerup(handle)
|
|
440
|
+
local perishes = getItemBooleanField(handle, ITEM_BF_PERISHABLE)
|
|
441
|
+
local dropsOnDeath = getItemBooleanField(handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
442
|
+
local canBeDropped = getItemBooleanField(handle, ITEM_BF_CAN_BE_DROPPED)
|
|
443
|
+
local canBeSold = isItemPawnable(handle)
|
|
444
|
+
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, isActivelyUsed)
|
|
445
|
+
setItemPawnable(handle, canBeSold)
|
|
446
|
+
setItemDroppable(handle, canBeDropped)
|
|
447
|
+
setItemDropOnDeath(handle, dropsOnDeath)
|
|
448
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
449
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
435
450
|
end
|
|
436
451
|
},
|
|
437
452
|
true
|
|
@@ -133,55 +133,55 @@ declare module "../unit" {
|
|
|
133
133
|
}
|
|
134
134
|
declare module "../unit" {
|
|
135
135
|
namespace Unit {
|
|
136
|
-
const
|
|
136
|
+
const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
declare module "../unit" {
|
|
140
140
|
namespace Unit {
|
|
141
|
-
const
|
|
141
|
+
const abilityStopEvent: DispatchingEvent<[Unit, Ability]>;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
declare module "../unit" {
|
|
145
145
|
namespace Unit {
|
|
146
|
-
const
|
|
146
|
+
const abilityCommandEvent: {
|
|
147
|
+
readonly [abilityTypeId: number]: {
|
|
148
|
+
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
declare module "../unit" {
|
|
150
154
|
namespace Unit {
|
|
151
|
-
const
|
|
155
|
+
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
declare module "../unit" {
|
|
155
159
|
namespace Unit {
|
|
156
|
-
const
|
|
160
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
declare module "../unit" {
|
|
160
164
|
namespace Unit {
|
|
161
|
-
const
|
|
165
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
declare module "../unit" {
|
|
165
169
|
namespace Unit {
|
|
166
|
-
const
|
|
170
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
declare module "../unit" {
|
|
170
174
|
namespace Unit {
|
|
171
|
-
const
|
|
175
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
declare module "../unit" {
|
|
175
179
|
namespace Unit {
|
|
176
|
-
const
|
|
180
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
declare module "../unit" {
|
|
180
184
|
namespace Unit {
|
|
181
|
-
const
|
|
182
|
-
readonly [abilityTypeId: number]: {
|
|
183
|
-
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
185
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -22,7 +22,12 @@ local checkNotNull = ____preconditions.checkNotNull
|
|
|
22
22
|
local ____lazy = require("utility.lazy")
|
|
23
23
|
local lazyRecord = ____lazy.lazyRecord
|
|
24
24
|
local ____timer = require("core.types.timer")
|
|
25
|
+
local consumeZeroTimerCallback = ____timer.consumeZeroTimerCallback
|
|
25
26
|
local Timer = ____timer.Timer
|
|
27
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
28
|
+
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
29
|
+
local ____attributes = require("attributes")
|
|
30
|
+
local attribute = ____attributes.attribute
|
|
26
31
|
local eventInvoke = Event.invoke
|
|
27
32
|
local condition = Condition
|
|
28
33
|
local createTrigger = CreateTrigger
|
|
@@ -347,10 +352,65 @@ rawset(
|
|
|
347
352
|
extractAbilityTypeId
|
|
348
353
|
)
|
|
349
354
|
)
|
|
355
|
+
local internalAbilityChannelingFinishEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_FINISH, collectUnitAbilityEventParameters)
|
|
356
|
+
rawset(
|
|
357
|
+
Unit,
|
|
358
|
+
"abilityChannelingFinishEvent",
|
|
359
|
+
createDispatchingEvent(internalAbilityChannelingFinishEvent, extractAbilityTypeId)
|
|
360
|
+
)
|
|
361
|
+
local internalAbilityStopEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters)
|
|
362
|
+
rawset(
|
|
363
|
+
Unit,
|
|
364
|
+
"abilityStopEvent",
|
|
365
|
+
createDispatchingEvent(internalAbilityStopEvent, extractAbilityTypeId)
|
|
366
|
+
)
|
|
367
|
+
rawset(
|
|
368
|
+
Unit,
|
|
369
|
+
"abilityCommandEvent",
|
|
370
|
+
lazyRecord(function(abilityTypeId)
|
|
371
|
+
return lazyRecord(function(orderTypeStringId)
|
|
372
|
+
return __TS__New(
|
|
373
|
+
InitializingEvent,
|
|
374
|
+
function(event)
|
|
375
|
+
local trigger = createTrigger()
|
|
376
|
+
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
377
|
+
triggerAddCondition(
|
|
378
|
+
trigger,
|
|
379
|
+
condition(function()
|
|
380
|
+
local unit = Unit:of(getTriggerUnit())
|
|
381
|
+
if unit ~= nil then
|
|
382
|
+
local ability = unit:getAbility(abilityTypeId)
|
|
383
|
+
if ability ~= nil then
|
|
384
|
+
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end)
|
|
388
|
+
)
|
|
389
|
+
end
|
|
390
|
+
)
|
|
391
|
+
end)
|
|
392
|
+
end)
|
|
393
|
+
)
|
|
350
394
|
local internalAbilityImpactEvent = __TS__New(Event)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
395
|
+
local impactCallbackIdAttribute = attribute()
|
|
396
|
+
local function invokeImpactEvent(unit, ability, ...)
|
|
397
|
+
ability[impactCallbackIdAttribute] = nil
|
|
398
|
+
eventInvoke(internalAbilityImpactEvent, unit, ability, ...)
|
|
399
|
+
end
|
|
400
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
401
|
+
999999,
|
|
402
|
+
function(unit, ability, ...)
|
|
403
|
+
ability[impactCallbackIdAttribute] = Timer:run(invokeImpactEvent, unit, ability, ...)
|
|
404
|
+
end
|
|
405
|
+
)
|
|
406
|
+
local function consumeImpactCallback(_, ability)
|
|
407
|
+
local impactCallbackId = ability[impactCallbackIdAttribute]
|
|
408
|
+
if impactCallbackId ~= nil then
|
|
409
|
+
consumeZeroTimerCallback(impactCallbackId)
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
internalAbilityChannelingFinishEvent:addListener(999999, consumeImpactCallback)
|
|
413
|
+
internalAbilityStopEvent:addListener(999999, consumeImpactCallback)
|
|
354
414
|
rawset(
|
|
355
415
|
Unit,
|
|
356
416
|
"abilityImpactEvent",
|
|
@@ -407,47 +467,14 @@ rawset(
|
|
|
407
467
|
extractAbilityTypeId
|
|
408
468
|
)
|
|
409
469
|
)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
Unit,
|
|
420
|
-
"abilityStopEvent",
|
|
421
|
-
createDispatchingEvent(
|
|
422
|
-
__TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters),
|
|
423
|
-
extractAbilityTypeId
|
|
424
|
-
)
|
|
425
|
-
)
|
|
426
|
-
rawset(
|
|
427
|
-
Unit,
|
|
428
|
-
"abilityCommandEvent",
|
|
429
|
-
lazyRecord(function(abilityTypeId)
|
|
430
|
-
return lazyRecord(function(orderTypeStringId)
|
|
431
|
-
return __TS__New(
|
|
432
|
-
InitializingEvent,
|
|
433
|
-
function(event)
|
|
434
|
-
local trigger = createTrigger()
|
|
435
|
-
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
436
|
-
triggerAddCondition(
|
|
437
|
-
trigger,
|
|
438
|
-
condition(function()
|
|
439
|
-
local unit = Unit:of(getTriggerUnit())
|
|
440
|
-
if unit ~= nil then
|
|
441
|
-
local ability = unit:getAbility(abilityTypeId)
|
|
442
|
-
if ability ~= nil then
|
|
443
|
-
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
444
|
-
end
|
|
445
|
-
end
|
|
446
|
-
end)
|
|
447
|
-
)
|
|
448
|
-
end
|
|
449
|
-
)
|
|
450
|
-
end)
|
|
451
|
-
end)
|
|
470
|
+
local spellEffectOnlyAbilityTypeIds = luaSetOf(fourCC("AAns"))
|
|
471
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
472
|
+
-999999,
|
|
473
|
+
function(unit, ability)
|
|
474
|
+
if spellEffectOnlyAbilityTypeIds[ability.parentTypeId] ~= nil then
|
|
475
|
+
eventInvoke(internalAbilityChannelingFinishEvent, unit, ability)
|
|
476
|
+
eventInvoke(internalAbilityStopEvent, unit, ability)
|
|
477
|
+
end
|
|
478
|
+
end
|
|
452
479
|
)
|
|
453
480
|
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
|