warscript 0.0.1-dev.c60b168 → 0.0.1-dev.c677d41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +1 -0
- package/attributes.lua +9 -0
- package/core/types/frame.lua +14 -9
- package/core/types/handle.lua +1 -1
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/playerCamera.lua +44 -0
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +8 -2
- package/decl/native.d.ts +2 -2
- 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 +2 -1
- package/engine/behaviour/ability.lua +2 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +9 -5
- package/engine/behaviour/unit/stun-immunity.lua +17 -7
- package/engine/behaviour/unit.d.ts +9 -3
- package/engine/behaviour/unit.lua +106 -24
- package/engine/buff.d.ts +19 -4
- package/engine/buff.lua +122 -41
- package/engine/internal/ability.lua +6 -5
- package/engine/internal/item.d.ts +13 -15
- package/engine/internal/item.lua +59 -48
- 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/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- 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/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit-missile-launch.lua +51 -20
- package/engine/internal/unit.d.ts +16 -20
- package/engine/internal/unit.lua +159 -160
- 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/ability-type.lua +4 -1
- 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/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +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 +3 -2
- package/engine/unit.d.ts +4 -0
- package/engine/unit.lua +4 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +10 -8
- package/package.json +2 -2
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +5 -1
- package/utility/callback-array.lua +16 -1
- package/utility/linked-map.d.ts +26 -0
- package/utility/linked-map.lua +66 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +23 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/records.lua +20 -1
- package/utility/types.d.ts +3 -0
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 = {
|
|
@@ -410,6 +421,19 @@ function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
|
410
421
|
self.unit = unit
|
|
411
422
|
self.index = index
|
|
412
423
|
end
|
|
424
|
+
__TS__SetDescriptor(
|
|
425
|
+
UnitWeapon.prototype,
|
|
426
|
+
"isEnabled",
|
|
427
|
+
{
|
|
428
|
+
get = function(self)
|
|
429
|
+
return BlzGetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index)
|
|
430
|
+
end,
|
|
431
|
+
set = function(self, isEnabled)
|
|
432
|
+
BlzSetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index, isEnabled)
|
|
433
|
+
end
|
|
434
|
+
},
|
|
435
|
+
true
|
|
436
|
+
)
|
|
413
437
|
__TS__SetDescriptor(
|
|
414
438
|
UnitWeapon.prototype,
|
|
415
439
|
"cooldown",
|
|
@@ -633,26 +657,30 @@ local fieldSetters = {
|
|
|
633
657
|
}
|
|
634
658
|
local dummies = {}
|
|
635
659
|
for ____, player in ipairs(Player.all) do
|
|
636
|
-
local dummy = assert(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
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
|
+
)
|
|
643
671
|
ShowUnit(dummy, false)
|
|
644
672
|
dummies[player] = dummy
|
|
645
673
|
end
|
|
646
674
|
local function delayHealthChecksCallback(unit)
|
|
647
|
-
local counter = (unit[
|
|
675
|
+
local counter = (unit[104] or 0) - 1
|
|
648
676
|
if counter ~= 0 then
|
|
649
|
-
unit[
|
|
677
|
+
unit[104] = counter
|
|
650
678
|
return
|
|
651
679
|
end
|
|
652
|
-
unit[
|
|
653
|
-
local healthBonus = unit[
|
|
680
|
+
unit[104] = nil
|
|
681
|
+
local healthBonus = unit[105]
|
|
654
682
|
if healthBonus ~= nil then
|
|
655
|
-
unit[
|
|
683
|
+
unit[105] = nil
|
|
656
684
|
local handle = unit.handle
|
|
657
685
|
BlzSetUnitMaxHP(
|
|
658
686
|
handle,
|
|
@@ -682,38 +710,52 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
682
710
|
nextSyncId = ____nextSyncId_1 + 1
|
|
683
711
|
self.syncId = ____nextSyncId_1
|
|
684
712
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
685
|
-
assert(
|
|
686
|
-
|
|
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
|
+
)
|
|
687
723
|
if unitAddAbility(
|
|
688
724
|
handle,
|
|
689
725
|
fourCC("Amrf")
|
|
690
726
|
) then
|
|
691
|
-
assert(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
727
|
+
assert(
|
|
728
|
+
unitRemoveAbility(
|
|
729
|
+
handle,
|
|
730
|
+
fourCC("Amrf")
|
|
731
|
+
),
|
|
732
|
+
"fly ability must be removed after addition",
|
|
733
|
+
self
|
|
734
|
+
)
|
|
695
735
|
end
|
|
696
736
|
unitBySyncId[self.syncId] = self
|
|
697
737
|
local ____ = self.abilities
|
|
698
738
|
end
|
|
699
|
-
function Unit.prototype.getEvent(self,
|
|
700
|
-
self.events = self.events or (
|
|
701
|
-
local eventId = GetHandleId(
|
|
702
|
-
|
|
703
|
-
|
|
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(
|
|
704
745
|
TriggerEvent,
|
|
705
746
|
function(trigger)
|
|
706
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
747
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
707
748
|
end,
|
|
708
749
|
collector or (function() return {} end)
|
|
709
750
|
)
|
|
751
|
+
self.events:put(eventId, event)
|
|
710
752
|
end
|
|
711
|
-
return
|
|
753
|
+
return event
|
|
712
754
|
end
|
|
713
755
|
function Unit.prototype.onDestroy(self)
|
|
714
756
|
local handle = self.handle
|
|
715
|
-
self[
|
|
716
|
-
self[
|
|
757
|
+
self[108] = getUnitX(handle)
|
|
758
|
+
self[109] = getUnitY(handle)
|
|
717
759
|
if not self._owner then
|
|
718
760
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
719
761
|
end
|
|
@@ -752,7 +794,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
|
|
|
752
794
|
self._attackHandlers = handlers
|
|
753
795
|
if #handlers == 1 then
|
|
754
796
|
local handle = self.handle
|
|
755
|
-
assert(
|
|
797
|
+
assert(
|
|
798
|
+
unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
|
|
799
|
+
"attack handler ability must be added",
|
|
800
|
+
self
|
|
801
|
+
)
|
|
756
802
|
end
|
|
757
803
|
return handler
|
|
758
804
|
end
|
|
@@ -836,16 +882,18 @@ function Unit.prototype.queueAnimation(self, animation)
|
|
|
836
882
|
QueueUnitAnimation(self.handle, animation)
|
|
837
883
|
end
|
|
838
884
|
function Unit.prototype.chooseWeapon(self, target)
|
|
839
|
-
|
|
840
|
-
|
|
885
|
+
local firstWeapon = self.firstWeapon
|
|
886
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
887
|
+
return firstWeapon
|
|
841
888
|
end
|
|
842
|
-
|
|
843
|
-
|
|
889
|
+
local secondWeapon = self.secondWeapon
|
|
890
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
891
|
+
return secondWeapon
|
|
844
892
|
end
|
|
845
893
|
return nil
|
|
846
894
|
end
|
|
847
895
|
function Unit.prototype.delayHealthChecks(self)
|
|
848
|
-
self[
|
|
896
|
+
self[104] = (self[104] or 0) + 1
|
|
849
897
|
Timer:run(delayHealthChecksCallback, self)
|
|
850
898
|
end
|
|
851
899
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -935,20 +983,21 @@ end
|
|
|
935
983
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
936
984
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
937
985
|
end
|
|
938
|
-
function Unit.prototype.
|
|
986
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
939
987
|
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
940
988
|
return UnitAbility:of(ability, abilityId, self)
|
|
941
989
|
end
|
|
942
|
-
function Unit.prototype.removeAbility(self,
|
|
990
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
943
991
|
local abilities = self.abilities
|
|
944
992
|
for i = 1, #abilities do
|
|
945
|
-
if abilities[i].typeId ==
|
|
946
|
-
abilities[i]
|
|
993
|
+
if abilities[i].typeId == abilityTypeId then
|
|
994
|
+
local ability = abilities[i]
|
|
947
995
|
tremove(abilities, i)
|
|
996
|
+
ability:destroy()
|
|
948
997
|
return true
|
|
949
998
|
end
|
|
950
999
|
end
|
|
951
|
-
return
|
|
1000
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
952
1001
|
end
|
|
953
1002
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
954
1003
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -962,24 +1011,6 @@ end
|
|
|
962
1011
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
963
1012
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
964
1013
|
end
|
|
965
|
-
function Unit.prototype.interruptMovement(self)
|
|
966
|
-
local handle = self.handle
|
|
967
|
-
unitDisableAbility(
|
|
968
|
-
handle,
|
|
969
|
-
fourCC("Amov"),
|
|
970
|
-
true,
|
|
971
|
-
false
|
|
972
|
-
)
|
|
973
|
-
unitDisableAbility(
|
|
974
|
-
handle,
|
|
975
|
-
fourCC("Amov"),
|
|
976
|
-
false,
|
|
977
|
-
false
|
|
978
|
-
)
|
|
979
|
-
end
|
|
980
|
-
function Unit.prototype.interruptAttack(self)
|
|
981
|
-
unitInterruptAttack(self.handle)
|
|
982
|
-
end
|
|
983
1014
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
984
1015
|
local handle = self.handle
|
|
985
1016
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1050,18 +1081,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1050
1081
|
end
|
|
1051
1082
|
function Unit.prototype.incrementStunCounter(self)
|
|
1052
1083
|
local stunCounter = self[102] or 0
|
|
1053
|
-
if not self[101] or stunCounter >= 0 then
|
|
1084
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1054
1085
|
BlzPauseUnitEx(self.handle, true)
|
|
1055
1086
|
end
|
|
1056
1087
|
self[102] = stunCounter + 1
|
|
1057
1088
|
end
|
|
1058
1089
|
function Unit.prototype.decrementStunCounter(self)
|
|
1059
1090
|
local stunCounter = self[102] or 0
|
|
1060
|
-
if not self[101] or stunCounter >= 1 then
|
|
1091
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1061
1092
|
BlzPauseUnitEx(self.handle, false)
|
|
1062
1093
|
end
|
|
1063
1094
|
self[102] = stunCounter - 1
|
|
1064
1095
|
end
|
|
1096
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1097
|
+
local forceStunCounter = self[103] or 0
|
|
1098
|
+
if forceStunCounter == 0 then
|
|
1099
|
+
local handle = self.handle
|
|
1100
|
+
if not self[101] then
|
|
1101
|
+
for _ = self[102] or 0, -1 do
|
|
1102
|
+
BlzPauseUnitEx(handle, true)
|
|
1103
|
+
end
|
|
1104
|
+
end
|
|
1105
|
+
BlzPauseUnitEx(handle, true)
|
|
1106
|
+
end
|
|
1107
|
+
self[103] = forceStunCounter + 1
|
|
1108
|
+
end
|
|
1109
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1110
|
+
local forceStunCounter = self[103] or 0
|
|
1111
|
+
if forceStunCounter == 1 then
|
|
1112
|
+
local handle = self.handle
|
|
1113
|
+
if not self[101] then
|
|
1114
|
+
for _ = self[102] or 0, -1 do
|
|
1115
|
+
BlzPauseUnitEx(handle, false)
|
|
1116
|
+
end
|
|
1117
|
+
end
|
|
1118
|
+
BlzPauseUnitEx(handle, false)
|
|
1119
|
+
end
|
|
1120
|
+
self[103] = forceStunCounter - 1
|
|
1121
|
+
end
|
|
1065
1122
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1066
1123
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1067
1124
|
owner.handle,
|
|
@@ -1348,19 +1405,6 @@ __TS__SetDescriptor(
|
|
|
1348
1405
|
},
|
|
1349
1406
|
true
|
|
1350
1407
|
)
|
|
1351
|
-
__TS__SetDescriptor(
|
|
1352
|
-
Unit.prototype,
|
|
1353
|
-
"strengthBase",
|
|
1354
|
-
{
|
|
1355
|
-
get = function(self)
|
|
1356
|
-
return getHeroStr(self.handle, false)
|
|
1357
|
-
end,
|
|
1358
|
-
set = function(self, strengthBase)
|
|
1359
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1360
|
-
end
|
|
1361
|
-
},
|
|
1362
|
-
true
|
|
1363
|
-
)
|
|
1364
1408
|
__TS__SetDescriptor(
|
|
1365
1409
|
Unit.prototype,
|
|
1366
1410
|
"strengthBonus",
|
|
@@ -1378,19 +1422,6 @@ __TS__SetDescriptor(
|
|
|
1378
1422
|
end},
|
|
1379
1423
|
true
|
|
1380
1424
|
)
|
|
1381
|
-
__TS__SetDescriptor(
|
|
1382
|
-
Unit.prototype,
|
|
1383
|
-
"agilityBase",
|
|
1384
|
-
{
|
|
1385
|
-
get = function(self)
|
|
1386
|
-
return getHeroAgi(self.handle, false)
|
|
1387
|
-
end,
|
|
1388
|
-
set = function(self, agilityBase)
|
|
1389
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1390
|
-
end
|
|
1391
|
-
},
|
|
1392
|
-
true
|
|
1393
|
-
)
|
|
1394
1425
|
__TS__SetDescriptor(
|
|
1395
1426
|
Unit.prototype,
|
|
1396
1427
|
"agilityBonus",
|
|
@@ -1408,19 +1439,6 @@ __TS__SetDescriptor(
|
|
|
1408
1439
|
end},
|
|
1409
1440
|
true
|
|
1410
1441
|
)
|
|
1411
|
-
__TS__SetDescriptor(
|
|
1412
|
-
Unit.prototype,
|
|
1413
|
-
"intelligenceBase",
|
|
1414
|
-
{
|
|
1415
|
-
get = function(self)
|
|
1416
|
-
return getHeroInt(self.handle, false)
|
|
1417
|
-
end,
|
|
1418
|
-
set = function(self, intelligenceBase)
|
|
1419
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1420
|
-
end
|
|
1421
|
-
},
|
|
1422
|
-
true
|
|
1423
|
-
)
|
|
1424
1442
|
__TS__SetDescriptor(
|
|
1425
1443
|
Unit.prototype,
|
|
1426
1444
|
"intelligenceBonus",
|
|
@@ -1469,7 +1487,7 @@ __TS__SetDescriptor(
|
|
|
1469
1487
|
"isTeamGlowVisible",
|
|
1470
1488
|
{
|
|
1471
1489
|
get = function(self)
|
|
1472
|
-
return not self[
|
|
1490
|
+
return not self[107]
|
|
1473
1491
|
end,
|
|
1474
1492
|
set = function(self, isTeamGlowVisible)
|
|
1475
1493
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
@@ -1479,7 +1497,7 @@ __TS__SetDescriptor(
|
|
|
1479
1497
|
else
|
|
1480
1498
|
____temp_7 = nil
|
|
1481
1499
|
end
|
|
1482
|
-
self[
|
|
1500
|
+
self[107] = ____temp_7
|
|
1483
1501
|
end
|
|
1484
1502
|
},
|
|
1485
1503
|
true
|
|
@@ -1489,7 +1507,7 @@ __TS__SetDescriptor(
|
|
|
1489
1507
|
"color",
|
|
1490
1508
|
{set = function(self, color)
|
|
1491
1509
|
SetUnitColor(self.handle, color.handle)
|
|
1492
|
-
if self[
|
|
1510
|
+
if self[107] then
|
|
1493
1511
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1494
1512
|
end
|
|
1495
1513
|
end},
|
|
@@ -1513,14 +1531,14 @@ __TS__SetDescriptor(
|
|
|
1513
1531
|
"maxHealth",
|
|
1514
1532
|
{
|
|
1515
1533
|
get = function(self)
|
|
1516
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1534
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1517
1535
|
end,
|
|
1518
1536
|
set = function(self, maxHealth)
|
|
1519
|
-
if maxHealth < 1 and self[
|
|
1520
|
-
self[
|
|
1537
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1538
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1521
1539
|
maxHealth = 1
|
|
1522
1540
|
end
|
|
1523
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1541
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1524
1542
|
end
|
|
1525
1543
|
},
|
|
1526
1544
|
true
|
|
@@ -1562,10 +1580,10 @@ __TS__SetDescriptor(
|
|
|
1562
1580
|
"health",
|
|
1563
1581
|
{
|
|
1564
1582
|
get = function(self)
|
|
1565
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1583
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1566
1584
|
end,
|
|
1567
1585
|
set = function(self, health)
|
|
1568
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1586
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1569
1587
|
end
|
|
1570
1588
|
},
|
|
1571
1589
|
true
|
|
@@ -1641,25 +1659,12 @@ __TS__SetDescriptor(
|
|
|
1641
1659
|
},
|
|
1642
1660
|
true
|
|
1643
1661
|
)
|
|
1644
|
-
__TS__SetDescriptor(
|
|
1645
|
-
Unit.prototype,
|
|
1646
|
-
"flyHeight",
|
|
1647
|
-
{
|
|
1648
|
-
get = function(self)
|
|
1649
|
-
return getUnitFlyHeight(self.handle)
|
|
1650
|
-
end,
|
|
1651
|
-
set = function(self, v)
|
|
1652
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1653
|
-
end
|
|
1654
|
-
},
|
|
1655
|
-
true
|
|
1656
|
-
)
|
|
1657
1662
|
__TS__SetDescriptor(
|
|
1658
1663
|
Unit.prototype,
|
|
1659
1664
|
"x",
|
|
1660
1665
|
{
|
|
1661
1666
|
get = function(self)
|
|
1662
|
-
return self[
|
|
1667
|
+
return self[108] or getUnitX(self.handle)
|
|
1663
1668
|
end,
|
|
1664
1669
|
set = function(self, v)
|
|
1665
1670
|
SetUnitX(self.handle, v)
|
|
@@ -1672,7 +1677,7 @@ __TS__SetDescriptor(
|
|
|
1672
1677
|
"y",
|
|
1673
1678
|
{
|
|
1674
1679
|
get = function(self)
|
|
1675
|
-
return self[
|
|
1680
|
+
return self[109] or getUnitY(self.handle)
|
|
1676
1681
|
end,
|
|
1677
1682
|
set = function(self, v)
|
|
1678
1683
|
SetUnitY(self.handle, v)
|
|
@@ -1777,14 +1782,18 @@ __TS__SetDescriptor(
|
|
|
1777
1782
|
local handle = self.handle
|
|
1778
1783
|
if isPaused and not IsUnitPaused(handle) then
|
|
1779
1784
|
self[101] = true
|
|
1780
|
-
|
|
1781
|
-
|
|
1785
|
+
if (self[103] or 0) <= 0 then
|
|
1786
|
+
for _ = self[102] or 0, -1 do
|
|
1787
|
+
BlzPauseUnitEx(handle, true)
|
|
1788
|
+
end
|
|
1782
1789
|
end
|
|
1783
1790
|
PauseUnit(handle, true)
|
|
1784
1791
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1785
1792
|
PauseUnit(handle, false)
|
|
1786
|
-
|
|
1787
|
-
|
|
1793
|
+
if (self[103] or 0) <= 0 then
|
|
1794
|
+
for _ = self[102] or 0, -1 do
|
|
1795
|
+
BlzPauseUnitEx(handle, false)
|
|
1796
|
+
end
|
|
1788
1797
|
end
|
|
1789
1798
|
self[101] = nil
|
|
1790
1799
|
end
|
|
@@ -1842,20 +1851,6 @@ __TS__SetDescriptor(
|
|
|
1842
1851
|
},
|
|
1843
1852
|
true
|
|
1844
1853
|
)
|
|
1845
|
-
__TS__SetDescriptor(
|
|
1846
|
-
Unit.prototype,
|
|
1847
|
-
"scale",
|
|
1848
|
-
{
|
|
1849
|
-
get = function(self)
|
|
1850
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1851
|
-
end,
|
|
1852
|
-
set = function(self, v)
|
|
1853
|
-
setUnitScale(self.handle, v, v, v)
|
|
1854
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1855
|
-
end
|
|
1856
|
-
},
|
|
1857
|
-
true
|
|
1858
|
-
)
|
|
1859
1854
|
__TS__SetDescriptor(
|
|
1860
1855
|
Unit.prototype,
|
|
1861
1856
|
"timeScale",
|
|
@@ -2151,6 +2146,11 @@ __TS__SetDescriptor(
|
|
|
2151
2146
|
end},
|
|
2152
2147
|
true
|
|
2153
2148
|
)
|
|
2149
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2150
|
+
____exports.UnitTriggerEvent,
|
|
2151
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2152
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2153
|
+
)
|
|
2154
2154
|
Unit.deathEvent = __TS__New(
|
|
2155
2155
|
____exports.UnitTriggerEvent,
|
|
2156
2156
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2467,12 +2467,7 @@ Unit.onDamaging = (function()
|
|
|
2467
2467
|
preventRetaliation = damagingEventPreventRetaliation
|
|
2468
2468
|
}
|
|
2469
2469
|
if data.isAttack and source then
|
|
2470
|
-
|
|
2471
|
-
if weapon == -1 then
|
|
2472
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2473
|
-
weapon = 0
|
|
2474
|
-
end
|
|
2475
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2470
|
+
data.weapon = source:chooseWeapon(target)
|
|
2476
2471
|
end
|
|
2477
2472
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2478
2473
|
invoke(
|
|
@@ -2617,7 +2612,7 @@ Unit.onDamage = __TS__New(
|
|
|
2617
2612
|
invoke(event, source, target, evData)
|
|
2618
2613
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2619
2614
|
local bonusHealth = math.ceil(evData.amount)
|
|
2620
|
-
target[
|
|
2615
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2621
2616
|
BlzSetUnitMaxHP(
|
|
2622
2617
|
target.handle,
|
|
2623
2618
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2631,7 +2626,7 @@ Unit.onDamage = __TS__New(
|
|
|
2631
2626
|
evData[0],
|
|
2632
2627
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2633
2628
|
)
|
|
2634
|
-
target[
|
|
2629
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2635
2630
|
SetWidgetLife(
|
|
2636
2631
|
target.handle,
|
|
2637
2632
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2781,6 +2776,10 @@ __TS__ObjectDefineProperty(
|
|
|
2781
2776
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2782
2777
|
return destroyEvent
|
|
2783
2778
|
end}
|
|
2779
|
+
)
|
|
2780
|
+
Unit.synchronize = synchronizer(
|
|
2781
|
+
function(unit) return unit.syncId end,
|
|
2782
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2784
2783
|
);
|
|
2785
2784
|
(function(self)
|
|
2786
2785
|
local leaveAbilityIds = postcompile(function()
|
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
|
+
}
|