warscript 0.0.1-dev.96a6f7e → 0.0.1-dev.96f1707
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/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 +4 -0
- package/core/types/frame.lua +71 -0
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/timer.d.ts +6 -7
- package/core/types/timer.lua +18 -21
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -1
- 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 +5 -0
- 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 +3 -0
- package/engine/behaviour/ability/damage.lua +2 -2
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +35 -0
- 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.d.ts +20 -4
- package/engine/behaviour/ability.lua +111 -38
- package/engine/behaviour/unit.d.ts +2 -0
- package/engine/buff.d.ts +62 -42
- package/engine/buff.lua +312 -234
- package/engine/internal/ability.d.ts +15 -2
- package/engine/internal/ability.lua +84 -4
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item.d.ts +2 -2
- package/engine/internal/item.lua +56 -25
- 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/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 +10 -1
- package/engine/internal/unit/ability.lua +36 -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/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +17 -0
- 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 +1 -0
- package/engine/internal/unit/item.lua +8 -4
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit.d.ts +32 -7
- package/engine/internal/unit.lua +186 -79
- 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/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- 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/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 +89 -33
- 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 +3 -1
- package/engine/object-data/entry/item-type.lua +15 -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 +8 -1
- package/engine/object-data/entry/unit-type.lua +69 -10
- 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 +9 -3
- package/engine/object-field/ability.lua +3 -0
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +4 -0
- 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/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +34 -3
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/reflection.lua +11 -7
package/engine/internal/unit.lua
CHANGED
|
@@ -51,11 +51,14 @@ 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
|
|
54
56
|
local match = string.match
|
|
55
57
|
local ____tostring = _G.tostring
|
|
56
58
|
local setUnitAnimation = SetUnitAnimation
|
|
57
59
|
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
58
60
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
61
|
+
local resetUnitAnimation = ResetUnitAnimation
|
|
59
62
|
local queueUnitAnimation = QueueUnitAnimation
|
|
60
63
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
61
64
|
local getUnitRealField = BlzGetUnitRealField
|
|
@@ -75,6 +78,7 @@ local setUnitScale = SetUnitScale
|
|
|
75
78
|
local setUnitPosition = SetUnitPosition
|
|
76
79
|
local setUnitTimeScale = SetUnitTimeScale
|
|
77
80
|
local getHandleId = GetHandleId
|
|
81
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
78
82
|
local createUnit = CreateUnit
|
|
79
83
|
local killUnit = KillUnit
|
|
80
84
|
local setUnitExploded = SetUnitExploded
|
|
@@ -562,17 +566,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
562
566
|
____exports.Unit:of(unit)
|
|
563
567
|
)
|
|
564
568
|
end
|
|
565
|
-
if not unitAddAbility(unit, abilityId) then
|
|
566
|
-
if getUnitAbility(unit, abilityId) == ability then
|
|
567
|
-
return UnitAbility:of(
|
|
568
|
-
ability,
|
|
569
|
-
abilityId,
|
|
570
|
-
____exports.Unit:of(unit)
|
|
571
|
-
)
|
|
572
|
-
end
|
|
573
|
-
else
|
|
574
|
-
unitRemoveAbility(unit, abilityId)
|
|
575
|
-
end
|
|
576
569
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
577
570
|
local item = unitItemInSlot(unit, i)
|
|
578
571
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -630,15 +623,15 @@ for ____, player in ipairs(Player.all) do
|
|
|
630
623
|
dummies[player] = dummy
|
|
631
624
|
end
|
|
632
625
|
local function delayHealthChecksCallback(unit)
|
|
633
|
-
local counter = (unit[
|
|
626
|
+
local counter = (unit[103] or 0) - 1
|
|
634
627
|
if counter ~= 0 then
|
|
635
|
-
unit[
|
|
628
|
+
unit[103] = counter
|
|
636
629
|
return
|
|
637
630
|
end
|
|
638
|
-
unit[
|
|
639
|
-
local healthBonus = unit[
|
|
631
|
+
unit[103] = nil
|
|
632
|
+
local healthBonus = unit[104]
|
|
640
633
|
if healthBonus ~= nil then
|
|
641
|
-
unit[
|
|
634
|
+
unit[104] = nil
|
|
642
635
|
local handle = unit.handle
|
|
643
636
|
BlzSetUnitMaxHP(
|
|
644
637
|
handle,
|
|
@@ -646,12 +639,17 @@ local function delayHealthChecksCallback(unit)
|
|
|
646
639
|
)
|
|
647
640
|
end
|
|
648
641
|
end
|
|
642
|
+
local nextSyncId = 1
|
|
643
|
+
local unitBySyncId = setmetatable({}, {__mode = "k"})
|
|
649
644
|
____exports.Unit = __TS__Class()
|
|
650
645
|
local Unit = ____exports.Unit
|
|
651
646
|
Unit.name = "Unit"
|
|
652
647
|
__TS__ClassExtends(Unit, Handle)
|
|
653
648
|
function Unit.prototype.____constructor(self, handle)
|
|
654
649
|
Handle.prototype.____constructor(self, handle)
|
|
650
|
+
local ____nextSyncId_0 = nextSyncId
|
|
651
|
+
nextSyncId = ____nextSyncId_0 + 1
|
|
652
|
+
self.syncId = ____nextSyncId_0
|
|
655
653
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
656
654
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
657
655
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -664,6 +662,7 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
664
662
|
fourCC("Amrf")
|
|
665
663
|
))
|
|
666
664
|
end
|
|
665
|
+
unitBySyncId[self.syncId] = self
|
|
667
666
|
local ____ = self.abilities
|
|
668
667
|
end
|
|
669
668
|
function Unit.prototype.getEvent(self, event, collector)
|
|
@@ -682,6 +681,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
682
681
|
end
|
|
683
682
|
function Unit.prototype.onDestroy(self)
|
|
684
683
|
local handle = self.handle
|
|
684
|
+
self[107] = getUnitX(handle)
|
|
685
|
+
self[108] = getUnitY(handle)
|
|
685
686
|
if not self._owner then
|
|
686
687
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
687
688
|
end
|
|
@@ -749,8 +750,8 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
749
750
|
end}
|
|
750
751
|
end
|
|
751
752
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
752
|
-
local
|
|
753
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
753
|
+
local ____combatClassification_1 = combatClassification
|
|
754
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_1 == ____combatClassification_1
|
|
754
755
|
end
|
|
755
756
|
function Unit.prototype.addClassification(self, classification)
|
|
756
757
|
return unitAddType(self.handle, classification)
|
|
@@ -768,13 +769,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
768
769
|
return isUnitInvisible(self.handle, player.handle)
|
|
769
770
|
end
|
|
770
771
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
771
|
-
local
|
|
772
|
+
local ____temp_2
|
|
772
773
|
if type(x) == "number" then
|
|
773
|
-
|
|
774
|
+
____temp_2 = isUnitInRangeXY(self.handle, x, y, range)
|
|
774
775
|
else
|
|
775
|
-
|
|
776
|
+
____temp_2 = isUnitInRange(self.handle, x.handle, y)
|
|
776
777
|
end
|
|
777
|
-
return
|
|
778
|
+
return ____temp_2
|
|
778
779
|
end
|
|
779
780
|
function Unit.prototype.isAllyOf(self, unit)
|
|
780
781
|
return isUnitAlly(
|
|
@@ -797,11 +798,14 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
797
798
|
setUnitAnimation(self.handle, animation)
|
|
798
799
|
end
|
|
799
800
|
end
|
|
801
|
+
function Unit.prototype.resetAnimation(self)
|
|
802
|
+
resetUnitAnimation(self.handle)
|
|
803
|
+
end
|
|
800
804
|
function Unit.prototype.queueAnimation(self, animation)
|
|
801
805
|
queueUnitAnimation(self.handle, animation)
|
|
802
806
|
end
|
|
803
807
|
function Unit.prototype.delayHealthChecks(self)
|
|
804
|
-
self[
|
|
808
|
+
self[103] = (self[103] or 0) + 1
|
|
805
809
|
Timer:run(delayHealthChecksCallback, self)
|
|
806
810
|
end
|
|
807
811
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -818,14 +822,14 @@ function Unit.prototype.kill(self)
|
|
|
818
822
|
killUnit(self.handle)
|
|
819
823
|
end
|
|
820
824
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
821
|
-
local
|
|
822
|
-
local
|
|
823
|
-
local
|
|
824
|
-
if
|
|
825
|
-
|
|
825
|
+
local ____ReviveHero_5 = ReviveHero
|
|
826
|
+
local ____array_4 = __TS__SparseArrayNew(self.handle, x, y)
|
|
827
|
+
local ____doEffect_3 = doEffect
|
|
828
|
+
if ____doEffect_3 == nil then
|
|
829
|
+
____doEffect_3 = false
|
|
826
830
|
end
|
|
827
|
-
__TS__SparseArrayPush(
|
|
828
|
-
|
|
831
|
+
__TS__SparseArrayPush(____array_4, ____doEffect_3)
|
|
832
|
+
____ReviveHero_5(__TS__SparseArraySpread(____array_4))
|
|
829
833
|
end
|
|
830
834
|
function Unit.prototype.healTarget(self, target, amount)
|
|
831
835
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -934,8 +938,15 @@ function Unit.prototype.interruptAttack(self)
|
|
|
934
938
|
unitInterruptAttack(self.handle)
|
|
935
939
|
end
|
|
936
940
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
937
|
-
|
|
938
|
-
unitDisableAbility(
|
|
941
|
+
local handle = self.handle
|
|
942
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
943
|
+
Timer:run(
|
|
944
|
+
unitDisableAbility,
|
|
945
|
+
handle,
|
|
946
|
+
abilityId,
|
|
947
|
+
false,
|
|
948
|
+
false
|
|
949
|
+
)
|
|
939
950
|
end
|
|
940
951
|
function Unit.prototype.getDistanceTo(self, target)
|
|
941
952
|
local handle = self.handle
|
|
@@ -995,18 +1006,18 @@ function Unit.prototype.unpauseEx(self)
|
|
|
995
1006
|
self:decrementStunCounter()
|
|
996
1007
|
end
|
|
997
1008
|
function Unit.prototype.incrementStunCounter(self)
|
|
998
|
-
local stunCounter = self[
|
|
999
|
-
if not self[
|
|
1009
|
+
local stunCounter = self[102] or 0
|
|
1010
|
+
if not self[101] or stunCounter >= 0 then
|
|
1000
1011
|
BlzPauseUnitEx(self.handle, true)
|
|
1001
1012
|
end
|
|
1002
|
-
self[
|
|
1013
|
+
self[102] = stunCounter + 1
|
|
1003
1014
|
end
|
|
1004
1015
|
function Unit.prototype.decrementStunCounter(self)
|
|
1005
|
-
local stunCounter = self[
|
|
1006
|
-
if not self[
|
|
1016
|
+
local stunCounter = self[102] or 0
|
|
1017
|
+
if not self[101] or stunCounter >= 1 then
|
|
1007
1018
|
BlzPauseUnitEx(self.handle, false)
|
|
1008
1019
|
end
|
|
1009
|
-
self[
|
|
1020
|
+
self[102] = stunCounter - 1
|
|
1010
1021
|
end
|
|
1011
1022
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1012
1023
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
@@ -1108,8 +1119,11 @@ function Unit.getInSector(self, pos, range, offsetAngle, centralAngle)
|
|
|
1108
1119
|
)
|
|
1109
1120
|
return targetCollection
|
|
1110
1121
|
end
|
|
1111
|
-
function Unit.getSelectionOf(self, player)
|
|
1112
|
-
|
|
1122
|
+
function Unit.getSelectionOf(self, player, target)
|
|
1123
|
+
if target == nil then
|
|
1124
|
+
target = {}
|
|
1125
|
+
end
|
|
1126
|
+
targetCollection = target
|
|
1113
1127
|
targetCollectionNextIndex = 1
|
|
1114
1128
|
GroupEnumUnitsSelected(dummyGroup, player.handle, collectIntoTarget)
|
|
1115
1129
|
return targetCollection
|
|
@@ -1131,6 +1145,9 @@ end
|
|
|
1131
1145
|
function Unit.prototype.__tostring(self)
|
|
1132
1146
|
return (((self.constructor.name .. "$") .. util.id2s(self.typeId)) .. "@") .. tostring(getHandleId(self.handle))
|
|
1133
1147
|
end
|
|
1148
|
+
function Unit.getBySyncId(self, syncId)
|
|
1149
|
+
return unitBySyncId[syncId]
|
|
1150
|
+
end
|
|
1134
1151
|
__TS__SetDescriptor(
|
|
1135
1152
|
Unit.prototype,
|
|
1136
1153
|
"_deltas",
|
|
@@ -1194,6 +1211,14 @@ __TS__SetDescriptor(
|
|
|
1194
1211
|
end},
|
|
1195
1212
|
true
|
|
1196
1213
|
)
|
|
1214
|
+
__TS__SetDescriptor(
|
|
1215
|
+
Unit.prototype,
|
|
1216
|
+
"isStunned",
|
|
1217
|
+
{get = function(self)
|
|
1218
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1219
|
+
end},
|
|
1220
|
+
true
|
|
1221
|
+
)
|
|
1197
1222
|
__TS__SetDescriptor(
|
|
1198
1223
|
Unit.prototype,
|
|
1199
1224
|
"combatClassifications",
|
|
@@ -1267,6 +1292,19 @@ __TS__SetDescriptor(
|
|
|
1267
1292
|
},
|
|
1268
1293
|
true
|
|
1269
1294
|
)
|
|
1295
|
+
__TS__SetDescriptor(
|
|
1296
|
+
Unit.prototype,
|
|
1297
|
+
"primaryAttribute",
|
|
1298
|
+
{
|
|
1299
|
+
get = function(self)
|
|
1300
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1301
|
+
end,
|
|
1302
|
+
set = function(self, primaryAttribute)
|
|
1303
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1304
|
+
end
|
|
1305
|
+
},
|
|
1306
|
+
true
|
|
1307
|
+
)
|
|
1270
1308
|
__TS__SetDescriptor(
|
|
1271
1309
|
Unit.prototype,
|
|
1272
1310
|
"strengthBase",
|
|
@@ -1388,17 +1426,17 @@ __TS__SetDescriptor(
|
|
|
1388
1426
|
"isTeamGlowVisible",
|
|
1389
1427
|
{
|
|
1390
1428
|
get = function(self)
|
|
1391
|
-
return not self[
|
|
1429
|
+
return not self[106]
|
|
1392
1430
|
end,
|
|
1393
1431
|
set = function(self, isTeamGlowVisible)
|
|
1394
1432
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1395
|
-
local
|
|
1433
|
+
local ____temp_6
|
|
1396
1434
|
if not isTeamGlowVisible then
|
|
1397
|
-
|
|
1435
|
+
____temp_6 = true
|
|
1398
1436
|
else
|
|
1399
|
-
|
|
1437
|
+
____temp_6 = nil
|
|
1400
1438
|
end
|
|
1401
|
-
self[
|
|
1439
|
+
self[106] = ____temp_6
|
|
1402
1440
|
end
|
|
1403
1441
|
},
|
|
1404
1442
|
true
|
|
@@ -1408,7 +1446,7 @@ __TS__SetDescriptor(
|
|
|
1408
1446
|
"color",
|
|
1409
1447
|
{set = function(self, color)
|
|
1410
1448
|
setUnitColor(self.handle, color.handle)
|
|
1411
|
-
if self[
|
|
1449
|
+
if self[106] then
|
|
1412
1450
|
showUnitTeamGlow(self.handle, false)
|
|
1413
1451
|
end
|
|
1414
1452
|
end},
|
|
@@ -1432,14 +1470,14 @@ __TS__SetDescriptor(
|
|
|
1432
1470
|
"maxHealth",
|
|
1433
1471
|
{
|
|
1434
1472
|
get = function(self)
|
|
1435
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1473
|
+
return BlzGetUnitMaxHP(self.handle) - (self[104] or 0) - (self[105] or 0)
|
|
1436
1474
|
end,
|
|
1437
1475
|
set = function(self, maxHealth)
|
|
1438
|
-
if maxHealth < 1 and self[
|
|
1439
|
-
self[
|
|
1476
|
+
if maxHealth < 1 and self[103] ~= nil then
|
|
1477
|
+
self[104] = (self[104] or 0) + (1 - maxHealth)
|
|
1440
1478
|
maxHealth = 1
|
|
1441
1479
|
end
|
|
1442
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1480
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[105] or 0))
|
|
1443
1481
|
end
|
|
1444
1482
|
},
|
|
1445
1483
|
true
|
|
@@ -1481,10 +1519,10 @@ __TS__SetDescriptor(
|
|
|
1481
1519
|
"health",
|
|
1482
1520
|
{
|
|
1483
1521
|
get = function(self)
|
|
1484
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1522
|
+
return GetWidgetLife(self.handle) - (self[105] or 0)
|
|
1485
1523
|
end,
|
|
1486
1524
|
set = function(self, health)
|
|
1487
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1525
|
+
SetWidgetLife(self.handle, health + (self[105] or 0))
|
|
1488
1526
|
end
|
|
1489
1527
|
},
|
|
1490
1528
|
true
|
|
@@ -1578,7 +1616,7 @@ __TS__SetDescriptor(
|
|
|
1578
1616
|
"x",
|
|
1579
1617
|
{
|
|
1580
1618
|
get = function(self)
|
|
1581
|
-
return getUnitX(self.handle)
|
|
1619
|
+
return self[107] or getUnitX(self.handle)
|
|
1582
1620
|
end,
|
|
1583
1621
|
set = function(self, v)
|
|
1584
1622
|
SetUnitX(self.handle, v)
|
|
@@ -1591,7 +1629,7 @@ __TS__SetDescriptor(
|
|
|
1591
1629
|
"y",
|
|
1592
1630
|
{
|
|
1593
1631
|
get = function(self)
|
|
1594
|
-
return getUnitY(self.handle)
|
|
1632
|
+
return self[108] or getUnitY(self.handle)
|
|
1595
1633
|
end,
|
|
1596
1634
|
set = function(self, v)
|
|
1597
1635
|
SetUnitY(self.handle, v)
|
|
@@ -1695,17 +1733,17 @@ __TS__SetDescriptor(
|
|
|
1695
1733
|
set = function(self, isPaused)
|
|
1696
1734
|
local handle = self.handle
|
|
1697
1735
|
if isPaused and not IsUnitPaused(handle) then
|
|
1698
|
-
self[
|
|
1699
|
-
for _ = self[
|
|
1736
|
+
self[101] = true
|
|
1737
|
+
for _ = self[102] or 0, -1 do
|
|
1700
1738
|
BlzPauseUnitEx(handle, true)
|
|
1701
1739
|
end
|
|
1702
1740
|
PauseUnit(handle, true)
|
|
1703
1741
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1704
1742
|
PauseUnit(handle, false)
|
|
1705
|
-
for _ = self[
|
|
1743
|
+
for _ = self[102] or 0, -1 do
|
|
1706
1744
|
BlzPauseUnitEx(handle, false)
|
|
1707
1745
|
end
|
|
1708
|
-
self[
|
|
1746
|
+
self[101] = nil
|
|
1709
1747
|
end
|
|
1710
1748
|
end
|
|
1711
1749
|
},
|
|
@@ -1808,6 +1846,19 @@ __TS__SetDescriptor(
|
|
|
1808
1846
|
end},
|
|
1809
1847
|
true
|
|
1810
1848
|
)
|
|
1849
|
+
__TS__SetDescriptor(
|
|
1850
|
+
Unit.prototype,
|
|
1851
|
+
"movementType",
|
|
1852
|
+
{
|
|
1853
|
+
get = function(self)
|
|
1854
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1855
|
+
end,
|
|
1856
|
+
set = function(self, movementType)
|
|
1857
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1858
|
+
end
|
|
1859
|
+
},
|
|
1860
|
+
true
|
|
1861
|
+
)
|
|
1811
1862
|
__TS__SetDescriptor(
|
|
1812
1863
|
Unit.prototype,
|
|
1813
1864
|
"pathing",
|
|
@@ -2124,25 +2175,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2124
2175
|
InitializingEvent,
|
|
2125
2176
|
function(event)
|
|
2126
2177
|
local function listener(unit, id)
|
|
2127
|
-
local
|
|
2178
|
+
local ____GetSpellTargetUnit_result_9
|
|
2128
2179
|
if GetSpellTargetUnit() then
|
|
2129
|
-
|
|
2180
|
+
____GetSpellTargetUnit_result_9 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2130
2181
|
else
|
|
2131
|
-
local
|
|
2182
|
+
local ____GetSpellTargetItem_result_8
|
|
2132
2183
|
if GetSpellTargetItem() then
|
|
2133
|
-
|
|
2184
|
+
____GetSpellTargetItem_result_8 = Item:of(GetSpellTargetItem())
|
|
2134
2185
|
else
|
|
2135
|
-
local
|
|
2186
|
+
local ____GetSpellTargetDestructable_result_7
|
|
2136
2187
|
if GetSpellTargetDestructable() then
|
|
2137
|
-
|
|
2188
|
+
____GetSpellTargetDestructable_result_7 = Destructable:of(GetSpellTargetDestructable())
|
|
2138
2189
|
else
|
|
2139
|
-
|
|
2190
|
+
____GetSpellTargetDestructable_result_7 = nil
|
|
2140
2191
|
end
|
|
2141
|
-
|
|
2192
|
+
____GetSpellTargetItem_result_8 = ____GetSpellTargetDestructable_result_7
|
|
2142
2193
|
end
|
|
2143
|
-
|
|
2194
|
+
____GetSpellTargetUnit_result_9 = ____GetSpellTargetItem_result_8
|
|
2144
2195
|
end
|
|
2145
|
-
local target =
|
|
2196
|
+
local target = ____GetSpellTargetUnit_result_9
|
|
2146
2197
|
if target then
|
|
2147
2198
|
invoke(event, unit, id, target)
|
|
2148
2199
|
end
|
|
@@ -2314,10 +2365,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2314
2365
|
____exports.UnitTriggerEvent,
|
|
2315
2366
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2316
2367
|
function()
|
|
2317
|
-
local
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2368
|
+
local handle = getOrderedUnit()
|
|
2369
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2370
|
+
local unit = ____exports.Unit:of(handle)
|
|
2371
|
+
if unit.state == 1 then
|
|
2372
|
+
return unit, getIssuedOrderId()
|
|
2373
|
+
end
|
|
2321
2374
|
end
|
|
2322
2375
|
return IgnoreEvent
|
|
2323
2376
|
end
|
|
@@ -2469,7 +2522,7 @@ Unit.onDamage = __TS__New(
|
|
|
2469
2522
|
invoke(event, source, target, evData)
|
|
2470
2523
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2471
2524
|
local bonusHealth = math.ceil(evData.amount)
|
|
2472
|
-
target[
|
|
2525
|
+
target[105] = (target[105] or 0) + bonusHealth
|
|
2473
2526
|
BlzSetUnitMaxHP(
|
|
2474
2527
|
target.handle,
|
|
2475
2528
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2483,7 +2536,7 @@ Unit.onDamage = __TS__New(
|
|
|
2483
2536
|
evData[0],
|
|
2484
2537
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2485
2538
|
)
|
|
2486
|
-
target[
|
|
2539
|
+
target[105] = (target[105] or 0) - bonusHealth
|
|
2487
2540
|
SetWidgetLife(
|
|
2488
2541
|
target.handle,
|
|
2489
2542
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2508,8 +2561,9 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2508
2561
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2509
2562
|
function()
|
|
2510
2563
|
local unit = getTriggerUnit()
|
|
2511
|
-
|
|
2512
|
-
|
|
2564
|
+
local item = getManipulatedItem()
|
|
2565
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2566
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2513
2567
|
end
|
|
2514
2568
|
return IgnoreEvent
|
|
2515
2569
|
end
|
|
@@ -2519,8 +2573,9 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2519
2573
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2520
2574
|
function()
|
|
2521
2575
|
local unit = getTriggerUnit()
|
|
2522
|
-
|
|
2523
|
-
|
|
2576
|
+
local item = getManipulatedItem()
|
|
2577
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2578
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2524
2579
|
end
|
|
2525
2580
|
return IgnoreEvent
|
|
2526
2581
|
end
|
|
@@ -2528,13 +2583,65 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2528
2583
|
Unit.itemUsedEvent = __TS__New(
|
|
2529
2584
|
____exports.UnitTriggerEvent,
|
|
2530
2585
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2531
|
-
function()
|
|
2586
|
+
function()
|
|
2587
|
+
local unit = getTriggerUnit()
|
|
2588
|
+
local item = getManipulatedItem()
|
|
2589
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2590
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2591
|
+
end
|
|
2592
|
+
return IgnoreEvent
|
|
2593
|
+
end
|
|
2532
2594
|
)
|
|
2533
2595
|
Unit.itemStackedEvent = __TS__New(
|
|
2534
2596
|
____exports.UnitTriggerEvent,
|
|
2535
2597
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2536
2598
|
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2537
2599
|
)
|
|
2600
|
+
__TS__ObjectDefineProperty(
|
|
2601
|
+
Unit,
|
|
2602
|
+
"itemUseOrderEvent",
|
|
2603
|
+
{get = function(self)
|
|
2604
|
+
local event = __TS__New(Event)
|
|
2605
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2606
|
+
local slot = order - orderId("useslot0")
|
|
2607
|
+
local function listener(unit)
|
|
2608
|
+
local item = unit.items[slot + 1]
|
|
2609
|
+
if item ~= nil then
|
|
2610
|
+
invoke(event, unit, item)
|
|
2611
|
+
end
|
|
2612
|
+
end
|
|
2613
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2614
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2615
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2616
|
+
end
|
|
2617
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2618
|
+
return event
|
|
2619
|
+
end}
|
|
2620
|
+
)
|
|
2621
|
+
__TS__ObjectDefineProperty(
|
|
2622
|
+
Unit,
|
|
2623
|
+
"itemMoveOrderEvent",
|
|
2624
|
+
{get = function(self)
|
|
2625
|
+
local event = __TS__New(Event)
|
|
2626
|
+
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2627
|
+
local slotTo = order - orderId("moveslot0")
|
|
2628
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2629
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2630
|
+
if slotFrom ~= nil then
|
|
2631
|
+
invoke(
|
|
2632
|
+
event,
|
|
2633
|
+
unit,
|
|
2634
|
+
item,
|
|
2635
|
+
slotFrom,
|
|
2636
|
+
slotTo
|
|
2637
|
+
)
|
|
2638
|
+
end
|
|
2639
|
+
end)
|
|
2640
|
+
end
|
|
2641
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2642
|
+
return event
|
|
2643
|
+
end}
|
|
2644
|
+
)
|
|
2538
2645
|
__TS__ObjectDefineProperty(
|
|
2539
2646
|
Unit,
|
|
2540
2647
|
"onCreate",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local getUnitAbility = BlzGetUnitAbility
|
|
3
3
|
local unitAddAbility = UnitAddAbility
|
|
4
|
+
local unitInventorySize = UnitInventorySize
|
|
5
|
+
local unitItemInSlot = UnitItemInSlot
|
|
4
6
|
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
5
7
|
---
|
|
6
8
|
-- @internal For use by internal systems only.
|
|
@@ -10,4 +12,14 @@ ____exports.addInternalAbility = function(unit, abilityTypeId)
|
|
|
10
12
|
end
|
|
11
13
|
return getUnitAbility(unit, abilityTypeId)
|
|
12
14
|
end
|
|
15
|
+
---
|
|
16
|
+
-- @internal For use by internal systems only.
|
|
17
|
+
____exports.findUnitItemSlot = function(unit, item)
|
|
18
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
19
|
+
if item == unitItemInSlot(unit, slot) then
|
|
20
|
+
return slot
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
13
25
|
return ____exports
|
package/engine/lightning.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { LightningTypeId } from "./object-data/entry/lightning-type";
|
|
3
|
-
import { Handle, HandleDestructor } from "../core/types/handle";
|
|
4
3
|
import { Unit } from "../core/types/unit";
|
|
4
|
+
import { AbstractDestroyable, Destructor } from "../destroyable";
|
|
5
5
|
declare const enum LightningPropertyKey {
|
|
6
6
|
CHECK_VISIBILITY = 100,
|
|
7
7
|
SOURCE_UNIT = 101,
|
|
@@ -12,10 +12,12 @@ declare const enum LightningPropertyKey {
|
|
|
12
12
|
TARGET_X = 106,
|
|
13
13
|
TARGET_Y = 107,
|
|
14
14
|
TARGET_Z = 108,
|
|
15
|
-
DURATION = 109
|
|
15
|
+
DURATION = 109,
|
|
16
|
+
FADING = 110
|
|
16
17
|
}
|
|
17
18
|
export type LightningConstructor<T extends Lightning> = typeof Lightning & (new (handle: jlightning, typeId: LightningTypeId) => T);
|
|
18
|
-
export declare class Lightning extends
|
|
19
|
+
export declare class Lightning extends AbstractDestroyable {
|
|
20
|
+
readonly handle: jlightning;
|
|
19
21
|
readonly typeId: LightningTypeId;
|
|
20
22
|
private [LightningPropertyKey.CHECK_VISIBILITY]?;
|
|
21
23
|
private [LightningPropertyKey.SOURCE_UNIT]?;
|
|
@@ -27,8 +29,9 @@ export declare class Lightning extends Handle<jlightning> {
|
|
|
27
29
|
private [LightningPropertyKey.TARGET_Y]?;
|
|
28
30
|
private [LightningPropertyKey.TARGET_Z]?;
|
|
29
31
|
private [LightningPropertyKey.DURATION]?;
|
|
32
|
+
private [LightningPropertyKey.FADING]?;
|
|
30
33
|
constructor(handle: jlightning, typeId: LightningTypeId);
|
|
31
|
-
protected onDestroy():
|
|
34
|
+
protected onDestroy(): Destructor;
|
|
32
35
|
static create<T extends Lightning>(this: LightningConstructor<T>, typeId: LightningTypeId, ...parameters: [
|
|
33
36
|
...checkVisibility: [boolean] | [],
|
|
34
37
|
...sourceAndTarget: [sourceX: number, sourceY: number, targetX: number, targetY: number] | [
|
|
@@ -46,6 +49,10 @@ export declare class Lightning extends Handle<jlightning> {
|
|
|
46
49
|
target: Unit
|
|
47
50
|
]
|
|
48
51
|
]): T;
|
|
49
|
-
static flash(...parameters: [
|
|
52
|
+
static flash(...parameters: [
|
|
53
|
+
...parameters: Parameters<(typeof Lightning)["create"]>,
|
|
54
|
+
duration: number,
|
|
55
|
+
fading?: boolean
|
|
56
|
+
]): void;
|
|
50
57
|
}
|
|
51
58
|
export {};
|