warscript 0.0.1-dev.ea69747 → 0.0.1-dev.ec4cf89
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 +12 -0
- package/attributes.lua +16 -0
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/frame.d.ts +2 -1
- package/core/types/frame.lua +2 -0
- package/core/types/group.d.ts +0 -1
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +13 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- 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/instant-impact.lua +4 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +8 -1
- package/engine/behaviour/ability.lua +62 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +3 -2
- package/engine/behaviour/unit.lua +7 -0
- package/engine/buff.d.ts +36 -15
- package/engine/buff.lua +162 -68
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +1 -1
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/bonus.d.ts +5 -6
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +37 -10
- package/engine/internal/unit.lua +248 -88
- 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/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +1 -1
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- 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 +0 -1
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +42 -2
- package/engine/object-data/entry/unit-type.lua +378 -50
- 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 +8 -6
- package/engine/object-field/ability.lua +6 -0
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +6 -4
- package/engine/object-field.lua +38 -12
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +42 -1
- package/engine/standard/entries/unit-type.lua +42 -1
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- 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/exception.d.ts +2 -0
- package/exception.lua +4 -0
- package/global/vec2.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -14
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +4 -5
- package/utility/arrays.lua +4 -1
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +21 -8
- package/utility/linked-set.lua +16 -0
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +2 -2
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/buff.lua
CHANGED
|
@@ -107,7 +107,11 @@ local buffParametersKeys = {
|
|
|
107
107
|
disablesAutoAttack = true,
|
|
108
108
|
destroysOnDamage = true,
|
|
109
109
|
maximumAutoAttackCount = true,
|
|
110
|
-
uniqueGroup = true
|
|
110
|
+
uniqueGroup = true,
|
|
111
|
+
damageOnExpiration = true,
|
|
112
|
+
healingOnExpiration = true,
|
|
113
|
+
killsOnExpiration = true,
|
|
114
|
+
explodesOnExpiration = true
|
|
111
115
|
}
|
|
112
116
|
local function resolveNumberValue(ability, level, value)
|
|
113
117
|
if value == nil or type(value) == "number" then
|
|
@@ -145,7 +149,14 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
145
149
|
buff[property] = resolvedValue
|
|
146
150
|
end
|
|
147
151
|
end
|
|
148
|
-
local buffBooleanParameters = {
|
|
152
|
+
local buffBooleanParameters = {
|
|
153
|
+
"stuns",
|
|
154
|
+
"ignoresStunImmunity",
|
|
155
|
+
"disablesAutoAttack",
|
|
156
|
+
"providesInvulnerability",
|
|
157
|
+
"killsOnExpiration",
|
|
158
|
+
"explodesOnExpiration"
|
|
159
|
+
}
|
|
149
160
|
local buffNumberParameters = {
|
|
150
161
|
"durationIncreaseOnAutoAttack",
|
|
151
162
|
"attackSpeedIncreaseFactor",
|
|
@@ -158,7 +169,9 @@ local buffNumberParameters = {
|
|
|
158
169
|
"damageOverDuration",
|
|
159
170
|
"healingInterval",
|
|
160
171
|
"healingPerInterval",
|
|
161
|
-
"healingOverDuration"
|
|
172
|
+
"healingOverDuration",
|
|
173
|
+
"damageOnExpiration",
|
|
174
|
+
"healingOnExpiration"
|
|
162
175
|
}
|
|
163
176
|
local unsuccessfulApplicationMarker = {}
|
|
164
177
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -207,6 +220,7 @@ local function expireBuff(buff)
|
|
|
207
220
|
end
|
|
208
221
|
end
|
|
209
222
|
Timer:run(destroyBuff, buff)
|
|
223
|
+
buff:onExpiration()
|
|
210
224
|
end
|
|
211
225
|
local function buffDamageIntervalInitialTimerCallback(buff)
|
|
212
226
|
buffDamageIntervalTimerCallback(buff)
|
|
@@ -530,11 +544,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
530
544
|
behavior:destroy()
|
|
531
545
|
end
|
|
532
546
|
end
|
|
533
|
-
if self[
|
|
547
|
+
if self[132] then
|
|
534
548
|
unit:decrementDisableAutoAttackCounter()
|
|
535
549
|
end
|
|
536
|
-
if self[
|
|
537
|
-
if self[
|
|
550
|
+
if self[130] then
|
|
551
|
+
if self[131] then
|
|
538
552
|
unit:decrementStunCounter()
|
|
539
553
|
end
|
|
540
554
|
unit:decrementStunCounter()
|
|
@@ -583,20 +597,34 @@ function Buff.getByTypeId(self, unit, typeId)
|
|
|
583
597
|
end
|
|
584
598
|
return nil
|
|
585
599
|
end
|
|
586
|
-
function Buff.prototype.
|
|
600
|
+
function Buff.prototype.onExpiration(self)
|
|
587
601
|
local unit = self.unit
|
|
588
602
|
if self[119] ~= nil then
|
|
603
|
+
(self[101] or unit):damageTarget(unit, self[119] or 0)
|
|
604
|
+
end
|
|
605
|
+
if self[120] ~= nil then
|
|
606
|
+
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
607
|
+
end
|
|
608
|
+
if self[135] then
|
|
609
|
+
unit:explode()
|
|
610
|
+
elseif self[134] then
|
|
611
|
+
unit:kill()
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
function Buff.prototype.onDeath(self, source)
|
|
615
|
+
local unit = self.unit
|
|
616
|
+
if self[121] ~= nil then
|
|
589
617
|
damageArea(
|
|
590
618
|
self[101] or unit,
|
|
591
|
-
self[
|
|
619
|
+
self[121],
|
|
592
620
|
unit.x,
|
|
593
621
|
unit.y,
|
|
594
|
-
self[121] or 0,
|
|
595
|
-
self[120] or 0,
|
|
596
622
|
self[123] or 0,
|
|
597
623
|
self[122] or 0,
|
|
598
624
|
self[125] or 0,
|
|
599
|
-
self[124] or 0
|
|
625
|
+
self[124] or 0,
|
|
626
|
+
self[127] or 0,
|
|
627
|
+
self[126] or 0
|
|
600
628
|
)
|
|
601
629
|
end
|
|
602
630
|
end
|
|
@@ -618,9 +646,9 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
618
646
|
end
|
|
619
647
|
self.remainingDuration = remainingDuration
|
|
620
648
|
end
|
|
621
|
-
local autoAttackCount = (self[
|
|
622
|
-
self[
|
|
623
|
-
if autoAttackCount == self[
|
|
649
|
+
local autoAttackCount = (self[128] or 0) + 1
|
|
650
|
+
self[128] = autoAttackCount
|
|
651
|
+
if autoAttackCount == self[129] then
|
|
624
652
|
self:destroy()
|
|
625
653
|
end
|
|
626
654
|
end
|
|
@@ -802,6 +830,32 @@ __TS__SetDescriptor(
|
|
|
802
830
|
},
|
|
803
831
|
true
|
|
804
832
|
)
|
|
833
|
+
__TS__SetDescriptor(
|
|
834
|
+
Buff.prototype,
|
|
835
|
+
"damageOnExpiration",
|
|
836
|
+
{
|
|
837
|
+
get = function(self)
|
|
838
|
+
return self[119] or 0
|
|
839
|
+
end,
|
|
840
|
+
set = function(self, damageOnExpiration)
|
|
841
|
+
self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
|
|
842
|
+
end
|
|
843
|
+
},
|
|
844
|
+
true
|
|
845
|
+
)
|
|
846
|
+
__TS__SetDescriptor(
|
|
847
|
+
Buff.prototype,
|
|
848
|
+
"healingOnExpiration",
|
|
849
|
+
{
|
|
850
|
+
get = function(self)
|
|
851
|
+
return self[120] or 0
|
|
852
|
+
end,
|
|
853
|
+
set = function(self, healingOnExpiration)
|
|
854
|
+
self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
|
|
855
|
+
end
|
|
856
|
+
},
|
|
857
|
+
true
|
|
858
|
+
)
|
|
805
859
|
__TS__SetDescriptor(
|
|
806
860
|
Buff.prototype,
|
|
807
861
|
"receivedDamageFactor",
|
|
@@ -833,25 +887,25 @@ __TS__SetDescriptor(
|
|
|
833
887
|
"stuns",
|
|
834
888
|
{
|
|
835
889
|
get = function(self)
|
|
836
|
-
local
|
|
837
|
-
if
|
|
838
|
-
|
|
890
|
+
local ____self__130_52 = self[130]
|
|
891
|
+
if ____self__130_52 == nil then
|
|
892
|
+
____self__130_52 = false
|
|
839
893
|
end
|
|
840
|
-
return
|
|
894
|
+
return ____self__130_52
|
|
841
895
|
end,
|
|
842
896
|
set = function(self, stuns)
|
|
843
|
-
if not stuns and self[
|
|
844
|
-
if self[
|
|
897
|
+
if not stuns and self[130] then
|
|
898
|
+
if self[131] then
|
|
845
899
|
self.object:decrementStunCounter()
|
|
846
900
|
end
|
|
847
901
|
self.object:decrementStunCounter()
|
|
848
|
-
self[
|
|
849
|
-
elseif stuns and not self[
|
|
850
|
-
if self[
|
|
902
|
+
self[130] = nil
|
|
903
|
+
elseif stuns and not self[130] then
|
|
904
|
+
if self[131] then
|
|
851
905
|
self.object:incrementStunCounter()
|
|
852
906
|
end
|
|
853
907
|
self.object:incrementStunCounter()
|
|
854
|
-
self[
|
|
908
|
+
self[130] = true
|
|
855
909
|
end
|
|
856
910
|
end
|
|
857
911
|
},
|
|
@@ -862,23 +916,23 @@ __TS__SetDescriptor(
|
|
|
862
916
|
"ignoresStunImmunity",
|
|
863
917
|
{
|
|
864
918
|
get = function(self)
|
|
865
|
-
local
|
|
866
|
-
if
|
|
867
|
-
|
|
919
|
+
local ____self__131_53 = self[131]
|
|
920
|
+
if ____self__131_53 == nil then
|
|
921
|
+
____self__131_53 = false
|
|
868
922
|
end
|
|
869
|
-
return
|
|
923
|
+
return ____self__131_53
|
|
870
924
|
end,
|
|
871
925
|
set = function(self, ignoresStunImmunity)
|
|
872
|
-
if not ignoresStunImmunity and self[
|
|
873
|
-
if self[
|
|
926
|
+
if not ignoresStunImmunity and self[131] then
|
|
927
|
+
if self[130] then
|
|
874
928
|
self.object:decrementStunCounter()
|
|
875
929
|
end
|
|
876
|
-
self[
|
|
877
|
-
elseif ignoresStunImmunity and not self[
|
|
878
|
-
if self[
|
|
930
|
+
self[131] = nil
|
|
931
|
+
elseif ignoresStunImmunity and not self[131] then
|
|
932
|
+
if self[130] then
|
|
879
933
|
self.object:incrementStunCounter()
|
|
880
934
|
end
|
|
881
|
-
self[
|
|
935
|
+
self[131] = true
|
|
882
936
|
end
|
|
883
937
|
end
|
|
884
938
|
},
|
|
@@ -889,19 +943,19 @@ __TS__SetDescriptor(
|
|
|
889
943
|
"disablesAutoAttack",
|
|
890
944
|
{
|
|
891
945
|
get = function(self)
|
|
892
|
-
local
|
|
893
|
-
if
|
|
894
|
-
|
|
946
|
+
local ____self__132_54 = self[132]
|
|
947
|
+
if ____self__132_54 == nil then
|
|
948
|
+
____self__132_54 = false
|
|
895
949
|
end
|
|
896
|
-
return
|
|
950
|
+
return ____self__132_54
|
|
897
951
|
end,
|
|
898
952
|
set = function(self, disablesAutoAttack)
|
|
899
|
-
if not disablesAutoAttack and self[
|
|
953
|
+
if not disablesAutoAttack and self[132] then
|
|
900
954
|
self.object:decrementDisableAutoAttackCounter()
|
|
901
|
-
self[
|
|
902
|
-
elseif disablesAutoAttack and not self[
|
|
955
|
+
self[132] = nil
|
|
956
|
+
elseif disablesAutoAttack and not self[132] then
|
|
903
957
|
self.object:incrementDisableAutoAttackCounter()
|
|
904
|
-
self[
|
|
958
|
+
self[132] = true
|
|
905
959
|
end
|
|
906
960
|
end
|
|
907
961
|
},
|
|
@@ -912,19 +966,61 @@ __TS__SetDescriptor(
|
|
|
912
966
|
"providesInvulnerability",
|
|
913
967
|
{
|
|
914
968
|
get = function(self)
|
|
915
|
-
local
|
|
916
|
-
if
|
|
917
|
-
|
|
969
|
+
local ____self__133_55 = self[133]
|
|
970
|
+
if ____self__133_55 == nil then
|
|
971
|
+
____self__133_55 = false
|
|
918
972
|
end
|
|
919
|
-
return
|
|
973
|
+
return ____self__133_55
|
|
920
974
|
end,
|
|
921
975
|
set = function(self, providesInvulnerability)
|
|
922
|
-
if not providesInvulnerability and self[
|
|
976
|
+
if not providesInvulnerability and self[133] then
|
|
923
977
|
self.object:decrementInvulnerabilityCounter()
|
|
924
|
-
self[
|
|
925
|
-
elseif providesInvulnerability and not self[
|
|
978
|
+
self[133] = nil
|
|
979
|
+
elseif providesInvulnerability and not self[133] then
|
|
926
980
|
self.object:incrementInvulnerabilityCounter()
|
|
927
|
-
self[
|
|
981
|
+
self[133] = true
|
|
982
|
+
end
|
|
983
|
+
end
|
|
984
|
+
},
|
|
985
|
+
true
|
|
986
|
+
)
|
|
987
|
+
__TS__SetDescriptor(
|
|
988
|
+
Buff.prototype,
|
|
989
|
+
"killsOnExpiration",
|
|
990
|
+
{
|
|
991
|
+
get = function(self)
|
|
992
|
+
local ____self__134_56 = self[134]
|
|
993
|
+
if ____self__134_56 == nil then
|
|
994
|
+
____self__134_56 = false
|
|
995
|
+
end
|
|
996
|
+
return ____self__134_56
|
|
997
|
+
end,
|
|
998
|
+
set = function(self, killsOnExpiration)
|
|
999
|
+
if not killsOnExpiration and self[134] then
|
|
1000
|
+
self[134] = nil
|
|
1001
|
+
elseif killsOnExpiration and not self[134] then
|
|
1002
|
+
self[134] = true
|
|
1003
|
+
end
|
|
1004
|
+
end
|
|
1005
|
+
},
|
|
1006
|
+
true
|
|
1007
|
+
)
|
|
1008
|
+
__TS__SetDescriptor(
|
|
1009
|
+
Buff.prototype,
|
|
1010
|
+
"explodesOnExpiration",
|
|
1011
|
+
{
|
|
1012
|
+
get = function(self)
|
|
1013
|
+
local ____self__135_57 = self[135]
|
|
1014
|
+
if ____self__135_57 == nil then
|
|
1015
|
+
____self__135_57 = false
|
|
1016
|
+
end
|
|
1017
|
+
return ____self__135_57
|
|
1018
|
+
end,
|
|
1019
|
+
set = function(self, killsOnExpiration)
|
|
1020
|
+
if not killsOnExpiration and self[135] then
|
|
1021
|
+
self[135] = nil
|
|
1022
|
+
elseif killsOnExpiration and not self[135] then
|
|
1023
|
+
self[135] = true
|
|
928
1024
|
end
|
|
929
1025
|
end
|
|
930
1026
|
},
|
|
@@ -935,13 +1031,13 @@ __TS__SetDescriptor(
|
|
|
935
1031
|
"maximumAutoAttackCount",
|
|
936
1032
|
{
|
|
937
1033
|
get = function(self)
|
|
938
|
-
return self[
|
|
1034
|
+
return self[129] or 0
|
|
939
1035
|
end,
|
|
940
1036
|
set = function(self, maximumAutoAttackCount)
|
|
941
1037
|
if maximumAutoAttackCount == 0 then
|
|
942
|
-
self[
|
|
1038
|
+
self[129] = nil
|
|
943
1039
|
else
|
|
944
|
-
self[
|
|
1040
|
+
self[129] = maximumAutoAttackCount
|
|
945
1041
|
end
|
|
946
1042
|
end
|
|
947
1043
|
},
|
|
@@ -999,13 +1095,13 @@ __TS__SetDescriptor(
|
|
|
999
1095
|
"remainingDuration",
|
|
1000
1096
|
{
|
|
1001
1097
|
get = function(self)
|
|
1002
|
-
local
|
|
1003
|
-
return
|
|
1098
|
+
local ____opt_58 = self._timer
|
|
1099
|
+
return ____opt_58 and ____opt_58.remaining or 0
|
|
1004
1100
|
end,
|
|
1005
1101
|
set = function(self, remainingDuration)
|
|
1006
|
-
local
|
|
1007
|
-
local
|
|
1008
|
-
local remainingDurationDelta =
|
|
1102
|
+
local ____remainingDuration_62 = remainingDuration
|
|
1103
|
+
local ____opt_60 = self._timer
|
|
1104
|
+
local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
|
|
1009
1105
|
if remainingDurationDelta ~= 0 then
|
|
1010
1106
|
self[102] = self[102] + remainingDurationDelta
|
|
1011
1107
|
if remainingDuration <= 0 then
|
|
@@ -1035,24 +1131,22 @@ __TS__SetDescriptor(
|
|
|
1035
1131
|
true
|
|
1036
1132
|
);
|
|
1037
1133
|
(function(self)
|
|
1134
|
+
local function destroyBuffIfNeeded(buff)
|
|
1135
|
+
if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
|
|
1136
|
+
buff:destroy()
|
|
1137
|
+
end
|
|
1138
|
+
end
|
|
1038
1139
|
____exports.checkBuff = function(unit, buffTypeId)
|
|
1039
1140
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1040
1141
|
if buffByTypeId ~= nil then
|
|
1041
1142
|
local buff = buffByTypeId[buffTypeId]
|
|
1042
|
-
if buff ~= nil
|
|
1043
|
-
buff
|
|
1143
|
+
if buff ~= nil then
|
|
1144
|
+
destroyBuffIfNeeded(buff)
|
|
1044
1145
|
end
|
|
1045
1146
|
end
|
|
1046
1147
|
end
|
|
1047
1148
|
____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
|
|
1149
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1056
1150
|
end
|
|
1057
1151
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1058
1152
|
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
|
|
@@ -12,7 +12,7 @@ interface Fields<K, V> {
|
|
|
12
12
|
interface AbilityLevel {
|
|
13
13
|
realFields: Fields<jabilityreallevelfield, number>;
|
|
14
14
|
}
|
|
15
|
-
type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
15
|
+
export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
16
16
|
export declare class AbilitySnapshot {
|
|
17
17
|
}
|
|
18
18
|
export declare abstract class Ability extends Handle<jability> {
|
|
@@ -4,6 +4,8 @@ local UnitClassification = ____unit.UnitClassification
|
|
|
4
4
|
local ____ability = require("engine.standard.fields.ability")
|
|
5
5
|
local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
|
|
6
6
|
local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
|
|
7
|
+
---
|
|
8
|
+
-- @internal For use by internal systems only.
|
|
7
9
|
____exports.getAbilityDuration = function(ability, target)
|
|
8
10
|
local level = ability.level
|
|
9
11
|
return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
3
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
4
|
+
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
5
|
+
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
6
|
+
local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
|
|
7
|
+
local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
|
|
8
|
+
local ____preconditions = require("utility.preconditions")
|
|
9
|
+
local checkNotNull = ____preconditions.checkNotNull
|
|
10
|
+
local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
|
|
11
|
+
local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
|
|
12
|
+
local ____arrays = require("utility.arrays")
|
|
13
|
+
local map = ____arrays.map
|
|
14
|
+
local toLuaSet = ____arrays.toLuaSet
|
|
15
|
+
local createItem = CreateItem
|
|
16
|
+
local getAbilityId = BlzGetAbilityId
|
|
17
|
+
local getItemAbility = BlzGetItemAbility
|
|
18
|
+
local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
|
|
19
|
+
local itemAddAbility = BlzItemAddAbility
|
|
20
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
21
|
+
local removeItem = RemoveItem
|
|
22
|
+
local unitAddAbility = UnitAddAbility
|
|
23
|
+
local unitAddItem = UnitAddItem
|
|
24
|
+
local unitDropItemSlot = UnitDropItemSlot
|
|
25
|
+
local unitInventorySize = UnitInventorySize
|
|
26
|
+
local unitRemoveAbility = UnitRemoveAbility
|
|
27
|
+
local unitRemoveItemFromSlot = UnitRemoveItemFromSlot
|
|
28
|
+
local INVENTORY_ABILITY_TYPE_IDS = postcompile(function()
|
|
29
|
+
return toLuaSet(AbilityType:getAllIdsByBaseIds(map({
|
|
30
|
+
"AInv",
|
|
31
|
+
"Aihn",
|
|
32
|
+
"Aien",
|
|
33
|
+
"Aion",
|
|
34
|
+
"Aiun"
|
|
35
|
+
}, fourCC)))
|
|
36
|
+
end)
|
|
37
|
+
---
|
|
38
|
+
-- @internal For use by internal systems only.
|
|
39
|
+
____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ...)
|
|
40
|
+
local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
|
|
41
|
+
unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
|
|
42
|
+
itemAddAbility(nativeItem, abilityTypeId)
|
|
43
|
+
local nativeAbility = checkNotNull(getItemAbility(nativeItem, abilityTypeId))
|
|
44
|
+
if prepareAbility ~= nil then
|
|
45
|
+
prepareAbility(nativeAbility, ...)
|
|
46
|
+
end
|
|
47
|
+
setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
|
|
48
|
+
setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
49
|
+
local success
|
|
50
|
+
if unitAddItem(nativeUnit, nativeItem) then
|
|
51
|
+
success = true
|
|
52
|
+
else
|
|
53
|
+
local latestInventoryAbilityTypeId = 0
|
|
54
|
+
local nativeItemBySlot = {}
|
|
55
|
+
local inventorySize = unitInventorySize(nativeUnit)
|
|
56
|
+
if inventorySize ~= 0 then
|
|
57
|
+
for slot = 0, inventorySize - 1 do
|
|
58
|
+
nativeItemBySlot[slot] = unitRemoveItemFromSlot(nativeUnit, slot)
|
|
59
|
+
end
|
|
60
|
+
local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
|
|
61
|
+
local i = 1
|
|
62
|
+
while unitNativeAbility ~= nil do
|
|
63
|
+
local abilityTypeId = getAbilityId(unitNativeAbility)
|
|
64
|
+
if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
|
|
65
|
+
latestInventoryAbilityTypeId = abilityTypeId
|
|
66
|
+
end
|
|
67
|
+
unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
|
|
68
|
+
i = i + 1
|
|
69
|
+
end
|
|
70
|
+
unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
71
|
+
end
|
|
72
|
+
unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
73
|
+
success = unitAddItem(nativeUnit, nativeItem)
|
|
74
|
+
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
75
|
+
if latestInventoryAbilityTypeId ~= 0 then
|
|
76
|
+
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
77
|
+
for slot, nativeItem in pairs(nativeItemBySlot) do
|
|
78
|
+
unitAddItem(nativeUnit, nativeItem)
|
|
79
|
+
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
removeItem(nativeItem)
|
|
84
|
+
return success
|
|
85
|
+
end
|
|
86
|
+
return ____exports
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Unit } from "../unit";
|
|
4
3
|
import { AbilityTypeId } from "../../object-data/entry/ability-type";
|
|
@@ -34,8 +33,8 @@ export declare namespace UnitBonusType {
|
|
|
34
33
|
const DAMAGE: UnitBonusType<UnitDamageBonusId>;
|
|
35
34
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
36
35
|
}
|
|
37
|
-
export declare const addUnitBonus: <Id extends UnitBonusId
|
|
38
|
-
export declare const removeUnitBonus: <Id extends UnitBonusId
|
|
39
|
-
export declare const updateUnitBonus: <Id extends UnitBonusId
|
|
40
|
-
export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId
|
|
41
|
-
export declare const getUnitBonus: <Id extends UnitBonusId
|
|
36
|
+
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
37
|
+
export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
|
|
38
|
+
export declare const updateUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id, value: number) => boolean;
|
|
39
|
+
export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id | undefined, value: number) => Id | undefined;
|
|
40
|
+
export declare const getUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.internal.unit")
|
|
3
|
+
local Unit = ____unit.Unit
|
|
4
|
+
local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
|
|
5
|
+
local castAbility = ____cast_2Dability.castAbility
|
|
6
|
+
local ____blink = require("engine.object-data.entry.ability-type.blink")
|
|
7
|
+
local BlinkAbilityType = ____blink.BlinkAbilityType
|
|
8
|
+
local ____math = require("math")
|
|
9
|
+
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
10
|
+
local getUnitX = GetUnitX
|
|
11
|
+
local getUnitY = GetUnitY
|
|
12
|
+
local setUnitX = SetUnitX
|
|
13
|
+
local setUnitY = SetUnitY
|
|
14
|
+
local BLINK_ABILITY_TYPE_ID = compiletime(function()
|
|
15
|
+
local abilityType = BlinkAbilityType:create()
|
|
16
|
+
abilityType.minimumRange = 0
|
|
17
|
+
abilityType.maximumRange = MAXIMUM_INTEGER
|
|
18
|
+
abilityType.manaCost = 0
|
|
19
|
+
abilityType.cooldown = 0
|
|
20
|
+
return abilityType.id
|
|
21
|
+
end)
|
|
22
|
+
Unit.prototype.detachMissiles = function(self)
|
|
23
|
+
local nativeUnit = self.handle
|
|
24
|
+
local x = getUnitX(nativeUnit)
|
|
25
|
+
local y = getUnitY(nativeUnit)
|
|
26
|
+
castAbility(nativeUnit, BLINK_ABILITY_TYPE_ID)
|
|
27
|
+
setUnitX(nativeUnit, x)
|
|
28
|
+
setUnitY(nativeUnit, y)
|
|
29
|
+
end
|
|
30
|
+
return ____exports
|
|
@@ -6,9 +6,8 @@ local ____unit = require("engine.internal.unit")
|
|
|
6
6
|
local Unit = ____unit.Unit
|
|
7
7
|
local ____event = require("event")
|
|
8
8
|
local Event = ____event.Event
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local boundRegion = ____mapbounds.boundRegion
|
|
9
|
+
local ____game_2Dmap = require("engine.game-map")
|
|
10
|
+
local GameMap = ____game_2Dmap.GameMap
|
|
12
11
|
local eventInvoke = Event.invoke
|
|
13
12
|
local tableRemove = table.remove
|
|
14
13
|
local ____assert = _G.assert
|
|
@@ -58,8 +57,8 @@ triggerAddCondition(
|
|
|
58
57
|
deboard(unit)
|
|
59
58
|
end
|
|
60
59
|
if not unitAlive(handle) then
|
|
61
|
-
unit.x =
|
|
62
|
-
unit.y =
|
|
60
|
+
unit.x = GameMap.worldBoundsRect.maxX
|
|
61
|
+
unit.y = GameMap.worldBoundsRect.maxY
|
|
63
62
|
end
|
|
64
63
|
local transport = Unit:of(getTransportUnit())
|
|
65
64
|
transportByUnit[unit] = transport
|
|
@@ -68,11 +67,6 @@ triggerAddCondition(
|
|
|
68
67
|
eventInvoke(onBoardEvent, unit, transport)
|
|
69
68
|
end)
|
|
70
69
|
)
|
|
71
|
-
boundRegion.onUnitEnter:addListener(function(unit)
|
|
72
|
-
if transportByUnit[unit] ~= nil and not isUnitLoaded(unit.handle) then
|
|
73
|
-
deboard(unit)
|
|
74
|
-
end
|
|
75
|
-
end)
|
|
76
70
|
Unit.deathEvent:addListener(function(unit)
|
|
77
71
|
if transportByUnit[unit] ~= nil then
|
|
78
72
|
deboard(unit)
|
|
@@ -25,7 +25,7 @@ local function timerCallback(source, target)
|
|
|
25
25
|
Event.invoke(autoAttackFinishEvent, source, target)
|
|
26
26
|
end
|
|
27
27
|
Unit.autoAttackStartEvent:addListener(function(source, target)
|
|
28
|
-
local attackPoint = source.weapons[1].
|
|
28
|
+
local attackPoint = source.weapons[1].impactDelay
|
|
29
29
|
local timer = Timer:simple(attackPoint, timerCallback, source, target)
|
|
30
30
|
eventTimerByUnit[source] = timer
|
|
31
31
|
end)
|