warscript 0.0.1-dev.90f1d49 → 0.0.1-dev.91da42b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +1 -2
- package/attributes.lua +9 -0
- package/core/types/frame.lua +24 -21
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -1
- package/core/types/timer.lua +27 -2
- package/decl/native.d.ts +6 -4
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/apply-buff.lua +5 -5
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +11 -3
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +2 -1
- package/engine/behaviour/ability.lua +10 -18
- package/engine/behaviour/unit/stun-immunity.d.ts +11 -5
- package/engine/behaviour/unit/stun-immunity.lua +53 -28
- package/engine/behaviour/unit.d.ts +39 -3
- package/engine/behaviour/unit.lua +259 -6
- package/engine/buff.d.ts +17 -6
- package/engine/buff.lua +160 -97
- 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/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +98 -9
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +27 -24
- package/engine/internal/unit.lua +234 -186
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- 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/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/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/destructible-type.d.ts +27 -1
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/unit-type.d.ts +15 -2
- package/engine/object-data/entry/unit-type.lua +135 -33
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +31 -5
- package/engine/object-field/unit.lua +95 -0
- package/engine/object-field.d.ts +17 -6
- package/engine/object-field.lua +291 -134
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +12 -0
- package/engine/standard/fields/unit.lua +20 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +250 -10
- package/engine/unit.d.ts +5 -0
- package/engine/unit.lua +5 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- 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/utility/types.d.ts +3 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/internal/unit.lua
CHANGED
|
@@ -60,28 +60,25 @@ local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage
|
|
|
60
60
|
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
61
|
local ____attributes = require("attributes")
|
|
62
62
|
local isAttribute = ____attributes.isAttribute
|
|
63
|
+
local ____ability = require("engine.internal.item.ability")
|
|
64
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
65
|
+
local ____synchronization = require("engine.synchronization")
|
|
66
|
+
local synchronizer = ____synchronization.synchronizer
|
|
63
67
|
local match = string.match
|
|
64
68
|
local ____tostring = _G.tostring
|
|
65
69
|
local setUnitAnimation = SetUnitAnimation
|
|
66
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
67
70
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
68
|
-
local resetUnitAnimation = ResetUnitAnimation
|
|
69
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
70
71
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
71
72
|
local getUnitRealField = BlzGetUnitRealField
|
|
72
73
|
local getHeroStr = GetHeroStr
|
|
73
74
|
local getHeroAgi = GetHeroAgi
|
|
74
75
|
local getHeroInt = GetHeroInt
|
|
75
|
-
local setHeroStr = SetHeroStr
|
|
76
|
-
local setHeroAgi = SetHeroAgi
|
|
77
|
-
local setHeroInt = SetHeroInt
|
|
78
76
|
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
79
77
|
local getUnitStringField = BlzGetUnitStringField
|
|
80
78
|
local setUnitIntegerField = BlzSetUnitIntegerField
|
|
81
79
|
local setUnitRealField = BlzSetUnitRealField
|
|
82
80
|
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
83
81
|
local setUnitStringField = BlzSetUnitStringField
|
|
84
|
-
local setUnitScale = SetUnitScale
|
|
85
82
|
local setUnitPosition = SetUnitPosition
|
|
86
83
|
local setUnitTimeScale = SetUnitTimeScale
|
|
87
84
|
local getHandleId = GetHandleId
|
|
@@ -109,7 +106,6 @@ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
|
109
106
|
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
110
107
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
111
108
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
112
|
-
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
113
109
|
local isUnitInvisible = IsUnitInvisible
|
|
114
110
|
local isUnitVisible = IsUnitVisible
|
|
115
111
|
local getUnitX = GetUnitX
|
|
@@ -126,10 +122,6 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
126
122
|
local getIssuedOrderId = GetIssuedOrderId
|
|
127
123
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
128
124
|
local unitAlive = UnitAlive
|
|
129
|
-
local unitAddType = UnitAddType
|
|
130
|
-
local unitRemoveType = UnitRemoveType
|
|
131
|
-
local isUnitIllusion = IsUnitIllusion
|
|
132
|
-
local isUnitType = IsUnitType
|
|
133
125
|
local isUnitAlly = IsUnitAlly
|
|
134
126
|
local isUnitEnemy = IsUnitEnemy
|
|
135
127
|
local getOwningPlayer = GetOwningPlayer
|
|
@@ -142,6 +134,7 @@ do
|
|
|
142
134
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
143
135
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
144
136
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
137
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
145
138
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
146
139
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
147
140
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -349,6 +342,9 @@ local function dispatchAbility(event)
|
|
|
349
342
|
}
|
|
350
343
|
)
|
|
351
344
|
end
|
|
345
|
+
local function damagingEventPreventRetaliation(self)
|
|
346
|
+
self[0] = true
|
|
347
|
+
end
|
|
352
348
|
local function damageEventPreventDeath(self, callback, ...)
|
|
353
349
|
if self[0] ~= nil then
|
|
354
350
|
return
|
|
@@ -411,6 +407,19 @@ function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
|
411
407
|
self.unit = unit
|
|
412
408
|
self.index = index
|
|
413
409
|
end
|
|
410
|
+
__TS__SetDescriptor(
|
|
411
|
+
UnitWeapon.prototype,
|
|
412
|
+
"isEnabled",
|
|
413
|
+
{
|
|
414
|
+
get = function(self)
|
|
415
|
+
return BlzGetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index)
|
|
416
|
+
end,
|
|
417
|
+
set = function(self, isEnabled)
|
|
418
|
+
BlzSetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index, isEnabled)
|
|
419
|
+
end
|
|
420
|
+
},
|
|
421
|
+
true
|
|
422
|
+
)
|
|
414
423
|
__TS__SetDescriptor(
|
|
415
424
|
UnitWeapon.prototype,
|
|
416
425
|
"cooldown",
|
|
@@ -445,6 +454,19 @@ __TS__SetDescriptor(
|
|
|
445
454
|
},
|
|
446
455
|
true
|
|
447
456
|
)
|
|
457
|
+
__TS__SetDescriptor(
|
|
458
|
+
UnitWeapon.prototype,
|
|
459
|
+
"allowedTargetCombatClassifications",
|
|
460
|
+
{
|
|
461
|
+
get = function(self)
|
|
462
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
463
|
+
end,
|
|
464
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
465
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
466
|
+
end
|
|
467
|
+
},
|
|
468
|
+
true
|
|
469
|
+
)
|
|
448
470
|
__TS__SetDescriptor(
|
|
449
471
|
UnitWeapon.prototype,
|
|
450
472
|
"damageBase",
|
|
@@ -632,15 +654,15 @@ for ____, player in ipairs(Player.all) do
|
|
|
632
654
|
dummies[player] = dummy
|
|
633
655
|
end
|
|
634
656
|
local function delayHealthChecksCallback(unit)
|
|
635
|
-
local counter = (unit[
|
|
657
|
+
local counter = (unit[104] or 0) - 1
|
|
636
658
|
if counter ~= 0 then
|
|
637
|
-
unit[
|
|
659
|
+
unit[104] = counter
|
|
638
660
|
return
|
|
639
661
|
end
|
|
640
|
-
unit[
|
|
641
|
-
local healthBonus = unit[
|
|
662
|
+
unit[104] = nil
|
|
663
|
+
local healthBonus = unit[105]
|
|
642
664
|
if healthBonus ~= nil then
|
|
643
|
-
unit[
|
|
665
|
+
unit[105] = nil
|
|
644
666
|
local handle = unit.handle
|
|
645
667
|
BlzSetUnitMaxHP(
|
|
646
668
|
handle,
|
|
@@ -651,15 +673,24 @@ end
|
|
|
651
673
|
local nextSyncId = 1
|
|
652
674
|
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
653
675
|
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
676
|
+
local function addAbility(unit, abilityTypeId)
|
|
677
|
+
local ____unitAddAbility_result_0
|
|
678
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
679
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
680
|
+
else
|
|
681
|
+
____unitAddAbility_result_0 = nil
|
|
682
|
+
end
|
|
683
|
+
return ____unitAddAbility_result_0
|
|
684
|
+
end
|
|
654
685
|
____exports.Unit = __TS__Class()
|
|
655
686
|
local Unit = ____exports.Unit
|
|
656
687
|
Unit.name = "Unit"
|
|
657
688
|
__TS__ClassExtends(Unit, Handle)
|
|
658
689
|
function Unit.prototype.____constructor(self, handle)
|
|
659
690
|
Handle.prototype.____constructor(self, handle)
|
|
660
|
-
local
|
|
661
|
-
nextSyncId =
|
|
662
|
-
self.syncId =
|
|
691
|
+
local ____nextSyncId_1 = nextSyncId
|
|
692
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
693
|
+
self.syncId = ____nextSyncId_1
|
|
663
694
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
664
695
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
665
696
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -691,8 +722,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
691
722
|
end
|
|
692
723
|
function Unit.prototype.onDestroy(self)
|
|
693
724
|
local handle = self.handle
|
|
694
|
-
self[
|
|
695
|
-
self[
|
|
725
|
+
self[108] = getUnitX(handle)
|
|
726
|
+
self[109] = getUnitY(handle)
|
|
696
727
|
if not self._owner then
|
|
697
728
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
698
729
|
end
|
|
@@ -760,17 +791,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
760
791
|
end}
|
|
761
792
|
end
|
|
762
793
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
763
|
-
local
|
|
764
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
794
|
+
local ____combatClassification_2 = combatClassification
|
|
795
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
765
796
|
end
|
|
766
797
|
function Unit.prototype.addClassification(self, classification)
|
|
767
|
-
return
|
|
798
|
+
return UnitAddType(self.handle, classification)
|
|
768
799
|
end
|
|
769
800
|
function Unit.prototype.removeClassification(self, classification)
|
|
770
|
-
return
|
|
801
|
+
return UnitRemoveType(self.handle, classification)
|
|
771
802
|
end
|
|
772
803
|
function Unit.prototype.hasClassification(self, classification)
|
|
773
|
-
return
|
|
804
|
+
return IsUnitType(self.handle, classification)
|
|
774
805
|
end
|
|
775
806
|
function Unit.prototype.isVisibleTo(self, player)
|
|
776
807
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -779,13 +810,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
779
810
|
return isUnitInvisible(self.handle, player.handle)
|
|
780
811
|
end
|
|
781
812
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
782
|
-
local
|
|
813
|
+
local ____temp_3
|
|
783
814
|
if type(x) == "number" then
|
|
784
|
-
|
|
815
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
785
816
|
else
|
|
786
|
-
|
|
817
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
787
818
|
end
|
|
788
|
-
return
|
|
819
|
+
return ____temp_3
|
|
789
820
|
end
|
|
790
821
|
function Unit.prototype.isAllyOf(self, unit)
|
|
791
822
|
return isUnitAlly(
|
|
@@ -803,19 +834,30 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
803
834
|
if type(animation) == "number" then
|
|
804
835
|
setUnitAnimationByIndex(self.handle, animation)
|
|
805
836
|
elseif rarity then
|
|
806
|
-
|
|
837
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
807
838
|
else
|
|
808
839
|
setUnitAnimation(self.handle, animation)
|
|
809
840
|
end
|
|
810
841
|
end
|
|
811
842
|
function Unit.prototype.resetAnimation(self)
|
|
812
|
-
|
|
843
|
+
ResetUnitAnimation(self.handle)
|
|
813
844
|
end
|
|
814
845
|
function Unit.prototype.queueAnimation(self, animation)
|
|
815
|
-
|
|
846
|
+
QueueUnitAnimation(self.handle, animation)
|
|
847
|
+
end
|
|
848
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
849
|
+
local firstWeapon = self.firstWeapon
|
|
850
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
851
|
+
return firstWeapon
|
|
852
|
+
end
|
|
853
|
+
local secondWeapon = self.secondWeapon
|
|
854
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
855
|
+
return secondWeapon
|
|
856
|
+
end
|
|
857
|
+
return nil
|
|
816
858
|
end
|
|
817
859
|
function Unit.prototype.delayHealthChecks(self)
|
|
818
|
-
self[
|
|
860
|
+
self[104] = (self[104] or 0) + 1
|
|
819
861
|
Timer:run(delayHealthChecksCallback, self)
|
|
820
862
|
end
|
|
821
863
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -832,14 +874,14 @@ function Unit.prototype.kill(self)
|
|
|
832
874
|
killUnit(self.handle)
|
|
833
875
|
end
|
|
834
876
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
835
|
-
local
|
|
836
|
-
local
|
|
837
|
-
local
|
|
838
|
-
if
|
|
839
|
-
|
|
877
|
+
local ____ReviveHero_6 = ReviveHero
|
|
878
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
879
|
+
local ____doEffect_4 = doEffect
|
|
880
|
+
if ____doEffect_4 == nil then
|
|
881
|
+
____doEffect_4 = false
|
|
840
882
|
end
|
|
841
|
-
__TS__SparseArrayPush(
|
|
842
|
-
|
|
883
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
884
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
843
885
|
end
|
|
844
886
|
function Unit.prototype.healTarget(self, target, amount)
|
|
845
887
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -882,17 +924,16 @@ function Unit.prototype.itemInSlot(self, slot)
|
|
|
882
924
|
return Item:of(unitItemInSlot(self.handle, slot))
|
|
883
925
|
end
|
|
884
926
|
function Unit.prototype.addAbility(self, abilityId)
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
927
|
+
local ability = UnitAbility:of(
|
|
928
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
929
|
+
abilityId,
|
|
930
|
+
self
|
|
931
|
+
)
|
|
932
|
+
if ability ~= nil then
|
|
891
933
|
local abilities = self.abilities
|
|
892
934
|
abilities[#abilities + 1] = ability
|
|
893
|
-
return ability
|
|
894
935
|
end
|
|
895
|
-
return
|
|
936
|
+
return ability
|
|
896
937
|
end
|
|
897
938
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
898
939
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -906,31 +947,21 @@ end
|
|
|
906
947
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
907
948
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
908
949
|
end
|
|
909
|
-
function Unit.prototype.
|
|
910
|
-
local
|
|
911
|
-
|
|
912
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
913
|
-
return nil
|
|
914
|
-
end
|
|
915
|
-
return UnitAbility:of(
|
|
916
|
-
getUnitAbility(self.handle, abilityId),
|
|
917
|
-
abilityId,
|
|
918
|
-
self
|
|
919
|
-
)
|
|
950
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
951
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
952
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
920
953
|
end
|
|
921
|
-
function Unit.prototype.removeAbility(self,
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
end
|
|
954
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
955
|
+
local abilities = self.abilities
|
|
956
|
+
for i = 1, #abilities do
|
|
957
|
+
if abilities[i].typeId == abilityTypeId then
|
|
958
|
+
local ability = abilities[i]
|
|
959
|
+
tremove(abilities, i)
|
|
960
|
+
ability:destroy()
|
|
961
|
+
return true
|
|
930
962
|
end
|
|
931
|
-
return true
|
|
932
963
|
end
|
|
933
|
-
return
|
|
964
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
934
965
|
end
|
|
935
966
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
936
967
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -944,9 +975,6 @@ end
|
|
|
944
975
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
945
976
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
946
977
|
end
|
|
947
|
-
function Unit.prototype.interruptAttack(self)
|
|
948
|
-
unitInterruptAttack(self.handle)
|
|
949
|
-
end
|
|
950
978
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
951
979
|
local handle = self.handle
|
|
952
980
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1017,18 +1045,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1017
1045
|
end
|
|
1018
1046
|
function Unit.prototype.incrementStunCounter(self)
|
|
1019
1047
|
local stunCounter = self[102] or 0
|
|
1020
|
-
if not self[101] or stunCounter >= 0 then
|
|
1048
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1021
1049
|
BlzPauseUnitEx(self.handle, true)
|
|
1022
1050
|
end
|
|
1023
1051
|
self[102] = stunCounter + 1
|
|
1024
1052
|
end
|
|
1025
1053
|
function Unit.prototype.decrementStunCounter(self)
|
|
1026
1054
|
local stunCounter = self[102] or 0
|
|
1027
|
-
if not self[101] or stunCounter >= 1 then
|
|
1055
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1028
1056
|
BlzPauseUnitEx(self.handle, false)
|
|
1029
1057
|
end
|
|
1030
1058
|
self[102] = stunCounter - 1
|
|
1031
1059
|
end
|
|
1060
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1061
|
+
local forceStunCounter = self[103] or 0
|
|
1062
|
+
if forceStunCounter == 0 then
|
|
1063
|
+
local handle = self.handle
|
|
1064
|
+
if not self[101] then
|
|
1065
|
+
for _ = self[102] or 0, -1 do
|
|
1066
|
+
BlzPauseUnitEx(handle, true)
|
|
1067
|
+
end
|
|
1068
|
+
end
|
|
1069
|
+
BlzPauseUnitEx(handle, true)
|
|
1070
|
+
end
|
|
1071
|
+
self[103] = forceStunCounter + 1
|
|
1072
|
+
end
|
|
1073
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1074
|
+
local forceStunCounter = self[103] or 0
|
|
1075
|
+
if forceStunCounter == 1 then
|
|
1076
|
+
local handle = self.handle
|
|
1077
|
+
if not self[101] then
|
|
1078
|
+
for _ = self[102] or 0, -1 do
|
|
1079
|
+
BlzPauseUnitEx(handle, false)
|
|
1080
|
+
end
|
|
1081
|
+
end
|
|
1082
|
+
BlzPauseUnitEx(handle, false)
|
|
1083
|
+
end
|
|
1084
|
+
self[103] = forceStunCounter - 1
|
|
1085
|
+
end
|
|
1032
1086
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1033
1087
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1034
1088
|
owner.handle,
|
|
@@ -1217,7 +1271,7 @@ __TS__SetDescriptor(
|
|
|
1217
1271
|
Unit.prototype,
|
|
1218
1272
|
"isIllusion",
|
|
1219
1273
|
{get = function(self)
|
|
1220
|
-
return
|
|
1274
|
+
return IsUnitIllusion(self.handle)
|
|
1221
1275
|
end},
|
|
1222
1276
|
true
|
|
1223
1277
|
)
|
|
@@ -1315,19 +1369,6 @@ __TS__SetDescriptor(
|
|
|
1315
1369
|
},
|
|
1316
1370
|
true
|
|
1317
1371
|
)
|
|
1318
|
-
__TS__SetDescriptor(
|
|
1319
|
-
Unit.prototype,
|
|
1320
|
-
"strengthBase",
|
|
1321
|
-
{
|
|
1322
|
-
get = function(self)
|
|
1323
|
-
return getHeroStr(self.handle, false)
|
|
1324
|
-
end,
|
|
1325
|
-
set = function(self, strengthBase)
|
|
1326
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1327
|
-
end
|
|
1328
|
-
},
|
|
1329
|
-
true
|
|
1330
|
-
)
|
|
1331
1372
|
__TS__SetDescriptor(
|
|
1332
1373
|
Unit.prototype,
|
|
1333
1374
|
"strengthBonus",
|
|
@@ -1345,19 +1386,6 @@ __TS__SetDescriptor(
|
|
|
1345
1386
|
end},
|
|
1346
1387
|
true
|
|
1347
1388
|
)
|
|
1348
|
-
__TS__SetDescriptor(
|
|
1349
|
-
Unit.prototype,
|
|
1350
|
-
"agilityBase",
|
|
1351
|
-
{
|
|
1352
|
-
get = function(self)
|
|
1353
|
-
return getHeroAgi(self.handle, false)
|
|
1354
|
-
end,
|
|
1355
|
-
set = function(self, agilityBase)
|
|
1356
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1357
|
-
end
|
|
1358
|
-
},
|
|
1359
|
-
true
|
|
1360
|
-
)
|
|
1361
1389
|
__TS__SetDescriptor(
|
|
1362
1390
|
Unit.prototype,
|
|
1363
1391
|
"agilityBonus",
|
|
@@ -1375,19 +1403,6 @@ __TS__SetDescriptor(
|
|
|
1375
1403
|
end},
|
|
1376
1404
|
true
|
|
1377
1405
|
)
|
|
1378
|
-
__TS__SetDescriptor(
|
|
1379
|
-
Unit.prototype,
|
|
1380
|
-
"intelligenceBase",
|
|
1381
|
-
{
|
|
1382
|
-
get = function(self)
|
|
1383
|
-
return getHeroInt(self.handle, false)
|
|
1384
|
-
end,
|
|
1385
|
-
set = function(self, intelligenceBase)
|
|
1386
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1387
|
-
end
|
|
1388
|
-
},
|
|
1389
|
-
true
|
|
1390
|
-
)
|
|
1391
1406
|
__TS__SetDescriptor(
|
|
1392
1407
|
Unit.prototype,
|
|
1393
1408
|
"intelligenceBonus",
|
|
@@ -1436,17 +1451,17 @@ __TS__SetDescriptor(
|
|
|
1436
1451
|
"isTeamGlowVisible",
|
|
1437
1452
|
{
|
|
1438
1453
|
get = function(self)
|
|
1439
|
-
return not self[
|
|
1454
|
+
return not self[107]
|
|
1440
1455
|
end,
|
|
1441
1456
|
set = function(self, isTeamGlowVisible)
|
|
1442
1457
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1443
|
-
local
|
|
1458
|
+
local ____temp_7
|
|
1444
1459
|
if not isTeamGlowVisible then
|
|
1445
|
-
|
|
1460
|
+
____temp_7 = true
|
|
1446
1461
|
else
|
|
1447
|
-
|
|
1462
|
+
____temp_7 = nil
|
|
1448
1463
|
end
|
|
1449
|
-
self[
|
|
1464
|
+
self[107] = ____temp_7
|
|
1450
1465
|
end
|
|
1451
1466
|
},
|
|
1452
1467
|
true
|
|
@@ -1456,7 +1471,7 @@ __TS__SetDescriptor(
|
|
|
1456
1471
|
"color",
|
|
1457
1472
|
{set = function(self, color)
|
|
1458
1473
|
SetUnitColor(self.handle, color.handle)
|
|
1459
|
-
if self[
|
|
1474
|
+
if self[107] then
|
|
1460
1475
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1461
1476
|
end
|
|
1462
1477
|
end},
|
|
@@ -1480,14 +1495,14 @@ __TS__SetDescriptor(
|
|
|
1480
1495
|
"maxHealth",
|
|
1481
1496
|
{
|
|
1482
1497
|
get = function(self)
|
|
1483
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1498
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1484
1499
|
end,
|
|
1485
1500
|
set = function(self, maxHealth)
|
|
1486
|
-
if maxHealth < 1 and self[
|
|
1487
|
-
self[
|
|
1501
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1502
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1488
1503
|
maxHealth = 1
|
|
1489
1504
|
end
|
|
1490
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1505
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1491
1506
|
end
|
|
1492
1507
|
},
|
|
1493
1508
|
true
|
|
@@ -1529,10 +1544,10 @@ __TS__SetDescriptor(
|
|
|
1529
1544
|
"health",
|
|
1530
1545
|
{
|
|
1531
1546
|
get = function(self)
|
|
1532
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1547
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1533
1548
|
end,
|
|
1534
1549
|
set = function(self, health)
|
|
1535
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1550
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1536
1551
|
end
|
|
1537
1552
|
},
|
|
1538
1553
|
true
|
|
@@ -1608,25 +1623,12 @@ __TS__SetDescriptor(
|
|
|
1608
1623
|
},
|
|
1609
1624
|
true
|
|
1610
1625
|
)
|
|
1611
|
-
__TS__SetDescriptor(
|
|
1612
|
-
Unit.prototype,
|
|
1613
|
-
"flyHeight",
|
|
1614
|
-
{
|
|
1615
|
-
get = function(self)
|
|
1616
|
-
return getUnitFlyHeight(self.handle)
|
|
1617
|
-
end,
|
|
1618
|
-
set = function(self, v)
|
|
1619
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1620
|
-
end
|
|
1621
|
-
},
|
|
1622
|
-
true
|
|
1623
|
-
)
|
|
1624
1626
|
__TS__SetDescriptor(
|
|
1625
1627
|
Unit.prototype,
|
|
1626
1628
|
"x",
|
|
1627
1629
|
{
|
|
1628
1630
|
get = function(self)
|
|
1629
|
-
return self[
|
|
1631
|
+
return self[108] or getUnitX(self.handle)
|
|
1630
1632
|
end,
|
|
1631
1633
|
set = function(self, v)
|
|
1632
1634
|
SetUnitX(self.handle, v)
|
|
@@ -1639,7 +1641,7 @@ __TS__SetDescriptor(
|
|
|
1639
1641
|
"y",
|
|
1640
1642
|
{
|
|
1641
1643
|
get = function(self)
|
|
1642
|
-
return self[
|
|
1644
|
+
return self[109] or getUnitY(self.handle)
|
|
1643
1645
|
end,
|
|
1644
1646
|
set = function(self, v)
|
|
1645
1647
|
SetUnitY(self.handle, v)
|
|
@@ -1744,14 +1746,18 @@ __TS__SetDescriptor(
|
|
|
1744
1746
|
local handle = self.handle
|
|
1745
1747
|
if isPaused and not IsUnitPaused(handle) then
|
|
1746
1748
|
self[101] = true
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
+
if (self[103] or 0) <= 0 then
|
|
1750
|
+
for _ = self[102] or 0, -1 do
|
|
1751
|
+
BlzPauseUnitEx(handle, true)
|
|
1752
|
+
end
|
|
1749
1753
|
end
|
|
1750
1754
|
PauseUnit(handle, true)
|
|
1751
1755
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1752
1756
|
PauseUnit(handle, false)
|
|
1753
|
-
|
|
1754
|
-
|
|
1757
|
+
if (self[103] or 0) <= 0 then
|
|
1758
|
+
for _ = self[102] or 0, -1 do
|
|
1759
|
+
BlzPauseUnitEx(handle, false)
|
|
1760
|
+
end
|
|
1755
1761
|
end
|
|
1756
1762
|
self[101] = nil
|
|
1757
1763
|
end
|
|
@@ -1809,20 +1815,6 @@ __TS__SetDescriptor(
|
|
|
1809
1815
|
},
|
|
1810
1816
|
true
|
|
1811
1817
|
)
|
|
1812
|
-
__TS__SetDescriptor(
|
|
1813
|
-
Unit.prototype,
|
|
1814
|
-
"scale",
|
|
1815
|
-
{
|
|
1816
|
-
get = function(self)
|
|
1817
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1818
|
-
end,
|
|
1819
|
-
set = function(self, v)
|
|
1820
|
-
setUnitScale(self.handle, v, v, v)
|
|
1821
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1822
|
-
end
|
|
1823
|
-
},
|
|
1824
|
-
true
|
|
1825
|
-
)
|
|
1826
1818
|
__TS__SetDescriptor(
|
|
1827
1819
|
Unit.prototype,
|
|
1828
1820
|
"timeScale",
|
|
@@ -2050,6 +2042,14 @@ __TS__SetDescriptor(
|
|
|
2050
2042
|
end},
|
|
2051
2043
|
true
|
|
2052
2044
|
)
|
|
2045
|
+
__TS__SetDescriptor(
|
|
2046
|
+
Unit.prototype,
|
|
2047
|
+
"targetAcquiredEvent",
|
|
2048
|
+
{get = function(self)
|
|
2049
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2050
|
+
end},
|
|
2051
|
+
true
|
|
2052
|
+
)
|
|
2053
2053
|
__TS__SetDescriptor(
|
|
2054
2054
|
Unit.prototype,
|
|
2055
2055
|
"onSelect",
|
|
@@ -2110,6 +2110,11 @@ __TS__SetDescriptor(
|
|
|
2110
2110
|
end},
|
|
2111
2111
|
true
|
|
2112
2112
|
)
|
|
2113
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2114
|
+
____exports.UnitTriggerEvent,
|
|
2115
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2116
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2117
|
+
)
|
|
2113
2118
|
Unit.deathEvent = __TS__New(
|
|
2114
2119
|
____exports.UnitTriggerEvent,
|
|
2115
2120
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2185,25 +2190,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2185
2190
|
InitializingEvent,
|
|
2186
2191
|
function(event)
|
|
2187
2192
|
local function listener(unit, id)
|
|
2188
|
-
local
|
|
2193
|
+
local ____GetSpellTargetUnit_result_10
|
|
2189
2194
|
if GetSpellTargetUnit() then
|
|
2190
|
-
|
|
2195
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2191
2196
|
else
|
|
2192
|
-
local
|
|
2197
|
+
local ____GetSpellTargetItem_result_9
|
|
2193
2198
|
if GetSpellTargetItem() then
|
|
2194
|
-
|
|
2199
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2195
2200
|
else
|
|
2196
|
-
local
|
|
2201
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2197
2202
|
if GetSpellTargetDestructable() then
|
|
2198
|
-
|
|
2203
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2199
2204
|
else
|
|
2200
|
-
|
|
2205
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2201
2206
|
end
|
|
2202
|
-
|
|
2207
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2203
2208
|
end
|
|
2204
|
-
|
|
2209
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2205
2210
|
end
|
|
2206
|
-
local target =
|
|
2211
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2207
2212
|
if target then
|
|
2208
2213
|
invoke(event, unit, id, target)
|
|
2209
2214
|
end
|
|
@@ -2422,15 +2427,11 @@ Unit.onDamaging = (function()
|
|
|
2422
2427
|
metadata = metadata,
|
|
2423
2428
|
isAttack = BlzGetEventIsAttack(),
|
|
2424
2429
|
originalAmount = GetEventDamage(),
|
|
2425
|
-
originalMetadata = metadata
|
|
2430
|
+
originalMetadata = metadata,
|
|
2431
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2426
2432
|
}
|
|
2427
2433
|
if data.isAttack and source then
|
|
2428
|
-
|
|
2429
|
-
if weapon == -1 then
|
|
2430
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2431
|
-
weapon = 0
|
|
2432
|
-
end
|
|
2433
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2434
|
+
data.weapon = source:chooseWeapon(target)
|
|
2434
2435
|
end
|
|
2435
2436
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2436
2437
|
invoke(
|
|
@@ -2451,6 +2452,20 @@ Unit.onDamaging = (function()
|
|
|
2451
2452
|
}
|
|
2452
2453
|
)
|
|
2453
2454
|
)
|
|
2455
|
+
if data[0] and source then
|
|
2456
|
+
local sourceOwner = source.owner.handle
|
|
2457
|
+
data[1] = sourceOwner
|
|
2458
|
+
local targetOwner = target.owner.handle
|
|
2459
|
+
data[2] = targetOwner
|
|
2460
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2461
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2462
|
+
data[3] = true
|
|
2463
|
+
end
|
|
2464
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2465
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2466
|
+
data[4] = true
|
|
2467
|
+
end
|
|
2468
|
+
end
|
|
2454
2469
|
damagingEventByTarget[target] = data
|
|
2455
2470
|
return
|
|
2456
2471
|
end
|
|
@@ -2534,6 +2549,16 @@ Unit.onDamage = __TS__New(
|
|
|
2534
2549
|
data[key] = value
|
|
2535
2550
|
end
|
|
2536
2551
|
end
|
|
2552
|
+
local sourceOwner = damagingEvent[1]
|
|
2553
|
+
if sourceOwner then
|
|
2554
|
+
local targetOwner = damagingEvent[2]
|
|
2555
|
+
if damagingEvent[3] then
|
|
2556
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2557
|
+
end
|
|
2558
|
+
if damagingEvent[4] then
|
|
2559
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2560
|
+
end
|
|
2561
|
+
end
|
|
2537
2562
|
end
|
|
2538
2563
|
local evData = setmetatable(
|
|
2539
2564
|
{},
|
|
@@ -2551,7 +2576,7 @@ Unit.onDamage = __TS__New(
|
|
|
2551
2576
|
invoke(event, source, target, evData)
|
|
2552
2577
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2553
2578
|
local bonusHealth = math.ceil(evData.amount)
|
|
2554
|
-
target[
|
|
2579
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2555
2580
|
BlzSetUnitMaxHP(
|
|
2556
2581
|
target.handle,
|
|
2557
2582
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2565,7 +2590,7 @@ Unit.onDamage = __TS__New(
|
|
|
2565
2590
|
evData[0],
|
|
2566
2591
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2567
2592
|
)
|
|
2568
|
-
target[
|
|
2593
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2569
2594
|
SetWidgetLife(
|
|
2570
2595
|
target.handle,
|
|
2571
2596
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2601,10 +2626,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2601
2626
|
____exports.UnitTriggerEvent,
|
|
2602
2627
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2603
2628
|
function()
|
|
2604
|
-
local
|
|
2605
|
-
local
|
|
2606
|
-
if getUnitTypeId(
|
|
2607
|
-
|
|
2629
|
+
local unitHandle = getTriggerUnit()
|
|
2630
|
+
local itemHandle = getManipulatedItem()
|
|
2631
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
|
|
2632
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2633
|
+
local item = Item:of(itemHandle)
|
|
2634
|
+
if item.owner ~= unit then
|
|
2635
|
+
return unit, item
|
|
2636
|
+
end
|
|
2608
2637
|
end
|
|
2609
2638
|
return IgnoreEvent
|
|
2610
2639
|
end
|
|
@@ -2624,7 +2653,22 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2624
2653
|
Unit.itemStackedEvent = __TS__New(
|
|
2625
2654
|
____exports.UnitTriggerEvent,
|
|
2626
2655
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2627
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(
|
|
2656
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2657
|
+
)
|
|
2658
|
+
__TS__ObjectDefineProperty(
|
|
2659
|
+
Unit,
|
|
2660
|
+
"itemChargesChangedEvent",
|
|
2661
|
+
{get = function(self)
|
|
2662
|
+
local event = __TS__New(Event)
|
|
2663
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2664
|
+
local unit = item.owner
|
|
2665
|
+
if unit ~= nil then
|
|
2666
|
+
invoke(event, unit, item)
|
|
2667
|
+
end
|
|
2668
|
+
end)
|
|
2669
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2670
|
+
return event
|
|
2671
|
+
end}
|
|
2628
2672
|
)
|
|
2629
2673
|
__TS__ObjectDefineProperty(
|
|
2630
2674
|
Unit,
|
|
@@ -2696,6 +2740,10 @@ __TS__ObjectDefineProperty(
|
|
|
2696
2740
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2697
2741
|
return destroyEvent
|
|
2698
2742
|
end}
|
|
2743
|
+
)
|
|
2744
|
+
Unit.synchronize = synchronizer(
|
|
2745
|
+
function(unit) return unit.syncId end,
|
|
2746
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2699
2747
|
);
|
|
2700
2748
|
(function(self)
|
|
2701
2749
|
local leaveAbilityIds = postcompile(function()
|