warscript 0.0.1-dev.cc63edd → 0.0.1-dev.ccc2b77
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 +0 -1
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/frame.d.ts +5 -1
- package/core/types/frame.lua +34 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/apply-buff.d.ts +3 -5
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +8 -2
- package/engine/behaviour/unit.lua +27 -0
- package/engine/buff.d.ts +62 -20
- package/engine/buff.lua +247 -72
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +1 -11
- package/engine/internal/ability.lua +2 -78
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/unit/bonus.d.ts +9 -8
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit/item.d.ts +23 -0
- package/engine/internal/unit/item.lua +74 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +7 -6
- package/engine/internal/unit.lua +50 -33
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +81 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +12 -1
- package/engine/object-data/entry/item-type.lua +78 -0
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +0 -1
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-field/ability.d.ts +18 -1
- package/engine/object-field/ability.lua +51 -1
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +10 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- 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/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +1 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -13
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +16 -0
- package/string.lua +5 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +3 -4
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +11 -3
- package/utility/linked-set.lua +5 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/buff.lua
CHANGED
|
@@ -94,6 +94,7 @@ local buffParametersKeys = {
|
|
|
94
94
|
armorIncreaseFactor = true,
|
|
95
95
|
attackSpeedIncreaseFactor = true,
|
|
96
96
|
movementSpeedIncreaseFactor = true,
|
|
97
|
+
damageFactor = true,
|
|
97
98
|
receivedDamageFactor = true,
|
|
98
99
|
receivedMagicDamageFactor = true,
|
|
99
100
|
durationIncreaseOnAutoAttack = true,
|
|
@@ -107,8 +108,26 @@ local buffParametersKeys = {
|
|
|
107
108
|
disablesAutoAttack = true,
|
|
108
109
|
destroysOnDamage = true,
|
|
109
110
|
maximumAutoAttackCount = true,
|
|
110
|
-
|
|
111
|
+
maximumDamageDealtEventCount = true,
|
|
112
|
+
maximumDamageReceivedEventCount = true,
|
|
113
|
+
uniqueGroup = true,
|
|
114
|
+
damageOnExpiration = true,
|
|
115
|
+
healingOnExpiration = true,
|
|
116
|
+
killsOnExpiration = true,
|
|
117
|
+
explodesOnExpiration = true
|
|
111
118
|
}
|
|
119
|
+
local function resolveEnumValue(ability, level, value)
|
|
120
|
+
if value == nil or type(value) == "number" then
|
|
121
|
+
return value
|
|
122
|
+
end
|
|
123
|
+
if ability == nil then
|
|
124
|
+
error(
|
|
125
|
+
__TS__New(IllegalArgumentException),
|
|
126
|
+
0
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
return value:getValue(ability, level or ability.level)
|
|
130
|
+
end
|
|
112
131
|
local function resolveNumberValue(ability, level, value)
|
|
113
132
|
if value == nil or type(value) == "number" then
|
|
114
133
|
return value
|
|
@@ -145,20 +164,32 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
145
164
|
buff[property] = resolvedValue
|
|
146
165
|
end
|
|
147
166
|
end
|
|
148
|
-
local buffBooleanParameters = {
|
|
167
|
+
local buffBooleanParameters = {
|
|
168
|
+
"stuns",
|
|
169
|
+
"ignoresStunImmunity",
|
|
170
|
+
"disablesAutoAttack",
|
|
171
|
+
"providesInvulnerability",
|
|
172
|
+
"killsOnExpiration",
|
|
173
|
+
"explodesOnExpiration"
|
|
174
|
+
}
|
|
149
175
|
local buffNumberParameters = {
|
|
150
176
|
"durationIncreaseOnAutoAttack",
|
|
151
177
|
"attackSpeedIncreaseFactor",
|
|
152
178
|
"movementSpeedIncreaseFactor",
|
|
153
179
|
"armorIncrease",
|
|
180
|
+
"damageFactor",
|
|
154
181
|
"receivedDamageFactor",
|
|
155
182
|
"maximumAutoAttackCount",
|
|
183
|
+
"maximumDamageDealtEventCount",
|
|
184
|
+
"maximumDamageReceivedEventCount",
|
|
156
185
|
"damageInterval",
|
|
157
186
|
"damagePerInterval",
|
|
158
187
|
"damageOverDuration",
|
|
159
188
|
"healingInterval",
|
|
160
189
|
"healingPerInterval",
|
|
161
|
-
"healingOverDuration"
|
|
190
|
+
"healingOverDuration",
|
|
191
|
+
"damageOnExpiration",
|
|
192
|
+
"healingOnExpiration"
|
|
162
193
|
}
|
|
163
194
|
local unsuccessfulApplicationMarker = {}
|
|
164
195
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -207,6 +238,7 @@ local function expireBuff(buff)
|
|
|
207
238
|
end
|
|
208
239
|
end
|
|
209
240
|
Timer:run(destroyBuff, buff)
|
|
241
|
+
buff:onExpiration()
|
|
210
242
|
end
|
|
211
243
|
local function buffDamageIntervalInitialTimerCallback(buff)
|
|
212
244
|
buffDamageIntervalTimerCallback(buff)
|
|
@@ -296,8 +328,6 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
296
328
|
end
|
|
297
329
|
end
|
|
298
330
|
self.typeId = typeId
|
|
299
|
-
self.polarity = polarity
|
|
300
|
-
self.resistanceType = resistanceType
|
|
301
331
|
if not __TS__InstanceOf(ability, Ability) then
|
|
302
332
|
parameters = ability
|
|
303
333
|
ability = nil
|
|
@@ -324,6 +354,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
324
354
|
learnLevelMinimum = learnLevelMinimum or ability:getField(ABILITY_IF_REQUIRED_LEVEL)
|
|
325
355
|
duration = duration or getAbilityDuration(ability, _unit)
|
|
326
356
|
end
|
|
357
|
+
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
358
|
+
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
327
359
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
328
360
|
if buffByTypeId == nil then
|
|
329
361
|
buffByTypeId = {}
|
|
@@ -340,8 +372,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
340
372
|
if not internalApplyBuff(
|
|
341
373
|
_unit,
|
|
342
374
|
typeId,
|
|
343
|
-
polarity,
|
|
344
|
-
resistanceType,
|
|
375
|
+
self.polarity,
|
|
376
|
+
self.resistanceType,
|
|
345
377
|
level,
|
|
346
378
|
duration,
|
|
347
379
|
spellStealPriority,
|
|
@@ -530,11 +562,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
530
562
|
behavior:destroy()
|
|
531
563
|
end
|
|
532
564
|
end
|
|
533
|
-
if self[
|
|
565
|
+
if self[136] then
|
|
534
566
|
unit:decrementDisableAutoAttackCounter()
|
|
535
567
|
end
|
|
536
|
-
if self[
|
|
537
|
-
if self[
|
|
568
|
+
if self[134] then
|
|
569
|
+
if self[135] then
|
|
538
570
|
unit:decrementStunCounter()
|
|
539
571
|
end
|
|
540
572
|
unit:decrementStunCounter()
|
|
@@ -583,20 +615,34 @@ function Buff.getByTypeId(self, unit, typeId)
|
|
|
583
615
|
end
|
|
584
616
|
return nil
|
|
585
617
|
end
|
|
586
|
-
function Buff.prototype.
|
|
618
|
+
function Buff.prototype.onExpiration(self)
|
|
587
619
|
local unit = self.unit
|
|
588
620
|
if self[119] ~= nil then
|
|
621
|
+
(self[101] or unit):damageTarget(unit, self[119] or 0)
|
|
622
|
+
end
|
|
623
|
+
if self[120] ~= nil then
|
|
624
|
+
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
625
|
+
end
|
|
626
|
+
if self[139] then
|
|
627
|
+
unit:explode()
|
|
628
|
+
elseif self[138] then
|
|
629
|
+
unit:kill()
|
|
630
|
+
end
|
|
631
|
+
end
|
|
632
|
+
function Buff.prototype.onDeath(self, source)
|
|
633
|
+
local unit = self.unit
|
|
634
|
+
if self[121] ~= nil then
|
|
589
635
|
damageArea(
|
|
590
636
|
self[101] or unit,
|
|
591
|
-
self[
|
|
637
|
+
self[121],
|
|
592
638
|
unit.x,
|
|
593
639
|
unit.y,
|
|
594
|
-
self[121] or 0,
|
|
595
|
-
self[120] or 0,
|
|
596
640
|
self[123] or 0,
|
|
597
641
|
self[122] or 0,
|
|
598
642
|
self[125] or 0,
|
|
599
|
-
self[124] or 0
|
|
643
|
+
self[124] or 0,
|
|
644
|
+
self[127] or 0,
|
|
645
|
+
self[126] or 0
|
|
600
646
|
)
|
|
601
647
|
end
|
|
602
648
|
end
|
|
@@ -618,9 +664,25 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
618
664
|
end
|
|
619
665
|
self.remainingDuration = remainingDuration
|
|
620
666
|
end
|
|
621
|
-
local autoAttackCount = (self[
|
|
622
|
-
self[
|
|
623
|
-
if autoAttackCount == self[
|
|
667
|
+
local autoAttackCount = (self[128] or 0) + 1
|
|
668
|
+
self[128] = autoAttackCount
|
|
669
|
+
if autoAttackCount == self[129] then
|
|
670
|
+
self:destroy()
|
|
671
|
+
end
|
|
672
|
+
end
|
|
673
|
+
if event.originalAmount ~= 0 then
|
|
674
|
+
local damageDealtEventCount = (self[130] or 0) + 1
|
|
675
|
+
self[130] = damageDealtEventCount
|
|
676
|
+
if damageDealtEventCount == self[131] then
|
|
677
|
+
self:destroy()
|
|
678
|
+
end
|
|
679
|
+
end
|
|
680
|
+
end
|
|
681
|
+
function Buff.prototype.onDamageReceived(self, source, event)
|
|
682
|
+
if event.originalAmount ~= 0 then
|
|
683
|
+
local damageReceivedEventCount = (self[132] or 0) + 1
|
|
684
|
+
self[132] = damageReceivedEventCount
|
|
685
|
+
if damageReceivedEventCount == self[133] then
|
|
624
686
|
self:destroy()
|
|
625
687
|
end
|
|
626
688
|
end
|
|
@@ -802,6 +864,45 @@ __TS__SetDescriptor(
|
|
|
802
864
|
},
|
|
803
865
|
true
|
|
804
866
|
)
|
|
867
|
+
__TS__SetDescriptor(
|
|
868
|
+
Buff.prototype,
|
|
869
|
+
"damageOnExpiration",
|
|
870
|
+
{
|
|
871
|
+
get = function(self)
|
|
872
|
+
return self[119] or 0
|
|
873
|
+
end,
|
|
874
|
+
set = function(self, damageOnExpiration)
|
|
875
|
+
self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
|
|
876
|
+
end
|
|
877
|
+
},
|
|
878
|
+
true
|
|
879
|
+
)
|
|
880
|
+
__TS__SetDescriptor(
|
|
881
|
+
Buff.prototype,
|
|
882
|
+
"healingOnExpiration",
|
|
883
|
+
{
|
|
884
|
+
get = function(self)
|
|
885
|
+
return self[120] or 0
|
|
886
|
+
end,
|
|
887
|
+
set = function(self, healingOnExpiration)
|
|
888
|
+
self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
|
|
889
|
+
end
|
|
890
|
+
},
|
|
891
|
+
true
|
|
892
|
+
)
|
|
893
|
+
__TS__SetDescriptor(
|
|
894
|
+
Buff.prototype,
|
|
895
|
+
"damageFactor",
|
|
896
|
+
{
|
|
897
|
+
get = function(self)
|
|
898
|
+
return self:getUnitBonus(UnitBonusType.DAMAGE_FACTOR)
|
|
899
|
+
end,
|
|
900
|
+
set = function(self, damageFactor)
|
|
901
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.DAMAGE_FACTOR, damageFactor)
|
|
902
|
+
end
|
|
903
|
+
},
|
|
904
|
+
true
|
|
905
|
+
)
|
|
805
906
|
__TS__SetDescriptor(
|
|
806
907
|
Buff.prototype,
|
|
807
908
|
"receivedDamageFactor",
|
|
@@ -833,25 +934,25 @@ __TS__SetDescriptor(
|
|
|
833
934
|
"stuns",
|
|
834
935
|
{
|
|
835
936
|
get = function(self)
|
|
836
|
-
local
|
|
837
|
-
if
|
|
838
|
-
|
|
937
|
+
local ____self__134_52 = self[134]
|
|
938
|
+
if ____self__134_52 == nil then
|
|
939
|
+
____self__134_52 = false
|
|
839
940
|
end
|
|
840
|
-
return
|
|
941
|
+
return ____self__134_52
|
|
841
942
|
end,
|
|
842
943
|
set = function(self, stuns)
|
|
843
|
-
if not stuns and self[
|
|
844
|
-
if self[
|
|
944
|
+
if not stuns and self[134] then
|
|
945
|
+
if self[135] then
|
|
845
946
|
self.object:decrementStunCounter()
|
|
846
947
|
end
|
|
847
948
|
self.object:decrementStunCounter()
|
|
848
|
-
self[
|
|
849
|
-
elseif stuns and not self[
|
|
850
|
-
if self[
|
|
949
|
+
self[134] = nil
|
|
950
|
+
elseif stuns and not self[134] then
|
|
951
|
+
if self[135] then
|
|
851
952
|
self.object:incrementStunCounter()
|
|
852
953
|
end
|
|
853
954
|
self.object:incrementStunCounter()
|
|
854
|
-
self[
|
|
955
|
+
self[134] = true
|
|
855
956
|
end
|
|
856
957
|
end
|
|
857
958
|
},
|
|
@@ -862,23 +963,23 @@ __TS__SetDescriptor(
|
|
|
862
963
|
"ignoresStunImmunity",
|
|
863
964
|
{
|
|
864
965
|
get = function(self)
|
|
865
|
-
local
|
|
866
|
-
if
|
|
867
|
-
|
|
966
|
+
local ____self__135_53 = self[135]
|
|
967
|
+
if ____self__135_53 == nil then
|
|
968
|
+
____self__135_53 = false
|
|
868
969
|
end
|
|
869
|
-
return
|
|
970
|
+
return ____self__135_53
|
|
870
971
|
end,
|
|
871
972
|
set = function(self, ignoresStunImmunity)
|
|
872
|
-
if not ignoresStunImmunity and self[
|
|
873
|
-
if self[
|
|
973
|
+
if not ignoresStunImmunity and self[135] then
|
|
974
|
+
if self[134] then
|
|
874
975
|
self.object:decrementStunCounter()
|
|
875
976
|
end
|
|
876
|
-
self[
|
|
877
|
-
elseif ignoresStunImmunity and not self[
|
|
878
|
-
if self[
|
|
977
|
+
self[135] = nil
|
|
978
|
+
elseif ignoresStunImmunity and not self[135] then
|
|
979
|
+
if self[134] then
|
|
879
980
|
self.object:incrementStunCounter()
|
|
880
981
|
end
|
|
881
|
-
self[
|
|
982
|
+
self[135] = true
|
|
882
983
|
end
|
|
883
984
|
end
|
|
884
985
|
},
|
|
@@ -889,19 +990,19 @@ __TS__SetDescriptor(
|
|
|
889
990
|
"disablesAutoAttack",
|
|
890
991
|
{
|
|
891
992
|
get = function(self)
|
|
892
|
-
local
|
|
893
|
-
if
|
|
894
|
-
|
|
993
|
+
local ____self__136_54 = self[136]
|
|
994
|
+
if ____self__136_54 == nil then
|
|
995
|
+
____self__136_54 = false
|
|
895
996
|
end
|
|
896
|
-
return
|
|
997
|
+
return ____self__136_54
|
|
897
998
|
end,
|
|
898
999
|
set = function(self, disablesAutoAttack)
|
|
899
|
-
if not disablesAutoAttack and self[
|
|
1000
|
+
if not disablesAutoAttack and self[136] then
|
|
900
1001
|
self.object:decrementDisableAutoAttackCounter()
|
|
901
|
-
self[
|
|
902
|
-
elseif disablesAutoAttack and not self[
|
|
1002
|
+
self[136] = nil
|
|
1003
|
+
elseif disablesAutoAttack and not self[136] then
|
|
903
1004
|
self.object:incrementDisableAutoAttackCounter()
|
|
904
|
-
self[
|
|
1005
|
+
self[136] = true
|
|
905
1006
|
end
|
|
906
1007
|
end
|
|
907
1008
|
},
|
|
@@ -912,19 +1013,95 @@ __TS__SetDescriptor(
|
|
|
912
1013
|
"providesInvulnerability",
|
|
913
1014
|
{
|
|
914
1015
|
get = function(self)
|
|
915
|
-
local
|
|
916
|
-
if
|
|
917
|
-
|
|
1016
|
+
local ____self__137_55 = self[137]
|
|
1017
|
+
if ____self__137_55 == nil then
|
|
1018
|
+
____self__137_55 = false
|
|
918
1019
|
end
|
|
919
|
-
return
|
|
1020
|
+
return ____self__137_55
|
|
920
1021
|
end,
|
|
921
1022
|
set = function(self, providesInvulnerability)
|
|
922
|
-
if not providesInvulnerability and self[
|
|
1023
|
+
if not providesInvulnerability and self[137] then
|
|
923
1024
|
self.object:decrementInvulnerabilityCounter()
|
|
924
|
-
self[
|
|
925
|
-
elseif providesInvulnerability and not self[
|
|
1025
|
+
self[137] = nil
|
|
1026
|
+
elseif providesInvulnerability and not self[137] then
|
|
926
1027
|
self.object:incrementInvulnerabilityCounter()
|
|
927
|
-
self[
|
|
1028
|
+
self[137] = true
|
|
1029
|
+
end
|
|
1030
|
+
end
|
|
1031
|
+
},
|
|
1032
|
+
true
|
|
1033
|
+
)
|
|
1034
|
+
__TS__SetDescriptor(
|
|
1035
|
+
Buff.prototype,
|
|
1036
|
+
"killsOnExpiration",
|
|
1037
|
+
{
|
|
1038
|
+
get = function(self)
|
|
1039
|
+
local ____self__138_56 = self[138]
|
|
1040
|
+
if ____self__138_56 == nil then
|
|
1041
|
+
____self__138_56 = false
|
|
1042
|
+
end
|
|
1043
|
+
return ____self__138_56
|
|
1044
|
+
end,
|
|
1045
|
+
set = function(self, killsOnExpiration)
|
|
1046
|
+
if not killsOnExpiration and self[138] then
|
|
1047
|
+
self[138] = nil
|
|
1048
|
+
elseif killsOnExpiration and not self[138] then
|
|
1049
|
+
self[138] = true
|
|
1050
|
+
end
|
|
1051
|
+
end
|
|
1052
|
+
},
|
|
1053
|
+
true
|
|
1054
|
+
)
|
|
1055
|
+
__TS__SetDescriptor(
|
|
1056
|
+
Buff.prototype,
|
|
1057
|
+
"explodesOnExpiration",
|
|
1058
|
+
{
|
|
1059
|
+
get = function(self)
|
|
1060
|
+
local ____self__139_57 = self[139]
|
|
1061
|
+
if ____self__139_57 == nil then
|
|
1062
|
+
____self__139_57 = false
|
|
1063
|
+
end
|
|
1064
|
+
return ____self__139_57
|
|
1065
|
+
end,
|
|
1066
|
+
set = function(self, killsOnExpiration)
|
|
1067
|
+
if not killsOnExpiration and self[139] then
|
|
1068
|
+
self[139] = nil
|
|
1069
|
+
elseif killsOnExpiration and not self[139] then
|
|
1070
|
+
self[139] = true
|
|
1071
|
+
end
|
|
1072
|
+
end
|
|
1073
|
+
},
|
|
1074
|
+
true
|
|
1075
|
+
)
|
|
1076
|
+
__TS__SetDescriptor(
|
|
1077
|
+
Buff.prototype,
|
|
1078
|
+
"maximumDamageDealtEventCount",
|
|
1079
|
+
{
|
|
1080
|
+
get = function(self)
|
|
1081
|
+
return self[131] or 0
|
|
1082
|
+
end,
|
|
1083
|
+
set = function(self, maximumDamageDealtEventCount)
|
|
1084
|
+
if maximumDamageDealtEventCount == 0 then
|
|
1085
|
+
self[131] = nil
|
|
1086
|
+
else
|
|
1087
|
+
self[131] = maximumDamageDealtEventCount
|
|
1088
|
+
end
|
|
1089
|
+
end
|
|
1090
|
+
},
|
|
1091
|
+
true
|
|
1092
|
+
)
|
|
1093
|
+
__TS__SetDescriptor(
|
|
1094
|
+
Buff.prototype,
|
|
1095
|
+
"maximumDamageReceivedEventCount",
|
|
1096
|
+
{
|
|
1097
|
+
get = function(self)
|
|
1098
|
+
return self[133] or 0
|
|
1099
|
+
end,
|
|
1100
|
+
set = function(self, maximumDamageReceivedEventCount)
|
|
1101
|
+
if maximumDamageReceivedEventCount == 0 then
|
|
1102
|
+
self[133] = nil
|
|
1103
|
+
else
|
|
1104
|
+
self[133] = maximumDamageReceivedEventCount
|
|
928
1105
|
end
|
|
929
1106
|
end
|
|
930
1107
|
},
|
|
@@ -935,13 +1112,13 @@ __TS__SetDescriptor(
|
|
|
935
1112
|
"maximumAutoAttackCount",
|
|
936
1113
|
{
|
|
937
1114
|
get = function(self)
|
|
938
|
-
return self[
|
|
1115
|
+
return self[129] or 0
|
|
939
1116
|
end,
|
|
940
1117
|
set = function(self, maximumAutoAttackCount)
|
|
941
1118
|
if maximumAutoAttackCount == 0 then
|
|
942
|
-
self[
|
|
1119
|
+
self[129] = nil
|
|
943
1120
|
else
|
|
944
|
-
self[
|
|
1121
|
+
self[129] = maximumAutoAttackCount
|
|
945
1122
|
end
|
|
946
1123
|
end
|
|
947
1124
|
},
|
|
@@ -999,13 +1176,13 @@ __TS__SetDescriptor(
|
|
|
999
1176
|
"remainingDuration",
|
|
1000
1177
|
{
|
|
1001
1178
|
get = function(self)
|
|
1002
|
-
local
|
|
1003
|
-
return
|
|
1179
|
+
local ____opt_58 = self._timer
|
|
1180
|
+
return ____opt_58 and ____opt_58.remaining or 0
|
|
1004
1181
|
end,
|
|
1005
1182
|
set = function(self, remainingDuration)
|
|
1006
|
-
local
|
|
1007
|
-
local
|
|
1008
|
-
local remainingDurationDelta =
|
|
1183
|
+
local ____remainingDuration_62 = remainingDuration
|
|
1184
|
+
local ____opt_60 = self._timer
|
|
1185
|
+
local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
|
|
1009
1186
|
if remainingDurationDelta ~= 0 then
|
|
1010
1187
|
self[102] = self[102] + remainingDurationDelta
|
|
1011
1188
|
if remainingDuration <= 0 then
|
|
@@ -1035,24 +1212,22 @@ __TS__SetDescriptor(
|
|
|
1035
1212
|
true
|
|
1036
1213
|
);
|
|
1037
1214
|
(function(self)
|
|
1215
|
+
local function destroyBuffIfNeeded(buff)
|
|
1216
|
+
if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
|
|
1217
|
+
buff:destroy()
|
|
1218
|
+
end
|
|
1219
|
+
end
|
|
1038
1220
|
____exports.checkBuff = function(unit, buffTypeId)
|
|
1039
1221
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1040
1222
|
if buffByTypeId ~= nil then
|
|
1041
1223
|
local buff = buffByTypeId[buffTypeId]
|
|
1042
|
-
if buff ~= nil
|
|
1043
|
-
buff
|
|
1224
|
+
if buff ~= nil then
|
|
1225
|
+
destroyBuffIfNeeded(buff)
|
|
1044
1226
|
end
|
|
1045
1227
|
end
|
|
1046
1228
|
end
|
|
1047
1229
|
____exports.checkBuffs = function(unit)
|
|
1048
|
-
|
|
1049
|
-
if buffByTypeId ~= nil then
|
|
1050
|
-
for ____, buff in pairs(buffByTypeId) do
|
|
1051
|
-
if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
|
|
1052
|
-
buff:destroy()
|
|
1053
|
-
end
|
|
1054
|
-
end
|
|
1055
|
-
end
|
|
1230
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1056
1231
|
end
|
|
1057
1232
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1058
1233
|
0,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____rect = require("core.types.rect")
|
|
6
|
+
local Rect = ____rect.Rect
|
|
7
|
+
local ____region = require("core.types.region")
|
|
8
|
+
local Region = ____region.Region
|
|
9
|
+
____exports.GameMap = __TS__Class()
|
|
10
|
+
local GameMap = ____exports.GameMap
|
|
11
|
+
GameMap.name = "GameMap"
|
|
12
|
+
function GameMap.prototype.____constructor(self)
|
|
13
|
+
end
|
|
14
|
+
__TS__ObjectDefineProperty(
|
|
15
|
+
GameMap,
|
|
16
|
+
"worldBoundsRect",
|
|
17
|
+
{get = function(self)
|
|
18
|
+
local rect = Rect:of(GetWorldBounds())
|
|
19
|
+
rawset(self, "worldBoundsRect", rect)
|
|
20
|
+
return rect
|
|
21
|
+
end}
|
|
22
|
+
)
|
|
23
|
+
__TS__ObjectDefineProperty(
|
|
24
|
+
GameMap,
|
|
25
|
+
"worldBoundsRegion",
|
|
26
|
+
{get = function(self)
|
|
27
|
+
local region = Region:create(self.worldBoundsRect)
|
|
28
|
+
rawset(self, "worldBoundsRegion", region)
|
|
29
|
+
return region
|
|
30
|
+
end}
|
|
31
|
+
)
|
|
32
|
+
return ____exports
|
|
@@ -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]>;
|
|
@@ -88,4 +79,3 @@ export declare class ItemAbility extends Ability {
|
|
|
88
79
|
static get onCreate(): Event<[ItemAbility]>;
|
|
89
80
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
90
81
|
}
|
|
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,6 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
33
32
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
34
33
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
35
34
|
local getHandleId = GetHandleId
|
|
36
|
-
local getItemAbility = BlzGetItemAbility
|
|
37
35
|
local match = string.match
|
|
38
36
|
local ____type = _G.type
|
|
39
37
|
local ____tostring = _G.tostring
|
|
@@ -151,55 +149,6 @@ local orders = postcompile(function()
|
|
|
151
149
|
end
|
|
152
150
|
return orders
|
|
153
151
|
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
152
|
local fieldGetters = {
|
|
204
153
|
abilityintegerfield = function(ability, field)
|
|
205
154
|
return getAbilityIntegerField(ability.handle, field)
|
|
@@ -355,34 +304,9 @@ __TS__SetDescriptor(
|
|
|
355
304
|
)
|
|
356
305
|
__TS__SetDescriptor(
|
|
357
306
|
Ability.prototype,
|
|
358
|
-
"
|
|
307
|
+
"levelCount",
|
|
359
308
|
{get = function(self)
|
|
360
|
-
|
|
361
|
-
rawset(self, "realFields", realFields)
|
|
362
|
-
return realFields
|
|
363
|
-
end},
|
|
364
|
-
true
|
|
365
|
-
)
|
|
366
|
-
__TS__SetDescriptor(
|
|
367
|
-
Ability.prototype,
|
|
368
|
-
"levels",
|
|
369
|
-
{get = function(self)
|
|
370
|
-
local handle = self.handle
|
|
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
|
|
309
|
+
return self:getField(ABILITY_IF_LEVELS)
|
|
386
310
|
end},
|
|
387
311
|
true
|
|
388
312
|
)
|
|
@@ -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(
|