warscript 0.0.1-dev.eda504c → 0.0.1-dev.ee6e396
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/core/types/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/tileCell.d.ts +2 -1
- package/core/types/tileCell.lua +5 -0
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +10 -2
- package/engine/behavior.lua +157 -76
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability.d.ts +6 -1
- package/engine/behaviour/ability.lua +31 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -5
- package/engine/behaviour/unit/stun-immunity.lua +6 -5
- package/engine/behaviour/unit.d.ts +7 -3
- package/engine/behaviour/unit.lua +101 -24
- package/engine/buff.d.ts +19 -4
- package/engine/buff.lua +122 -41
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit-missile-launch.lua +16 -6
- package/engine/internal/unit.d.ts +13 -19
- package/engine/internal/unit.lua +140 -173
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/destructible-type.d.ts +27 -1
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/unit-type.d.ts +4 -0
- package/engine/object-data/entry/unit-type.lua +76 -32
- package/engine/object-field/unit.d.ts +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +9 -1
- package/engine/object-field.lua +265 -122
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +11 -3
- package/engine/standard/fields/unit.lua +15 -2
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +2 -1
- package/engine/unit.d.ts +5 -0
- package/engine/unit.lua +5 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +9 -7
- package/package.json +2 -2
- package/patch-lua.lua +15 -0
- package/utility/linked-map.d.ts +34 -0
- package/utility/linked-map.lua +101 -0
- package/utility/linked-set.d.ts +3 -1
- package/utility/linked-set.lua +38 -0
- package/utility/records.lua +20 -1
package/engine/internal/unit.lua
CHANGED
|
@@ -62,6 +62,10 @@ local ____attributes = require("attributes")
|
|
|
62
62
|
local isAttribute = ____attributes.isAttribute
|
|
63
63
|
local ____ability = require("engine.internal.item.ability")
|
|
64
64
|
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
65
|
+
local ____synchronization = require("engine.synchronization")
|
|
66
|
+
local synchronizer = ____synchronization.synchronizer
|
|
67
|
+
local ____linked_2Dmap = require("utility.linked-map")
|
|
68
|
+
local LinkedMap = ____linked_2Dmap.LinkedMap
|
|
65
69
|
local match = string.match
|
|
66
70
|
local ____tostring = _G.tostring
|
|
67
71
|
local setUnitAnimation = SetUnitAnimation
|
|
@@ -71,16 +75,12 @@ local getUnitRealField = BlzGetUnitRealField
|
|
|
71
75
|
local getHeroStr = GetHeroStr
|
|
72
76
|
local getHeroAgi = GetHeroAgi
|
|
73
77
|
local getHeroInt = GetHeroInt
|
|
74
|
-
local setHeroStr = SetHeroStr
|
|
75
|
-
local setHeroAgi = SetHeroAgi
|
|
76
|
-
local setHeroInt = SetHeroInt
|
|
77
78
|
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
78
79
|
local getUnitStringField = BlzGetUnitStringField
|
|
79
80
|
local setUnitIntegerField = BlzSetUnitIntegerField
|
|
80
81
|
local setUnitRealField = BlzSetUnitRealField
|
|
81
82
|
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
82
83
|
local setUnitStringField = BlzSetUnitStringField
|
|
83
|
-
local setUnitScale = SetUnitScale
|
|
84
84
|
local setUnitPosition = SetUnitPosition
|
|
85
85
|
local setUnitTimeScale = SetUnitTimeScale
|
|
86
86
|
local getHandleId = GetHandleId
|
|
@@ -108,7 +108,6 @@ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
|
108
108
|
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
109
109
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
110
110
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
111
|
-
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
112
111
|
local isUnitInvisible = IsUnitInvisible
|
|
113
112
|
local isUnitVisible = IsUnitVisible
|
|
114
113
|
local getUnitX = GetUnitX
|
|
@@ -384,15 +383,27 @@ local modifiers = {
|
|
|
384
383
|
end,
|
|
385
384
|
armor = function(unit, value)
|
|
386
385
|
if UnitAddAbility(unit, armorBonusAbilityId) then
|
|
387
|
-
assert(
|
|
386
|
+
assert(
|
|
387
|
+
UnitMakeAbilityPermanent(unit, true, armorBonusAbilityId),
|
|
388
|
+
"armor bonus ability must be made permanent",
|
|
389
|
+
unit
|
|
390
|
+
)
|
|
388
391
|
end
|
|
389
|
-
local ability = assert(
|
|
390
|
-
|
|
391
|
-
ability,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
392
|
+
local ability = assert(
|
|
393
|
+
BlzGetUnitAbility(unit, armorBonusAbilityId),
|
|
394
|
+
"armor bonus ability must be existing",
|
|
395
|
+
unit
|
|
396
|
+
)
|
|
397
|
+
assert(
|
|
398
|
+
BlzSetAbilityRealLevelField(
|
|
399
|
+
ability,
|
|
400
|
+
armorBonusField,
|
|
401
|
+
0,
|
|
402
|
+
BlzGetAbilityRealLevelField(ability, armorBonusField, 0) + value
|
|
403
|
+
),
|
|
404
|
+
"armor bonus ability field must be set",
|
|
405
|
+
unit
|
|
406
|
+
)
|
|
396
407
|
end
|
|
397
408
|
}
|
|
398
409
|
local getters = {
|
|
@@ -646,26 +657,30 @@ local fieldSetters = {
|
|
|
646
657
|
}
|
|
647
658
|
local dummies = {}
|
|
648
659
|
for ____, player in ipairs(Player.all) do
|
|
649
|
-
local dummy = assert(
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
660
|
+
local dummy = assert(
|
|
661
|
+
createUnit(
|
|
662
|
+
player.handle,
|
|
663
|
+
dummyUnitId,
|
|
664
|
+
0,
|
|
665
|
+
0,
|
|
666
|
+
270
|
|
667
|
+
),
|
|
668
|
+
"dummy must be created",
|
|
669
|
+
player
|
|
670
|
+
)
|
|
656
671
|
ShowUnit(dummy, false)
|
|
657
672
|
dummies[player] = dummy
|
|
658
673
|
end
|
|
659
674
|
local function delayHealthChecksCallback(unit)
|
|
660
|
-
local counter = (unit[
|
|
675
|
+
local counter = (unit[104] or 0) - 1
|
|
661
676
|
if counter ~= 0 then
|
|
662
|
-
unit[
|
|
677
|
+
unit[104] = counter
|
|
663
678
|
return
|
|
664
679
|
end
|
|
665
|
-
unit[
|
|
666
|
-
local healthBonus = unit[
|
|
680
|
+
unit[104] = nil
|
|
681
|
+
local healthBonus = unit[105]
|
|
667
682
|
if healthBonus ~= nil then
|
|
668
|
-
unit[
|
|
683
|
+
unit[105] = nil
|
|
669
684
|
local handle = unit.handle
|
|
670
685
|
BlzSetUnitMaxHP(
|
|
671
686
|
handle,
|
|
@@ -695,41 +710,57 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
695
710
|
nextSyncId = ____nextSyncId_1 + 1
|
|
696
711
|
self.syncId = ____nextSyncId_1
|
|
697
712
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
698
|
-
assert(
|
|
699
|
-
|
|
713
|
+
assert(
|
|
714
|
+
unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId),
|
|
715
|
+
"leave detection ability must be added",
|
|
716
|
+
self
|
|
717
|
+
)
|
|
718
|
+
assert(
|
|
719
|
+
unitAddAbility(handle, morphDetectAbilityId),
|
|
720
|
+
"morph detection ability must be added",
|
|
721
|
+
self
|
|
722
|
+
)
|
|
700
723
|
if unitAddAbility(
|
|
701
724
|
handle,
|
|
702
725
|
fourCC("Amrf")
|
|
703
726
|
) then
|
|
704
|
-
assert(
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
727
|
+
assert(
|
|
728
|
+
unitRemoveAbility(
|
|
729
|
+
handle,
|
|
730
|
+
fourCC("Amrf")
|
|
731
|
+
),
|
|
732
|
+
"fly ability must be removed after addition",
|
|
733
|
+
self
|
|
734
|
+
)
|
|
708
735
|
end
|
|
709
736
|
unitBySyncId[self.syncId] = self
|
|
710
737
|
local ____ = self.abilities
|
|
711
738
|
end
|
|
712
|
-
function Unit.prototype.getEvent(self,
|
|
713
|
-
self.events = self.events or (
|
|
714
|
-
local eventId = GetHandleId(
|
|
715
|
-
|
|
716
|
-
|
|
739
|
+
function Unit.prototype.getEvent(self, jevent, collector)
|
|
740
|
+
self.events = self.events or __TS__New(LinkedMap)
|
|
741
|
+
local eventId = GetHandleId(jevent)
|
|
742
|
+
local event = self.events:get(eventId)
|
|
743
|
+
if event == nil then
|
|
744
|
+
event = __TS__New(
|
|
717
745
|
TriggerEvent,
|
|
718
746
|
function(trigger)
|
|
719
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
747
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
720
748
|
end,
|
|
721
749
|
collector or (function() return {} end)
|
|
722
750
|
)
|
|
751
|
+
self.events:put(eventId, event)
|
|
723
752
|
end
|
|
724
|
-
return
|
|
753
|
+
return event
|
|
754
|
+
end
|
|
755
|
+
function Unit.prototype.saveData(self)
|
|
756
|
+
local handle = self.handle
|
|
757
|
+
self[108] = self[108] or getUnitX(handle)
|
|
758
|
+
self[109] = self[109] or getUnitY(handle)
|
|
759
|
+
self._owner = self._owner or Player:of(getOwningPlayer(handle))
|
|
725
760
|
end
|
|
726
761
|
function Unit.prototype.onDestroy(self)
|
|
727
762
|
local handle = self.handle
|
|
728
|
-
self
|
|
729
|
-
self[108] = getUnitY(handle)
|
|
730
|
-
if not self._owner then
|
|
731
|
-
self._owner = Player:of(getOwningPlayer(handle))
|
|
732
|
-
end
|
|
763
|
+
self:saveData()
|
|
733
764
|
local abilities = self.abilities
|
|
734
765
|
for ____, ability in ipairs(abilities) do
|
|
735
766
|
ability:destroy()
|
|
@@ -765,7 +796,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
|
|
|
765
796
|
self._attackHandlers = handlers
|
|
766
797
|
if #handlers == 1 then
|
|
767
798
|
local handle = self.handle
|
|
768
|
-
assert(
|
|
799
|
+
assert(
|
|
800
|
+
unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
|
|
801
|
+
"attack handler ability must be added",
|
|
802
|
+
self
|
|
803
|
+
)
|
|
769
804
|
end
|
|
770
805
|
return handler
|
|
771
806
|
end
|
|
@@ -860,7 +895,7 @@ function Unit.prototype.chooseWeapon(self, target)
|
|
|
860
895
|
return nil
|
|
861
896
|
end
|
|
862
897
|
function Unit.prototype.delayHealthChecks(self)
|
|
863
|
-
self[
|
|
898
|
+
self[104] = (self[104] or 0) + 1
|
|
864
899
|
Timer:run(delayHealthChecksCallback, self)
|
|
865
900
|
end
|
|
866
901
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -978,24 +1013,6 @@ end
|
|
|
978
1013
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
979
1014
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
980
1015
|
end
|
|
981
|
-
function Unit.prototype.interruptMovement(self)
|
|
982
|
-
local handle = self.handle
|
|
983
|
-
unitDisableAbility(
|
|
984
|
-
handle,
|
|
985
|
-
fourCC("Amov"),
|
|
986
|
-
true,
|
|
987
|
-
false
|
|
988
|
-
)
|
|
989
|
-
unitDisableAbility(
|
|
990
|
-
handle,
|
|
991
|
-
fourCC("Amov"),
|
|
992
|
-
false,
|
|
993
|
-
false
|
|
994
|
-
)
|
|
995
|
-
end
|
|
996
|
-
function Unit.prototype.interruptAttack(self)
|
|
997
|
-
unitInterruptAttack(self.handle)
|
|
998
|
-
end
|
|
999
1016
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
1000
1017
|
local handle = self.handle
|
|
1001
1018
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1066,18 +1083,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1066
1083
|
end
|
|
1067
1084
|
function Unit.prototype.incrementStunCounter(self)
|
|
1068
1085
|
local stunCounter = self[102] or 0
|
|
1069
|
-
if not self[101] or stunCounter >= 0 then
|
|
1086
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1070
1087
|
BlzPauseUnitEx(self.handle, true)
|
|
1071
1088
|
end
|
|
1072
1089
|
self[102] = stunCounter + 1
|
|
1073
1090
|
end
|
|
1074
1091
|
function Unit.prototype.decrementStunCounter(self)
|
|
1075
1092
|
local stunCounter = self[102] or 0
|
|
1076
|
-
if not self[101] or stunCounter >= 1 then
|
|
1093
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1077
1094
|
BlzPauseUnitEx(self.handle, false)
|
|
1078
1095
|
end
|
|
1079
1096
|
self[102] = stunCounter - 1
|
|
1080
1097
|
end
|
|
1098
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1099
|
+
local forceStunCounter = self[103] or 0
|
|
1100
|
+
if forceStunCounter == 0 then
|
|
1101
|
+
local handle = self.handle
|
|
1102
|
+
if not self[101] then
|
|
1103
|
+
for _ = self[102] or 0, -1 do
|
|
1104
|
+
BlzPauseUnitEx(handle, true)
|
|
1105
|
+
end
|
|
1106
|
+
end
|
|
1107
|
+
BlzPauseUnitEx(handle, true)
|
|
1108
|
+
end
|
|
1109
|
+
self[103] = forceStunCounter + 1
|
|
1110
|
+
end
|
|
1111
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1112
|
+
local forceStunCounter = self[103] or 0
|
|
1113
|
+
if forceStunCounter == 1 then
|
|
1114
|
+
local handle = self.handle
|
|
1115
|
+
if not self[101] then
|
|
1116
|
+
for _ = self[102] or 0, -1 do
|
|
1117
|
+
BlzPauseUnitEx(handle, false)
|
|
1118
|
+
end
|
|
1119
|
+
end
|
|
1120
|
+
BlzPauseUnitEx(handle, false)
|
|
1121
|
+
end
|
|
1122
|
+
self[103] = forceStunCounter - 1
|
|
1123
|
+
end
|
|
1081
1124
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1082
1125
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1083
1126
|
owner.handle,
|
|
@@ -1364,19 +1407,6 @@ __TS__SetDescriptor(
|
|
|
1364
1407
|
},
|
|
1365
1408
|
true
|
|
1366
1409
|
)
|
|
1367
|
-
__TS__SetDescriptor(
|
|
1368
|
-
Unit.prototype,
|
|
1369
|
-
"strengthBase",
|
|
1370
|
-
{
|
|
1371
|
-
get = function(self)
|
|
1372
|
-
return getHeroStr(self.handle, false)
|
|
1373
|
-
end,
|
|
1374
|
-
set = function(self, strengthBase)
|
|
1375
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1376
|
-
end
|
|
1377
|
-
},
|
|
1378
|
-
true
|
|
1379
|
-
)
|
|
1380
1410
|
__TS__SetDescriptor(
|
|
1381
1411
|
Unit.prototype,
|
|
1382
1412
|
"strengthBonus",
|
|
@@ -1394,19 +1424,6 @@ __TS__SetDescriptor(
|
|
|
1394
1424
|
end},
|
|
1395
1425
|
true
|
|
1396
1426
|
)
|
|
1397
|
-
__TS__SetDescriptor(
|
|
1398
|
-
Unit.prototype,
|
|
1399
|
-
"agilityBase",
|
|
1400
|
-
{
|
|
1401
|
-
get = function(self)
|
|
1402
|
-
return getHeroAgi(self.handle, false)
|
|
1403
|
-
end,
|
|
1404
|
-
set = function(self, agilityBase)
|
|
1405
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1406
|
-
end
|
|
1407
|
-
},
|
|
1408
|
-
true
|
|
1409
|
-
)
|
|
1410
1427
|
__TS__SetDescriptor(
|
|
1411
1428
|
Unit.prototype,
|
|
1412
1429
|
"agilityBonus",
|
|
@@ -1424,19 +1441,6 @@ __TS__SetDescriptor(
|
|
|
1424
1441
|
end},
|
|
1425
1442
|
true
|
|
1426
1443
|
)
|
|
1427
|
-
__TS__SetDescriptor(
|
|
1428
|
-
Unit.prototype,
|
|
1429
|
-
"intelligenceBase",
|
|
1430
|
-
{
|
|
1431
|
-
get = function(self)
|
|
1432
|
-
return getHeroInt(self.handle, false)
|
|
1433
|
-
end,
|
|
1434
|
-
set = function(self, intelligenceBase)
|
|
1435
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1436
|
-
end
|
|
1437
|
-
},
|
|
1438
|
-
true
|
|
1439
|
-
)
|
|
1440
1444
|
__TS__SetDescriptor(
|
|
1441
1445
|
Unit.prototype,
|
|
1442
1446
|
"intelligenceBonus",
|
|
@@ -1485,7 +1489,7 @@ __TS__SetDescriptor(
|
|
|
1485
1489
|
"isTeamGlowVisible",
|
|
1486
1490
|
{
|
|
1487
1491
|
get = function(self)
|
|
1488
|
-
return not self[
|
|
1492
|
+
return not self[107]
|
|
1489
1493
|
end,
|
|
1490
1494
|
set = function(self, isTeamGlowVisible)
|
|
1491
1495
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
@@ -1495,7 +1499,7 @@ __TS__SetDescriptor(
|
|
|
1495
1499
|
else
|
|
1496
1500
|
____temp_7 = nil
|
|
1497
1501
|
end
|
|
1498
|
-
self[
|
|
1502
|
+
self[107] = ____temp_7
|
|
1499
1503
|
end
|
|
1500
1504
|
},
|
|
1501
1505
|
true
|
|
@@ -1505,7 +1509,7 @@ __TS__SetDescriptor(
|
|
|
1505
1509
|
"color",
|
|
1506
1510
|
{set = function(self, color)
|
|
1507
1511
|
SetUnitColor(self.handle, color.handle)
|
|
1508
|
-
if self[
|
|
1512
|
+
if self[107] then
|
|
1509
1513
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1510
1514
|
end
|
|
1511
1515
|
end},
|
|
@@ -1529,14 +1533,14 @@ __TS__SetDescriptor(
|
|
|
1529
1533
|
"maxHealth",
|
|
1530
1534
|
{
|
|
1531
1535
|
get = function(self)
|
|
1532
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1536
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1533
1537
|
end,
|
|
1534
1538
|
set = function(self, maxHealth)
|
|
1535
|
-
if maxHealth < 1 and self[
|
|
1536
|
-
self[
|
|
1539
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1540
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1537
1541
|
maxHealth = 1
|
|
1538
1542
|
end
|
|
1539
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1543
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1540
1544
|
end
|
|
1541
1545
|
},
|
|
1542
1546
|
true
|
|
@@ -1578,10 +1582,10 @@ __TS__SetDescriptor(
|
|
|
1578
1582
|
"health",
|
|
1579
1583
|
{
|
|
1580
1584
|
get = function(self)
|
|
1581
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1585
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1582
1586
|
end,
|
|
1583
1587
|
set = function(self, health)
|
|
1584
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1588
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1585
1589
|
end
|
|
1586
1590
|
},
|
|
1587
1591
|
true
|
|
@@ -1657,25 +1661,12 @@ __TS__SetDescriptor(
|
|
|
1657
1661
|
},
|
|
1658
1662
|
true
|
|
1659
1663
|
)
|
|
1660
|
-
__TS__SetDescriptor(
|
|
1661
|
-
Unit.prototype,
|
|
1662
|
-
"flyHeight",
|
|
1663
|
-
{
|
|
1664
|
-
get = function(self)
|
|
1665
|
-
return getUnitFlyHeight(self.handle)
|
|
1666
|
-
end,
|
|
1667
|
-
set = function(self, v)
|
|
1668
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1669
|
-
end
|
|
1670
|
-
},
|
|
1671
|
-
true
|
|
1672
|
-
)
|
|
1673
1664
|
__TS__SetDescriptor(
|
|
1674
1665
|
Unit.prototype,
|
|
1675
1666
|
"x",
|
|
1676
1667
|
{
|
|
1677
1668
|
get = function(self)
|
|
1678
|
-
return self[
|
|
1669
|
+
return self[108] or getUnitX(self.handle)
|
|
1679
1670
|
end,
|
|
1680
1671
|
set = function(self, v)
|
|
1681
1672
|
SetUnitX(self.handle, v)
|
|
@@ -1688,7 +1679,7 @@ __TS__SetDescriptor(
|
|
|
1688
1679
|
"y",
|
|
1689
1680
|
{
|
|
1690
1681
|
get = function(self)
|
|
1691
|
-
return self[
|
|
1682
|
+
return self[109] or getUnitY(self.handle)
|
|
1692
1683
|
end,
|
|
1693
1684
|
set = function(self, v)
|
|
1694
1685
|
SetUnitY(self.handle, v)
|
|
@@ -1793,14 +1784,18 @@ __TS__SetDescriptor(
|
|
|
1793
1784
|
local handle = self.handle
|
|
1794
1785
|
if isPaused and not IsUnitPaused(handle) then
|
|
1795
1786
|
self[101] = true
|
|
1796
|
-
|
|
1797
|
-
|
|
1787
|
+
if (self[103] or 0) <= 0 then
|
|
1788
|
+
for _ = self[102] or 0, -1 do
|
|
1789
|
+
BlzPauseUnitEx(handle, true)
|
|
1790
|
+
end
|
|
1798
1791
|
end
|
|
1799
1792
|
PauseUnit(handle, true)
|
|
1800
1793
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1801
1794
|
PauseUnit(handle, false)
|
|
1802
|
-
|
|
1803
|
-
|
|
1795
|
+
if (self[103] or 0) <= 0 then
|
|
1796
|
+
for _ = self[102] or 0, -1 do
|
|
1797
|
+
BlzPauseUnitEx(handle, false)
|
|
1798
|
+
end
|
|
1804
1799
|
end
|
|
1805
1800
|
self[101] = nil
|
|
1806
1801
|
end
|
|
@@ -1858,20 +1853,6 @@ __TS__SetDescriptor(
|
|
|
1858
1853
|
},
|
|
1859
1854
|
true
|
|
1860
1855
|
)
|
|
1861
|
-
__TS__SetDescriptor(
|
|
1862
|
-
Unit.prototype,
|
|
1863
|
-
"scale",
|
|
1864
|
-
{
|
|
1865
|
-
get = function(self)
|
|
1866
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1867
|
-
end,
|
|
1868
|
-
set = function(self, v)
|
|
1869
|
-
setUnitScale(self.handle, v, v, v)
|
|
1870
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1871
|
-
end
|
|
1872
|
-
},
|
|
1873
|
-
true
|
|
1874
|
-
)
|
|
1875
1856
|
__TS__SetDescriptor(
|
|
1876
1857
|
Unit.prototype,
|
|
1877
1858
|
"timeScale",
|
|
@@ -2008,30 +1989,6 @@ __TS__SetDescriptor(
|
|
|
2008
1989
|
end},
|
|
2009
1990
|
true
|
|
2010
1991
|
)
|
|
2011
|
-
__TS__SetDescriptor(
|
|
2012
|
-
Unit.prototype,
|
|
2013
|
-
"onUnitInRange",
|
|
2014
|
-
{get = function(self)
|
|
2015
|
-
local handle = self.handle
|
|
2016
|
-
local onUnitInRange = setmetatable(
|
|
2017
|
-
{},
|
|
2018
|
-
{__index = function(self, value)
|
|
2019
|
-
local event = __TS__New(
|
|
2020
|
-
TriggerEvent,
|
|
2021
|
-
function(trigger)
|
|
2022
|
-
TriggerRegisterUnitInRangeSimple(trigger, value, handle)
|
|
2023
|
-
end,
|
|
2024
|
-
function() return ____exports.Unit:of(handle) end
|
|
2025
|
-
)
|
|
2026
|
-
rawset(self, value, event)
|
|
2027
|
-
return event
|
|
2028
|
-
end}
|
|
2029
|
-
)
|
|
2030
|
-
rawset(self, "onUnitInRange", onUnitInRange)
|
|
2031
|
-
return onUnitInRange
|
|
2032
|
-
end},
|
|
2033
|
-
true
|
|
2034
|
-
)
|
|
2035
1992
|
__TS__SetDescriptor(
|
|
2036
1993
|
Unit.prototype,
|
|
2037
1994
|
"onManaEqual",
|
|
@@ -2167,6 +2124,11 @@ __TS__SetDescriptor(
|
|
|
2167
2124
|
end},
|
|
2168
2125
|
true
|
|
2169
2126
|
)
|
|
2127
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2128
|
+
____exports.UnitTriggerEvent,
|
|
2129
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2130
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2131
|
+
)
|
|
2170
2132
|
Unit.deathEvent = __TS__New(
|
|
2171
2133
|
____exports.UnitTriggerEvent,
|
|
2172
2134
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2628,7 +2590,7 @@ Unit.onDamage = __TS__New(
|
|
|
2628
2590
|
invoke(event, source, target, evData)
|
|
2629
2591
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2630
2592
|
local bonusHealth = math.ceil(evData.amount)
|
|
2631
|
-
target[
|
|
2593
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2632
2594
|
BlzSetUnitMaxHP(
|
|
2633
2595
|
target.handle,
|
|
2634
2596
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2642,7 +2604,7 @@ Unit.onDamage = __TS__New(
|
|
|
2642
2604
|
evData[0],
|
|
2643
2605
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2644
2606
|
)
|
|
2645
|
-
target[
|
|
2607
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2646
2608
|
SetWidgetLife(
|
|
2647
2609
|
target.handle,
|
|
2648
2610
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2792,6 +2754,10 @@ __TS__ObjectDefineProperty(
|
|
|
2792
2754
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2793
2755
|
return destroyEvent
|
|
2794
2756
|
end}
|
|
2757
|
+
)
|
|
2758
|
+
Unit.synchronize = synchronizer(
|
|
2759
|
+
function(unit) return unit.syncId end,
|
|
2760
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2795
2761
|
);
|
|
2796
2762
|
(function(self)
|
|
2797
2763
|
local leaveAbilityIds = postcompile(function()
|
|
@@ -2821,7 +2787,8 @@ __TS__ObjectDefineProperty(
|
|
|
2821
2787
|
return
|
|
2822
2788
|
end
|
|
2823
2789
|
end
|
|
2824
|
-
unit:
|
|
2790
|
+
unit:saveData()
|
|
2791
|
+
Timer:run(unit, "destroy")
|
|
2825
2792
|
end)
|
|
2826
2793
|
end
|
|
2827
2794
|
end)(Unit)
|
package/engine/local-client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Unit } from "../core/types/unit";
|
|
|
3
3
|
import { Async } from "../core/types/async";
|
|
4
4
|
import { Event, TriggerEvent } from "../event";
|
|
5
5
|
import { GraphicsMode } from "./index";
|
|
6
|
+
import { Color } from "../core/types/color";
|
|
6
7
|
export declare class LocalClient {
|
|
7
8
|
private constructor();
|
|
8
9
|
static readonly locale: string;
|
|
@@ -11,6 +12,7 @@ export declare class LocalClient {
|
|
|
11
12
|
static get isHD(): boolean;
|
|
12
13
|
static get graphicsMode(): GraphicsMode;
|
|
13
14
|
static get isActive(): boolean;
|
|
15
|
+
static pingMinimap(x: number, y: number, duration: number, ...parameters: [] | [red: number, green: number, blue: number, flashy?: boolean] | [color: Color, flashy?: boolean]): void;
|
|
14
16
|
static get mouseFocusUnit(): Async<Unit> | undefined;
|
|
15
17
|
static get mainSelectedUnit(): Async<Unit> | undefined;
|
|
16
18
|
static get mainSelectedUnitChangeEvent(): Event<[
|
package/engine/local-client.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
4
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
4
5
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
5
6
|
local __TS__New = ____lualib.__TS__New
|
|
6
7
|
local ____exports = {}
|
|
@@ -15,6 +16,8 @@ local ____player = require("core.types.player")
|
|
|
15
16
|
local Player = ____player.Player
|
|
16
17
|
local ____timer = require("core.types.timer")
|
|
17
18
|
local Timer = ____timer.Timer
|
|
19
|
+
local ____color = require("core.types.color")
|
|
20
|
+
local Color = ____color.Color
|
|
18
21
|
local loadTOCFile = BlzLoadTOCFile
|
|
19
22
|
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
20
23
|
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
@@ -25,6 +28,8 @@ local getMouseFocusUnit = BlzGetMouseFocusUnit
|
|
|
25
28
|
local getUnitRealField = BlzGetUnitRealField
|
|
26
29
|
local getUnitTypeId = GetUnitTypeId
|
|
27
30
|
local getLocale = BlzGetLocale
|
|
31
|
+
local pingMinimap = PingMinimap
|
|
32
|
+
local pingMinimapEx = PingMinimapEx
|
|
28
33
|
local tableSort = table.sort
|
|
29
34
|
local tocPath = "_warscript\\IsHD.toc"
|
|
30
35
|
compiletime(function()
|
|
@@ -62,6 +67,31 @@ local LocalClient = ____exports.LocalClient
|
|
|
62
67
|
LocalClient.name = "LocalClient"
|
|
63
68
|
function LocalClient.prototype.____constructor(self)
|
|
64
69
|
end
|
|
70
|
+
function LocalClient.pingMinimap(self, x, y, duration, redOrColor, greenOrFlashy, blue, flashy)
|
|
71
|
+
if redOrColor == nil then
|
|
72
|
+
pingMinimap(x, y, duration)
|
|
73
|
+
elseif __TS__InstanceOf(redOrColor, Color) then
|
|
74
|
+
pingMinimapEx(
|
|
75
|
+
x,
|
|
76
|
+
y,
|
|
77
|
+
duration,
|
|
78
|
+
redOrColor.r,
|
|
79
|
+
redOrColor.g,
|
|
80
|
+
redOrColor.b,
|
|
81
|
+
greenOrFlashy or false
|
|
82
|
+
)
|
|
83
|
+
else
|
|
84
|
+
pingMinimapEx(
|
|
85
|
+
x,
|
|
86
|
+
y,
|
|
87
|
+
duration,
|
|
88
|
+
redOrColor,
|
|
89
|
+
greenOrFlashy,
|
|
90
|
+
blue,
|
|
91
|
+
flashy or false
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
65
95
|
LocalClient.locale = getLocale()
|
|
66
96
|
__TS__ObjectDefineProperty(
|
|
67
97
|
LocalClient,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityType, AbilityTypeId } from "../ability-type";
|
|
3
|
+
import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
|
|
4
|
+
export declare class ManaRegenerationAbilityType extends AbilityType {
|
|
5
|
+
static readonly BASE_ID: AbilityTypeId;
|
|
6
|
+
get manaRegenerationRateIncreaseFactor(): number[];
|
|
7
|
+
set manaRegenerationRateIncreaseFactor(manaRegenerationRateIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
7
|
+
local AbilityType = ____ability_2Dtype.AbilityType
|
|
8
|
+
____exports.ManaRegenerationAbilityType = __TS__Class()
|
|
9
|
+
local ManaRegenerationAbilityType = ____exports.ManaRegenerationAbilityType
|
|
10
|
+
ManaRegenerationAbilityType.name = "ManaRegenerationAbilityType"
|
|
11
|
+
__TS__ClassExtends(ManaRegenerationAbilityType, AbilityType)
|
|
12
|
+
ManaRegenerationAbilityType.BASE_ID = fourCC("AIrn")
|
|
13
|
+
__TS__SetDescriptor(
|
|
14
|
+
ManaRegenerationAbilityType.prototype,
|
|
15
|
+
"manaRegenerationRateIncreaseFactor",
|
|
16
|
+
{
|
|
17
|
+
get = function(self)
|
|
18
|
+
return self:getNumberLevelField("Imrp")
|
|
19
|
+
end,
|
|
20
|
+
set = function(self, manaRegenerationRateIncreaseFactor)
|
|
21
|
+
self:setNumberLevelField("Imrp", manaRegenerationRateIncreaseFactor)
|
|
22
|
+
end
|
|
23
|
+
},
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
return ____exports
|