warscript 0.0.1-dev.ccd5725 → 0.0.1-dev.d18f377
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +0 -1
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/effect.d.ts +12 -3
- package/core/types/effect.lua +56 -7
- package/core/types/frame.d.ts +8 -1
- package/core/types/frame.lua +93 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +6 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/apply-buff.d.ts +3 -5
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +29 -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 -15
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +18 -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 +14 -3
- package/engine/behaviour/ability.lua +75 -12
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +8 -2
- package/engine/behaviour/unit.lua +27 -0
- package/engine/buff.d.ts +68 -21
- package/engine/buff.lua +276 -90
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +5 -12
- package/engine/internal/ability.lua +13 -74
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/bonus.d.ts +9 -8
- package/engine/internal/unit/bonus.lua +6 -1
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +84 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +25 -6
- package/engine/internal/unit.d.ts +57 -16
- package/engine/internal/unit.lua +313 -122
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +12 -1
- package/engine/object-data/entry/item-type.lua +78 -0
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +25 -2
- package/engine/object-data/entry/unit-type.lua +255 -49
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-field/ability.d.ts +19 -2
- package/engine/object-field/ability.lua +51 -1
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +39 -1
- package/engine/standard/entries/unit-type.lua +39 -1
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +11 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +1 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -14
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +11 -5
- package/utility/arrays.lua +34 -3
- package/utility/bit-set.d.ts +0 -2
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +11 -3
- package/utility/linked-set.lua +5 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/internal/unit.lua
CHANGED
|
@@ -5,9 +5,12 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
5
5
|
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local __TS__Class = ____lualib.__TS__Class
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
8
9
|
local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
|
|
10
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
11
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
12
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
13
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
10
|
-
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
11
14
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
12
15
|
local Set = ____lualib.Set
|
|
13
16
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
@@ -92,6 +95,10 @@ local isUnitInRangeXY = IsUnitInRangeXY
|
|
|
92
95
|
local isUnitInRange = IsUnitInRange
|
|
93
96
|
local setResourceAmount = SetResourceAmount
|
|
94
97
|
local getResourceAmount = GetResourceAmount
|
|
98
|
+
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
99
|
+
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
100
|
+
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
101
|
+
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
95
102
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
96
103
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
97
104
|
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
@@ -275,16 +282,14 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
|
|
|
275
282
|
end
|
|
276
283
|
local function dispatch(event, idGetter, argsGetter)
|
|
277
284
|
local initialized = false
|
|
278
|
-
local x = {}
|
|
279
285
|
return setmetatable(
|
|
280
|
-
|
|
286
|
+
{},
|
|
281
287
|
{
|
|
282
288
|
__index = function(self, id)
|
|
283
289
|
if type(id) ~= "number" then
|
|
284
290
|
return event[id]
|
|
285
291
|
end
|
|
286
292
|
if not initialized then
|
|
287
|
-
local invoke = Event.invoke
|
|
288
293
|
event:addListener(function(...)
|
|
289
294
|
local id = idGetter(...)
|
|
290
295
|
local dispatched = rawget(self, id)
|
|
@@ -322,7 +327,6 @@ local function dispatchAbility(event)
|
|
|
322
327
|
return event[id]
|
|
323
328
|
end
|
|
324
329
|
if not initialized then
|
|
325
|
-
local invoke = Event.invoke
|
|
326
330
|
event:addListener(function(unit, ability, ...)
|
|
327
331
|
local dispatched = rawget(self, ability.typeId)
|
|
328
332
|
if dispatched ~= nil then
|
|
@@ -387,51 +391,158 @@ local getters = {
|
|
|
387
391
|
return BlzGetUnitArmor(unit)
|
|
388
392
|
end
|
|
389
393
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
394
|
+
____exports.UnitWeapon = __TS__Class()
|
|
395
|
+
local UnitWeapon = ____exports.UnitWeapon
|
|
396
|
+
UnitWeapon.name = "UnitWeapon"
|
|
397
|
+
function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
398
|
+
self.unit = unit
|
|
399
|
+
self.index = index
|
|
400
|
+
end
|
|
401
|
+
__TS__SetDescriptor(
|
|
402
|
+
UnitWeapon.prototype,
|
|
403
|
+
"cooldown",
|
|
404
|
+
{
|
|
405
|
+
get = function(self)
|
|
406
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index)
|
|
407
|
+
end,
|
|
408
|
+
set = function(self, cooldown)
|
|
409
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index, cooldown)
|
|
410
|
+
end
|
|
411
|
+
},
|
|
412
|
+
true
|
|
413
|
+
)
|
|
414
|
+
__TS__SetDescriptor(
|
|
415
|
+
UnitWeapon.prototype,
|
|
416
|
+
"damage",
|
|
417
|
+
{
|
|
418
|
+
get = function(self)
|
|
419
|
+
local minimumDamage = self.damageBase + self.damageDiceCount
|
|
420
|
+
local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
|
|
421
|
+
return {minimumDamage, maximumDamage}
|
|
422
|
+
end,
|
|
423
|
+
set = function(self, ____bindingPattern0)
|
|
424
|
+
local maximumDamage
|
|
425
|
+
local minimumDamage
|
|
426
|
+
minimumDamage = ____bindingPattern0[1]
|
|
427
|
+
maximumDamage = ____bindingPattern0[2]
|
|
428
|
+
self.damageBase = minimumDamage - 1
|
|
429
|
+
self.damageDiceCount = 1
|
|
430
|
+
self.damageDiceSideCount = maximumDamage - minimumDamage + 1
|
|
431
|
+
end
|
|
432
|
+
},
|
|
433
|
+
true
|
|
434
|
+
)
|
|
435
|
+
__TS__SetDescriptor(
|
|
436
|
+
UnitWeapon.prototype,
|
|
437
|
+
"damageBase",
|
|
438
|
+
{
|
|
439
|
+
get = function(self)
|
|
440
|
+
return BlzGetUnitBaseDamage(self.unit.handle, self.index)
|
|
441
|
+
end,
|
|
442
|
+
set = function(self, damageBase)
|
|
443
|
+
BlzSetUnitBaseDamage(self.unit.handle, self.index, damageBase)
|
|
444
|
+
end
|
|
445
|
+
},
|
|
446
|
+
true
|
|
447
|
+
)
|
|
448
|
+
__TS__SetDescriptor(
|
|
449
|
+
UnitWeapon.prototype,
|
|
450
|
+
"damageDiceCount",
|
|
451
|
+
{
|
|
452
|
+
get = function(self)
|
|
453
|
+
return BlzGetUnitDiceNumber(self.unit.handle, self.index)
|
|
454
|
+
end,
|
|
455
|
+
set = function(self, damageDiceCount)
|
|
456
|
+
BlzSetUnitDiceNumber(self.unit.handle, self.index, damageDiceCount)
|
|
457
|
+
end
|
|
458
|
+
},
|
|
459
|
+
true
|
|
460
|
+
)
|
|
461
|
+
__TS__SetDescriptor(
|
|
462
|
+
UnitWeapon.prototype,
|
|
463
|
+
"damageDiceSideCount",
|
|
464
|
+
{
|
|
465
|
+
get = function(self)
|
|
466
|
+
return BlzGetUnitDiceSides(self.unit.handle, self.index)
|
|
467
|
+
end,
|
|
468
|
+
set = function(self, damageDiceSideCount)
|
|
469
|
+
BlzSetUnitDiceSides(self.unit.handle, self.index, damageDiceSideCount)
|
|
470
|
+
end
|
|
471
|
+
},
|
|
472
|
+
true
|
|
473
|
+
)
|
|
474
|
+
__TS__SetDescriptor(
|
|
475
|
+
UnitWeapon.prototype,
|
|
476
|
+
"range",
|
|
477
|
+
{
|
|
478
|
+
get = function(self)
|
|
479
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_RANGE, self.index)
|
|
480
|
+
end,
|
|
481
|
+
set = function(self, range)
|
|
482
|
+
local handle = self.unit.handle
|
|
483
|
+
local index = self.index
|
|
484
|
+
setUnitWeaponRealField(
|
|
485
|
+
handle,
|
|
486
|
+
UNIT_WEAPON_RF_ATTACK_RANGE,
|
|
487
|
+
index + 1,
|
|
488
|
+
getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1) + (range - getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index))
|
|
489
|
+
)
|
|
490
|
+
end
|
|
491
|
+
},
|
|
492
|
+
true
|
|
493
|
+
)
|
|
494
|
+
__TS__SetDescriptor(
|
|
495
|
+
UnitWeapon.prototype,
|
|
496
|
+
"impactDelay",
|
|
497
|
+
{
|
|
498
|
+
get = function(self)
|
|
499
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index)
|
|
500
|
+
end,
|
|
501
|
+
set = function(self, impactDelay)
|
|
502
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index, impactDelay)
|
|
503
|
+
end
|
|
504
|
+
},
|
|
505
|
+
true
|
|
506
|
+
)
|
|
507
|
+
__TS__SetDescriptor(
|
|
508
|
+
UnitWeapon.prototype,
|
|
509
|
+
"missileArc",
|
|
510
|
+
{
|
|
511
|
+
get = function(self)
|
|
512
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index)
|
|
513
|
+
end,
|
|
514
|
+
set = function(self, missileArc)
|
|
515
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index, missileArc)
|
|
516
|
+
end
|
|
517
|
+
},
|
|
518
|
+
true
|
|
519
|
+
)
|
|
520
|
+
__TS__SetDescriptor(
|
|
521
|
+
UnitWeapon.prototype,
|
|
522
|
+
"missileModelPath",
|
|
523
|
+
{
|
|
524
|
+
get = function(self)
|
|
525
|
+
return getUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index)
|
|
526
|
+
end,
|
|
527
|
+
set = function(self, missileModelPath)
|
|
528
|
+
setUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index, missileModelPath)
|
|
529
|
+
end
|
|
530
|
+
},
|
|
531
|
+
true
|
|
532
|
+
)
|
|
533
|
+
__TS__SetDescriptor(
|
|
534
|
+
UnitWeapon.prototype,
|
|
535
|
+
"missileSpeed",
|
|
536
|
+
{
|
|
537
|
+
get = function(self)
|
|
538
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index)
|
|
539
|
+
end,
|
|
540
|
+
set = function(self, missileSpeed)
|
|
541
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index, missileSpeed)
|
|
542
|
+
end
|
|
543
|
+
},
|
|
544
|
+
true
|
|
545
|
+
)
|
|
435
546
|
local unitInventorySize = UnitInventorySize
|
|
436
547
|
local unitItemInSlot = UnitItemInSlot
|
|
437
548
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -442,8 +553,6 @@ local getAbilityName = GetAbilityName
|
|
|
442
553
|
local unitAddAbility = UnitAddAbility
|
|
443
554
|
local getUnitGoldCost = GetUnitGoldCost
|
|
444
555
|
local getUnitLumberCost = GetUnitWoodCost
|
|
445
|
-
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
446
|
-
local unitAddItem = UnitAddItem
|
|
447
556
|
local unitRemoveAbility = UnitRemoveAbility
|
|
448
557
|
local function retrieveAbility(unit, ability, abilityId)
|
|
449
558
|
if ability == nil then
|
|
@@ -453,17 +562,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
453
562
|
____exports.Unit:of(unit)
|
|
454
563
|
)
|
|
455
564
|
end
|
|
456
|
-
if not unitAddAbility(unit, abilityId) then
|
|
457
|
-
if getUnitAbility(unit, abilityId) == ability then
|
|
458
|
-
return UnitAbility:of(
|
|
459
|
-
ability,
|
|
460
|
-
abilityId,
|
|
461
|
-
____exports.Unit:of(unit)
|
|
462
|
-
)
|
|
463
|
-
end
|
|
464
|
-
else
|
|
465
|
-
unitRemoveAbility(unit, abilityId)
|
|
466
|
-
end
|
|
467
565
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
468
566
|
local item = unitItemInSlot(unit, i)
|
|
469
567
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -520,12 +618,34 @@ for ____, player in ipairs(Player.all) do
|
|
|
520
618
|
ShowUnit(dummy, false)
|
|
521
619
|
dummies[player] = dummy
|
|
522
620
|
end
|
|
621
|
+
local function delayHealthChecksCallback(unit)
|
|
622
|
+
local counter = (unit[103] or 0) - 1
|
|
623
|
+
if counter ~= 0 then
|
|
624
|
+
unit[103] = counter
|
|
625
|
+
return
|
|
626
|
+
end
|
|
627
|
+
unit[103] = nil
|
|
628
|
+
local healthBonus = unit[104]
|
|
629
|
+
if healthBonus ~= nil then
|
|
630
|
+
unit[104] = nil
|
|
631
|
+
local handle = unit.handle
|
|
632
|
+
BlzSetUnitMaxHP(
|
|
633
|
+
handle,
|
|
634
|
+
BlzGetUnitMaxHP(handle) - healthBonus
|
|
635
|
+
)
|
|
636
|
+
end
|
|
637
|
+
end
|
|
638
|
+
local nextSyncId = 1
|
|
639
|
+
local unitBySyncId = setmetatable({}, {__mode = "k"})
|
|
523
640
|
____exports.Unit = __TS__Class()
|
|
524
641
|
local Unit = ____exports.Unit
|
|
525
642
|
Unit.name = "Unit"
|
|
526
643
|
__TS__ClassExtends(Unit, Handle)
|
|
527
644
|
function Unit.prototype.____constructor(self, handle)
|
|
528
645
|
Handle.prototype.____constructor(self, handle)
|
|
646
|
+
local ____nextSyncId_0 = nextSyncId
|
|
647
|
+
nextSyncId = ____nextSyncId_0 + 1
|
|
648
|
+
self.syncId = ____nextSyncId_0
|
|
529
649
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
530
650
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
531
651
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -538,6 +658,7 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
538
658
|
fourCC("Amrf")
|
|
539
659
|
))
|
|
540
660
|
end
|
|
661
|
+
unitBySyncId[self.syncId] = self
|
|
541
662
|
local ____ = self.abilities
|
|
542
663
|
end
|
|
543
664
|
function Unit.prototype.getEvent(self, event, collector)
|
|
@@ -623,8 +744,8 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
623
744
|
end}
|
|
624
745
|
end
|
|
625
746
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
626
|
-
local
|
|
627
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
747
|
+
local ____combatClassification_1 = combatClassification
|
|
748
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_1 == ____combatClassification_1
|
|
628
749
|
end
|
|
629
750
|
function Unit.prototype.addClassification(self, classification)
|
|
630
751
|
return unitAddType(self.handle, classification)
|
|
@@ -642,13 +763,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
642
763
|
return isUnitInvisible(self.handle, player.handle)
|
|
643
764
|
end
|
|
644
765
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
645
|
-
local
|
|
766
|
+
local ____temp_2
|
|
646
767
|
if type(x) == "number" then
|
|
647
|
-
|
|
768
|
+
____temp_2 = isUnitInRangeXY(self.handle, x, y, range)
|
|
648
769
|
else
|
|
649
|
-
|
|
770
|
+
____temp_2 = isUnitInRange(self.handle, x.handle, y)
|
|
650
771
|
end
|
|
651
|
-
return
|
|
772
|
+
return ____temp_2
|
|
652
773
|
end
|
|
653
774
|
function Unit.prototype.isAllyOf(self, unit)
|
|
654
775
|
return isUnitAlly(
|
|
@@ -674,6 +795,10 @@ end
|
|
|
674
795
|
function Unit.prototype.queueAnimation(self, animation)
|
|
675
796
|
queueUnitAnimation(self.handle, animation)
|
|
676
797
|
end
|
|
798
|
+
function Unit.prototype.delayHealthChecks(self)
|
|
799
|
+
self[103] = (self[103] or 0) + 1
|
|
800
|
+
Timer:run(delayHealthChecksCallback, self)
|
|
801
|
+
end
|
|
677
802
|
function Unit.prototype.setPosition(self, x, y)
|
|
678
803
|
setUnitPosition(self.handle, x, y)
|
|
679
804
|
end
|
|
@@ -687,8 +812,15 @@ end
|
|
|
687
812
|
function Unit.prototype.kill(self)
|
|
688
813
|
killUnit(self.handle)
|
|
689
814
|
end
|
|
690
|
-
function Unit.prototype.revive(self,
|
|
691
|
-
|
|
815
|
+
function Unit.prototype.revive(self, x, y, doEffect)
|
|
816
|
+
local ____ReviveHero_5 = ReviveHero
|
|
817
|
+
local ____array_4 = __TS__SparseArrayNew(self.handle, x, y)
|
|
818
|
+
local ____doEffect_3 = doEffect
|
|
819
|
+
if ____doEffect_3 == nil then
|
|
820
|
+
____doEffect_3 = false
|
|
821
|
+
end
|
|
822
|
+
__TS__SparseArrayPush(____array_4, ____doEffect_3)
|
|
823
|
+
____ReviveHero_5(__TS__SparseArraySpread(____array_4))
|
|
692
824
|
end
|
|
693
825
|
function Unit.prototype.healTarget(self, target, amount)
|
|
694
826
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -728,7 +860,7 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
728
860
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
729
861
|
end
|
|
730
862
|
function Unit.prototype.itemInSlot(self, slot)
|
|
731
|
-
return Item:of(
|
|
863
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
732
864
|
end
|
|
733
865
|
function Unit.prototype.addAbility(self, abilityId)
|
|
734
866
|
if unitAddAbility(self.handle, abilityId) then
|
|
@@ -784,6 +916,9 @@ end
|
|
|
784
916
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
785
917
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
786
918
|
end
|
|
919
|
+
function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
|
|
920
|
+
return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
|
|
921
|
+
end
|
|
787
922
|
function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
|
|
788
923
|
BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
|
|
789
924
|
end
|
|
@@ -855,18 +990,18 @@ function Unit.prototype.unpauseEx(self)
|
|
|
855
990
|
self:decrementStunCounter()
|
|
856
991
|
end
|
|
857
992
|
function Unit.prototype.incrementStunCounter(self)
|
|
858
|
-
local stunCounter = self[
|
|
859
|
-
if not self[
|
|
993
|
+
local stunCounter = self[102] or 0
|
|
994
|
+
if not self[101] or stunCounter >= 0 then
|
|
860
995
|
BlzPauseUnitEx(self.handle, true)
|
|
861
996
|
end
|
|
862
|
-
self[
|
|
997
|
+
self[102] = stunCounter + 1
|
|
863
998
|
end
|
|
864
999
|
function Unit.prototype.decrementStunCounter(self)
|
|
865
|
-
local stunCounter = self[
|
|
866
|
-
if not self[
|
|
1000
|
+
local stunCounter = self[102] or 0
|
|
1001
|
+
if not self[101] or stunCounter >= 1 then
|
|
867
1002
|
BlzPauseUnitEx(self.handle, false)
|
|
868
1003
|
end
|
|
869
|
-
self[
|
|
1004
|
+
self[102] = stunCounter - 1
|
|
870
1005
|
end
|
|
871
1006
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
872
1007
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
@@ -968,8 +1103,11 @@ function Unit.getInSector(self, pos, range, offsetAngle, centralAngle)
|
|
|
968
1103
|
)
|
|
969
1104
|
return targetCollection
|
|
970
1105
|
end
|
|
971
|
-
function Unit.getSelectionOf(self, player)
|
|
972
|
-
|
|
1106
|
+
function Unit.getSelectionOf(self, player, target)
|
|
1107
|
+
if target == nil then
|
|
1108
|
+
target = {}
|
|
1109
|
+
end
|
|
1110
|
+
targetCollection = target
|
|
973
1111
|
targetCollectionNextIndex = 1
|
|
974
1112
|
GroupEnumUnitsSelected(dummyGroup, player.handle, collectIntoTarget)
|
|
975
1113
|
return targetCollection
|
|
@@ -991,6 +1129,9 @@ end
|
|
|
991
1129
|
function Unit.prototype.__tostring(self)
|
|
992
1130
|
return (((self.constructor.name .. "$") .. util.id2s(self.typeId)) .. "@") .. tostring(getHandleId(self.handle))
|
|
993
1131
|
end
|
|
1132
|
+
function Unit.getBySyncId(self, syncId)
|
|
1133
|
+
return unitBySyncId[syncId]
|
|
1134
|
+
end
|
|
994
1135
|
__TS__SetDescriptor(
|
|
995
1136
|
Unit.prototype,
|
|
996
1137
|
"_deltas",
|
|
@@ -1071,12 +1212,27 @@ __TS__SetDescriptor(
|
|
|
1071
1212
|
Unit.prototype,
|
|
1072
1213
|
"weapons",
|
|
1073
1214
|
{get = function(self)
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1215
|
+
return {self.firstWeapon, self.secondWeapon}
|
|
1216
|
+
end},
|
|
1217
|
+
true
|
|
1218
|
+
)
|
|
1219
|
+
__TS__SetDescriptor(
|
|
1220
|
+
Unit.prototype,
|
|
1221
|
+
"firstWeapon",
|
|
1222
|
+
{get = function(self)
|
|
1223
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 0)
|
|
1224
|
+
rawset(self, "firstWeapon", weapon)
|
|
1225
|
+
return weapon
|
|
1226
|
+
end},
|
|
1227
|
+
true
|
|
1228
|
+
)
|
|
1229
|
+
__TS__SetDescriptor(
|
|
1230
|
+
Unit.prototype,
|
|
1231
|
+
"secondWeapon",
|
|
1232
|
+
{get = function(self)
|
|
1233
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 1)
|
|
1234
|
+
rawset(self, "secondWeapon", weapon)
|
|
1235
|
+
return weapon
|
|
1080
1236
|
end},
|
|
1081
1237
|
true
|
|
1082
1238
|
)
|
|
@@ -1233,17 +1389,17 @@ __TS__SetDescriptor(
|
|
|
1233
1389
|
"isTeamGlowVisible",
|
|
1234
1390
|
{
|
|
1235
1391
|
get = function(self)
|
|
1236
|
-
return not self[
|
|
1392
|
+
return not self[106]
|
|
1237
1393
|
end,
|
|
1238
1394
|
set = function(self, isTeamGlowVisible)
|
|
1239
1395
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1240
|
-
local
|
|
1396
|
+
local ____temp_6
|
|
1241
1397
|
if not isTeamGlowVisible then
|
|
1242
|
-
|
|
1398
|
+
____temp_6 = true
|
|
1243
1399
|
else
|
|
1244
|
-
|
|
1400
|
+
____temp_6 = nil
|
|
1245
1401
|
end
|
|
1246
|
-
self[
|
|
1402
|
+
self[106] = ____temp_6
|
|
1247
1403
|
end
|
|
1248
1404
|
},
|
|
1249
1405
|
true
|
|
@@ -1253,7 +1409,7 @@ __TS__SetDescriptor(
|
|
|
1253
1409
|
"color",
|
|
1254
1410
|
{set = function(self, color)
|
|
1255
1411
|
setUnitColor(self.handle, color.handle)
|
|
1256
|
-
if self[
|
|
1412
|
+
if self[106] then
|
|
1257
1413
|
showUnitTeamGlow(self.handle, false)
|
|
1258
1414
|
end
|
|
1259
1415
|
end},
|
|
@@ -1277,10 +1433,14 @@ __TS__SetDescriptor(
|
|
|
1277
1433
|
"maxHealth",
|
|
1278
1434
|
{
|
|
1279
1435
|
get = function(self)
|
|
1280
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1436
|
+
return BlzGetUnitMaxHP(self.handle) - (self[104] or 0) - (self[105] or 0)
|
|
1281
1437
|
end,
|
|
1282
1438
|
set = function(self, maxHealth)
|
|
1283
|
-
|
|
1439
|
+
if maxHealth < 1 and self[103] ~= nil then
|
|
1440
|
+
self[104] = (self[104] or 0) + (1 - maxHealth)
|
|
1441
|
+
maxHealth = 1
|
|
1442
|
+
end
|
|
1443
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[105] or 0))
|
|
1284
1444
|
end
|
|
1285
1445
|
},
|
|
1286
1446
|
true
|
|
@@ -1322,10 +1482,10 @@ __TS__SetDescriptor(
|
|
|
1322
1482
|
"health",
|
|
1323
1483
|
{
|
|
1324
1484
|
get = function(self)
|
|
1325
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1485
|
+
return GetWidgetLife(self.handle) - (self[105] or 0)
|
|
1326
1486
|
end,
|
|
1327
1487
|
set = function(self, health)
|
|
1328
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1488
|
+
SetWidgetLife(self.handle, health + (self[105] or 0))
|
|
1329
1489
|
end
|
|
1330
1490
|
},
|
|
1331
1491
|
true
|
|
@@ -1536,17 +1696,17 @@ __TS__SetDescriptor(
|
|
|
1536
1696
|
set = function(self, isPaused)
|
|
1537
1697
|
local handle = self.handle
|
|
1538
1698
|
if isPaused and not IsUnitPaused(handle) then
|
|
1539
|
-
self[
|
|
1540
|
-
for _ = self[
|
|
1699
|
+
self[101] = true
|
|
1700
|
+
for _ = self[102] or 0, -1 do
|
|
1541
1701
|
BlzPauseUnitEx(handle, true)
|
|
1542
1702
|
end
|
|
1543
1703
|
PauseUnit(handle, true)
|
|
1544
1704
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1545
1705
|
PauseUnit(handle, false)
|
|
1546
|
-
for _ = self[
|
|
1706
|
+
for _ = self[102] or 0, -1 do
|
|
1547
1707
|
BlzPauseUnitEx(handle, false)
|
|
1548
1708
|
end
|
|
1549
|
-
self[
|
|
1709
|
+
self[101] = nil
|
|
1550
1710
|
end
|
|
1551
1711
|
end
|
|
1552
1712
|
},
|
|
@@ -1903,7 +2063,6 @@ Unit.onDecay = __TS__New(
|
|
|
1903
2063
|
Unit.onResurrect = __TS__New(
|
|
1904
2064
|
InitializingEvent,
|
|
1905
2065
|
function(event)
|
|
1906
|
-
local invoke = Event.invoke
|
|
1907
2066
|
local dead = setmetatable({}, {__mode = "k"})
|
|
1908
2067
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
1909
2068
|
dead[unit] = true
|
|
@@ -1919,10 +2078,15 @@ Unit.onResurrect = __TS__New(
|
|
|
1919
2078
|
Unit.morphEvent = __TS__New(
|
|
1920
2079
|
InitializingEvent,
|
|
1921
2080
|
function(event)
|
|
2081
|
+
local function ifNotLeft(unit)
|
|
2082
|
+
local handle = unit.handle
|
|
2083
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
|
|
2084
|
+
invoke(event, unit)
|
|
2085
|
+
end
|
|
2086
|
+
end
|
|
1922
2087
|
____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
|
|
1923
2088
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
1924
|
-
|
|
1925
|
-
Timer:run(Event.invoke, event, unit)
|
|
2089
|
+
Timer:run(ifNotLeft, unit)
|
|
1926
2090
|
end
|
|
1927
2091
|
end)
|
|
1928
2092
|
end
|
|
@@ -1960,27 +2124,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
|
|
|
1960
2124
|
Unit.onTargetCast = dispatchId(__TS__New(
|
|
1961
2125
|
InitializingEvent,
|
|
1962
2126
|
function(event)
|
|
1963
|
-
local invoke = Event.invoke
|
|
1964
2127
|
local function listener(unit, id)
|
|
1965
|
-
local
|
|
2128
|
+
local ____GetSpellTargetUnit_result_9
|
|
1966
2129
|
if GetSpellTargetUnit() then
|
|
1967
|
-
|
|
2130
|
+
____GetSpellTargetUnit_result_9 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
1968
2131
|
else
|
|
1969
|
-
local
|
|
2132
|
+
local ____GetSpellTargetItem_result_8
|
|
1970
2133
|
if GetSpellTargetItem() then
|
|
1971
|
-
|
|
2134
|
+
____GetSpellTargetItem_result_8 = Item:of(GetSpellTargetItem())
|
|
1972
2135
|
else
|
|
1973
|
-
local
|
|
2136
|
+
local ____GetSpellTargetDestructable_result_7
|
|
1974
2137
|
if GetSpellTargetDestructable() then
|
|
1975
|
-
|
|
2138
|
+
____GetSpellTargetDestructable_result_7 = Destructable:of(GetSpellTargetDestructable())
|
|
1976
2139
|
else
|
|
1977
|
-
|
|
2140
|
+
____GetSpellTargetDestructable_result_7 = nil
|
|
1978
2141
|
end
|
|
1979
|
-
|
|
2142
|
+
____GetSpellTargetItem_result_8 = ____GetSpellTargetDestructable_result_7
|
|
1980
2143
|
end
|
|
1981
|
-
|
|
2144
|
+
____GetSpellTargetUnit_result_9 = ____GetSpellTargetItem_result_8
|
|
1982
2145
|
end
|
|
1983
|
-
local target =
|
|
2146
|
+
local target = ____GetSpellTargetUnit_result_9
|
|
1984
2147
|
if target then
|
|
1985
2148
|
invoke(event, unit, id, target)
|
|
1986
2149
|
end
|
|
@@ -2177,7 +2340,6 @@ Unit.autoAttackStartEvent = __TS__New(
|
|
|
2177
2340
|
)
|
|
2178
2341
|
Unit.onDamaging = (function()
|
|
2179
2342
|
local event = __TS__New(Event)
|
|
2180
|
-
local invoke = Event.invoke
|
|
2181
2343
|
local trigger = CreateTrigger()
|
|
2182
2344
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
|
|
2183
2345
|
TriggerAddCondition(
|
|
@@ -2276,7 +2438,6 @@ end)()
|
|
|
2276
2438
|
Unit.onDamage = __TS__New(
|
|
2277
2439
|
InitializingEvent,
|
|
2278
2440
|
function(event)
|
|
2279
|
-
local invoke = Event.invoke
|
|
2280
2441
|
local trigger = CreateTrigger()
|
|
2281
2442
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
|
|
2282
2443
|
TriggerAddCondition(
|
|
@@ -2292,6 +2453,7 @@ Unit.onDamage = __TS__New(
|
|
|
2292
2453
|
damageType = BlzGetEventDamageType(),
|
|
2293
2454
|
weaponType = BlzGetEventWeaponType(),
|
|
2294
2455
|
isAttack = BlzGetEventIsAttack(),
|
|
2456
|
+
originalAmount = GetEventDamage(),
|
|
2295
2457
|
preventDeath = damageEventPreventDeath
|
|
2296
2458
|
}
|
|
2297
2459
|
local evData = setmetatable(
|
|
@@ -2308,7 +2470,7 @@ Unit.onDamage = __TS__New(
|
|
|
2308
2470
|
invoke(event, source, target, evData)
|
|
2309
2471
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2310
2472
|
local bonusHealth = math.ceil(evData.amount)
|
|
2311
|
-
target[
|
|
2473
|
+
target[105] = (target[105] or 0) + bonusHealth
|
|
2312
2474
|
BlzSetUnitMaxHP(
|
|
2313
2475
|
target.handle,
|
|
2314
2476
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2322,7 +2484,7 @@ Unit.onDamage = __TS__New(
|
|
|
2322
2484
|
evData[0],
|
|
2323
2485
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2324
2486
|
)
|
|
2325
|
-
target[
|
|
2487
|
+
target[105] = (target[105] or 0) - bonusHealth
|
|
2326
2488
|
SetWidgetLife(
|
|
2327
2489
|
target.handle,
|
|
2328
2490
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2342,7 +2504,7 @@ Unit.onDamage = __TS__New(
|
|
|
2342
2504
|
DestroyTrigger(trigger)
|
|
2343
2505
|
end
|
|
2344
2506
|
)
|
|
2345
|
-
Unit.
|
|
2507
|
+
Unit.itemDroppedEvent = __TS__New(
|
|
2346
2508
|
____exports.UnitTriggerEvent,
|
|
2347
2509
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2348
2510
|
function()
|
|
@@ -2353,7 +2515,7 @@ Unit.onItemDrop = __TS__New(
|
|
|
2353
2515
|
return IgnoreEvent
|
|
2354
2516
|
end
|
|
2355
2517
|
)
|
|
2356
|
-
Unit.
|
|
2518
|
+
Unit.itemPickedUpEvent = __TS__New(
|
|
2357
2519
|
____exports.UnitTriggerEvent,
|
|
2358
2520
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2359
2521
|
function()
|
|
@@ -2364,10 +2526,39 @@ Unit.onItemPickup = __TS__New(
|
|
|
2364
2526
|
return IgnoreEvent
|
|
2365
2527
|
end
|
|
2366
2528
|
)
|
|
2367
|
-
Unit.
|
|
2529
|
+
Unit.itemUsedEvent = __TS__New(
|
|
2368
2530
|
____exports.UnitTriggerEvent,
|
|
2369
2531
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2370
|
-
function() return ____exports.Unit:of(
|
|
2532
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2533
|
+
)
|
|
2534
|
+
Unit.itemStackedEvent = __TS__New(
|
|
2535
|
+
____exports.UnitTriggerEvent,
|
|
2536
|
+
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2537
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2538
|
+
)
|
|
2539
|
+
__TS__ObjectDefineProperty(
|
|
2540
|
+
Unit,
|
|
2541
|
+
"itemMovedEvent",
|
|
2542
|
+
{get = function(self)
|
|
2543
|
+
local event = __TS__New(Event)
|
|
2544
|
+
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2545
|
+
local slotTo = order - orderId("moveslot0")
|
|
2546
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2547
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2548
|
+
if slotFrom ~= nil then
|
|
2549
|
+
invoke(
|
|
2550
|
+
event,
|
|
2551
|
+
unit,
|
|
2552
|
+
item,
|
|
2553
|
+
slotFrom,
|
|
2554
|
+
slotTo
|
|
2555
|
+
)
|
|
2556
|
+
end
|
|
2557
|
+
end)
|
|
2558
|
+
end
|
|
2559
|
+
rawset(self, "itemMovedEvent", event)
|
|
2560
|
+
return event
|
|
2561
|
+
end}
|
|
2371
2562
|
)
|
|
2372
2563
|
__TS__ObjectDefineProperty(
|
|
2373
2564
|
Unit,
|