warscript 0.0.1-dev.eda504c → 0.0.1-dev.ee6e396
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/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +10 -2
- package/engine/behavior.lua +157 -76
- 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 +6 -1
- package/engine/behaviour/ability.lua +31 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -5
- package/engine/behaviour/unit/stun-immunity.lua +6 -5
- package/engine/behaviour/unit.d.ts +7 -3
- package/engine/behaviour/unit.lua +101 -24
- package/engine/buff.d.ts +19 -4
- package/engine/buff.lua +122 -41
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -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 +16 -6
- package/engine/internal/unit.d.ts +13 -19
- package/engine/internal/unit.lua +140 -173
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/destructible-type.d.ts +27 -1
- package/engine/object-data/entry/destructible-type.lua +155 -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 +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +9 -1
- package/engine/object-field.lua +265 -122
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +11 -3
- package/engine/standard/fields/unit.lua +15 -2
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +2 -1
- package/engine/unit.d.ts +5 -0
- package/engine/unit.lua +5 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +9 -7
- package/package.json +2 -2
- package/patch-lua.lua +15 -0
- package/utility/linked-map.d.ts +34 -0
- package/utility/linked-map.lua +101 -0
- package/utility/linked-set.d.ts +3 -1
- package/utility/linked-set.lua +38 -0
- package/utility/records.lua +20 -1
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
|
|
@@ -41,6 +42,7 @@ local BuffType = ____buff_2Dtype.BuffType
|
|
|
41
42
|
local ____unit = require("engine.behaviour.unit")
|
|
42
43
|
local UnitBehavior = ____unit.UnitBehavior
|
|
43
44
|
local ____arrays = require("utility.arrays")
|
|
45
|
+
local emptyArray = ____arrays.emptyArray
|
|
44
46
|
local forEach = ____arrays.forEach
|
|
45
47
|
local ____event = require("event")
|
|
46
48
|
local Event = ____event.Event
|
|
@@ -50,6 +52,12 @@ local ____item = require("engine.internal.item")
|
|
|
50
52
|
local Item = ____item.Item
|
|
51
53
|
local ____destructable = require("core.types.destructable")
|
|
52
54
|
local Destructable = ____destructable.Destructable
|
|
55
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
56
|
+
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
57
|
+
local ____ability = require("engine.behaviour.ability")
|
|
58
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
59
|
+
local ____records = require("utility.records")
|
|
60
|
+
local sortedKeysUnnested = ____records.sortedKeysUnnested
|
|
53
61
|
local getUnitAbility = BlzGetUnitAbility
|
|
54
62
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
55
63
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -98,6 +106,7 @@ local buffParametersKeys = {
|
|
|
98
106
|
armorIncreaseFactor = true,
|
|
99
107
|
attackSpeedIncreaseFactor = true,
|
|
100
108
|
movementSpeedIncreaseFactor = true,
|
|
109
|
+
manaRegenerationRateIncreaseFactor = true,
|
|
101
110
|
evasionProbability = true,
|
|
102
111
|
missProbability = true,
|
|
103
112
|
damageFactor = true,
|
|
@@ -121,7 +130,8 @@ local buffParametersKeys = {
|
|
|
121
130
|
damageOnExpiration = true,
|
|
122
131
|
healingOnExpiration = true,
|
|
123
132
|
killsOnExpiration = true,
|
|
124
|
-
explodesOnExpiration = true
|
|
133
|
+
explodesOnExpiration = true,
|
|
134
|
+
abilityCooldownFactor = true
|
|
125
135
|
}
|
|
126
136
|
local function resolveEnumValue(ability, level, value)
|
|
127
137
|
if value == nil or type(value) == "number" then
|
|
@@ -184,6 +194,7 @@ local buffNumberParameters = {
|
|
|
184
194
|
"durationIncreaseOnAutoAttack",
|
|
185
195
|
"attackSpeedIncreaseFactor",
|
|
186
196
|
"movementSpeedIncreaseFactor",
|
|
197
|
+
"manaRegenerationRateIncreaseFactor",
|
|
187
198
|
"evasionProbability",
|
|
188
199
|
"armorIncrease",
|
|
189
200
|
"damageFactor",
|
|
@@ -198,7 +209,8 @@ local buffNumberParameters = {
|
|
|
198
209
|
"healingPerInterval",
|
|
199
210
|
"healingOverDuration",
|
|
200
211
|
"damageOnExpiration",
|
|
201
|
-
"healingOnExpiration"
|
|
212
|
+
"healingOnExpiration",
|
|
213
|
+
"abilityCooldownFactor"
|
|
202
214
|
}
|
|
203
215
|
local unsuccessfulApplicationMarker = {}
|
|
204
216
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -317,33 +329,38 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
317
329
|
local polarity
|
|
318
330
|
local resistanceType
|
|
319
331
|
local ability
|
|
332
|
+
local abilityBehavior
|
|
320
333
|
if type(typeIdOrTypeIds) ~= "number" then
|
|
321
334
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
322
335
|
polarity = resistanceTypeOrPolarity
|
|
323
336
|
resistanceType = abilityOrParametersOrResistanceType
|
|
324
|
-
if __TS__InstanceOf(parametersOrAbility,
|
|
337
|
+
if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
|
|
338
|
+
abilityBehavior = parametersOrAbility
|
|
339
|
+
ability = abilityBehavior.ability
|
|
340
|
+
elseif __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
325
341
|
ability = parametersOrAbility
|
|
326
|
-
|
|
327
|
-
ability = nil
|
|
342
|
+
elseif parametersOrAbility ~= nil then
|
|
328
343
|
parameters = parametersOrAbility
|
|
329
344
|
end
|
|
330
345
|
else
|
|
331
346
|
typeId = typeIdOrTypeIds
|
|
332
347
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
333
348
|
resistanceType = resistanceTypeOrPolarity
|
|
334
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType,
|
|
349
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
|
|
350
|
+
abilityBehavior = abilityOrParametersOrResistanceType
|
|
351
|
+
ability = abilityBehavior.ability
|
|
352
|
+
parameters = parametersOrAbility
|
|
353
|
+
elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
335
354
|
ability = abilityOrParametersOrResistanceType
|
|
336
355
|
parameters = parametersOrAbility
|
|
337
|
-
|
|
338
|
-
ability = nil
|
|
356
|
+
elseif abilityOrParametersOrResistanceType ~= nil then
|
|
339
357
|
parameters = abilityOrParametersOrResistanceType
|
|
358
|
+
else
|
|
359
|
+
parameters = parametersOrAbility
|
|
340
360
|
end
|
|
341
361
|
end
|
|
362
|
+
self.sourceAbilityBehavior = abilityBehavior
|
|
342
363
|
self.typeId = typeId
|
|
343
|
-
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
344
|
-
parameters = ability
|
|
345
|
-
ability = nil
|
|
346
|
-
end
|
|
347
364
|
local defaultParameters = self.constructor.defaultParameters
|
|
348
365
|
local level = parameters and parameters.level or defaultParameters.level
|
|
349
366
|
local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
|
|
@@ -454,24 +471,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
454
471
|
abilityTypeIds = {}
|
|
455
472
|
self._abilityTypeIds = abilityTypeIds
|
|
456
473
|
end
|
|
457
|
-
for
|
|
474
|
+
for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
|
|
475
|
+
local abilityParameters = parametersAbilityTypeIds[abilityTypeId]
|
|
458
476
|
local addedAbility = _unit:addAbility(abilityTypeId)
|
|
459
477
|
if addedAbility ~= nil then
|
|
460
478
|
_unit:makeAbilityPermanent(abilityTypeId, true)
|
|
461
479
|
_unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
resolveNumberValue(ability, level, abilityParameterValue)
|
|
471
|
-
)
|
|
472
|
-
end
|
|
480
|
+
if abilityParameters.isButtonVisible == false then
|
|
481
|
+
_unit:hideAbility(abilityTypeId, true)
|
|
482
|
+
end
|
|
483
|
+
for ____, field in ipairs(abilityParameters.fields or emptyArray()) do
|
|
484
|
+
field[1]:setValue(
|
|
485
|
+
addedAbility,
|
|
486
|
+
resolveNumberValue(ability, level, field[2])
|
|
487
|
+
)
|
|
473
488
|
end
|
|
474
|
-
abilityTypeIds[
|
|
489
|
+
abilityTypeIds[#abilityTypeIds + 1] = abilityTypeId
|
|
475
490
|
end
|
|
476
491
|
end
|
|
477
492
|
local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
|
|
@@ -483,18 +498,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
483
498
|
self._behaviors = behaviors
|
|
484
499
|
end
|
|
485
500
|
end
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
501
|
+
if parameters ~= nil then
|
|
502
|
+
local additionalParameters = {}
|
|
503
|
+
for ____, key in ipairs(sortedKeysUnnested(parameters)) do
|
|
504
|
+
if not buffParametersKeys[key] then
|
|
505
|
+
if ability then
|
|
506
|
+
additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, parameters[key])
|
|
507
|
+
else
|
|
508
|
+
additionalParameters[key] = parameters[key]
|
|
509
|
+
end
|
|
493
510
|
end
|
|
494
511
|
end
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
512
|
+
if (next(additionalParameters)) ~= nil then
|
|
513
|
+
self.parameters = additionalParameters
|
|
514
|
+
end
|
|
498
515
|
end
|
|
499
516
|
end
|
|
500
517
|
if duration ~= nil and duration > 0 then
|
|
@@ -506,6 +523,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
523
|
self[100] = 1
|
|
507
524
|
Event.invoke(buffCreatedEvent, self)
|
|
508
525
|
end
|
|
526
|
+
function Buff.prototype.onAbilityGained(self, ability)
|
|
527
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
528
|
+
local abilityCooldownModifier = self[144]
|
|
529
|
+
if abilityCooldownModifier then
|
|
530
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
|
|
531
|
+
end
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
function Buff.prototype.onAbilityLost(self, ability)
|
|
535
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
536
|
+
local abilityCooldownModifier = self[144]
|
|
537
|
+
if abilityCooldownModifier then
|
|
538
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
|
|
539
|
+
end
|
|
540
|
+
end
|
|
541
|
+
end
|
|
509
542
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
510
543
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
511
544
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
@@ -580,6 +613,12 @@ function Buff.prototype.onDestroy(self)
|
|
|
580
613
|
behavior:destroy()
|
|
581
614
|
end
|
|
582
615
|
end
|
|
616
|
+
local previousAbilityCooldownModifier = self[144]
|
|
617
|
+
if previousAbilityCooldownModifier then
|
|
618
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
619
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
620
|
+
end
|
|
621
|
+
end
|
|
583
622
|
if self[139] then
|
|
584
623
|
unit:decrementInvulnerabilityCounter()
|
|
585
624
|
end
|
|
@@ -588,7 +627,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
588
627
|
end
|
|
589
628
|
if self[136] then
|
|
590
629
|
if self[137] then
|
|
591
|
-
unit:
|
|
630
|
+
unit:decrementForceStunCounter()
|
|
592
631
|
end
|
|
593
632
|
unit:decrementStunCounter()
|
|
594
633
|
end
|
|
@@ -596,7 +635,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
596
635
|
unit:decrementGhostCounter()
|
|
597
636
|
end
|
|
598
637
|
if self._abilityTypeIds ~= nil then
|
|
599
|
-
for abilityTypeId in
|
|
638
|
+
for ____, abilityTypeId in ipairs(self._abilityTypeIds) do
|
|
600
639
|
unit:removeAbility(abilityTypeId)
|
|
601
640
|
end
|
|
602
641
|
end
|
|
@@ -987,13 +1026,13 @@ __TS__SetDescriptor(
|
|
|
987
1026
|
set = function(self, stuns)
|
|
988
1027
|
if not stuns and self[136] then
|
|
989
1028
|
if self[137] then
|
|
990
|
-
self.object:
|
|
1029
|
+
self.object:decrementForceStunCounter()
|
|
991
1030
|
end
|
|
992
1031
|
self.object:decrementStunCounter()
|
|
993
1032
|
self[136] = nil
|
|
994
1033
|
elseif stuns and not self[136] then
|
|
995
1034
|
if self[137] then
|
|
996
|
-
self.object:
|
|
1035
|
+
self.object:incrementForceStunCounter()
|
|
997
1036
|
end
|
|
998
1037
|
self.object:incrementStunCounter()
|
|
999
1038
|
self[136] = true
|
|
@@ -1016,12 +1055,12 @@ __TS__SetDescriptor(
|
|
|
1016
1055
|
set = function(self, ignoresStunImmunity)
|
|
1017
1056
|
if not ignoresStunImmunity and self[137] then
|
|
1018
1057
|
if self[136] then
|
|
1019
|
-
self.object:
|
|
1058
|
+
self.object:decrementForceStunCounter()
|
|
1020
1059
|
end
|
|
1021
1060
|
self[137] = nil
|
|
1022
1061
|
elseif ignoresStunImmunity and not self[137] then
|
|
1023
1062
|
if self[136] then
|
|
1024
|
-
self.object:
|
|
1063
|
+
self.object:incrementForceStunCounter()
|
|
1025
1064
|
end
|
|
1026
1065
|
self[137] = true
|
|
1027
1066
|
end
|
|
@@ -1220,6 +1259,19 @@ __TS__SetDescriptor(
|
|
|
1220
1259
|
},
|
|
1221
1260
|
true
|
|
1222
1261
|
)
|
|
1262
|
+
__TS__SetDescriptor(
|
|
1263
|
+
Buff.prototype,
|
|
1264
|
+
"manaRegenerationRateIncreaseFactor",
|
|
1265
|
+
{
|
|
1266
|
+
get = function(self)
|
|
1267
|
+
return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
|
|
1268
|
+
end,
|
|
1269
|
+
set = function(self, manaRegenerationRateIncreaseFactor)
|
|
1270
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
|
|
1271
|
+
end
|
|
1272
|
+
},
|
|
1273
|
+
true
|
|
1274
|
+
)
|
|
1223
1275
|
__TS__SetDescriptor(
|
|
1224
1276
|
Buff.prototype,
|
|
1225
1277
|
"duration",
|
|
@@ -1269,6 +1321,32 @@ __TS__SetDescriptor(
|
|
|
1269
1321
|
},
|
|
1270
1322
|
true
|
|
1271
1323
|
)
|
|
1324
|
+
__TS__SetDescriptor(
|
|
1325
|
+
Buff.prototype,
|
|
1326
|
+
"abilityCooldownFactor",
|
|
1327
|
+
{
|
|
1328
|
+
get = function(self)
|
|
1329
|
+
return self[143] or 1
|
|
1330
|
+
end,
|
|
1331
|
+
set = function(self, abilityCooldownFactor)
|
|
1332
|
+
local previousAbilityCooldownModifier = self[144]
|
|
1333
|
+
if previousAbilityCooldownModifier then
|
|
1334
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1335
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
1336
|
+
end
|
|
1337
|
+
end
|
|
1338
|
+
local function modifier(ability, level, cooldown)
|
|
1339
|
+
return cooldown * abilityCooldownFactor
|
|
1340
|
+
end
|
|
1341
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1342
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
|
|
1343
|
+
end
|
|
1344
|
+
self[144] = modifier
|
|
1345
|
+
self[143] = abilityCooldownFactor
|
|
1346
|
+
end
|
|
1347
|
+
},
|
|
1348
|
+
true
|
|
1349
|
+
)
|
|
1272
1350
|
Buff.createdEvent = buffCreatedEvent
|
|
1273
1351
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1274
1352
|
(function(self)
|
|
@@ -1327,5 +1405,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1327
1405
|
buffCreatedEvent:addListener(function(buff)
|
|
1328
1406
|
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1329
1407
|
end)
|
|
1408
|
+
buffBeingDestroyedEvent:addListener(function(buff)
|
|
1409
|
+
UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
|
|
1410
|
+
end)
|
|
1330
1411
|
end)(Buff)
|
|
1331
1412
|
return ____exports
|
|
@@ -74,9 +74,12 @@ ____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ..
|
|
|
74
74
|
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
75
75
|
if latestInventoryAbilityTypeId ~= 0 then
|
|
76
76
|
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
77
|
-
for slot,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
for slot = 0, inventorySize - 1 do
|
|
78
|
+
local nativeItem = nativeItemBySlot[slot]
|
|
79
|
+
if nativeItem ~= nil then
|
|
80
|
+
unitAddItem(nativeUnit, nativeItem)
|
|
81
|
+
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
82
|
+
end
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____mana_2Dregeneration = require("engine.object-data.entry.ability-type.mana-regeneration")
|
|
3
|
+
local ManaRegenerationAbilityType = ____mana_2Dregeneration.ManaRegenerationAbilityType
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems.
|
|
6
|
+
____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = compiletime(function()
|
|
7
|
+
local abilityType = ManaRegenerationAbilityType:create()
|
|
8
|
+
abilityType.isInternal = true
|
|
9
|
+
abilityType.isButtonVisible = false
|
|
10
|
+
abilityType.manaRegenerationRateIncreaseFactor = 4
|
|
11
|
+
return abilityType.id
|
|
12
|
+
end)
|
|
13
|
+
---
|
|
14
|
+
-- @internal For use by internal systems.
|
|
15
|
+
____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ABILITY_RLF_MANA_REGENERATION_BONUS_AS_FRACTION_OF_NORMAL
|
|
16
|
+
return ____exports
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare module "../unit" {
|
|
3
|
+
interface Unit {
|
|
4
|
+
strengthBase: number;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare module "../unit" {
|
|
8
|
+
interface Unit {
|
|
9
|
+
agilityBase: number;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare module "../unit" {
|
|
13
|
+
interface Unit {
|
|
14
|
+
intelligenceBase: number;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 AGILITY_UNIT_FIELD = ____unit.AGILITY_UNIT_FIELD
|
|
8
|
+
local INTELLIGENCE_UNIT_FIELD = ____unit.INTELLIGENCE_UNIT_FIELD
|
|
9
|
+
local STRENGTH_UNIT_FIELD = ____unit.STRENGTH_UNIT_FIELD
|
|
10
|
+
__TS__ObjectDefineProperty(
|
|
11
|
+
Unit.prototype,
|
|
12
|
+
"strengthBase",
|
|
13
|
+
{
|
|
14
|
+
get = function(self)
|
|
15
|
+
return STRENGTH_UNIT_FIELD:getValue(self)
|
|
16
|
+
end,
|
|
17
|
+
set = function(self, value)
|
|
18
|
+
STRENGTH_UNIT_FIELD:setValue(self, value)
|
|
19
|
+
end
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
__TS__ObjectDefineProperty(
|
|
23
|
+
Unit.prototype,
|
|
24
|
+
"agilityBase",
|
|
25
|
+
{
|
|
26
|
+
get = function(self)
|
|
27
|
+
return AGILITY_UNIT_FIELD:getValue(self)
|
|
28
|
+
end,
|
|
29
|
+
set = function(self, value)
|
|
30
|
+
AGILITY_UNIT_FIELD:setValue(self, value)
|
|
31
|
+
end
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
__TS__ObjectDefineProperty(
|
|
35
|
+
Unit.prototype,
|
|
36
|
+
"intelligenceBase",
|
|
37
|
+
{
|
|
38
|
+
get = function(self)
|
|
39
|
+
return INTELLIGENCE_UNIT_FIELD:getValue(self)
|
|
40
|
+
end,
|
|
41
|
+
set = function(self, value)
|
|
42
|
+
INTELLIGENCE_UNIT_FIELD:setValue(self, value)
|
|
43
|
+
end
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
return ____exports
|
|
@@ -12,6 +12,7 @@ export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
|
|
|
12
12
|
export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
|
|
13
13
|
export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
|
|
14
14
|
export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
|
|
15
|
+
export type UnitManaRegenerationRateFactorBonusId = UnitBonusId<"manaRegenerationRateFactor">;
|
|
15
16
|
export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
16
17
|
abilityTypeId: AbilityTypeId;
|
|
17
18
|
field: jabilityintegerlevelfield;
|
|
@@ -36,6 +37,7 @@ export declare namespace UnitBonusType {
|
|
|
36
37
|
const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
37
38
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
38
39
|
const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
|
|
40
|
+
const MANA_REGENERATION_RATE_FACTOR: UnitBonusType<UnitManaRegenerationRateFactorBonusId>;
|
|
39
41
|
}
|
|
40
42
|
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
41
43
|
export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
|
|
@@ -24,6 +24,9 @@ local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspee
|
|
|
24
24
|
local ____evasion_2Dprobability = require("engine.internal.object-data.evasion-probability")
|
|
25
25
|
local EVASION_PROBABILITY_ABILITY_FIELD = ____evasion_2Dprobability.EVASION_PROBABILITY_ABILITY_FIELD
|
|
26
26
|
local EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = ____evasion_2Dprobability.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID
|
|
27
|
+
local ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor = require("engine.internal.object-data.mana-regeneration-rate-increase-factor")
|
|
28
|
+
local MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD
|
|
29
|
+
local MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
|
|
27
30
|
local damageFactorByUnit = {}
|
|
28
31
|
local receivedDamageFactorByUnit = {}
|
|
29
32
|
local function atLeastOnceProbability(array)
|
|
@@ -73,6 +76,13 @@ do
|
|
|
73
76
|
reduce = atLeastOnceProbability,
|
|
74
77
|
initialValue = 0
|
|
75
78
|
}
|
|
79
|
+
UnitBonusType.MANA_REGENERATION_RATE_FACTOR = {
|
|
80
|
+
abilityTypeId = MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID,
|
|
81
|
+
field = MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD,
|
|
82
|
+
integer = false,
|
|
83
|
+
reduce = sum,
|
|
84
|
+
initialValue = 0
|
|
85
|
+
}
|
|
76
86
|
end
|
|
77
87
|
local bonusesByUnitByBonusType = {}
|
|
78
88
|
local nextId = 1
|
|
@@ -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_FIELD = ____unit.FLY_HEIGHT_UNIT_FIELD
|
|
8
|
+
__TS__ObjectDefineProperty(
|
|
9
|
+
Unit.prototype,
|
|
10
|
+
"flyHeight",
|
|
11
|
+
{
|
|
12
|
+
get = function(self)
|
|
13
|
+
return FLY_HEIGHT_UNIT_FIELD:getValue(self)
|
|
14
|
+
end,
|
|
15
|
+
set = function(self, value)
|
|
16
|
+
FLY_HEIGHT_UNIT_FIELD:setValue(self, value)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
return ____exports
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.internal.unit")
|
|
3
|
+
local Unit = ____unit.Unit
|
|
4
|
+
local ____unit_2Dmissile_2Dlaunch = require("engine.internal.unit-missile-launch")
|
|
5
|
+
local resetAutoAttackTimer = ____unit_2Dmissile_2Dlaunch.resetAutoAttackTimer
|
|
6
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
7
|
+
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
8
|
+
Unit.prototype.interruptAttack = function(self)
|
|
9
|
+
unitInterruptAttack(self.handle)
|
|
10
|
+
resetAutoAttackTimer(self)
|
|
11
|
+
end
|
|
12
|
+
Unit.prototype.interruptMovement = function(self)
|
|
13
|
+
local handle = self.handle
|
|
14
|
+
unitDisableAbility(
|
|
15
|
+
handle,
|
|
16
|
+
fourCC("Amov"),
|
|
17
|
+
true,
|
|
18
|
+
false
|
|
19
|
+
)
|
|
20
|
+
unitDisableAbility(
|
|
21
|
+
handle,
|
|
22
|
+
fourCC("Amov"),
|
|
23
|
+
false,
|
|
24
|
+
false
|
|
25
|
+
)
|
|
26
|
+
resetAutoAttackTimer(self)
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -1,46 +1,31 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__New = ____lualib.__TS__New
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local ____player = require("core.types.player")
|
|
5
|
-
local Player = ____player.Player
|
|
6
|
-
local ____math = require("math")
|
|
7
|
-
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
8
|
-
local MINIMUM_INTEGER = ____math.MINIMUM_INTEGER
|
|
9
4
|
local ____local_2Dclient = require("engine.local-client")
|
|
10
5
|
local LocalClient = ____local_2Dclient.LocalClient
|
|
11
6
|
local ____unit = require("engine.internal.unit")
|
|
12
7
|
local Unit = ____unit.Unit
|
|
13
8
|
local ____event = require("event")
|
|
14
9
|
local Event = ____event.Event
|
|
10
|
+
local ____synchronization = require("engine.synchronization")
|
|
11
|
+
local ObjectBus = ____synchronization.ObjectBus
|
|
15
12
|
local mainSelectedUnitChangeEvent = __TS__New(Event)
|
|
16
13
|
rawset(Unit, "mainSelectedUnitChangeEvent", mainSelectedUnitChangeEvent)
|
|
17
14
|
local mainSelectedUnitByPlayer = {}
|
|
18
|
-
local
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"",
|
|
23
|
-
0
|
|
15
|
+
local unitBus = __TS__New(
|
|
16
|
+
ObjectBus,
|
|
17
|
+
function(unit) return unit.syncId end,
|
|
18
|
+
function(syncId) return Unit:getBySyncId(syncId) end
|
|
24
19
|
)
|
|
25
|
-
BlzFrameSetMinMaxValue(syncSlider, MINIMUM_INTEGER, MAXIMUM_INTEGER)
|
|
26
20
|
LocalClient.mainSelectedUnitChangeEvent:addListener(function()
|
|
27
|
-
|
|
28
|
-
local syncId = ____opt_0 and ____opt_0.syncId
|
|
29
|
-
BlzFrameSetValue(syncSlider, syncId or 0)
|
|
21
|
+
unitBus:send(LocalClient.mainSelectedUnit)
|
|
30
22
|
end)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function()
|
|
36
|
-
local player = Player:of(GetTriggerPlayer())
|
|
37
|
-
local mainSelectedUnit = Unit:getBySyncId(BlzGetTriggerFrameValue())
|
|
38
|
-
if mainSelectedUnit ~= mainSelectedUnitByPlayer[player] then
|
|
39
|
-
mainSelectedUnitByPlayer[player] = mainSelectedUnit
|
|
40
|
-
Event.invoke(mainSelectedUnitChangeEvent, player)
|
|
41
|
-
end
|
|
23
|
+
unitBus.event:addListener(function(player, unit)
|
|
24
|
+
if unit ~= mainSelectedUnitByPlayer[player] then
|
|
25
|
+
mainSelectedUnitByPlayer[player] = unit
|
|
26
|
+
Event.invoke(mainSelectedUnitChangeEvent, player)
|
|
42
27
|
end
|
|
43
|
-
)
|
|
28
|
+
end)
|
|
44
29
|
rawset(
|
|
45
30
|
Unit,
|
|
46
31
|
"getMainSelectedOf",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Event } from "../../../event";
|
|
3
|
+
declare module "../unit" {
|
|
4
|
+
interface Unit {
|
|
5
|
+
readonly unitInRangeEvent: Record<number, Event<[unit: Unit, range: number, unitInRange: Unit]>>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare module "../unit" {
|
|
9
|
+
interface Unit {
|
|
10
|
+
readonly unitOutOfRangeEvent: Record<number, Event<[unit: Unit, range: number, unitOutOfRange: Unit]>>;
|
|
11
|
+
}
|
|
12
|
+
}
|