warscript 0.0.1-dev.f024cc2 → 0.0.1-dev.f074376
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/core/types/frame.lua +14 -9
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/playerCamera.lua +44 -0
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +22 -2
- package/decl/native.d.ts +2 -2
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +12 -1
- package/engine/behavior.lua +199 -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 +15 -5
- package/engine/behaviour/unit.lua +116 -22
- package/engine/buff.d.ts +15 -5
- package/engine/buff.lua +151 -94
- package/engine/internal/ability.d.ts +3 -1
- package/engine/internal/ability.lua +26 -9
- package/engine/internal/item.d.ts +13 -15
- package/engine/internal/item.lua +63 -49
- 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/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- 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/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+ability.lua +9 -0
- package/engine/internal/unit-missile-launch.lua +44 -20
- package/engine/internal/unit.d.ts +15 -12
- package/engine/internal/unit.lua +93 -76
- 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/ability-type.lua +4 -1
- 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/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +9 -3
- package/engine/object-field.lua +237 -114
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +4 -1
- package/engine/standard/fields/unit.lua +6 -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/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/types.d.ts +3 -0
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
|
|
@@ -28,9 +29,6 @@ local ____math = require("math")
|
|
|
28
29
|
local max = ____math.max
|
|
29
30
|
local min = ____math.min
|
|
30
31
|
local ____bonus = require("engine.internal.unit.bonus")
|
|
31
|
-
local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
32
|
-
local getUnitBonus = ____bonus.getUnitBonus
|
|
33
|
-
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
34
32
|
local UnitBonusType = ____bonus.UnitBonusType
|
|
35
33
|
local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
|
|
36
34
|
local damageArea = ____area_2Ddamage.damageArea
|
|
@@ -53,6 +51,10 @@ local ____item = require("engine.internal.item")
|
|
|
53
51
|
local Item = ____item.Item
|
|
54
52
|
local ____destructable = require("core.types.destructable")
|
|
55
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
|
|
56
58
|
local getUnitAbility = BlzGetUnitAbility
|
|
57
59
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
58
60
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -101,6 +103,7 @@ local buffParametersKeys = {
|
|
|
101
103
|
armorIncreaseFactor = true,
|
|
102
104
|
attackSpeedIncreaseFactor = true,
|
|
103
105
|
movementSpeedIncreaseFactor = true,
|
|
106
|
+
manaRegenerationRateIncreaseFactor = true,
|
|
104
107
|
evasionProbability = true,
|
|
105
108
|
missProbability = true,
|
|
106
109
|
damageFactor = true,
|
|
@@ -124,7 +127,8 @@ local buffParametersKeys = {
|
|
|
124
127
|
damageOnExpiration = true,
|
|
125
128
|
healingOnExpiration = true,
|
|
126
129
|
killsOnExpiration = true,
|
|
127
|
-
explodesOnExpiration = true
|
|
130
|
+
explodesOnExpiration = true,
|
|
131
|
+
abilityCooldownFactor = true
|
|
128
132
|
}
|
|
129
133
|
local function resolveEnumValue(ability, level, value)
|
|
130
134
|
if value == nil or type(value) == "number" then
|
|
@@ -187,6 +191,7 @@ local buffNumberParameters = {
|
|
|
187
191
|
"durationIncreaseOnAutoAttack",
|
|
188
192
|
"attackSpeedIncreaseFactor",
|
|
189
193
|
"movementSpeedIncreaseFactor",
|
|
194
|
+
"manaRegenerationRateIncreaseFactor",
|
|
190
195
|
"evasionProbability",
|
|
191
196
|
"armorIncrease",
|
|
192
197
|
"damageFactor",
|
|
@@ -201,7 +206,8 @@ local buffNumberParameters = {
|
|
|
201
206
|
"healingPerInterval",
|
|
202
207
|
"healingOverDuration",
|
|
203
208
|
"damageOnExpiration",
|
|
204
|
-
"healingOnExpiration"
|
|
209
|
+
"healingOnExpiration",
|
|
210
|
+
"abilityCooldownFactor"
|
|
205
211
|
}
|
|
206
212
|
local unsuccessfulApplicationMarker = {}
|
|
207
213
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -320,33 +326,38 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
320
326
|
local polarity
|
|
321
327
|
local resistanceType
|
|
322
328
|
local ability
|
|
329
|
+
local abilityBehavior
|
|
323
330
|
if type(typeIdOrTypeIds) ~= "number" then
|
|
324
331
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
325
332
|
polarity = resistanceTypeOrPolarity
|
|
326
333
|
resistanceType = abilityOrParametersOrResistanceType
|
|
327
|
-
if __TS__InstanceOf(parametersOrAbility,
|
|
334
|
+
if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
|
|
335
|
+
abilityBehavior = parametersOrAbility
|
|
336
|
+
ability = abilityBehavior.ability
|
|
337
|
+
elseif __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
328
338
|
ability = parametersOrAbility
|
|
329
|
-
|
|
330
|
-
ability = nil
|
|
339
|
+
elseif parametersOrAbility ~= nil then
|
|
331
340
|
parameters = parametersOrAbility
|
|
332
341
|
end
|
|
333
342
|
else
|
|
334
343
|
typeId = typeIdOrTypeIds
|
|
335
344
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
336
345
|
resistanceType = resistanceTypeOrPolarity
|
|
337
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType,
|
|
346
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
|
|
347
|
+
abilityBehavior = abilityOrParametersOrResistanceType
|
|
348
|
+
ability = abilityBehavior.ability
|
|
349
|
+
parameters = parametersOrAbility
|
|
350
|
+
elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
338
351
|
ability = abilityOrParametersOrResistanceType
|
|
339
352
|
parameters = parametersOrAbility
|
|
340
|
-
|
|
341
|
-
ability = nil
|
|
353
|
+
elseif abilityOrParametersOrResistanceType ~= nil then
|
|
342
354
|
parameters = abilityOrParametersOrResistanceType
|
|
355
|
+
else
|
|
356
|
+
parameters = parametersOrAbility
|
|
343
357
|
end
|
|
344
358
|
end
|
|
359
|
+
self.sourceAbilityBehavior = abilityBehavior
|
|
345
360
|
self.typeId = typeId
|
|
346
|
-
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
347
|
-
parameters = ability
|
|
348
|
-
ability = nil
|
|
349
|
-
end
|
|
350
361
|
local defaultParameters = self.constructor.defaultParameters
|
|
351
362
|
local level = parameters and parameters.level or defaultParameters.level
|
|
352
363
|
local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
|
|
@@ -509,63 +520,66 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
509
520
|
self[100] = 1
|
|
510
521
|
Event.invoke(buffCreatedEvent, self)
|
|
511
522
|
end
|
|
512
|
-
function Buff.prototype.
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
523
|
+
function Buff.prototype.onAbilityGained(self, ability)
|
|
524
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
525
|
+
local abilityCooldownModifier = self[144]
|
|
526
|
+
if abilityCooldownModifier then
|
|
527
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
|
|
528
|
+
end
|
|
529
|
+
end
|
|
516
530
|
end
|
|
517
|
-
function Buff.prototype.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
531
|
+
function Buff.prototype.onAbilityLost(self, ability)
|
|
532
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
533
|
+
local abilityCooldownModifier = self[144]
|
|
534
|
+
if abilityCooldownModifier then
|
|
535
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
|
|
536
|
+
end
|
|
522
537
|
end
|
|
523
|
-
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
|
|
524
538
|
end
|
|
525
539
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
526
540
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
527
541
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
528
542
|
else
|
|
529
543
|
local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
|
|
530
|
-
local
|
|
531
|
-
local
|
|
532
|
-
local
|
|
544
|
+
local ____Effect_40 = Effect
|
|
545
|
+
local ____Effect_flash_41 = Effect.flash
|
|
546
|
+
local ____array_39 = __TS__SparseArrayNew(
|
|
533
547
|
self[105],
|
|
534
548
|
isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
|
|
535
549
|
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
536
550
|
)
|
|
537
|
-
local
|
|
551
|
+
local ____isWidgetProvided_38
|
|
538
552
|
if isWidgetProvided then
|
|
539
|
-
|
|
553
|
+
____isWidgetProvided_38 = yOrParametersOrDuration
|
|
540
554
|
else
|
|
541
|
-
|
|
555
|
+
____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
|
|
542
556
|
end
|
|
543
|
-
__TS__SparseArrayPush(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
__TS__SparseArraySpread(
|
|
557
|
+
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
558
|
+
____Effect_flash_41(
|
|
559
|
+
____Effect_40,
|
|
560
|
+
__TS__SparseArraySpread(____array_39)
|
|
547
561
|
)
|
|
548
562
|
end
|
|
549
563
|
end
|
|
550
564
|
function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
551
565
|
local isWidgetProvided = type(widgetOrDuration) == "table"
|
|
552
|
-
local
|
|
553
|
-
local
|
|
554
|
-
local
|
|
566
|
+
local ____Effect_44 = Effect
|
|
567
|
+
local ____Effect_flash_45 = Effect.flash
|
|
568
|
+
local ____array_43 = __TS__SparseArrayNew(
|
|
555
569
|
self[106],
|
|
556
570
|
isWidgetProvided and widgetOrDuration or self._unit,
|
|
557
571
|
stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
|
|
558
572
|
)
|
|
559
|
-
local
|
|
573
|
+
local ____isWidgetProvided_42
|
|
560
574
|
if isWidgetProvided then
|
|
561
|
-
|
|
575
|
+
____isWidgetProvided_42 = duration
|
|
562
576
|
else
|
|
563
|
-
|
|
577
|
+
____isWidgetProvided_42 = widgetOrDuration
|
|
564
578
|
end
|
|
565
|
-
__TS__SparseArrayPush(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
__TS__SparseArraySpread(
|
|
579
|
+
__TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
|
|
580
|
+
____Effect_flash_45(
|
|
581
|
+
____Effect_44,
|
|
582
|
+
__TS__SparseArraySpread(____array_43)
|
|
569
583
|
)
|
|
570
584
|
end
|
|
571
585
|
function Buff.prototype.onCreate(self)
|
|
@@ -596,6 +610,12 @@ function Buff.prototype.onDestroy(self)
|
|
|
596
610
|
behavior:destroy()
|
|
597
611
|
end
|
|
598
612
|
end
|
|
613
|
+
local previousAbilityCooldownModifier = self[144]
|
|
614
|
+
if previousAbilityCooldownModifier then
|
|
615
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
616
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
617
|
+
end
|
|
618
|
+
end
|
|
599
619
|
if self[139] then
|
|
600
620
|
unit:decrementInvulnerabilityCounter()
|
|
601
621
|
end
|
|
@@ -604,7 +624,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
604
624
|
end
|
|
605
625
|
if self[136] then
|
|
606
626
|
if self[137] then
|
|
607
|
-
unit:
|
|
627
|
+
unit:decrementForceStunCounter()
|
|
608
628
|
end
|
|
609
629
|
unit:decrementStunCounter()
|
|
610
630
|
end
|
|
@@ -616,11 +636,6 @@ function Buff.prototype.onDestroy(self)
|
|
|
616
636
|
unit:removeAbility(abilityTypeId)
|
|
617
637
|
end
|
|
618
638
|
end
|
|
619
|
-
if self._bonusIdByBonusType ~= nil then
|
|
620
|
-
for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
|
|
621
|
-
removeUnitBonus(unit, bonusType, bonusId)
|
|
622
|
-
end
|
|
623
|
-
end
|
|
624
639
|
Event.invoke(buffBeingDestroyedEvent, self)
|
|
625
640
|
self[100] = 3
|
|
626
641
|
return UnitBehavior.prototype.onDestroy(self)
|
|
@@ -650,8 +665,8 @@ function Buff.apply(self, ...)
|
|
|
650
665
|
end
|
|
651
666
|
end
|
|
652
667
|
function Buff.getByTypeId(self, unit, typeId)
|
|
653
|
-
local
|
|
654
|
-
local buff =
|
|
668
|
+
local ____opt_46 = buffByTypeIdByUnit[unit]
|
|
669
|
+
local buff = ____opt_46 and ____opt_46[typeId]
|
|
655
670
|
if __TS__InstanceOf(buff, self) then
|
|
656
671
|
return buff
|
|
657
672
|
end
|
|
@@ -809,8 +824,8 @@ __TS__SetDescriptor(
|
|
|
809
824
|
return
|
|
810
825
|
end
|
|
811
826
|
self[112] = damageInterval
|
|
812
|
-
local
|
|
813
|
-
local elapsed =
|
|
827
|
+
local ____opt_48 = self._timer
|
|
828
|
+
local elapsed = ____opt_48 and ____opt_48.elapsed or 0
|
|
814
829
|
local timer = self[114]
|
|
815
830
|
if timer == nil then
|
|
816
831
|
timer = Timer:create()
|
|
@@ -889,8 +904,8 @@ __TS__SetDescriptor(
|
|
|
889
904
|
return
|
|
890
905
|
end
|
|
891
906
|
self[117] = healingInterval
|
|
892
|
-
local
|
|
893
|
-
local elapsed =
|
|
907
|
+
local ____opt_50 = self._timer
|
|
908
|
+
local elapsed = ____opt_50 and ____opt_50.elapsed or 0
|
|
894
909
|
local timer = self[119]
|
|
895
910
|
if timer == nil then
|
|
896
911
|
timer = Timer:create()
|
|
@@ -976,11 +991,11 @@ __TS__SetDescriptor(
|
|
|
976
991
|
"turnsIntoGhost",
|
|
977
992
|
{
|
|
978
993
|
get = function(self)
|
|
979
|
-
local
|
|
980
|
-
if
|
|
981
|
-
|
|
994
|
+
local ____self__135_52 = self[135]
|
|
995
|
+
if ____self__135_52 == nil then
|
|
996
|
+
____self__135_52 = false
|
|
982
997
|
end
|
|
983
|
-
return
|
|
998
|
+
return ____self__135_52
|
|
984
999
|
end,
|
|
985
1000
|
set = function(self, turnsIntoGhost)
|
|
986
1001
|
if not turnsIntoGhost and self[135] then
|
|
@@ -999,22 +1014,22 @@ __TS__SetDescriptor(
|
|
|
999
1014
|
"stuns",
|
|
1000
1015
|
{
|
|
1001
1016
|
get = function(self)
|
|
1002
|
-
local
|
|
1003
|
-
if
|
|
1004
|
-
|
|
1017
|
+
local ____self__136_53 = self[136]
|
|
1018
|
+
if ____self__136_53 == nil then
|
|
1019
|
+
____self__136_53 = false
|
|
1005
1020
|
end
|
|
1006
|
-
return
|
|
1021
|
+
return ____self__136_53
|
|
1007
1022
|
end,
|
|
1008
1023
|
set = function(self, stuns)
|
|
1009
1024
|
if not stuns and self[136] then
|
|
1010
1025
|
if self[137] then
|
|
1011
|
-
self.object:
|
|
1026
|
+
self.object:decrementForceStunCounter()
|
|
1012
1027
|
end
|
|
1013
1028
|
self.object:decrementStunCounter()
|
|
1014
1029
|
self[136] = nil
|
|
1015
1030
|
elseif stuns and not self[136] then
|
|
1016
1031
|
if self[137] then
|
|
1017
|
-
self.object:
|
|
1032
|
+
self.object:incrementForceStunCounter()
|
|
1018
1033
|
end
|
|
1019
1034
|
self.object:incrementStunCounter()
|
|
1020
1035
|
self[136] = true
|
|
@@ -1028,21 +1043,21 @@ __TS__SetDescriptor(
|
|
|
1028
1043
|
"ignoresStunImmunity",
|
|
1029
1044
|
{
|
|
1030
1045
|
get = function(self)
|
|
1031
|
-
local
|
|
1032
|
-
if
|
|
1033
|
-
|
|
1046
|
+
local ____self__137_54 = self[137]
|
|
1047
|
+
if ____self__137_54 == nil then
|
|
1048
|
+
____self__137_54 = false
|
|
1034
1049
|
end
|
|
1035
|
-
return
|
|
1050
|
+
return ____self__137_54
|
|
1036
1051
|
end,
|
|
1037
1052
|
set = function(self, ignoresStunImmunity)
|
|
1038
1053
|
if not ignoresStunImmunity and self[137] then
|
|
1039
1054
|
if self[136] then
|
|
1040
|
-
self.object:
|
|
1055
|
+
self.object:decrementForceStunCounter()
|
|
1041
1056
|
end
|
|
1042
1057
|
self[137] = nil
|
|
1043
1058
|
elseif ignoresStunImmunity and not self[137] then
|
|
1044
1059
|
if self[136] then
|
|
1045
|
-
self.object:
|
|
1060
|
+
self.object:incrementForceStunCounter()
|
|
1046
1061
|
end
|
|
1047
1062
|
self[137] = true
|
|
1048
1063
|
end
|
|
@@ -1055,11 +1070,11 @@ __TS__SetDescriptor(
|
|
|
1055
1070
|
"disablesAutoAttack",
|
|
1056
1071
|
{
|
|
1057
1072
|
get = function(self)
|
|
1058
|
-
local
|
|
1059
|
-
if
|
|
1060
|
-
|
|
1073
|
+
local ____self__138_55 = self[138]
|
|
1074
|
+
if ____self__138_55 == nil then
|
|
1075
|
+
____self__138_55 = false
|
|
1061
1076
|
end
|
|
1062
|
-
return
|
|
1077
|
+
return ____self__138_55
|
|
1063
1078
|
end,
|
|
1064
1079
|
set = function(self, disablesAutoAttack)
|
|
1065
1080
|
if not disablesAutoAttack and self[138] then
|
|
@@ -1078,11 +1093,11 @@ __TS__SetDescriptor(
|
|
|
1078
1093
|
"providesInvulnerability",
|
|
1079
1094
|
{
|
|
1080
1095
|
get = function(self)
|
|
1081
|
-
local
|
|
1082
|
-
if
|
|
1083
|
-
|
|
1096
|
+
local ____self__139_56 = self[139]
|
|
1097
|
+
if ____self__139_56 == nil then
|
|
1098
|
+
____self__139_56 = false
|
|
1084
1099
|
end
|
|
1085
|
-
return
|
|
1100
|
+
return ____self__139_56
|
|
1086
1101
|
end,
|
|
1087
1102
|
set = function(self, providesInvulnerability)
|
|
1088
1103
|
if not providesInvulnerability and self[139] then
|
|
@@ -1101,11 +1116,11 @@ __TS__SetDescriptor(
|
|
|
1101
1116
|
"killsOnExpiration",
|
|
1102
1117
|
{
|
|
1103
1118
|
get = function(self)
|
|
1104
|
-
local
|
|
1105
|
-
if
|
|
1106
|
-
|
|
1119
|
+
local ____self__140_57 = self[140]
|
|
1120
|
+
if ____self__140_57 == nil then
|
|
1121
|
+
____self__140_57 = false
|
|
1107
1122
|
end
|
|
1108
|
-
return
|
|
1123
|
+
return ____self__140_57
|
|
1109
1124
|
end,
|
|
1110
1125
|
set = function(self, killsOnExpiration)
|
|
1111
1126
|
if not killsOnExpiration and self[140] then
|
|
@@ -1122,11 +1137,11 @@ __TS__SetDescriptor(
|
|
|
1122
1137
|
"explodesOnExpiration",
|
|
1123
1138
|
{
|
|
1124
1139
|
get = function(self)
|
|
1125
|
-
local
|
|
1126
|
-
if
|
|
1127
|
-
|
|
1140
|
+
local ____self__141_58 = self[141]
|
|
1141
|
+
if ____self__141_58 == nil then
|
|
1142
|
+
____self__141_58 = false
|
|
1128
1143
|
end
|
|
1129
|
-
return
|
|
1144
|
+
return ____self__141_58
|
|
1130
1145
|
end,
|
|
1131
1146
|
set = function(self, killsOnExpiration)
|
|
1132
1147
|
if not killsOnExpiration and self[141] then
|
|
@@ -1241,6 +1256,19 @@ __TS__SetDescriptor(
|
|
|
1241
1256
|
},
|
|
1242
1257
|
true
|
|
1243
1258
|
)
|
|
1259
|
+
__TS__SetDescriptor(
|
|
1260
|
+
Buff.prototype,
|
|
1261
|
+
"manaRegenerationRateIncreaseFactor",
|
|
1262
|
+
{
|
|
1263
|
+
get = function(self)
|
|
1264
|
+
return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
|
|
1265
|
+
end,
|
|
1266
|
+
set = function(self, manaRegenerationRateIncreaseFactor)
|
|
1267
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
|
|
1268
|
+
end
|
|
1269
|
+
},
|
|
1270
|
+
true
|
|
1271
|
+
)
|
|
1244
1272
|
__TS__SetDescriptor(
|
|
1245
1273
|
Buff.prototype,
|
|
1246
1274
|
"duration",
|
|
@@ -1254,13 +1282,13 @@ __TS__SetDescriptor(
|
|
|
1254
1282
|
"remainingDuration",
|
|
1255
1283
|
{
|
|
1256
1284
|
get = function(self)
|
|
1257
|
-
local
|
|
1258
|
-
return
|
|
1285
|
+
local ____opt_59 = self._timer
|
|
1286
|
+
return ____opt_59 and ____opt_59.remaining or 0
|
|
1259
1287
|
end,
|
|
1260
1288
|
set = function(self, remainingDuration)
|
|
1261
|
-
local
|
|
1262
|
-
local
|
|
1263
|
-
local remainingDurationDelta =
|
|
1289
|
+
local ____remainingDuration_63 = remainingDuration
|
|
1290
|
+
local ____opt_61 = self._timer
|
|
1291
|
+
local remainingDurationDelta = ____remainingDuration_63 - (____opt_61 and ____opt_61.remaining or 0)
|
|
1264
1292
|
if remainingDurationDelta ~= 0 then
|
|
1265
1293
|
self[103] = self[103] + remainingDurationDelta
|
|
1266
1294
|
if remainingDuration <= 0 then
|
|
@@ -1290,6 +1318,32 @@ __TS__SetDescriptor(
|
|
|
1290
1318
|
},
|
|
1291
1319
|
true
|
|
1292
1320
|
)
|
|
1321
|
+
__TS__SetDescriptor(
|
|
1322
|
+
Buff.prototype,
|
|
1323
|
+
"abilityCooldownFactor",
|
|
1324
|
+
{
|
|
1325
|
+
get = function(self)
|
|
1326
|
+
return self[143] or 1
|
|
1327
|
+
end,
|
|
1328
|
+
set = function(self, abilityCooldownFactor)
|
|
1329
|
+
local previousAbilityCooldownModifier = self[144]
|
|
1330
|
+
if previousAbilityCooldownModifier then
|
|
1331
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1332
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
1333
|
+
end
|
|
1334
|
+
end
|
|
1335
|
+
local function modifier(ability, level, cooldown)
|
|
1336
|
+
return cooldown * abilityCooldownFactor
|
|
1337
|
+
end
|
|
1338
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1339
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
|
|
1340
|
+
end
|
|
1341
|
+
self[144] = modifier
|
|
1342
|
+
self[143] = abilityCooldownFactor
|
|
1343
|
+
end
|
|
1344
|
+
},
|
|
1345
|
+
true
|
|
1346
|
+
)
|
|
1293
1347
|
Buff.createdEvent = buffCreatedEvent
|
|
1294
1348
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1295
1349
|
(function(self)
|
|
@@ -1348,5 +1402,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1348
1402
|
buffCreatedEvent:addListener(function(buff)
|
|
1349
1403
|
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1350
1404
|
end)
|
|
1405
|
+
buffBeingDestroyedEvent:addListener(function(buff)
|
|
1406
|
+
UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
|
|
1407
|
+
end)
|
|
1351
1408
|
end)(Buff)
|
|
1352
1409
|
return ____exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import { Handle } from "../../core/types/handle";
|
|
2
|
+
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Event } from "../../event";
|
|
4
4
|
import type { Item } from "../../core/types/item";
|
|
5
5
|
import type { Unit } from "./unit";
|
|
@@ -67,6 +67,7 @@ export declare class UnitAbility extends Ability {
|
|
|
67
67
|
get cooldownRemaining(): number;
|
|
68
68
|
set cooldownRemaining(cooldownRemaining: number);
|
|
69
69
|
interruptCast(): void;
|
|
70
|
+
protected onDestroy(): HandleDestructor;
|
|
70
71
|
static get onCreate(): Event<[UnitAbility]>;
|
|
71
72
|
static get onDestroy(): Event<[UnitAbility]>;
|
|
72
73
|
}
|
|
@@ -93,6 +94,7 @@ export declare class ItemAbility extends Ability {
|
|
|
93
94
|
get cooldownRemaining(): number;
|
|
94
95
|
set cooldownRemaining(cooldownRemaining: number);
|
|
95
96
|
interruptCast(): void;
|
|
97
|
+
protected onDestroy(): HandleDestructor;
|
|
96
98
|
static get onCreate(): Event<[ItemAbility]>;
|
|
97
99
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
98
100
|
}
|
|
@@ -232,6 +232,19 @@ ____exports.getOrderIdByAbilityTypeId = function(abilityTypeId)
|
|
|
232
232
|
local parentTypeId = availableFields[abilityTypeId]
|
|
233
233
|
return order2orderId(orders[____type(parentTypeId) == "number" and parentTypeId or abilityTypeId] or "")
|
|
234
234
|
end
|
|
235
|
+
---
|
|
236
|
+
-- @internal For use by internal systems only.
|
|
237
|
+
____exports.abilityTypeHasField = function(abilityTypeId, field)
|
|
238
|
+
field = ____type(field) == "number" and field or getHandleId(field)
|
|
239
|
+
if commonFields[field] then
|
|
240
|
+
return true
|
|
241
|
+
end
|
|
242
|
+
local id = availableFields[abilityTypeId]
|
|
243
|
+
if ____type(id) == "number" then
|
|
244
|
+
id = availableFields[id]
|
|
245
|
+
end
|
|
246
|
+
return not not (id and id[field])
|
|
247
|
+
end
|
|
235
248
|
____exports.Ability = __TS__Class()
|
|
236
249
|
local Ability = ____exports.Ability
|
|
237
250
|
Ability.name = "Ability"
|
|
@@ -247,15 +260,7 @@ function Ability.prototype.getSnapshot(self)
|
|
|
247
260
|
return nil
|
|
248
261
|
end
|
|
249
262
|
function Ability.prototype.hasField(self, field)
|
|
250
|
-
|
|
251
|
-
if commonFields[field] then
|
|
252
|
-
return true
|
|
253
|
-
end
|
|
254
|
-
local id = availableFields[self.typeId]
|
|
255
|
-
if ____type(id) == "number" then
|
|
256
|
-
id = availableFields[id]
|
|
257
|
-
end
|
|
258
|
-
return not not (id and id[field])
|
|
263
|
+
return ____exports.abilityTypeHasField(self.typeId, field)
|
|
259
264
|
end
|
|
260
265
|
function Ability.prototype.getField(self, field, level)
|
|
261
266
|
local fieldType = match(
|
|
@@ -420,6 +425,12 @@ end
|
|
|
420
425
|
function UnitAbility.prototype.interruptCast(self)
|
|
421
426
|
self.owner:interruptCast(self.typeId)
|
|
422
427
|
end
|
|
428
|
+
function UnitAbility.prototype.onDestroy(self)
|
|
429
|
+
if self.owner.state ~= 2 then
|
|
430
|
+
self.owner:removeAbility(self.typeId)
|
|
431
|
+
end
|
|
432
|
+
return UnitAbility.____super.prototype.onDestroy(self)
|
|
433
|
+
end
|
|
423
434
|
__TS__SetDescriptor(
|
|
424
435
|
UnitAbility.prototype,
|
|
425
436
|
"isDisabled",
|
|
@@ -512,6 +523,12 @@ function ItemAbility.prototype.interruptCast(self)
|
|
|
512
523
|
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, true)
|
|
513
524
|
end
|
|
514
525
|
end
|
|
526
|
+
function ItemAbility.prototype.onDestroy(self)
|
|
527
|
+
if self.owner.state ~= 2 then
|
|
528
|
+
self.owner:removeAbility(self.typeId)
|
|
529
|
+
end
|
|
530
|
+
return ItemAbility.____super.prototype.onDestroy(self)
|
|
531
|
+
end
|
|
515
532
|
__TS__SetDescriptor(
|
|
516
533
|
ItemAbility.prototype,
|
|
517
534
|
"level",
|
|
@@ -8,12 +8,10 @@ import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
|
8
8
|
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
9
9
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
10
|
declare const enum ItemPropertyKey {
|
|
11
|
-
ABILITIES = 100
|
|
12
|
-
LUA_INDEX_BY_ABILITY_TYPE_ID = 101
|
|
11
|
+
ABILITIES = 100
|
|
13
12
|
}
|
|
14
13
|
export declare class Item extends Handle<jitem> {
|
|
15
14
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
-
private readonly [ItemPropertyKey.LUA_INDEX_BY_ABILITY_TYPE_ID];
|
|
17
15
|
constructor(handle: jitem);
|
|
18
16
|
protected onDestroy(): HandleDestructor;
|
|
19
17
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
@@ -30,22 +28,22 @@ export declare class Item extends Handle<jitem> {
|
|
|
30
28
|
get extendedTooltip(): string;
|
|
31
29
|
set iconPath(v: string);
|
|
32
30
|
get iconPath(): string;
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
41
|
-
set
|
|
42
|
-
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;
|
|
43
41
|
get isAlive(): boolean;
|
|
44
42
|
get isDead(): boolean;
|
|
45
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
46
44
|
get isInvulnerable(): boolean;
|
|
47
|
-
set
|
|
48
|
-
get
|
|
45
|
+
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
+
get isActivelyUsed(): boolean;
|
|
49
47
|
set visible(v: boolean);
|
|
50
48
|
get visible(): boolean;
|
|
51
49
|
set level(v: number);
|