warscript 0.0.1-dev.d30161d → 0.0.1-dev.dbb3984
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/effect.d.ts +12 -3
- package/core/types/effect.lua +56 -7
- package/core/types/frame.d.ts +6 -0
- package/core/types/frame.lua +91 -1
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/engine/behavior.d.ts +2 -2
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/apply-buff.d.ts +3 -5
- package/engine/behaviour/unit.d.ts +5 -0
- package/engine/behaviour/unit.lua +20 -0
- package/engine/buff.d.ts +38 -12
- package/engine/buff.lua +171 -79
- package/engine/internal/ability.d.ts +3 -11
- package/engine/internal/ability.lua +9 -78
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/unit/ability.lua +0 -14
- package/engine/internal/unit/bonus.d.ts +4 -2
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +84 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +24 -10
- package/engine/internal/unit.lua +102 -71
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/entry/item-type.d.ts +12 -0
- package/engine/object-data/entry/item-type.lua +78 -0
- package/engine/object-field/ability.d.ts +17 -0
- package/engine/object-field/ability.lua +51 -1
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +34 -3
- package/utility/linked-set.d.ts +11 -2
- package/utility/linked-set.lua +5 -2
- package/utility/types.d.ts +1 -0
package/engine/buff.lua
CHANGED
|
@@ -46,6 +46,10 @@ local ____arrays = require("utility.arrays")
|
|
|
46
46
|
local forEach = ____arrays.forEach
|
|
47
47
|
local ____ability_2Dduration = require("engine.internal.mechanics.ability-duration")
|
|
48
48
|
local getAbilityDuration = ____ability_2Dduration.getAbilityDuration
|
|
49
|
+
local ____item = require("engine.internal.item")
|
|
50
|
+
local Item = ____item.Item
|
|
51
|
+
local ____destructable = require("core.types.destructable")
|
|
52
|
+
local Destructable = ____destructable.Destructable
|
|
49
53
|
local getUnitAbility = BlzGetUnitAbility
|
|
50
54
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
51
55
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -94,6 +98,7 @@ local buffParametersKeys = {
|
|
|
94
98
|
armorIncreaseFactor = true,
|
|
95
99
|
attackSpeedIncreaseFactor = true,
|
|
96
100
|
movementSpeedIncreaseFactor = true,
|
|
101
|
+
damageFactor = true,
|
|
97
102
|
receivedDamageFactor = true,
|
|
98
103
|
receivedMagicDamageFactor = true,
|
|
99
104
|
durationIncreaseOnAutoAttack = true,
|
|
@@ -107,12 +112,26 @@ local buffParametersKeys = {
|
|
|
107
112
|
disablesAutoAttack = true,
|
|
108
113
|
destroysOnDamage = true,
|
|
109
114
|
maximumAutoAttackCount = true,
|
|
115
|
+
maximumDamageDealtEventCount = true,
|
|
116
|
+
maximumDamageReceivedEventCount = true,
|
|
110
117
|
uniqueGroup = true,
|
|
111
118
|
damageOnExpiration = true,
|
|
112
119
|
healingOnExpiration = true,
|
|
113
120
|
killsOnExpiration = true,
|
|
114
121
|
explodesOnExpiration = true
|
|
115
122
|
}
|
|
123
|
+
local function resolveEnumValue(ability, level, value)
|
|
124
|
+
if value == nil or type(value) == "number" then
|
|
125
|
+
return value
|
|
126
|
+
end
|
|
127
|
+
if ability == nil then
|
|
128
|
+
error(
|
|
129
|
+
__TS__New(IllegalArgumentException),
|
|
130
|
+
0
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
return value:getValue(ability, level or ability.level)
|
|
134
|
+
end
|
|
116
135
|
local function resolveNumberValue(ability, level, value)
|
|
117
136
|
if value == nil or type(value) == "number" then
|
|
118
137
|
return value
|
|
@@ -162,8 +181,11 @@ local buffNumberParameters = {
|
|
|
162
181
|
"attackSpeedIncreaseFactor",
|
|
163
182
|
"movementSpeedIncreaseFactor",
|
|
164
183
|
"armorIncrease",
|
|
184
|
+
"damageFactor",
|
|
165
185
|
"receivedDamageFactor",
|
|
166
186
|
"maximumAutoAttackCount",
|
|
187
|
+
"maximumDamageDealtEventCount",
|
|
188
|
+
"maximumDamageReceivedEventCount",
|
|
167
189
|
"damageInterval",
|
|
168
190
|
"damagePerInterval",
|
|
169
191
|
"damageOverDuration",
|
|
@@ -310,8 +332,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
310
332
|
end
|
|
311
333
|
end
|
|
312
334
|
self.typeId = typeId
|
|
313
|
-
self.polarity = polarity
|
|
314
|
-
self.resistanceType = resistanceType
|
|
315
335
|
if not __TS__InstanceOf(ability, Ability) then
|
|
316
336
|
parameters = ability
|
|
317
337
|
ability = nil
|
|
@@ -338,6 +358,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
338
358
|
learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
|
|
339
359
|
duration = duration or getAbilityDuration(ability, _unit)
|
|
340
360
|
end
|
|
361
|
+
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
362
|
+
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
341
363
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
342
364
|
if buffByTypeId == nil then
|
|
343
365
|
buffByTypeId = {}
|
|
@@ -354,8 +376,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
354
376
|
if not internalApplyBuff(
|
|
355
377
|
_unit,
|
|
356
378
|
typeId,
|
|
357
|
-
polarity,
|
|
358
|
-
resistanceType,
|
|
379
|
+
self.polarity,
|
|
380
|
+
self.resistanceType,
|
|
359
381
|
level,
|
|
360
382
|
duration,
|
|
361
383
|
spellStealPriority,
|
|
@@ -464,6 +486,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
464
486
|
timer:start(duration, false, expireBuff, self)
|
|
465
487
|
self._timer = timer
|
|
466
488
|
end
|
|
489
|
+
self:onCreate()
|
|
467
490
|
end
|
|
468
491
|
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
469
492
|
local ____opt_36 = self._bonusIdByBonusType
|
|
@@ -478,26 +501,30 @@ function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
|
478
501
|
end
|
|
479
502
|
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
|
|
480
503
|
end
|
|
481
|
-
function Buff.prototype.flashEffect(self,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
local ____Effect_flash_41 = Effect.flash
|
|
485
|
-
local ____array_39 = __TS__SparseArrayNew(
|
|
486
|
-
self[104],
|
|
487
|
-
isWidgetProvided and widgetOrDuration or self._unit,
|
|
488
|
-
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
489
|
-
)
|
|
490
|
-
local ____isWidgetProvided_38
|
|
491
|
-
if isWidgetProvided then
|
|
492
|
-
____isWidgetProvided_38 = duration
|
|
504
|
+
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
505
|
+
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
506
|
+
Effect:flash(self[104], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
493
507
|
else
|
|
494
|
-
|
|
508
|
+
local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
|
|
509
|
+
local ____Effect_40 = Effect
|
|
510
|
+
local ____Effect_flash_41 = Effect.flash
|
|
511
|
+
local ____array_39 = __TS__SparseArrayNew(
|
|
512
|
+
self[104],
|
|
513
|
+
isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
|
|
514
|
+
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
515
|
+
)
|
|
516
|
+
local ____isWidgetProvided_38
|
|
517
|
+
if isWidgetProvided then
|
|
518
|
+
____isWidgetProvided_38 = parametersOrDuration
|
|
519
|
+
else
|
|
520
|
+
____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
|
|
521
|
+
end
|
|
522
|
+
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
523
|
+
____Effect_flash_41(
|
|
524
|
+
____Effect_40,
|
|
525
|
+
__TS__SparseArraySpread(____array_39)
|
|
526
|
+
)
|
|
495
527
|
end
|
|
496
|
-
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
497
|
-
____Effect_flash_41(
|
|
498
|
-
____Effect_40,
|
|
499
|
-
__TS__SparseArraySpread(____array_39)
|
|
500
|
-
)
|
|
501
528
|
end
|
|
502
529
|
function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
503
530
|
local isWidgetProvided = type(widgetOrDuration) == "table"
|
|
@@ -520,6 +547,8 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
|
520
547
|
__TS__SparseArraySpread(____array_43)
|
|
521
548
|
)
|
|
522
549
|
end
|
|
550
|
+
function Buff.prototype.onCreate(self)
|
|
551
|
+
end
|
|
523
552
|
function Buff.prototype.onDestroy(self)
|
|
524
553
|
local unit = self._unit
|
|
525
554
|
if getUnitAbility(unit.handle, self.typeId) == self.handle then
|
|
@@ -544,11 +573,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
544
573
|
behavior:destroy()
|
|
545
574
|
end
|
|
546
575
|
end
|
|
547
|
-
if self[
|
|
576
|
+
if self[136] then
|
|
548
577
|
unit:decrementDisableAutoAttackCounter()
|
|
549
578
|
end
|
|
550
|
-
if self[
|
|
551
|
-
if self[
|
|
579
|
+
if self[134] then
|
|
580
|
+
if self[135] then
|
|
552
581
|
unit:decrementStunCounter()
|
|
553
582
|
end
|
|
554
583
|
unit:decrementStunCounter()
|
|
@@ -605,9 +634,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
605
634
|
if self[120] ~= nil then
|
|
606
635
|
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
607
636
|
end
|
|
608
|
-
if self[
|
|
637
|
+
if self[139] then
|
|
609
638
|
unit:explode()
|
|
610
|
-
elseif self[
|
|
639
|
+
elseif self[138] then
|
|
611
640
|
unit:kill()
|
|
612
641
|
end
|
|
613
642
|
end
|
|
@@ -652,6 +681,22 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
652
681
|
self:destroy()
|
|
653
682
|
end
|
|
654
683
|
end
|
|
684
|
+
if event.originalAmount ~= 0 then
|
|
685
|
+
local damageDealtEventCount = (self[130] or 0) + 1
|
|
686
|
+
self[130] = damageDealtEventCount
|
|
687
|
+
if damageDealtEventCount == self[131] then
|
|
688
|
+
self:destroy()
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
end
|
|
692
|
+
function Buff.prototype.onDamageReceived(self, source, event)
|
|
693
|
+
if event.originalAmount ~= 0 then
|
|
694
|
+
local damageReceivedEventCount = (self[132] or 0) + 1
|
|
695
|
+
self[132] = damageReceivedEventCount
|
|
696
|
+
if damageReceivedEventCount == self[133] then
|
|
697
|
+
self:destroy()
|
|
698
|
+
end
|
|
699
|
+
end
|
|
655
700
|
end
|
|
656
701
|
Buff.defaultParameters = {}
|
|
657
702
|
__TS__SetDescriptor(
|
|
@@ -856,6 +901,19 @@ __TS__SetDescriptor(
|
|
|
856
901
|
},
|
|
857
902
|
true
|
|
858
903
|
)
|
|
904
|
+
__TS__SetDescriptor(
|
|
905
|
+
Buff.prototype,
|
|
906
|
+
"damageFactor",
|
|
907
|
+
{
|
|
908
|
+
get = function(self)
|
|
909
|
+
return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
|
|
910
|
+
end,
|
|
911
|
+
set = function(self, damageFactor)
|
|
912
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
|
|
913
|
+
end
|
|
914
|
+
},
|
|
915
|
+
true
|
|
916
|
+
)
|
|
859
917
|
__TS__SetDescriptor(
|
|
860
918
|
Buff.prototype,
|
|
861
919
|
"receivedDamageFactor",
|
|
@@ -887,25 +945,25 @@ __TS__SetDescriptor(
|
|
|
887
945
|
"stuns",
|
|
888
946
|
{
|
|
889
947
|
get = function(self)
|
|
890
|
-
local
|
|
891
|
-
if
|
|
892
|
-
|
|
948
|
+
local ____self__134_52 = self[134]
|
|
949
|
+
if ____self__134_52 == nil then
|
|
950
|
+
____self__134_52 = false
|
|
893
951
|
end
|
|
894
|
-
return
|
|
952
|
+
return ____self__134_52
|
|
895
953
|
end,
|
|
896
954
|
set = function(self, stuns)
|
|
897
|
-
if not stuns and self[
|
|
898
|
-
if self[
|
|
955
|
+
if not stuns and self[134] then
|
|
956
|
+
if self[135] then
|
|
899
957
|
self.object:decrementStunCounter()
|
|
900
958
|
end
|
|
901
959
|
self.object:decrementStunCounter()
|
|
902
|
-
self[
|
|
903
|
-
elseif stuns and not self[
|
|
904
|
-
if self[
|
|
960
|
+
self[134] = nil
|
|
961
|
+
elseif stuns and not self[134] then
|
|
962
|
+
if self[135] then
|
|
905
963
|
self.object:incrementStunCounter()
|
|
906
964
|
end
|
|
907
965
|
self.object:incrementStunCounter()
|
|
908
|
-
self[
|
|
966
|
+
self[134] = true
|
|
909
967
|
end
|
|
910
968
|
end
|
|
911
969
|
},
|
|
@@ -916,23 +974,23 @@ __TS__SetDescriptor(
|
|
|
916
974
|
"ignoresStunImmunity",
|
|
917
975
|
{
|
|
918
976
|
get = function(self)
|
|
919
|
-
local
|
|
920
|
-
if
|
|
921
|
-
|
|
977
|
+
local ____self__135_53 = self[135]
|
|
978
|
+
if ____self__135_53 == nil then
|
|
979
|
+
____self__135_53 = false
|
|
922
980
|
end
|
|
923
|
-
return
|
|
981
|
+
return ____self__135_53
|
|
924
982
|
end,
|
|
925
983
|
set = function(self, ignoresStunImmunity)
|
|
926
|
-
if not ignoresStunImmunity and self[
|
|
927
|
-
if self[
|
|
984
|
+
if not ignoresStunImmunity and self[135] then
|
|
985
|
+
if self[134] then
|
|
928
986
|
self.object:decrementStunCounter()
|
|
929
987
|
end
|
|
930
|
-
self[
|
|
931
|
-
elseif ignoresStunImmunity and not self[
|
|
932
|
-
if self[
|
|
988
|
+
self[135] = nil
|
|
989
|
+
elseif ignoresStunImmunity and not self[135] then
|
|
990
|
+
if self[134] then
|
|
933
991
|
self.object:incrementStunCounter()
|
|
934
992
|
end
|
|
935
|
-
self[
|
|
993
|
+
self[135] = true
|
|
936
994
|
end
|
|
937
995
|
end
|
|
938
996
|
},
|
|
@@ -943,19 +1001,19 @@ __TS__SetDescriptor(
|
|
|
943
1001
|
"disablesAutoAttack",
|
|
944
1002
|
{
|
|
945
1003
|
get = function(self)
|
|
946
|
-
local
|
|
947
|
-
if
|
|
948
|
-
|
|
1004
|
+
local ____self__136_54 = self[136]
|
|
1005
|
+
if ____self__136_54 == nil then
|
|
1006
|
+
____self__136_54 = false
|
|
949
1007
|
end
|
|
950
|
-
return
|
|
1008
|
+
return ____self__136_54
|
|
951
1009
|
end,
|
|
952
1010
|
set = function(self, disablesAutoAttack)
|
|
953
|
-
if not disablesAutoAttack and self[
|
|
1011
|
+
if not disablesAutoAttack and self[136] then
|
|
954
1012
|
self.object:decrementDisableAutoAttackCounter()
|
|
955
|
-
self[
|
|
956
|
-
elseif disablesAutoAttack and not self[
|
|
1013
|
+
self[136] = nil
|
|
1014
|
+
elseif disablesAutoAttack and not self[136] then
|
|
957
1015
|
self.object:incrementDisableAutoAttackCounter()
|
|
958
|
-
self[
|
|
1016
|
+
self[136] = true
|
|
959
1017
|
end
|
|
960
1018
|
end
|
|
961
1019
|
},
|
|
@@ -966,19 +1024,19 @@ __TS__SetDescriptor(
|
|
|
966
1024
|
"providesInvulnerability",
|
|
967
1025
|
{
|
|
968
1026
|
get = function(self)
|
|
969
|
-
local
|
|
970
|
-
if
|
|
971
|
-
|
|
1027
|
+
local ____self__137_55 = self[137]
|
|
1028
|
+
if ____self__137_55 == nil then
|
|
1029
|
+
____self__137_55 = false
|
|
972
1030
|
end
|
|
973
|
-
return
|
|
1031
|
+
return ____self__137_55
|
|
974
1032
|
end,
|
|
975
1033
|
set = function(self, providesInvulnerability)
|
|
976
|
-
if not providesInvulnerability and self[
|
|
1034
|
+
if not providesInvulnerability and self[137] then
|
|
977
1035
|
self.object:decrementInvulnerabilityCounter()
|
|
978
|
-
self[
|
|
979
|
-
elseif providesInvulnerability and not self[
|
|
1036
|
+
self[137] = nil
|
|
1037
|
+
elseif providesInvulnerability and not self[137] then
|
|
980
1038
|
self.object:incrementInvulnerabilityCounter()
|
|
981
|
-
self[
|
|
1039
|
+
self[137] = true
|
|
982
1040
|
end
|
|
983
1041
|
end
|
|
984
1042
|
},
|
|
@@ -989,17 +1047,17 @@ __TS__SetDescriptor(
|
|
|
989
1047
|
"killsOnExpiration",
|
|
990
1048
|
{
|
|
991
1049
|
get = function(self)
|
|
992
|
-
local
|
|
993
|
-
if
|
|
994
|
-
|
|
1050
|
+
local ____self__138_56 = self[138]
|
|
1051
|
+
if ____self__138_56 == nil then
|
|
1052
|
+
____self__138_56 = false
|
|
995
1053
|
end
|
|
996
|
-
return
|
|
1054
|
+
return ____self__138_56
|
|
997
1055
|
end,
|
|
998
1056
|
set = function(self, killsOnExpiration)
|
|
999
|
-
if not killsOnExpiration and self[
|
|
1000
|
-
self[
|
|
1001
|
-
elseif killsOnExpiration and not self[
|
|
1002
|
-
self[
|
|
1057
|
+
if not killsOnExpiration and self[138] then
|
|
1058
|
+
self[138] = nil
|
|
1059
|
+
elseif killsOnExpiration and not self[138] then
|
|
1060
|
+
self[138] = true
|
|
1003
1061
|
end
|
|
1004
1062
|
end
|
|
1005
1063
|
},
|
|
@@ -1010,17 +1068,51 @@ __TS__SetDescriptor(
|
|
|
1010
1068
|
"explodesOnExpiration",
|
|
1011
1069
|
{
|
|
1012
1070
|
get = function(self)
|
|
1013
|
-
local
|
|
1014
|
-
if
|
|
1015
|
-
|
|
1071
|
+
local ____self__139_57 = self[139]
|
|
1072
|
+
if ____self__139_57 == nil then
|
|
1073
|
+
____self__139_57 = false
|
|
1016
1074
|
end
|
|
1017
|
-
return
|
|
1075
|
+
return ____self__139_57
|
|
1018
1076
|
end,
|
|
1019
1077
|
set = function(self, killsOnExpiration)
|
|
1020
|
-
if not killsOnExpiration and self[
|
|
1021
|
-
self[
|
|
1022
|
-
elseif killsOnExpiration and not self[
|
|
1023
|
-
self[
|
|
1078
|
+
if not killsOnExpiration and self[139] then
|
|
1079
|
+
self[139] = nil
|
|
1080
|
+
elseif killsOnExpiration and not self[139] then
|
|
1081
|
+
self[139] = true
|
|
1082
|
+
end
|
|
1083
|
+
end
|
|
1084
|
+
},
|
|
1085
|
+
true
|
|
1086
|
+
)
|
|
1087
|
+
__TS__SetDescriptor(
|
|
1088
|
+
Buff.prototype,
|
|
1089
|
+
"maximumDamageDealtEventCount",
|
|
1090
|
+
{
|
|
1091
|
+
get = function(self)
|
|
1092
|
+
return self[131] or 0
|
|
1093
|
+
end,
|
|
1094
|
+
set = function(self, maximumDamageDealtEventCount)
|
|
1095
|
+
if maximumDamageDealtEventCount == 0 then
|
|
1096
|
+
self[131] = nil
|
|
1097
|
+
else
|
|
1098
|
+
self[131] = maximumDamageDealtEventCount
|
|
1099
|
+
end
|
|
1100
|
+
end
|
|
1101
|
+
},
|
|
1102
|
+
true
|
|
1103
|
+
)
|
|
1104
|
+
__TS__SetDescriptor(
|
|
1105
|
+
Buff.prototype,
|
|
1106
|
+
"maximumDamageReceivedEventCount",
|
|
1107
|
+
{
|
|
1108
|
+
get = function(self)
|
|
1109
|
+
return self[133] or 0
|
|
1110
|
+
end,
|
|
1111
|
+
set = function(self, maximumDamageReceivedEventCount)
|
|
1112
|
+
if maximumDamageReceivedEventCount == 0 then
|
|
1113
|
+
self[133] = nil
|
|
1114
|
+
else
|
|
1115
|
+
self[133] = maximumDamageReceivedEventCount
|
|
1024
1116
|
end
|
|
1025
1117
|
end
|
|
1026
1118
|
},
|
|
@@ -4,14 +4,6 @@ import { Event } from "../../event";
|
|
|
4
4
|
import type { Item } from "../../core/types/item";
|
|
5
5
|
import type { Unit } from "./unit";
|
|
6
6
|
import type { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
7
|
-
interface Fields<K, V> {
|
|
8
|
-
set(field: K, value: V): boolean;
|
|
9
|
-
get(field: K): V;
|
|
10
|
-
has(field: K): boolean;
|
|
11
|
-
}
|
|
12
|
-
interface AbilityLevel {
|
|
13
|
-
realFields: Fields<jabilityreallevelfield, number>;
|
|
14
|
-
}
|
|
15
7
|
export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
16
8
|
export declare class AbilitySnapshot {
|
|
17
9
|
}
|
|
@@ -40,8 +32,7 @@ export declare abstract class Ability extends Handle<jability> {
|
|
|
40
32
|
setField(field: jabilityintegerlevelfield | jabilityreallevelfield, level: number, value: number): boolean;
|
|
41
33
|
setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
|
|
42
34
|
setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
|
|
43
|
-
get
|
|
44
|
-
get levels(): readonly AbilityLevel[];
|
|
35
|
+
get levelCount(): number;
|
|
45
36
|
abstract get level(): number;
|
|
46
37
|
static get onCreate(): Event<[Ability]>;
|
|
47
38
|
static get destroyEvent(): Event<[Ability]>;
|
|
@@ -58,6 +49,8 @@ export declare class UnitAbility extends Ability {
|
|
|
58
49
|
readonly owner: Unit;
|
|
59
50
|
private readonly u;
|
|
60
51
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
52
|
+
incrementHideCounter(): void;
|
|
53
|
+
decrementHideCounter(): void;
|
|
61
54
|
get level(): number;
|
|
62
55
|
set level(v: number);
|
|
63
56
|
get cooldownRemaining(): number;
|
|
@@ -88,4 +81,3 @@ export declare class ItemAbility extends Ability {
|
|
|
88
81
|
static get onCreate(): Event<[ItemAbility]>;
|
|
89
82
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
90
83
|
}
|
|
91
|
-
export {};
|
|
@@ -2,7 +2,6 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
4
|
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
-
local __TS__New = ____lualib.__TS__New
|
|
6
5
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
7
6
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
8
7
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
@@ -33,7 +32,7 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
33
32
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
34
33
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
35
34
|
local getHandleId = GetHandleId
|
|
36
|
-
local
|
|
35
|
+
local unitHideAbility = BlzUnitHideAbility
|
|
37
36
|
local match = string.match
|
|
38
37
|
local ____type = _G.type
|
|
39
38
|
local ____tostring = _G.tostring
|
|
@@ -151,55 +150,6 @@ local orders = postcompile(function()
|
|
|
151
150
|
end
|
|
152
151
|
return orders
|
|
153
152
|
end)
|
|
154
|
-
local RealFields = __TS__Class()
|
|
155
|
-
RealFields.name = "RealFields"
|
|
156
|
-
function RealFields.prototype.____constructor(self, handle)
|
|
157
|
-
self.handle = handle
|
|
158
|
-
end
|
|
159
|
-
function RealFields.prototype.set(self, field, value)
|
|
160
|
-
return BlzSetAbilityRealField(self.handle, field, value)
|
|
161
|
-
end
|
|
162
|
-
function RealFields.prototype.get(self, field)
|
|
163
|
-
return BlzGetAbilityRealField(self.handle, field)
|
|
164
|
-
end
|
|
165
|
-
function RealFields.prototype.has(self, field)
|
|
166
|
-
local handle = self.handle
|
|
167
|
-
return BlzSetAbilityRealField(
|
|
168
|
-
handle,
|
|
169
|
-
field,
|
|
170
|
-
BlzGetAbilityRealField(handle, field)
|
|
171
|
-
)
|
|
172
|
-
end
|
|
173
|
-
local RealLevelFields = __TS__Class()
|
|
174
|
-
RealLevelFields.name = "RealLevelFields"
|
|
175
|
-
function RealLevelFields.prototype.____constructor(self, handle, level)
|
|
176
|
-
self.handle = handle
|
|
177
|
-
self.level = level
|
|
178
|
-
end
|
|
179
|
-
function RealLevelFields.prototype.set(self, field, value)
|
|
180
|
-
return BlzSetAbilityRealLevelField(self.handle, field, self.level, value)
|
|
181
|
-
end
|
|
182
|
-
function RealLevelFields.prototype.get(self, field)
|
|
183
|
-
return BlzGetAbilityRealLevelField(self.handle, field, self.level)
|
|
184
|
-
end
|
|
185
|
-
function RealLevelFields.prototype.has(self, field)
|
|
186
|
-
local handle = self.handle
|
|
187
|
-
return BlzSetAbilityRealLevelField(
|
|
188
|
-
handle,
|
|
189
|
-
field,
|
|
190
|
-
0,
|
|
191
|
-
BlzGetAbilityRealLevelField(handle, field, 0)
|
|
192
|
-
)
|
|
193
|
-
end
|
|
194
|
-
local realLevelMetatable = {__index = self}
|
|
195
|
-
local levelDescriptors = {realFields = function(self, handle, level)
|
|
196
|
-
return __TS__New(RealLevelFields, handle, level)
|
|
197
|
-
end}
|
|
198
|
-
local levelMetatable = {__index = function(self, key)
|
|
199
|
-
local fields = levelDescriptors[key](levelDescriptors, self.handle, self.level)
|
|
200
|
-
rawset(self, key, fields)
|
|
201
|
-
return fields
|
|
202
|
-
end}
|
|
203
153
|
local fieldGetters = {
|
|
204
154
|
abilityintegerfield = function(ability, field)
|
|
205
155
|
return getAbilityIntegerField(ability.handle, field)
|
|
@@ -355,34 +305,9 @@ __TS__SetDescriptor(
|
|
|
355
305
|
)
|
|
356
306
|
__TS__SetDescriptor(
|
|
357
307
|
Ability.prototype,
|
|
358
|
-
"
|
|
359
|
-
{get = function(self)
|
|
360
|
-
local realFields = __TS__New(RealFields, self.handle)
|
|
361
|
-
rawset(self, "realFields", realFields)
|
|
362
|
-
return realFields
|
|
363
|
-
end},
|
|
364
|
-
true
|
|
365
|
-
)
|
|
366
|
-
__TS__SetDescriptor(
|
|
367
|
-
Ability.prototype,
|
|
368
|
-
"levels",
|
|
308
|
+
"levelCount",
|
|
369
309
|
{get = function(self)
|
|
370
|
-
|
|
371
|
-
local levels = setmetatable(
|
|
372
|
-
{},
|
|
373
|
-
{
|
|
374
|
-
__len = function(self)
|
|
375
|
-
return BlzGetAbilityIntegerField(handle, ABILITY_IF_LEVELS)
|
|
376
|
-
end,
|
|
377
|
-
__index = function(self, i)
|
|
378
|
-
local level = setmetatable({handle = handle, level = i - 1}, levelMetatable)
|
|
379
|
-
self[i] = level
|
|
380
|
-
return level
|
|
381
|
-
end
|
|
382
|
-
}
|
|
383
|
-
)
|
|
384
|
-
rawset(self, "levels", levels)
|
|
385
|
-
return levels
|
|
310
|
+
return self:getField(ABILITY_IF_LEVELS)
|
|
386
311
|
end},
|
|
387
312
|
true
|
|
388
313
|
)
|
|
@@ -433,6 +358,12 @@ function UnitAbility.prototype.____constructor(self, handle, typeId, owner)
|
|
|
433
358
|
self.owner = owner
|
|
434
359
|
self.u = owner.handle
|
|
435
360
|
end
|
|
361
|
+
function UnitAbility.prototype.incrementHideCounter(self)
|
|
362
|
+
unitHideAbility(self.u, self.typeId, true)
|
|
363
|
+
end
|
|
364
|
+
function UnitAbility.prototype.decrementHideCounter(self)
|
|
365
|
+
unitHideAbility(self.u, self.typeId, false)
|
|
366
|
+
end
|
|
436
367
|
__TS__SetDescriptor(
|
|
437
368
|
UnitAbility.prototype,
|
|
438
369
|
"level",
|
|
@@ -6,10 +6,10 @@ local Item = ____item.Item
|
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
8
|
local ownerByItem = setmetatable({}, {__mode = "kv"})
|
|
9
|
-
Unit.
|
|
9
|
+
Unit.itemPickedUpEvent:addListener(function(unit, item)
|
|
10
10
|
ownerByItem[item] = unit
|
|
11
11
|
end)
|
|
12
|
-
Unit.
|
|
12
|
+
Unit.itemDroppedEvent:addListener(function(unit, item)
|
|
13
13
|
ownerByItem[item] = nil
|
|
14
14
|
end)
|
|
15
15
|
__TS__ObjectDefineProperty(
|
|
@@ -26,11 +26,8 @@ local getSpellTargetUnit = GetSpellTargetUnit
|
|
|
26
26
|
local getSpellTargetX = GetSpellTargetX
|
|
27
27
|
local getSpellTargetY = GetSpellTargetY
|
|
28
28
|
local getTriggerUnit = GetTriggerUnit
|
|
29
|
-
local getUnitAbility = BlzGetUnitAbility
|
|
30
|
-
local unitAddAbility = UnitAddAbility
|
|
31
29
|
local unitInventorySize = UnitInventorySize
|
|
32
30
|
local unitItemInSlot = UnitItemInSlot
|
|
33
|
-
local unitRemoveAbility = UnitRemoveAbility
|
|
34
31
|
local function retrieveAbility(unit, ability, abilityId)
|
|
35
32
|
if ability == nil then
|
|
36
33
|
return __TS__New(
|
|
@@ -39,17 +36,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
39
36
|
Unit:of(unit)
|
|
40
37
|
)
|
|
41
38
|
end
|
|
42
|
-
if not unitAddAbility(unit, abilityId) then
|
|
43
|
-
if getUnitAbility(unit, abilityId) == ability then
|
|
44
|
-
return UnitAbility:of(
|
|
45
|
-
ability,
|
|
46
|
-
abilityId,
|
|
47
|
-
Unit:of(unit)
|
|
48
|
-
)
|
|
49
|
-
end
|
|
50
|
-
else
|
|
51
|
-
unitRemoveAbility(unit, abilityId)
|
|
52
|
-
end
|
|
53
39
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
54
40
|
local item = unitItemInSlot(unit, i)
|
|
55
41
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -8,7 +8,8 @@ export type UnitBonusId<Brand extends string = any> = number & {
|
|
|
8
8
|
export type UnitArmorBonusId = UnitBonusId<"armor">;
|
|
9
9
|
export type UnitAttackSpeedFactorBonusId = UnitBonusId<"attackSpeedFactor">;
|
|
10
10
|
export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
|
|
11
|
-
export type
|
|
11
|
+
export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
|
|
12
|
+
export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
|
|
12
13
|
export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
|
|
13
14
|
export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
14
15
|
abilityTypeId: AbilityTypeId;
|
|
@@ -30,7 +31,8 @@ export declare namespace UnitBonusType {
|
|
|
30
31
|
const ARMOR: UnitBonusType<UnitArmorBonusId>;
|
|
31
32
|
const ATTACK_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
32
33
|
const MOVEMENT_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
33
|
-
const
|
|
34
|
+
const AUTO_ATTACK_DAMAGE: UnitBonusType<UnitAutoAttackDamageBonusId>;
|
|
35
|
+
const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
34
36
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
35
37
|
}
|
|
36
38
|
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
@@ -21,6 +21,7 @@ local AUTO_ATTACK_DAMAGE_INCREASE_DUMMY_ABILITY_TYPE_ID = ____auto_2Dattack_2Dda
|
|
|
21
21
|
local ____movement_2Dspeed_2Dincrease_2Dfactor = require("engine.internal.object-data.movement-speed-increase-factor")
|
|
22
22
|
local MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD
|
|
23
23
|
local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
|
|
24
|
+
local damageFactorByUnit = {}
|
|
24
25
|
local receivedDamageFactorByUnit = {}
|
|
25
26
|
____exports.UnitBonusType = {}
|
|
26
27
|
local UnitBonusType = ____exports.UnitBonusType
|
|
@@ -46,13 +47,14 @@ do
|
|
|
46
47
|
reduce = sum,
|
|
47
48
|
initialValue = 0
|
|
48
49
|
}
|
|
49
|
-
UnitBonusType.
|
|
50
|
+
UnitBonusType.AUTO_ATTACK_DAMAGE = {
|
|
50
51
|
abilityTypeId = AUTO_ATTACK_DAMAGE_INCREASE_DUMMY_ABILITY_TYPE_ID,
|
|
51
52
|
field = AUTO_ATTACK_DAMAGE_INCREASE_ABILITY_FIELD,
|
|
52
53
|
integer = false,
|
|
53
54
|
reduce = sum,
|
|
54
55
|
initialValue = 0
|
|
55
56
|
}
|
|
57
|
+
UnitBonusType.DAMAGE_FACTOR = {reduce = product, valueByUnit = damageFactorByUnit, initialValue = 1}
|
|
56
58
|
UnitBonusType.RECEIVED_DAMAGE_FACTOR = {reduce = product, valueByUnit = receivedDamageFactorByUnit, initialValue = 1}
|
|
57
59
|
end
|
|
58
60
|
local bonusesByUnitByBonusType = {}
|
|
@@ -180,6 +182,9 @@ end
|
|
|
180
182
|
Unit.onDamage:addListener(
|
|
181
183
|
4,
|
|
182
184
|
function(source, target, event)
|
|
185
|
+
if source ~= nil and damageFactorByUnit[source] ~= nil then
|
|
186
|
+
event.amount = event.amount * damageFactorByUnit[source]
|
|
187
|
+
end
|
|
183
188
|
if receivedDamageFactorByUnit[target] ~= nil then
|
|
184
189
|
event.amount = event.amount * receivedDamageFactorByUnit[target]
|
|
185
190
|
end
|