warscript 0.0.1-dev.4cfb266 → 0.0.1-dev.4f5b9e7
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 +5 -0
- package/attributes.lua +8 -1
- package/binarywriter.lua +12 -0
- package/core/types/frame.lua +24 -21
- package/core/types/player.lua +3 -1
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/tileCell.d.ts +9 -0
- package/core/types/tileCell.lua +92 -0
- package/core/types/timer.d.ts +2 -1
- package/core/types/timer.lua +21 -2
- package/decl/native.d.ts +6 -4
- package/engine/behavior.d.ts +5 -0
- package/engine/behavior.lua +106 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/damage.d.ts +4 -2
- package/engine/behaviour/ability/damage.lua +24 -36
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +11 -3
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.lua +8 -17
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -3
- package/engine/behaviour/unit/stun-immunity.lua +52 -27
- package/engine/behaviour/unit.d.ts +33 -1
- package/engine/behaviour/unit.lua +190 -4
- package/engine/buff.d.ts +2 -4
- package/engine/buff.lua +68 -83
- package/engine/internal/ability.d.ts +7 -1
- package/engine/internal/ability.lua +49 -9
- package/engine/internal/item/ability.lua +63 -11
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +16 -16
- package/engine/internal/item.lua +135 -49
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +63 -1
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +18 -5
- package/engine/internal/unit.d.ts +16 -8
- package/engine/internal/unit.lua +179 -81
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type.lua +5 -4
- package/engine/object-data/entry/unit-type.d.ts +11 -2
- package/engine/object-data/entry/unit-type.lua +59 -1
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.d.ts +8 -5
- package/engine/object-field.lua +90 -76
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +249 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +13 -0
- package/utility/callback-array.lua +46 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/lua-maps.d.ts +12 -2
- package/utility/lua-maps.lua +37 -2
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/internal/unit.lua
CHANGED
|
@@ -58,13 +58,14 @@ local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
|
58
58
|
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
59
|
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
60
60
|
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
|
+
local ____attributes = require("attributes")
|
|
62
|
+
local isAttribute = ____attributes.isAttribute
|
|
63
|
+
local ____ability = require("engine.internal.item.ability")
|
|
64
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
61
65
|
local match = string.match
|
|
62
66
|
local ____tostring = _G.tostring
|
|
63
67
|
local setUnitAnimation = SetUnitAnimation
|
|
64
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
65
68
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
66
|
-
local resetUnitAnimation = ResetUnitAnimation
|
|
67
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
68
69
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
69
70
|
local getUnitRealField = BlzGetUnitRealField
|
|
70
71
|
local getHeroStr = GetHeroStr
|
|
@@ -124,10 +125,6 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
124
125
|
local getIssuedOrderId = GetIssuedOrderId
|
|
125
126
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
126
127
|
local unitAlive = UnitAlive
|
|
127
|
-
local unitAddType = UnitAddType
|
|
128
|
-
local unitRemoveType = UnitRemoveType
|
|
129
|
-
local isUnitIllusion = IsUnitIllusion
|
|
130
|
-
local isUnitType = IsUnitType
|
|
131
128
|
local isUnitAlly = IsUnitAlly
|
|
132
129
|
local isUnitEnemy = IsUnitEnemy
|
|
133
130
|
local getOwningPlayer = GetOwningPlayer
|
|
@@ -140,6 +137,7 @@ do
|
|
|
140
137
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
141
138
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
142
139
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
140
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
143
141
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
144
142
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
145
143
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -347,6 +345,9 @@ local function dispatchAbility(event)
|
|
|
347
345
|
}
|
|
348
346
|
)
|
|
349
347
|
end
|
|
348
|
+
local function damagingEventPreventRetaliation(self)
|
|
349
|
+
self[0] = true
|
|
350
|
+
end
|
|
350
351
|
local function damageEventPreventDeath(self, callback, ...)
|
|
351
352
|
if self[0] ~= nil then
|
|
352
353
|
return
|
|
@@ -443,6 +444,19 @@ __TS__SetDescriptor(
|
|
|
443
444
|
},
|
|
444
445
|
true
|
|
445
446
|
)
|
|
447
|
+
__TS__SetDescriptor(
|
|
448
|
+
UnitWeapon.prototype,
|
|
449
|
+
"allowedTargetCombatClassifications",
|
|
450
|
+
{
|
|
451
|
+
get = function(self)
|
|
452
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
453
|
+
end,
|
|
454
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
455
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
456
|
+
end
|
|
457
|
+
},
|
|
458
|
+
true
|
|
459
|
+
)
|
|
446
460
|
__TS__SetDescriptor(
|
|
447
461
|
UnitWeapon.prototype,
|
|
448
462
|
"damageBase",
|
|
@@ -649,15 +663,24 @@ end
|
|
|
649
663
|
local nextSyncId = 1
|
|
650
664
|
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
651
665
|
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
666
|
+
local function addAbility(unit, abilityTypeId)
|
|
667
|
+
local ____unitAddAbility_result_0
|
|
668
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
669
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
670
|
+
else
|
|
671
|
+
____unitAddAbility_result_0 = nil
|
|
672
|
+
end
|
|
673
|
+
return ____unitAddAbility_result_0
|
|
674
|
+
end
|
|
652
675
|
____exports.Unit = __TS__Class()
|
|
653
676
|
local Unit = ____exports.Unit
|
|
654
677
|
Unit.name = "Unit"
|
|
655
678
|
__TS__ClassExtends(Unit, Handle)
|
|
656
679
|
function Unit.prototype.____constructor(self, handle)
|
|
657
680
|
Handle.prototype.____constructor(self, handle)
|
|
658
|
-
local
|
|
659
|
-
nextSyncId =
|
|
660
|
-
self.syncId =
|
|
681
|
+
local ____nextSyncId_1 = nextSyncId
|
|
682
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
683
|
+
self.syncId = ____nextSyncId_1
|
|
661
684
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
662
685
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
663
686
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -758,17 +781,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
758
781
|
end}
|
|
759
782
|
end
|
|
760
783
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
761
|
-
local
|
|
762
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
784
|
+
local ____combatClassification_2 = combatClassification
|
|
785
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
763
786
|
end
|
|
764
787
|
function Unit.prototype.addClassification(self, classification)
|
|
765
|
-
return
|
|
788
|
+
return UnitAddType(self.handle, classification)
|
|
766
789
|
end
|
|
767
790
|
function Unit.prototype.removeClassification(self, classification)
|
|
768
|
-
return
|
|
791
|
+
return UnitRemoveType(self.handle, classification)
|
|
769
792
|
end
|
|
770
793
|
function Unit.prototype.hasClassification(self, classification)
|
|
771
|
-
return
|
|
794
|
+
return IsUnitType(self.handle, classification)
|
|
772
795
|
end
|
|
773
796
|
function Unit.prototype.isVisibleTo(self, player)
|
|
774
797
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -777,13 +800,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
777
800
|
return isUnitInvisible(self.handle, player.handle)
|
|
778
801
|
end
|
|
779
802
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
780
|
-
local
|
|
803
|
+
local ____temp_3
|
|
781
804
|
if type(x) == "number" then
|
|
782
|
-
|
|
805
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
783
806
|
else
|
|
784
|
-
|
|
807
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
785
808
|
end
|
|
786
|
-
return
|
|
809
|
+
return ____temp_3
|
|
787
810
|
end
|
|
788
811
|
function Unit.prototype.isAllyOf(self, unit)
|
|
789
812
|
return isUnitAlly(
|
|
@@ -801,16 +824,25 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
801
824
|
if type(animation) == "number" then
|
|
802
825
|
setUnitAnimationByIndex(self.handle, animation)
|
|
803
826
|
elseif rarity then
|
|
804
|
-
|
|
827
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
805
828
|
else
|
|
806
829
|
setUnitAnimation(self.handle, animation)
|
|
807
830
|
end
|
|
808
831
|
end
|
|
809
832
|
function Unit.prototype.resetAnimation(self)
|
|
810
|
-
|
|
833
|
+
ResetUnitAnimation(self.handle)
|
|
811
834
|
end
|
|
812
835
|
function Unit.prototype.queueAnimation(self, animation)
|
|
813
|
-
|
|
836
|
+
QueueUnitAnimation(self.handle, animation)
|
|
837
|
+
end
|
|
838
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
839
|
+
if target:isAllowedTarget(self, self.firstWeapon.allowedTargetCombatClassifications) then
|
|
840
|
+
return self.firstWeapon
|
|
841
|
+
end
|
|
842
|
+
if target:isAllowedTarget(target, self.secondWeapon.allowedTargetCombatClassifications) then
|
|
843
|
+
return self.secondWeapon
|
|
844
|
+
end
|
|
845
|
+
return nil
|
|
814
846
|
end
|
|
815
847
|
function Unit.prototype.delayHealthChecks(self)
|
|
816
848
|
self[103] = (self[103] or 0) + 1
|
|
@@ -830,14 +862,14 @@ function Unit.prototype.kill(self)
|
|
|
830
862
|
killUnit(self.handle)
|
|
831
863
|
end
|
|
832
864
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
833
|
-
local
|
|
834
|
-
local
|
|
835
|
-
local
|
|
836
|
-
if
|
|
837
|
-
|
|
865
|
+
local ____ReviveHero_6 = ReviveHero
|
|
866
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
867
|
+
local ____doEffect_4 = doEffect
|
|
868
|
+
if ____doEffect_4 == nil then
|
|
869
|
+
____doEffect_4 = false
|
|
838
870
|
end
|
|
839
|
-
__TS__SparseArrayPush(
|
|
840
|
-
|
|
871
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
872
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
841
873
|
end
|
|
842
874
|
function Unit.prototype.healTarget(self, target, amount)
|
|
843
875
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -880,17 +912,16 @@ function Unit.prototype.itemInSlot(self, slot)
|
|
|
880
912
|
return Item:of(unitItemInSlot(self.handle, slot))
|
|
881
913
|
end
|
|
882
914
|
function Unit.prototype.addAbility(self, abilityId)
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
915
|
+
local ability = UnitAbility:of(
|
|
916
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
917
|
+
abilityId,
|
|
918
|
+
self
|
|
919
|
+
)
|
|
920
|
+
if ability ~= nil then
|
|
889
921
|
local abilities = self.abilities
|
|
890
922
|
abilities[#abilities + 1] = ability
|
|
891
|
-
return ability
|
|
892
923
|
end
|
|
893
|
-
return
|
|
924
|
+
return ability
|
|
894
925
|
end
|
|
895
926
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
896
927
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -904,31 +935,21 @@ end
|
|
|
904
935
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
905
936
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
906
937
|
end
|
|
907
|
-
function Unit.prototype.
|
|
908
|
-
local
|
|
909
|
-
|
|
910
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
911
|
-
return nil
|
|
912
|
-
end
|
|
913
|
-
return UnitAbility:of(
|
|
914
|
-
getUnitAbility(self.handle, abilityId),
|
|
915
|
-
abilityId,
|
|
916
|
-
self
|
|
917
|
-
)
|
|
938
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
939
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
940
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
918
941
|
end
|
|
919
|
-
function Unit.prototype.removeAbility(self,
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
end
|
|
942
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
943
|
+
local abilities = self.abilities
|
|
944
|
+
for i = 1, #abilities do
|
|
945
|
+
if abilities[i].typeId == abilityTypeId then
|
|
946
|
+
local ability = abilities[i]
|
|
947
|
+
tremove(abilities, i)
|
|
948
|
+
ability:destroy()
|
|
949
|
+
return true
|
|
928
950
|
end
|
|
929
|
-
return true
|
|
930
951
|
end
|
|
931
|
-
return
|
|
952
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
932
953
|
end
|
|
933
954
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
934
955
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -942,6 +963,21 @@ end
|
|
|
942
963
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
943
964
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
944
965
|
end
|
|
966
|
+
function Unit.prototype.interruptMovement(self)
|
|
967
|
+
local handle = self.handle
|
|
968
|
+
unitDisableAbility(
|
|
969
|
+
handle,
|
|
970
|
+
fourCC("Amov"),
|
|
971
|
+
true,
|
|
972
|
+
false
|
|
973
|
+
)
|
|
974
|
+
unitDisableAbility(
|
|
975
|
+
handle,
|
|
976
|
+
fourCC("Amov"),
|
|
977
|
+
false,
|
|
978
|
+
false
|
|
979
|
+
)
|
|
980
|
+
end
|
|
945
981
|
function Unit.prototype.interruptAttack(self)
|
|
946
982
|
unitInterruptAttack(self.handle)
|
|
947
983
|
end
|
|
@@ -1215,7 +1251,7 @@ __TS__SetDescriptor(
|
|
|
1215
1251
|
Unit.prototype,
|
|
1216
1252
|
"isIllusion",
|
|
1217
1253
|
{get = function(self)
|
|
1218
|
-
return
|
|
1254
|
+
return IsUnitIllusion(self.handle)
|
|
1219
1255
|
end},
|
|
1220
1256
|
true
|
|
1221
1257
|
)
|
|
@@ -1438,13 +1474,13 @@ __TS__SetDescriptor(
|
|
|
1438
1474
|
end,
|
|
1439
1475
|
set = function(self, isTeamGlowVisible)
|
|
1440
1476
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1441
|
-
local
|
|
1477
|
+
local ____temp_7
|
|
1442
1478
|
if not isTeamGlowVisible then
|
|
1443
|
-
|
|
1479
|
+
____temp_7 = true
|
|
1444
1480
|
else
|
|
1445
|
-
|
|
1481
|
+
____temp_7 = nil
|
|
1446
1482
|
end
|
|
1447
|
-
self[106] =
|
|
1483
|
+
self[106] = ____temp_7
|
|
1448
1484
|
end
|
|
1449
1485
|
},
|
|
1450
1486
|
true
|
|
@@ -2048,6 +2084,14 @@ __TS__SetDescriptor(
|
|
|
2048
2084
|
end},
|
|
2049
2085
|
true
|
|
2050
2086
|
)
|
|
2087
|
+
__TS__SetDescriptor(
|
|
2088
|
+
Unit.prototype,
|
|
2089
|
+
"targetAcquiredEvent",
|
|
2090
|
+
{get = function(self)
|
|
2091
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2092
|
+
end},
|
|
2093
|
+
true
|
|
2094
|
+
)
|
|
2051
2095
|
__TS__SetDescriptor(
|
|
2052
2096
|
Unit.prototype,
|
|
2053
2097
|
"onSelect",
|
|
@@ -2183,25 +2227,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2183
2227
|
InitializingEvent,
|
|
2184
2228
|
function(event)
|
|
2185
2229
|
local function listener(unit, id)
|
|
2186
|
-
local
|
|
2230
|
+
local ____GetSpellTargetUnit_result_10
|
|
2187
2231
|
if GetSpellTargetUnit() then
|
|
2188
|
-
|
|
2232
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2189
2233
|
else
|
|
2190
|
-
local
|
|
2234
|
+
local ____GetSpellTargetItem_result_9
|
|
2191
2235
|
if GetSpellTargetItem() then
|
|
2192
|
-
|
|
2236
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2193
2237
|
else
|
|
2194
|
-
local
|
|
2238
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2195
2239
|
if GetSpellTargetDestructable() then
|
|
2196
|
-
|
|
2240
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2197
2241
|
else
|
|
2198
|
-
|
|
2242
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2199
2243
|
end
|
|
2200
|
-
|
|
2244
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2201
2245
|
end
|
|
2202
|
-
|
|
2246
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2203
2247
|
end
|
|
2204
|
-
local target =
|
|
2248
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2205
2249
|
if target then
|
|
2206
2250
|
invoke(event, unit, id, target)
|
|
2207
2251
|
end
|
|
@@ -2420,7 +2464,8 @@ Unit.onDamaging = (function()
|
|
|
2420
2464
|
metadata = metadata,
|
|
2421
2465
|
isAttack = BlzGetEventIsAttack(),
|
|
2422
2466
|
originalAmount = GetEventDamage(),
|
|
2423
|
-
originalMetadata = metadata
|
|
2467
|
+
originalMetadata = metadata,
|
|
2468
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2424
2469
|
}
|
|
2425
2470
|
if data.isAttack and source then
|
|
2426
2471
|
local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
|
|
@@ -2449,6 +2494,20 @@ Unit.onDamaging = (function()
|
|
|
2449
2494
|
}
|
|
2450
2495
|
)
|
|
2451
2496
|
)
|
|
2497
|
+
if data[0] and source then
|
|
2498
|
+
local sourceOwner = source.owner.handle
|
|
2499
|
+
data[1] = sourceOwner
|
|
2500
|
+
local targetOwner = target.owner.handle
|
|
2501
|
+
data[2] = targetOwner
|
|
2502
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2503
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2504
|
+
data[3] = true
|
|
2505
|
+
end
|
|
2506
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2507
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2508
|
+
data[4] = true
|
|
2509
|
+
end
|
|
2510
|
+
end
|
|
2452
2511
|
damagingEventByTarget[target] = data
|
|
2453
2512
|
return
|
|
2454
2513
|
end
|
|
@@ -2526,12 +2585,32 @@ Unit.onDamage = __TS__New(
|
|
|
2526
2585
|
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2527
2586
|
preventDeath = damageEventPreventDeath
|
|
2528
2587
|
}
|
|
2588
|
+
if damagingEvent then
|
|
2589
|
+
for key, value in pairs(damagingEvent) do
|
|
2590
|
+
if isAttribute(key) then
|
|
2591
|
+
data[key] = value
|
|
2592
|
+
end
|
|
2593
|
+
end
|
|
2594
|
+
local sourceOwner = damagingEvent[1]
|
|
2595
|
+
if sourceOwner then
|
|
2596
|
+
local targetOwner = damagingEvent[2]
|
|
2597
|
+
if damagingEvent[3] then
|
|
2598
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2599
|
+
end
|
|
2600
|
+
if damagingEvent[4] then
|
|
2601
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2602
|
+
end
|
|
2603
|
+
end
|
|
2604
|
+
end
|
|
2529
2605
|
local evData = setmetatable(
|
|
2530
2606
|
{},
|
|
2531
2607
|
{
|
|
2532
2608
|
__index = data,
|
|
2533
2609
|
__newindex = function(self, key, value)
|
|
2534
|
-
damageSetters[key]
|
|
2610
|
+
local damageSetter = damageSetters[key]
|
|
2611
|
+
if damageSetter ~= nil then
|
|
2612
|
+
damageSetter(value)
|
|
2613
|
+
end
|
|
2535
2614
|
data[key] = value
|
|
2536
2615
|
end
|
|
2537
2616
|
}
|
|
@@ -2589,10 +2668,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2589
2668
|
____exports.UnitTriggerEvent,
|
|
2590
2669
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2591
2670
|
function()
|
|
2592
|
-
local
|
|
2593
|
-
local
|
|
2594
|
-
if getUnitTypeId(
|
|
2595
|
-
|
|
2671
|
+
local unitHandle = getTriggerUnit()
|
|
2672
|
+
local itemHandle = getManipulatedItem()
|
|
2673
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
|
|
2674
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2675
|
+
local item = Item:of(itemHandle)
|
|
2676
|
+
if item.owner ~= unit then
|
|
2677
|
+
return unit, item
|
|
2678
|
+
end
|
|
2596
2679
|
end
|
|
2597
2680
|
return IgnoreEvent
|
|
2598
2681
|
end
|
|
@@ -2612,7 +2695,22 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2612
2695
|
Unit.itemStackedEvent = __TS__New(
|
|
2613
2696
|
____exports.UnitTriggerEvent,
|
|
2614
2697
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2615
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(
|
|
2698
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2699
|
+
)
|
|
2700
|
+
__TS__ObjectDefineProperty(
|
|
2701
|
+
Unit,
|
|
2702
|
+
"itemChargesChangedEvent",
|
|
2703
|
+
{get = function(self)
|
|
2704
|
+
local event = __TS__New(Event)
|
|
2705
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2706
|
+
local unit = item.owner
|
|
2707
|
+
if unit ~= nil then
|
|
2708
|
+
invoke(event, unit, item)
|
|
2709
|
+
end
|
|
2710
|
+
end)
|
|
2711
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2712
|
+
return event
|
|
2713
|
+
end}
|
|
2616
2714
|
)
|
|
2617
2715
|
__TS__ObjectDefineProperty(
|
|
2618
2716
|
Unit,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____records = require("utility.records")
|
|
3
|
+
local invertRecord = ____records.invertRecord
|
|
4
|
+
local stringByArmorType = {
|
|
5
|
+
[0] = "small",
|
|
6
|
+
[1] = "medium",
|
|
7
|
+
[2] = "large",
|
|
8
|
+
[3] = "fort",
|
|
9
|
+
[4] = "normal",
|
|
10
|
+
[5] = "hero",
|
|
11
|
+
[6] = "divine",
|
|
12
|
+
[7] = "none"
|
|
13
|
+
}
|
|
14
|
+
local armorTypeByString = invertRecord(stringByArmorType)
|
|
15
|
+
local nativeByArmorType = {
|
|
16
|
+
[0] = DEFENSE_TYPE_LIGHT,
|
|
17
|
+
[1] = DEFENSE_TYPE_MEDIUM,
|
|
18
|
+
[2] = DEFENSE_TYPE_LARGE,
|
|
19
|
+
[3] = DEFENSE_TYPE_FORT,
|
|
20
|
+
[4] = DEFENSE_TYPE_NORMAL,
|
|
21
|
+
[5] = DEFENSE_TYPE_HERO,
|
|
22
|
+
[6] = DEFENSE_TYPE_DIVINE,
|
|
23
|
+
[7] = DEFENSE_TYPE_NONE
|
|
24
|
+
}
|
|
25
|
+
local armorTypeByNative = invertRecord(nativeByArmorType)
|
|
26
|
+
---
|
|
27
|
+
-- @internal For use by internal systems only.
|
|
28
|
+
____exports.armorTypeToString = function(armorType)
|
|
29
|
+
return stringByArmorType[armorType]
|
|
30
|
+
end
|
|
31
|
+
---
|
|
32
|
+
-- @internal For use by internal systems only.
|
|
33
|
+
____exports.stringToArmorType = function(____string)
|
|
34
|
+
return armorTypeByString[____string] or 7
|
|
35
|
+
end
|
|
36
|
+
---
|
|
37
|
+
-- @internal For use by internal systems only.
|
|
38
|
+
____exports.armorTypeToNative = function(armorType)
|
|
39
|
+
return nativeByArmorType[armorType]
|
|
40
|
+
end
|
|
41
|
+
---
|
|
42
|
+
-- @internal For use by internal systems only.
|
|
43
|
+
____exports.nativeToArmorType = function(armorType)
|
|
44
|
+
return armorTypeByNative[armorType]
|
|
45
|
+
end
|
|
46
|
+
return ____exports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityType, AbilityTypeId } from "../ability-type";
|
|
3
|
+
import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
|
|
4
|
+
export declare class PermanentInvisibilityAbilityType extends AbilityType {
|
|
5
|
+
static readonly BASE_ID: AbilityTypeId;
|
|
6
|
+
get shouldAutoAcquireAttackTargets(): boolean[];
|
|
7
|
+
set shouldAutoAcquireAttackTargets(shouldAutoAcquireAttackTargets: ObjectDataEntryLevelFieldValueSupplier<boolean>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
7
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
8
|
+
____exports.PermanentInvisibilityAbilityType = __TS__Class()
|
|
9
|
+
local PermanentInvisibilityAbilityType = ____exports.PermanentInvisibilityAbilityType
|
|
10
|
+
PermanentInvisibilityAbilityType.name = "PermanentInvisibilityAbilityType"
|
|
11
|
+
__TS__ClassExtends(PermanentInvisibilityAbilityType, AbilityType)
|
|
12
|
+
PermanentInvisibilityAbilityType.BASE_ID = fourCC("Apiv")
|
|
13
|
+
__TS__SetDescriptor(
|
|
14
|
+
PermanentInvisibilityAbilityType.prototype,
|
|
15
|
+
"shouldAutoAcquireAttackTargets",
|
|
16
|
+
{
|
|
17
|
+
get = function(self)
|
|
18
|
+
return self:getBooleanLevelField("Gho1")
|
|
19
|
+
end,
|
|
20
|
+
set = function(self, shouldAutoAcquireAttackTargets)
|
|
21
|
+
self:setBooleanLevelField("Gho1", shouldAutoAcquireAttackTargets)
|
|
22
|
+
end
|
|
23
|
+
},
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
return ____exports
|
|
@@ -38,6 +38,8 @@ local ____sound = require("core.types.sound")
|
|
|
38
38
|
local isSoundLabelCustom = ____sound.isSoundLabelCustom
|
|
39
39
|
local Sound3D = ____sound.Sound3D
|
|
40
40
|
local SoundSettings = ____sound.SoundSettings
|
|
41
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
42
|
+
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
41
43
|
local castAnimationFQNByAbilityTypeId = {}
|
|
42
44
|
local isButtonVisibleFalseAbilityTypes = {}
|
|
43
45
|
local casterCastingEffectPresetsByAbilityTypeId = {}
|
|
@@ -979,9 +981,7 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
|
|
|
979
981
|
4,
|
|
980
982
|
function(caster, ability)
|
|
981
983
|
if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
|
|
982
|
-
Timer:run(
|
|
983
|
-
caster:playAnimation(animationFQN)
|
|
984
|
-
end)
|
|
984
|
+
Timer:run(caster, "playAnimation", animationFQN)
|
|
985
985
|
end
|
|
986
986
|
end
|
|
987
987
|
)
|
|
@@ -1006,9 +1006,10 @@ for abilityTypeId, soundPresetId in pairs(postcompile(function() return targetEf
|
|
|
1006
1006
|
)
|
|
1007
1007
|
end
|
|
1008
1008
|
end
|
|
1009
|
+
local unsupportedEffectSoundAbilityTypeIds = luaSetOf(fourCC("AAns"))
|
|
1009
1010
|
Unit.abilityChannelingStartEvent:addListener(function(caster, ability)
|
|
1010
1011
|
local soundPresetId = ability:getField(ABILITY_SF_EFFECT_SOUND)
|
|
1011
|
-
if isSoundLabelCustom(soundPresetId) then
|
|
1012
|
+
if isSoundLabelCustom(soundPresetId) or unsupportedEffectSoundAbilityTypeIds[ability.parentTypeId] ~= nil and soundPresetId ~= "" then
|
|
1012
1013
|
Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
|
|
1013
1014
|
end
|
|
1014
1015
|
end)
|
|
@@ -13,6 +13,7 @@ import type { AbilityTypeId } from "./ability-type";
|
|
|
13
13
|
import type { UpgradeId } from "./upgrade";
|
|
14
14
|
import { AnimationQualifier } from "../auxiliary/animation-qualifier";
|
|
15
15
|
import { AttackType } from "../auxiliary/attack-type";
|
|
16
|
+
import { ArmorType } from "../auxiliary/armor-type";
|
|
16
17
|
export type UnitTypeId = ObjectDataEntryId & number & {
|
|
17
18
|
readonly __unitTypeId: unique symbol;
|
|
18
19
|
};
|
|
@@ -144,6 +145,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
144
145
|
set runSpeedSD(runSpeedSD: number);
|
|
145
146
|
get runSpeedHD(): number;
|
|
146
147
|
set runSpeedHD(runSpeedHD: number);
|
|
148
|
+
get selectionCircleHeight(): number;
|
|
149
|
+
set selectionCircleHeight(height: number);
|
|
147
150
|
get selectionCircleScale(): number;
|
|
148
151
|
set selectionCircleScale(selectionCircleScale: number);
|
|
149
152
|
get selectionCircleScaleSD(): number;
|
|
@@ -182,16 +185,20 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
182
185
|
set walkSpeedSD(walkSpeedSD: number);
|
|
183
186
|
get walkSpeedHD(): number;
|
|
184
187
|
set walkSpeedHD(walkSpeedHD: number);
|
|
188
|
+
get armor(): number;
|
|
189
|
+
set armor(armor: number);
|
|
185
190
|
get armorSoundType(): ArmorSoundType;
|
|
186
191
|
set armorSoundType(armorSoundType: ArmorSoundType);
|
|
187
192
|
get armorSoundTypeSD(): ArmorSoundType;
|
|
188
193
|
set armorSoundTypeSD(armorSoundTypeSD: ArmorSoundType);
|
|
189
194
|
get armorSoundTypeHD(): ArmorSoundType;
|
|
190
195
|
set armorSoundTypeHD(armorSoundTypeHD: ArmorSoundType);
|
|
196
|
+
get armorType(): ArmorType;
|
|
197
|
+
set armorType(armorType: ArmorType);
|
|
191
198
|
get combatClassifications(): CombatClassifications;
|
|
192
199
|
set combatClassifications(combatClassifications: CombatClassifications);
|
|
193
|
-
get
|
|
194
|
-
set
|
|
200
|
+
get classifications(): UnitClassifications;
|
|
201
|
+
set classifications(unitClassifications: UnitClassifications);
|
|
195
202
|
get weapons(): TupleOf<UnitTypeWeapon, 2>;
|
|
196
203
|
get firstWeapon(): UnitTypeWeapon;
|
|
197
204
|
get secondWeapon(): UnitTypeWeapon;
|
|
@@ -225,6 +232,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
|
|
|
225
232
|
set goldCost(goldCost: number);
|
|
226
233
|
get healthRegenerationRate(): number;
|
|
227
234
|
set healthRegenerationRate(healthRegenerationRate: number);
|
|
235
|
+
get level(): number;
|
|
236
|
+
set level(level: number);
|
|
228
237
|
get manaRegenerationRate(): number;
|
|
229
238
|
set manaRegenerationRate(manaRegenerationRate: number);
|
|
230
239
|
get maximumHealth(): number;
|