warscript 0.0.1-dev.63f1d69 → 0.0.1-dev.6564df4
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/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +14 -6
- package/core/types/effect.lua +131 -35
- package/core/types/frame.d.ts +8 -0
- package/core/types/frame.lua +103 -13
- package/core/types/player.lua +3 -1
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +79 -5
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/timer.d.ts +8 -8
- package/core/types/timer.lua +39 -23
- package/core/util.d.ts +1 -1
- package/core/util.lua +18 -1
- package/decl/native.d.ts +844 -788
- package/engine/behavior.d.ts +4 -2
- package/engine/behavior.lua +59 -33
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +39 -11
- package/engine/behaviour/ability/damage.lua +83 -37
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +43 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -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 +20 -4
- package/engine/behaviour/ability.lua +111 -47
- package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
- package/engine/behaviour/unit/stun-immunity.lua +43 -27
- package/engine/behaviour/unit.d.ts +37 -0
- package/engine/behaviour/unit.lua +205 -4
- package/engine/buff.d.ts +102 -42
- package/engine/buff.lua +446 -206
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +23 -14
- package/engine/internal/ability.lua +128 -85
- package/engine/internal/item/ability.lua +162 -4
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +7 -4
- package/engine/internal/item.lua +141 -35
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- 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/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +45 -1
- package/engine/internal/unit/ability.lua +98 -14
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/bonus.d.ts +6 -2
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +12 -3
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +33 -7
- package/engine/internal/unit.d.ts +54 -16
- package/engine/internal/unit.lua +395 -168
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -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/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- 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/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +19 -17
- package/engine/object-data/entry/ability-type.lua +90 -36
- package/engine/object-data/entry/buff-type/applicable.lua +18 -37
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +1 -1
- package/engine/object-data/entry/item-type.d.ts +15 -1
- package/engine/object-data/entry/item-type.lua +93 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +21 -5
- package/engine/object-data/entry/unit-type.lua +214 -93
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +28 -5
- package/engine/object-field/ability.lua +59 -5
- package/engine/object-field/unit.d.ts +57 -3
- package/engine/object-field/unit.lua +207 -7
- package/engine/object-field.d.ts +17 -6
- package/engine/object-field.lua +190 -90
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -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 +4 -0
- package/engine/unit.lua +4 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +7 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +2 -3
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/utility/arrays.d.ts +9 -1
- package/utility/arrays.lua +37 -3
- package/utility/callback-array.d.ts +13 -0
- package/utility/callback-array.lua +46 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +12 -2
- package/utility/linked-set.lua +8 -2
- package/utility/lua-maps.d.ts +4 -0
- package/utility/lua-maps.lua +20 -0
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/internal/unit.lua
CHANGED
|
@@ -51,12 +51,21 @@ local ____arrays = require("utility.arrays")
|
|
|
51
51
|
local forEach = ____arrays.forEach
|
|
52
52
|
local ____math = require("math")
|
|
53
53
|
local min = ____math.min
|
|
54
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
56
|
+
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
|
+
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
|
+
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
|
+
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
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
|
|
54
65
|
local match = string.match
|
|
55
66
|
local ____tostring = _G.tostring
|
|
56
67
|
local setUnitAnimation = SetUnitAnimation
|
|
57
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
58
68
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
59
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
60
69
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
61
70
|
local getUnitRealField = BlzGetUnitRealField
|
|
62
71
|
local getHeroStr = GetHeroStr
|
|
@@ -75,9 +84,9 @@ local setUnitScale = SetUnitScale
|
|
|
75
84
|
local setUnitPosition = SetUnitPosition
|
|
76
85
|
local setUnitTimeScale = SetUnitTimeScale
|
|
77
86
|
local getHandleId = GetHandleId
|
|
87
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
78
88
|
local createUnit = CreateUnit
|
|
79
89
|
local killUnit = KillUnit
|
|
80
|
-
local setUnitExploded = SetUnitExploded
|
|
81
90
|
local removeUnit = RemoveUnit
|
|
82
91
|
local getUnitTypeId = GetUnitTypeId
|
|
83
92
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -93,8 +102,6 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
93
102
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
94
103
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
95
104
|
local isUnitInRange = IsUnitInRange
|
|
96
|
-
local setResourceAmount = SetResourceAmount
|
|
97
|
-
local getResourceAmount = GetResourceAmount
|
|
98
105
|
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
99
106
|
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
100
107
|
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
@@ -118,15 +125,9 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
118
125
|
local getIssuedOrderId = GetIssuedOrderId
|
|
119
126
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
120
127
|
local unitAlive = UnitAlive
|
|
121
|
-
local unitAddType = UnitAddType
|
|
122
|
-
local unitRemoveType = UnitRemoveType
|
|
123
|
-
local isUnitIllusion = IsUnitIllusion
|
|
124
|
-
local isUnitType = IsUnitType
|
|
125
128
|
local isUnitAlly = IsUnitAlly
|
|
126
129
|
local isUnitEnemy = IsUnitEnemy
|
|
127
130
|
local getOwningPlayer = GetOwningPlayer
|
|
128
|
-
local setUnitColor = SetUnitColor
|
|
129
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
130
131
|
____exports.UnitClassification = {}
|
|
131
132
|
local UnitClassification = ____exports.UnitClassification
|
|
132
133
|
do
|
|
@@ -136,6 +137,7 @@ do
|
|
|
136
137
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
137
138
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
138
139
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
140
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
139
141
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
140
142
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
141
143
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -290,7 +292,6 @@ local function dispatch(event, idGetter, argsGetter)
|
|
|
290
292
|
return event[id]
|
|
291
293
|
end
|
|
292
294
|
if not initialized then
|
|
293
|
-
local invoke = Event.invoke
|
|
294
295
|
event:addListener(function(...)
|
|
295
296
|
local id = idGetter(...)
|
|
296
297
|
local dispatched = rawget(self, id)
|
|
@@ -328,7 +329,6 @@ local function dispatchAbility(event)
|
|
|
328
329
|
return event[id]
|
|
329
330
|
end
|
|
330
331
|
if not initialized then
|
|
331
|
-
local invoke = Event.invoke
|
|
332
332
|
event:addListener(function(unit, ability, ...)
|
|
333
333
|
local dispatched = rawget(self, ability.typeId)
|
|
334
334
|
if dispatched ~= nil then
|
|
@@ -345,6 +345,9 @@ local function dispatchAbility(event)
|
|
|
345
345
|
}
|
|
346
346
|
)
|
|
347
347
|
end
|
|
348
|
+
local function damagingEventPreventRetaliation(self)
|
|
349
|
+
self[0] = true
|
|
350
|
+
end
|
|
348
351
|
local function damageEventPreventDeath(self, callback, ...)
|
|
349
352
|
if self[0] ~= nil then
|
|
350
353
|
return
|
|
@@ -356,7 +359,14 @@ local function damageEventPreventDeath(self, callback, ...)
|
|
|
356
359
|
rawset(self, 1 + i, (select(i, ...)))
|
|
357
360
|
end
|
|
358
361
|
end
|
|
359
|
-
local damageSetters = {
|
|
362
|
+
local damageSetters = {
|
|
363
|
+
amount = BlzSetEventDamage,
|
|
364
|
+
attackType = function(attackType)
|
|
365
|
+
return BlzSetEventAttackType(attackTypeToNative(attackType))
|
|
366
|
+
end,
|
|
367
|
+
damageType = BlzSetEventDamageType,
|
|
368
|
+
weaponType = BlzSetEventWeaponType
|
|
369
|
+
}
|
|
360
370
|
local jlimitopByOperator = {
|
|
361
371
|
[0] = LESS_THAN_OR_EQUAL,
|
|
362
372
|
[1] = LESS_THAN_OR_EQUAL,
|
|
@@ -434,6 +444,19 @@ __TS__SetDescriptor(
|
|
|
434
444
|
},
|
|
435
445
|
true
|
|
436
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
|
+
)
|
|
437
460
|
__TS__SetDescriptor(
|
|
438
461
|
UnitWeapon.prototype,
|
|
439
462
|
"damageBase",
|
|
@@ -564,17 +587,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
564
587
|
____exports.Unit:of(unit)
|
|
565
588
|
)
|
|
566
589
|
end
|
|
567
|
-
if not unitAddAbility(unit, abilityId) then
|
|
568
|
-
if getUnitAbility(unit, abilityId) == ability then
|
|
569
|
-
return UnitAbility:of(
|
|
570
|
-
ability,
|
|
571
|
-
abilityId,
|
|
572
|
-
____exports.Unit:of(unit)
|
|
573
|
-
)
|
|
574
|
-
end
|
|
575
|
-
else
|
|
576
|
-
unitRemoveAbility(unit, abilityId)
|
|
577
|
-
end
|
|
578
590
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
579
591
|
local item = unitItemInSlot(unit, i)
|
|
580
592
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -632,15 +644,15 @@ for ____, player in ipairs(Player.all) do
|
|
|
632
644
|
dummies[player] = dummy
|
|
633
645
|
end
|
|
634
646
|
local function delayHealthChecksCallback(unit)
|
|
635
|
-
local counter = (unit[
|
|
647
|
+
local counter = (unit[103] or 0) - 1
|
|
636
648
|
if counter ~= 0 then
|
|
637
|
-
unit[
|
|
649
|
+
unit[103] = counter
|
|
638
650
|
return
|
|
639
651
|
end
|
|
640
|
-
unit[
|
|
641
|
-
local healthBonus = unit[
|
|
652
|
+
unit[103] = nil
|
|
653
|
+
local healthBonus = unit[104]
|
|
642
654
|
if healthBonus ~= nil then
|
|
643
|
-
unit[
|
|
655
|
+
unit[104] = nil
|
|
644
656
|
local handle = unit.handle
|
|
645
657
|
BlzSetUnitMaxHP(
|
|
646
658
|
handle,
|
|
@@ -648,12 +660,27 @@ local function delayHealthChecksCallback(unit)
|
|
|
648
660
|
)
|
|
649
661
|
end
|
|
650
662
|
end
|
|
663
|
+
local nextSyncId = 1
|
|
664
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
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
|
|
651
675
|
____exports.Unit = __TS__Class()
|
|
652
676
|
local Unit = ____exports.Unit
|
|
653
677
|
Unit.name = "Unit"
|
|
654
678
|
__TS__ClassExtends(Unit, Handle)
|
|
655
679
|
function Unit.prototype.____constructor(self, handle)
|
|
656
680
|
Handle.prototype.____constructor(self, handle)
|
|
681
|
+
local ____nextSyncId_1 = nextSyncId
|
|
682
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
683
|
+
self.syncId = ____nextSyncId_1
|
|
657
684
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
658
685
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
659
686
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -666,6 +693,7 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
666
693
|
fourCC("Amrf")
|
|
667
694
|
))
|
|
668
695
|
end
|
|
696
|
+
unitBySyncId[self.syncId] = self
|
|
669
697
|
local ____ = self.abilities
|
|
670
698
|
end
|
|
671
699
|
function Unit.prototype.getEvent(self, event, collector)
|
|
@@ -684,6 +712,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
684
712
|
end
|
|
685
713
|
function Unit.prototype.onDestroy(self)
|
|
686
714
|
local handle = self.handle
|
|
715
|
+
self[107] = getUnitX(handle)
|
|
716
|
+
self[108] = getUnitY(handle)
|
|
687
717
|
if not self._owner then
|
|
688
718
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
689
719
|
end
|
|
@@ -706,7 +736,10 @@ function Unit.prototype.onDestroy(self)
|
|
|
706
736
|
if eventsToDestroy ~= nil then
|
|
707
737
|
forEach(eventsToDestroy, "destroy")
|
|
708
738
|
end
|
|
709
|
-
|
|
739
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
|
|
740
|
+
unitRemoveAbility(handle, leaveDetectAbilityId)
|
|
741
|
+
removeUnit(handle)
|
|
742
|
+
end
|
|
710
743
|
return Handle.prototype.onDestroy(self)
|
|
711
744
|
end
|
|
712
745
|
function Unit.prototype.addAttackHandler(self, condition, action)
|
|
@@ -748,17 +781,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
748
781
|
end}
|
|
749
782
|
end
|
|
750
783
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
751
|
-
local
|
|
752
|
-
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
|
|
753
786
|
end
|
|
754
787
|
function Unit.prototype.addClassification(self, classification)
|
|
755
|
-
return
|
|
788
|
+
return UnitAddType(self.handle, classification)
|
|
756
789
|
end
|
|
757
790
|
function Unit.prototype.removeClassification(self, classification)
|
|
758
|
-
return
|
|
791
|
+
return UnitRemoveType(self.handle, classification)
|
|
759
792
|
end
|
|
760
793
|
function Unit.prototype.hasClassification(self, classification)
|
|
761
|
-
return
|
|
794
|
+
return IsUnitType(self.handle, classification)
|
|
762
795
|
end
|
|
763
796
|
function Unit.prototype.isVisibleTo(self, player)
|
|
764
797
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -767,13 +800,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
767
800
|
return isUnitInvisible(self.handle, player.handle)
|
|
768
801
|
end
|
|
769
802
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
770
|
-
local
|
|
803
|
+
local ____temp_3
|
|
771
804
|
if type(x) == "number" then
|
|
772
|
-
|
|
805
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
773
806
|
else
|
|
774
|
-
|
|
807
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
775
808
|
end
|
|
776
|
-
return
|
|
809
|
+
return ____temp_3
|
|
777
810
|
end
|
|
778
811
|
function Unit.prototype.isAllyOf(self, unit)
|
|
779
812
|
return isUnitAlly(
|
|
@@ -791,16 +824,28 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
791
824
|
if type(animation) == "number" then
|
|
792
825
|
setUnitAnimationByIndex(self.handle, animation)
|
|
793
826
|
elseif rarity then
|
|
794
|
-
|
|
827
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
795
828
|
else
|
|
796
829
|
setUnitAnimation(self.handle, animation)
|
|
797
830
|
end
|
|
798
831
|
end
|
|
832
|
+
function Unit.prototype.resetAnimation(self)
|
|
833
|
+
ResetUnitAnimation(self.handle)
|
|
834
|
+
end
|
|
799
835
|
function Unit.prototype.queueAnimation(self, animation)
|
|
800
|
-
|
|
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
|
|
801
846
|
end
|
|
802
847
|
function Unit.prototype.delayHealthChecks(self)
|
|
803
|
-
self[
|
|
848
|
+
self[103] = (self[103] or 0) + 1
|
|
804
849
|
Timer:run(delayHealthChecksCallback, self)
|
|
805
850
|
end
|
|
806
851
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -810,21 +855,21 @@ function Unit.prototype.isSelected(self, player)
|
|
|
810
855
|
return IsUnitSelected(self.handle, player.handle)
|
|
811
856
|
end
|
|
812
857
|
function Unit.prototype.explode(self)
|
|
813
|
-
|
|
858
|
+
SetUnitExploded(self.handle, true)
|
|
814
859
|
killUnit(self.handle)
|
|
815
860
|
end
|
|
816
861
|
function Unit.prototype.kill(self)
|
|
817
862
|
killUnit(self.handle)
|
|
818
863
|
end
|
|
819
864
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
820
|
-
local
|
|
821
|
-
local
|
|
822
|
-
local
|
|
823
|
-
if
|
|
824
|
-
|
|
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
|
|
825
870
|
end
|
|
826
|
-
__TS__SparseArrayPush(
|
|
827
|
-
|
|
871
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
872
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
828
873
|
end
|
|
829
874
|
function Unit.prototype.healTarget(self, target, amount)
|
|
830
875
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -864,20 +909,19 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
864
909
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
865
910
|
end
|
|
866
911
|
function Unit.prototype.itemInSlot(self, slot)
|
|
867
|
-
return Item:of(
|
|
912
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
868
913
|
end
|
|
869
914
|
function Unit.prototype.addAbility(self, abilityId)
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
915
|
+
local ability = UnitAbility:of(
|
|
916
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
917
|
+
abilityId,
|
|
918
|
+
self
|
|
919
|
+
)
|
|
920
|
+
if ability ~= nil then
|
|
876
921
|
local abilities = self.abilities
|
|
877
922
|
abilities[#abilities + 1] = ability
|
|
878
|
-
return ability
|
|
879
923
|
end
|
|
880
|
-
return
|
|
924
|
+
return ability
|
|
881
925
|
end
|
|
882
926
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
883
927
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -892,28 +936,17 @@ function Unit.prototype.hasAbility(self, abilityId)
|
|
|
892
936
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
893
937
|
end
|
|
894
938
|
function Unit.prototype.getAbilityById(self, abilityId)
|
|
895
|
-
local
|
|
896
|
-
|
|
897
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
898
|
-
return nil
|
|
899
|
-
end
|
|
900
|
-
return UnitAbility:of(
|
|
901
|
-
getUnitAbility(self.handle, abilityId),
|
|
902
|
-
abilityId,
|
|
903
|
-
self
|
|
904
|
-
)
|
|
939
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
940
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
905
941
|
end
|
|
906
942
|
function Unit.prototype.removeAbility(self, abilityId)
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
return true
|
|
914
|
-
end
|
|
943
|
+
local abilities = self.abilities
|
|
944
|
+
for i = 1, #abilities do
|
|
945
|
+
if abilities[i].typeId == abilityId then
|
|
946
|
+
abilities[i]:destroy()
|
|
947
|
+
tremove(abilities, i)
|
|
948
|
+
return true
|
|
915
949
|
end
|
|
916
|
-
return true
|
|
917
950
|
end
|
|
918
951
|
return false
|
|
919
952
|
end
|
|
@@ -929,12 +962,34 @@ end
|
|
|
929
962
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
930
963
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
931
964
|
end
|
|
965
|
+
function Unit.prototype.interruptMovement(self)
|
|
966
|
+
local handle = self.handle
|
|
967
|
+
unitDisableAbility(
|
|
968
|
+
handle,
|
|
969
|
+
fourCC("Amov"),
|
|
970
|
+
true,
|
|
971
|
+
false
|
|
972
|
+
)
|
|
973
|
+
unitDisableAbility(
|
|
974
|
+
handle,
|
|
975
|
+
fourCC("Amov"),
|
|
976
|
+
false,
|
|
977
|
+
false
|
|
978
|
+
)
|
|
979
|
+
end
|
|
932
980
|
function Unit.prototype.interruptAttack(self)
|
|
933
981
|
unitInterruptAttack(self.handle)
|
|
934
982
|
end
|
|
935
983
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
936
|
-
|
|
937
|
-
unitDisableAbility(
|
|
984
|
+
local handle = self.handle
|
|
985
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
986
|
+
Timer:run(
|
|
987
|
+
unitDisableAbility,
|
|
988
|
+
handle,
|
|
989
|
+
abilityId,
|
|
990
|
+
false,
|
|
991
|
+
false
|
|
992
|
+
)
|
|
938
993
|
end
|
|
939
994
|
function Unit.prototype.getDistanceTo(self, target)
|
|
940
995
|
local handle = self.handle
|
|
@@ -994,18 +1049,18 @@ function Unit.prototype.unpauseEx(self)
|
|
|
994
1049
|
self:decrementStunCounter()
|
|
995
1050
|
end
|
|
996
1051
|
function Unit.prototype.incrementStunCounter(self)
|
|
997
|
-
local stunCounter = self[
|
|
998
|
-
if not self[
|
|
1052
|
+
local stunCounter = self[102] or 0
|
|
1053
|
+
if not self[101] or stunCounter >= 0 then
|
|
999
1054
|
BlzPauseUnitEx(self.handle, true)
|
|
1000
1055
|
end
|
|
1001
|
-
self[
|
|
1056
|
+
self[102] = stunCounter + 1
|
|
1002
1057
|
end
|
|
1003
1058
|
function Unit.prototype.decrementStunCounter(self)
|
|
1004
|
-
local stunCounter = self[
|
|
1005
|
-
if not self[
|
|
1059
|
+
local stunCounter = self[102] or 0
|
|
1060
|
+
if not self[101] or stunCounter >= 1 then
|
|
1006
1061
|
BlzPauseUnitEx(self.handle, false)
|
|
1007
1062
|
end
|
|
1008
|
-
self[
|
|
1063
|
+
self[102] = stunCounter - 1
|
|
1009
1064
|
end
|
|
1010
1065
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1011
1066
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
@@ -1107,8 +1162,11 @@ function Unit.getInSector(self, pos, range, offsetAngle, centralAngle)
|
|
|
1107
1162
|
)
|
|
1108
1163
|
return targetCollection
|
|
1109
1164
|
end
|
|
1110
|
-
function Unit.getSelectionOf(self, player)
|
|
1111
|
-
|
|
1165
|
+
function Unit.getSelectionOf(self, player, target)
|
|
1166
|
+
if target == nil then
|
|
1167
|
+
target = {}
|
|
1168
|
+
end
|
|
1169
|
+
targetCollection = target
|
|
1112
1170
|
targetCollectionNextIndex = 1
|
|
1113
1171
|
GroupEnumUnitsSelected(dummyGroup, player.handle, collectIntoTarget)
|
|
1114
1172
|
return targetCollection
|
|
@@ -1130,6 +1188,9 @@ end
|
|
|
1130
1188
|
function Unit.prototype.__tostring(self)
|
|
1131
1189
|
return (((self.constructor.name .. "$") .. util.id2s(self.typeId)) .. "@") .. tostring(getHandleId(self.handle))
|
|
1132
1190
|
end
|
|
1191
|
+
function Unit.getBySyncId(self, syncId)
|
|
1192
|
+
return unitBySyncId[syncId]
|
|
1193
|
+
end
|
|
1133
1194
|
__TS__SetDescriptor(
|
|
1134
1195
|
Unit.prototype,
|
|
1135
1196
|
"_deltas",
|
|
@@ -1189,7 +1250,15 @@ __TS__SetDescriptor(
|
|
|
1189
1250
|
Unit.prototype,
|
|
1190
1251
|
"isIllusion",
|
|
1191
1252
|
{get = function(self)
|
|
1192
|
-
return
|
|
1253
|
+
return IsUnitIllusion(self.handle)
|
|
1254
|
+
end},
|
|
1255
|
+
true
|
|
1256
|
+
)
|
|
1257
|
+
__TS__SetDescriptor(
|
|
1258
|
+
Unit.prototype,
|
|
1259
|
+
"isStunned",
|
|
1260
|
+
{get = function(self)
|
|
1261
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1193
1262
|
end},
|
|
1194
1263
|
true
|
|
1195
1264
|
)
|
|
@@ -1266,6 +1335,19 @@ __TS__SetDescriptor(
|
|
|
1266
1335
|
},
|
|
1267
1336
|
true
|
|
1268
1337
|
)
|
|
1338
|
+
__TS__SetDescriptor(
|
|
1339
|
+
Unit.prototype,
|
|
1340
|
+
"primaryAttribute",
|
|
1341
|
+
{
|
|
1342
|
+
get = function(self)
|
|
1343
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1344
|
+
end,
|
|
1345
|
+
set = function(self, primaryAttribute)
|
|
1346
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1347
|
+
end
|
|
1348
|
+
},
|
|
1349
|
+
true
|
|
1350
|
+
)
|
|
1269
1351
|
__TS__SetDescriptor(
|
|
1270
1352
|
Unit.prototype,
|
|
1271
1353
|
"strengthBase",
|
|
@@ -1387,17 +1469,17 @@ __TS__SetDescriptor(
|
|
|
1387
1469
|
"isTeamGlowVisible",
|
|
1388
1470
|
{
|
|
1389
1471
|
get = function(self)
|
|
1390
|
-
return not self[
|
|
1472
|
+
return not self[106]
|
|
1391
1473
|
end,
|
|
1392
1474
|
set = function(self, isTeamGlowVisible)
|
|
1393
|
-
|
|
1394
|
-
local
|
|
1475
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1476
|
+
local ____temp_7
|
|
1395
1477
|
if not isTeamGlowVisible then
|
|
1396
|
-
|
|
1478
|
+
____temp_7 = true
|
|
1397
1479
|
else
|
|
1398
|
-
|
|
1480
|
+
____temp_7 = nil
|
|
1399
1481
|
end
|
|
1400
|
-
self[
|
|
1482
|
+
self[106] = ____temp_7
|
|
1401
1483
|
end
|
|
1402
1484
|
},
|
|
1403
1485
|
true
|
|
@@ -1406,9 +1488,9 @@ __TS__SetDescriptor(
|
|
|
1406
1488
|
Unit.prototype,
|
|
1407
1489
|
"color",
|
|
1408
1490
|
{set = function(self, color)
|
|
1409
|
-
|
|
1410
|
-
if self[
|
|
1411
|
-
|
|
1491
|
+
SetUnitColor(self.handle, color.handle)
|
|
1492
|
+
if self[106] then
|
|
1493
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1412
1494
|
end
|
|
1413
1495
|
end},
|
|
1414
1496
|
true
|
|
@@ -1431,14 +1513,14 @@ __TS__SetDescriptor(
|
|
|
1431
1513
|
"maxHealth",
|
|
1432
1514
|
{
|
|
1433
1515
|
get = function(self)
|
|
1434
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1516
|
+
return BlzGetUnitMaxHP(self.handle) - (self[104] or 0) - (self[105] or 0)
|
|
1435
1517
|
end,
|
|
1436
1518
|
set = function(self, maxHealth)
|
|
1437
|
-
if maxHealth < 1 and self[
|
|
1438
|
-
self[
|
|
1519
|
+
if maxHealth < 1 and self[103] ~= nil then
|
|
1520
|
+
self[104] = (self[104] or 0) + (1 - maxHealth)
|
|
1439
1521
|
maxHealth = 1
|
|
1440
1522
|
end
|
|
1441
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1523
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[105] or 0))
|
|
1442
1524
|
end
|
|
1443
1525
|
},
|
|
1444
1526
|
true
|
|
@@ -1480,10 +1562,10 @@ __TS__SetDescriptor(
|
|
|
1480
1562
|
"health",
|
|
1481
1563
|
{
|
|
1482
1564
|
get = function(self)
|
|
1483
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1565
|
+
return GetWidgetLife(self.handle) - (self[105] or 0)
|
|
1484
1566
|
end,
|
|
1485
1567
|
set = function(self, health)
|
|
1486
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1568
|
+
SetWidgetLife(self.handle, health + (self[105] or 0))
|
|
1487
1569
|
end
|
|
1488
1570
|
},
|
|
1489
1571
|
true
|
|
@@ -1577,7 +1659,7 @@ __TS__SetDescriptor(
|
|
|
1577
1659
|
"x",
|
|
1578
1660
|
{
|
|
1579
1661
|
get = function(self)
|
|
1580
|
-
return getUnitX(self.handle)
|
|
1662
|
+
return self[107] or getUnitX(self.handle)
|
|
1581
1663
|
end,
|
|
1582
1664
|
set = function(self, v)
|
|
1583
1665
|
SetUnitX(self.handle, v)
|
|
@@ -1590,7 +1672,7 @@ __TS__SetDescriptor(
|
|
|
1590
1672
|
"y",
|
|
1591
1673
|
{
|
|
1592
1674
|
get = function(self)
|
|
1593
|
-
return getUnitY(self.handle)
|
|
1675
|
+
return self[108] or getUnitY(self.handle)
|
|
1594
1676
|
end,
|
|
1595
1677
|
set = function(self, v)
|
|
1596
1678
|
SetUnitY(self.handle, v)
|
|
@@ -1676,10 +1758,10 @@ __TS__SetDescriptor(
|
|
|
1676
1758
|
"gold",
|
|
1677
1759
|
{
|
|
1678
1760
|
get = function(self)
|
|
1679
|
-
return
|
|
1761
|
+
return GetResourceAmount(self.handle)
|
|
1680
1762
|
end,
|
|
1681
1763
|
set = function(self, gold)
|
|
1682
|
-
|
|
1764
|
+
SetResourceAmount(self.handle, gold)
|
|
1683
1765
|
end
|
|
1684
1766
|
},
|
|
1685
1767
|
true
|
|
@@ -1694,17 +1776,17 @@ __TS__SetDescriptor(
|
|
|
1694
1776
|
set = function(self, isPaused)
|
|
1695
1777
|
local handle = self.handle
|
|
1696
1778
|
if isPaused and not IsUnitPaused(handle) then
|
|
1697
|
-
self[
|
|
1698
|
-
for _ = self[
|
|
1779
|
+
self[101] = true
|
|
1780
|
+
for _ = self[102] or 0, -1 do
|
|
1699
1781
|
BlzPauseUnitEx(handle, true)
|
|
1700
1782
|
end
|
|
1701
1783
|
PauseUnit(handle, true)
|
|
1702
1784
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1703
1785
|
PauseUnit(handle, false)
|
|
1704
|
-
for _ = self[
|
|
1786
|
+
for _ = self[102] or 0, -1 do
|
|
1705
1787
|
BlzPauseUnitEx(handle, false)
|
|
1706
1788
|
end
|
|
1707
|
-
self[
|
|
1789
|
+
self[101] = nil
|
|
1708
1790
|
end
|
|
1709
1791
|
end
|
|
1710
1792
|
},
|
|
@@ -1807,6 +1889,19 @@ __TS__SetDescriptor(
|
|
|
1807
1889
|
end},
|
|
1808
1890
|
true
|
|
1809
1891
|
)
|
|
1892
|
+
__TS__SetDescriptor(
|
|
1893
|
+
Unit.prototype,
|
|
1894
|
+
"movementType",
|
|
1895
|
+
{
|
|
1896
|
+
get = function(self)
|
|
1897
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1898
|
+
end,
|
|
1899
|
+
set = function(self, movementType)
|
|
1900
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1901
|
+
end
|
|
1902
|
+
},
|
|
1903
|
+
true
|
|
1904
|
+
)
|
|
1810
1905
|
__TS__SetDescriptor(
|
|
1811
1906
|
Unit.prototype,
|
|
1812
1907
|
"pathing",
|
|
@@ -1988,6 +2083,14 @@ __TS__SetDescriptor(
|
|
|
1988
2083
|
end},
|
|
1989
2084
|
true
|
|
1990
2085
|
)
|
|
2086
|
+
__TS__SetDescriptor(
|
|
2087
|
+
Unit.prototype,
|
|
2088
|
+
"targetAcquiredEvent",
|
|
2089
|
+
{get = function(self)
|
|
2090
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2091
|
+
end},
|
|
2092
|
+
true
|
|
2093
|
+
)
|
|
1991
2094
|
__TS__SetDescriptor(
|
|
1992
2095
|
Unit.prototype,
|
|
1993
2096
|
"onSelect",
|
|
@@ -2061,7 +2164,6 @@ Unit.onDecay = __TS__New(
|
|
|
2061
2164
|
Unit.onResurrect = __TS__New(
|
|
2062
2165
|
InitializingEvent,
|
|
2063
2166
|
function(event)
|
|
2064
|
-
local invoke = Event.invoke
|
|
2065
2167
|
local dead = setmetatable({}, {__mode = "k"})
|
|
2066
2168
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
2067
2169
|
dead[unit] = true
|
|
@@ -2077,10 +2179,15 @@ Unit.onResurrect = __TS__New(
|
|
|
2077
2179
|
Unit.morphEvent = __TS__New(
|
|
2078
2180
|
InitializingEvent,
|
|
2079
2181
|
function(event)
|
|
2182
|
+
local function ifNotLeft(unit)
|
|
2183
|
+
local handle = unit.handle
|
|
2184
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
|
|
2185
|
+
invoke(event, unit)
|
|
2186
|
+
end
|
|
2187
|
+
end
|
|
2080
2188
|
____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
|
|
2081
2189
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
2082
|
-
|
|
2083
|
-
Timer:run(Event.invoke, event, unit)
|
|
2190
|
+
Timer:run(ifNotLeft, unit)
|
|
2084
2191
|
end
|
|
2085
2192
|
end)
|
|
2086
2193
|
end
|
|
@@ -2118,27 +2225,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
|
|
|
2118
2225
|
Unit.onTargetCast = dispatchId(__TS__New(
|
|
2119
2226
|
InitializingEvent,
|
|
2120
2227
|
function(event)
|
|
2121
|
-
local invoke = Event.invoke
|
|
2122
2228
|
local function listener(unit, id)
|
|
2123
|
-
local
|
|
2229
|
+
local ____GetSpellTargetUnit_result_10
|
|
2124
2230
|
if GetSpellTargetUnit() then
|
|
2125
|
-
|
|
2231
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2126
2232
|
else
|
|
2127
|
-
local
|
|
2233
|
+
local ____GetSpellTargetItem_result_9
|
|
2128
2234
|
if GetSpellTargetItem() then
|
|
2129
|
-
|
|
2235
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2130
2236
|
else
|
|
2131
|
-
local
|
|
2237
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2132
2238
|
if GetSpellTargetDestructable() then
|
|
2133
|
-
|
|
2239
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2134
2240
|
else
|
|
2135
|
-
|
|
2241
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2136
2242
|
end
|
|
2137
|
-
|
|
2243
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2138
2244
|
end
|
|
2139
|
-
|
|
2245
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2140
2246
|
end
|
|
2141
|
-
local target =
|
|
2247
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2142
2248
|
if target then
|
|
2143
2249
|
invoke(event, unit, id, target)
|
|
2144
2250
|
end
|
|
@@ -2310,10 +2416,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2310
2416
|
____exports.UnitTriggerEvent,
|
|
2311
2417
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2312
2418
|
function()
|
|
2313
|
-
local
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2419
|
+
local handle = getOrderedUnit()
|
|
2420
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2421
|
+
local unit = ____exports.Unit:of(handle)
|
|
2422
|
+
if unit.state == 1 then
|
|
2423
|
+
return unit, getIssuedOrderId()
|
|
2424
|
+
end
|
|
2317
2425
|
end
|
|
2318
2426
|
return IgnoreEvent
|
|
2319
2427
|
end
|
|
@@ -2335,7 +2443,6 @@ Unit.autoAttackStartEvent = __TS__New(
|
|
|
2335
2443
|
)
|
|
2336
2444
|
Unit.onDamaging = (function()
|
|
2337
2445
|
local event = __TS__New(Event)
|
|
2338
|
-
local invoke = Event.invoke
|
|
2339
2446
|
local trigger = CreateTrigger()
|
|
2340
2447
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
|
|
2341
2448
|
TriggerAddCondition(
|
|
@@ -2345,13 +2452,19 @@ Unit.onDamaging = (function()
|
|
|
2345
2452
|
if source and source.typeId == dummyUnitId then
|
|
2346
2453
|
source = nil
|
|
2347
2454
|
end
|
|
2348
|
-
local target = BlzGetEventDamageTarget()
|
|
2455
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2456
|
+
local metadata = damageMetadataByTarget[target]
|
|
2457
|
+
damageMetadataByTarget[target] = nil
|
|
2349
2458
|
local data = {
|
|
2350
2459
|
amount = GetEventDamage(),
|
|
2351
|
-
attackType = BlzGetEventAttackType(),
|
|
2460
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2352
2461
|
damageType = BlzGetEventDamageType(),
|
|
2353
2462
|
weaponType = BlzGetEventWeaponType(),
|
|
2354
|
-
|
|
2463
|
+
metadata = metadata,
|
|
2464
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2465
|
+
originalAmount = GetEventDamage(),
|
|
2466
|
+
originalMetadata = metadata,
|
|
2467
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2355
2468
|
}
|
|
2356
2469
|
if data.isAttack and source then
|
|
2357
2470
|
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
|
|
@@ -2365,18 +2478,36 @@ Unit.onDamaging = (function()
|
|
|
2365
2478
|
invoke(
|
|
2366
2479
|
event,
|
|
2367
2480
|
source,
|
|
2368
|
-
|
|
2481
|
+
target,
|
|
2369
2482
|
setmetatable(
|
|
2370
2483
|
{},
|
|
2371
2484
|
{
|
|
2372
2485
|
__index = data,
|
|
2373
2486
|
__newindex = function(self, key, value)
|
|
2374
|
-
damageSetters[key]
|
|
2487
|
+
local damageSetter = damageSetters[key]
|
|
2488
|
+
if damageSetter ~= nil then
|
|
2489
|
+
damageSetter(value)
|
|
2490
|
+
end
|
|
2375
2491
|
data[key] = value
|
|
2376
2492
|
end
|
|
2377
2493
|
}
|
|
2378
2494
|
)
|
|
2379
2495
|
)
|
|
2496
|
+
if data[0] and source then
|
|
2497
|
+
local sourceOwner = source.owner.handle
|
|
2498
|
+
data[1] = sourceOwner
|
|
2499
|
+
local targetOwner = target.owner.handle
|
|
2500
|
+
data[2] = targetOwner
|
|
2501
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2502
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2503
|
+
data[3] = true
|
|
2504
|
+
end
|
|
2505
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2506
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2507
|
+
data[4] = true
|
|
2508
|
+
end
|
|
2509
|
+
end
|
|
2510
|
+
damagingEventByTarget[target] = data
|
|
2380
2511
|
return
|
|
2381
2512
|
end
|
|
2382
2513
|
BlzSetEventDamage(0)
|
|
@@ -2384,7 +2515,7 @@ Unit.onDamaging = (function()
|
|
|
2384
2515
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2385
2516
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2386
2517
|
local sourceOwner = source.owner.handle
|
|
2387
|
-
local targetOwner =
|
|
2518
|
+
local targetOwner = target.owner.handle
|
|
2388
2519
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2389
2520
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2390
2521
|
Timer:run(function()
|
|
@@ -2400,23 +2531,19 @@ Unit.onDamaging = (function()
|
|
|
2400
2531
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2401
2532
|
local condition = ____value[1]
|
|
2402
2533
|
local action = ____value[2]
|
|
2403
|
-
if condition(
|
|
2404
|
-
source,
|
|
2405
|
-
____exports.Unit:of(target),
|
|
2406
|
-
data
|
|
2407
|
-
) then
|
|
2534
|
+
if condition(source, target, data) then
|
|
2408
2535
|
action(
|
|
2409
2536
|
source,
|
|
2410
|
-
|
|
2537
|
+
target,
|
|
2411
2538
|
setmetatable(
|
|
2412
2539
|
{fire = function()
|
|
2413
2540
|
UnitDamageTarget(
|
|
2414
2541
|
source.handle,
|
|
2415
|
-
target,
|
|
2542
|
+
target.handle,
|
|
2416
2543
|
data.amount,
|
|
2417
2544
|
true,
|
|
2418
2545
|
true,
|
|
2419
|
-
data.attackType,
|
|
2546
|
+
attackTypeToNative(data.attackType),
|
|
2420
2547
|
data.damageType,
|
|
2421
2548
|
data.weaponType
|
|
2422
2549
|
)
|
|
@@ -2434,7 +2561,6 @@ end)()
|
|
|
2434
2561
|
Unit.onDamage = __TS__New(
|
|
2435
2562
|
InitializingEvent,
|
|
2436
2563
|
function(event)
|
|
2437
|
-
local invoke = Event.invoke
|
|
2438
2564
|
local trigger = CreateTrigger()
|
|
2439
2565
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
|
|
2440
2566
|
TriggerAddCondition(
|
|
@@ -2444,29 +2570,54 @@ Unit.onDamage = __TS__New(
|
|
|
2444
2570
|
if source and source.typeId == dummyUnitId then
|
|
2445
2571
|
source = nil
|
|
2446
2572
|
end
|
|
2573
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2574
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2575
|
+
damagingEventByTarget[target] = nil
|
|
2447
2576
|
local data = {
|
|
2448
2577
|
amount = GetEventDamage(),
|
|
2449
|
-
attackType = BlzGetEventAttackType(),
|
|
2578
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2450
2579
|
damageType = BlzGetEventDamageType(),
|
|
2451
2580
|
weaponType = BlzGetEventWeaponType(),
|
|
2581
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2452
2582
|
isAttack = BlzGetEventIsAttack(),
|
|
2583
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2584
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2453
2585
|
preventDeath = damageEventPreventDeath
|
|
2454
2586
|
}
|
|
2587
|
+
if damagingEvent then
|
|
2588
|
+
for key, value in pairs(damagingEvent) do
|
|
2589
|
+
if isAttribute(key) then
|
|
2590
|
+
data[key] = value
|
|
2591
|
+
end
|
|
2592
|
+
end
|
|
2593
|
+
local sourceOwner = damagingEvent[1]
|
|
2594
|
+
if sourceOwner then
|
|
2595
|
+
local targetOwner = damagingEvent[2]
|
|
2596
|
+
if damagingEvent[3] then
|
|
2597
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2598
|
+
end
|
|
2599
|
+
if damagingEvent[4] then
|
|
2600
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2601
|
+
end
|
|
2602
|
+
end
|
|
2603
|
+
end
|
|
2455
2604
|
local evData = setmetatable(
|
|
2456
2605
|
{},
|
|
2457
2606
|
{
|
|
2458
2607
|
__index = data,
|
|
2459
2608
|
__newindex = function(self, key, value)
|
|
2460
|
-
damageSetters[key]
|
|
2609
|
+
local damageSetter = damageSetters[key]
|
|
2610
|
+
if damageSetter ~= nil then
|
|
2611
|
+
damageSetter(value)
|
|
2612
|
+
end
|
|
2461
2613
|
data[key] = value
|
|
2462
2614
|
end
|
|
2463
2615
|
}
|
|
2464
2616
|
)
|
|
2465
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2466
2617
|
invoke(event, source, target, evData)
|
|
2467
2618
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2468
2619
|
local bonusHealth = math.ceil(evData.amount)
|
|
2469
|
-
target[
|
|
2620
|
+
target[105] = (target[105] or 0) + bonusHealth
|
|
2470
2621
|
BlzSetUnitMaxHP(
|
|
2471
2622
|
target.handle,
|
|
2472
2623
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2480,7 +2631,7 @@ Unit.onDamage = __TS__New(
|
|
|
2480
2631
|
evData[0],
|
|
2481
2632
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2482
2633
|
)
|
|
2483
|
-
target[
|
|
2634
|
+
target[105] = (target[105] or 0) - bonusHealth
|
|
2484
2635
|
SetWidgetLife(
|
|
2485
2636
|
target.handle,
|
|
2486
2637
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2500,32 +2651,110 @@ Unit.onDamage = __TS__New(
|
|
|
2500
2651
|
DestroyTrigger(trigger)
|
|
2501
2652
|
end
|
|
2502
2653
|
)
|
|
2503
|
-
Unit.
|
|
2654
|
+
Unit.itemDroppedEvent = __TS__New(
|
|
2504
2655
|
____exports.UnitTriggerEvent,
|
|
2505
2656
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2506
2657
|
function()
|
|
2507
2658
|
local unit = getTriggerUnit()
|
|
2508
|
-
|
|
2509
|
-
|
|
2659
|
+
local item = getManipulatedItem()
|
|
2660
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2661
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2510
2662
|
end
|
|
2511
2663
|
return IgnoreEvent
|
|
2512
2664
|
end
|
|
2513
2665
|
)
|
|
2514
|
-
Unit.
|
|
2666
|
+
Unit.itemPickedUpEvent = __TS__New(
|
|
2515
2667
|
____exports.UnitTriggerEvent,
|
|
2516
2668
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2517
2669
|
function()
|
|
2518
|
-
local
|
|
2519
|
-
|
|
2520
|
-
|
|
2670
|
+
local unitHandle = getTriggerUnit()
|
|
2671
|
+
local itemHandle = getManipulatedItem()
|
|
2672
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
|
|
2673
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2674
|
+
local item = Item:of(itemHandle)
|
|
2675
|
+
if item.owner ~= unit then
|
|
2676
|
+
return unit, item
|
|
2677
|
+
end
|
|
2521
2678
|
end
|
|
2522
2679
|
return IgnoreEvent
|
|
2523
2680
|
end
|
|
2524
2681
|
)
|
|
2525
|
-
Unit.
|
|
2682
|
+
Unit.itemUsedEvent = __TS__New(
|
|
2526
2683
|
____exports.UnitTriggerEvent,
|
|
2527
2684
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2528
|
-
function()
|
|
2685
|
+
function()
|
|
2686
|
+
local unit = getTriggerUnit()
|
|
2687
|
+
local item = getManipulatedItem()
|
|
2688
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2689
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2690
|
+
end
|
|
2691
|
+
return IgnoreEvent
|
|
2692
|
+
end
|
|
2693
|
+
)
|
|
2694
|
+
Unit.itemStackedEvent = __TS__New(
|
|
2695
|
+
____exports.UnitTriggerEvent,
|
|
2696
|
+
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2697
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2698
|
+
)
|
|
2699
|
+
__TS__ObjectDefineProperty(
|
|
2700
|
+
Unit,
|
|
2701
|
+
"itemChargesChangedEvent",
|
|
2702
|
+
{get = function(self)
|
|
2703
|
+
local event = __TS__New(Event)
|
|
2704
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2705
|
+
local unit = item.owner
|
|
2706
|
+
if unit ~= nil then
|
|
2707
|
+
invoke(event, unit, item)
|
|
2708
|
+
end
|
|
2709
|
+
end)
|
|
2710
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2711
|
+
return event
|
|
2712
|
+
end}
|
|
2713
|
+
)
|
|
2714
|
+
__TS__ObjectDefineProperty(
|
|
2715
|
+
Unit,
|
|
2716
|
+
"itemUseOrderEvent",
|
|
2717
|
+
{get = function(self)
|
|
2718
|
+
local event = __TS__New(Event)
|
|
2719
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2720
|
+
local slot = order - orderId("useslot0")
|
|
2721
|
+
local function listener(unit)
|
|
2722
|
+
local item = unit.items[slot + 1]
|
|
2723
|
+
if item ~= nil then
|
|
2724
|
+
invoke(event, unit, item)
|
|
2725
|
+
end
|
|
2726
|
+
end
|
|
2727
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2728
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2729
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2730
|
+
end
|
|
2731
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2732
|
+
return event
|
|
2733
|
+
end}
|
|
2734
|
+
)
|
|
2735
|
+
__TS__ObjectDefineProperty(
|
|
2736
|
+
Unit,
|
|
2737
|
+
"itemMoveOrderEvent",
|
|
2738
|
+
{get = function(self)
|
|
2739
|
+
local event = __TS__New(Event)
|
|
2740
|
+
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2741
|
+
local slotTo = order - orderId("moveslot0")
|
|
2742
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2743
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2744
|
+
if slotFrom ~= nil then
|
|
2745
|
+
invoke(
|
|
2746
|
+
event,
|
|
2747
|
+
unit,
|
|
2748
|
+
item,
|
|
2749
|
+
slotFrom,
|
|
2750
|
+
slotTo
|
|
2751
|
+
)
|
|
2752
|
+
end
|
|
2753
|
+
end)
|
|
2754
|
+
end
|
|
2755
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2756
|
+
return event
|
|
2757
|
+
end}
|
|
2529
2758
|
)
|
|
2530
2759
|
__TS__ObjectDefineProperty(
|
|
2531
2760
|
Unit,
|
|
@@ -2575,15 +2804,13 @@ __TS__ObjectDefineProperty(
|
|
|
2575
2804
|
orderId("unimmolation")
|
|
2576
2805
|
}) do
|
|
2577
2806
|
____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
return
|
|
2583
|
-
end
|
|
2807
|
+
local handle = unit.handle
|
|
2808
|
+
for i = 1, #leaveAbilityIds do
|
|
2809
|
+
if getUnitAbilityLevel(handle, leaveAbilityIds[i]) ~= 0 then
|
|
2810
|
+
return
|
|
2584
2811
|
end
|
|
2585
|
-
unit:destroy()
|
|
2586
2812
|
end
|
|
2813
|
+
unit:destroy()
|
|
2587
2814
|
end)
|
|
2588
2815
|
end
|
|
2589
2816
|
end)(Unit)
|