warscript 0.0.1-dev.d5f6f38 → 0.0.1-dev.d690591
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 +2 -3
- package/core/types/effect.lua +97 -50
- 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/decl/native.d.ts +840 -786
- 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 +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- 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 +56 -41
- package/engine/buff.lua +295 -228
- package/engine/internal/ability.d.ts +13 -2
- package/engine/internal/ability.lua +77 -4
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item.d.ts +4 -3
- 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/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -0
- 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.lua +6 -12
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit.d.ts +19 -3
- package/engine/internal/unit.lua +144 -45
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- 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/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/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 +10 -3
- package/engine/object-data/entry/unit-type.lua +155 -92
- 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 +10 -4
- package/engine/object-field/ability.lua +3 -0
- package/engine/object-field/unit.d.ts +46 -3
- package/engine/object-field/unit.lua +173 -7
- package/engine/object-field.d.ts +11 -3
- package/engine/object-field.lua +162 -76
- 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 +1 -0
- package/engine/unit.lua +1 -0
- package/objutil/buff.lua +1 -2
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +3 -0
- package/utility/lua-maps.lua +16 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
- package/utility/reflection.lua +11 -7
package/engine/internal/unit.lua
CHANGED
|
@@ -51,11 +51,19 @@ local ____arrays = require("utility.arrays")
|
|
|
51
51
|
local forEach = ____arrays.forEach
|
|
52
52
|
local ____math = require("math")
|
|
53
53
|
local min = ____math.min
|
|
54
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
56
|
+
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
|
+
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
|
+
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
|
+
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
60
|
+
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
54
61
|
local match = string.match
|
|
55
62
|
local ____tostring = _G.tostring
|
|
56
63
|
local setUnitAnimation = SetUnitAnimation
|
|
57
64
|
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
58
65
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
66
|
+
local resetUnitAnimation = ResetUnitAnimation
|
|
59
67
|
local queueUnitAnimation = QueueUnitAnimation
|
|
60
68
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
61
69
|
local getUnitRealField = BlzGetUnitRealField
|
|
@@ -75,9 +83,9 @@ local setUnitScale = SetUnitScale
|
|
|
75
83
|
local setUnitPosition = SetUnitPosition
|
|
76
84
|
local setUnitTimeScale = SetUnitTimeScale
|
|
77
85
|
local getHandleId = GetHandleId
|
|
86
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
78
87
|
local createUnit = CreateUnit
|
|
79
88
|
local killUnit = KillUnit
|
|
80
|
-
local setUnitExploded = SetUnitExploded
|
|
81
89
|
local removeUnit = RemoveUnit
|
|
82
90
|
local getUnitTypeId = GetUnitTypeId
|
|
83
91
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -93,8 +101,6 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
93
101
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
94
102
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
95
103
|
local isUnitInRange = IsUnitInRange
|
|
96
|
-
local setResourceAmount = SetResourceAmount
|
|
97
|
-
local getResourceAmount = GetResourceAmount
|
|
98
104
|
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
99
105
|
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
100
106
|
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
@@ -125,8 +131,6 @@ local isUnitType = IsUnitType
|
|
|
125
131
|
local isUnitAlly = IsUnitAlly
|
|
126
132
|
local isUnitEnemy = IsUnitEnemy
|
|
127
133
|
local getOwningPlayer = GetOwningPlayer
|
|
128
|
-
local setUnitColor = SetUnitColor
|
|
129
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
130
134
|
____exports.UnitClassification = {}
|
|
131
135
|
local UnitClassification = ____exports.UnitClassification
|
|
132
136
|
do
|
|
@@ -354,7 +358,14 @@ local function damageEventPreventDeath(self, callback, ...)
|
|
|
354
358
|
rawset(self, 1 + i, (select(i, ...)))
|
|
355
359
|
end
|
|
356
360
|
end
|
|
357
|
-
local damageSetters = {
|
|
361
|
+
local damageSetters = {
|
|
362
|
+
amount = BlzSetEventDamage,
|
|
363
|
+
attackType = function(attackType)
|
|
364
|
+
return BlzSetEventAttackType(attackTypeToNative(attackType))
|
|
365
|
+
end,
|
|
366
|
+
damageType = BlzSetEventDamageType,
|
|
367
|
+
weaponType = BlzSetEventWeaponType
|
|
368
|
+
}
|
|
358
369
|
local jlimitopByOperator = {
|
|
359
370
|
[0] = LESS_THAN_OR_EQUAL,
|
|
360
371
|
[1] = LESS_THAN_OR_EQUAL,
|
|
@@ -636,7 +647,8 @@ local function delayHealthChecksCallback(unit)
|
|
|
636
647
|
end
|
|
637
648
|
end
|
|
638
649
|
local nextSyncId = 1
|
|
639
|
-
local unitBySyncId = setmetatable({}, {__mode = "
|
|
650
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
651
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
640
652
|
____exports.Unit = __TS__Class()
|
|
641
653
|
local Unit = ____exports.Unit
|
|
642
654
|
Unit.name = "Unit"
|
|
@@ -677,6 +689,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
677
689
|
end
|
|
678
690
|
function Unit.prototype.onDestroy(self)
|
|
679
691
|
local handle = self.handle
|
|
692
|
+
self[107] = getUnitX(handle)
|
|
693
|
+
self[108] = getUnitY(handle)
|
|
680
694
|
if not self._owner then
|
|
681
695
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
682
696
|
end
|
|
@@ -792,6 +806,9 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
792
806
|
setUnitAnimation(self.handle, animation)
|
|
793
807
|
end
|
|
794
808
|
end
|
|
809
|
+
function Unit.prototype.resetAnimation(self)
|
|
810
|
+
resetUnitAnimation(self.handle)
|
|
811
|
+
end
|
|
795
812
|
function Unit.prototype.queueAnimation(self, animation)
|
|
796
813
|
queueUnitAnimation(self.handle, animation)
|
|
797
814
|
end
|
|
@@ -806,7 +823,7 @@ function Unit.prototype.isSelected(self, player)
|
|
|
806
823
|
return IsUnitSelected(self.handle, player.handle)
|
|
807
824
|
end
|
|
808
825
|
function Unit.prototype.explode(self)
|
|
809
|
-
|
|
826
|
+
SetUnitExploded(self.handle, true)
|
|
810
827
|
killUnit(self.handle)
|
|
811
828
|
end
|
|
812
829
|
function Unit.prototype.kill(self)
|
|
@@ -929,8 +946,15 @@ function Unit.prototype.interruptAttack(self)
|
|
|
929
946
|
unitInterruptAttack(self.handle)
|
|
930
947
|
end
|
|
931
948
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
932
|
-
|
|
933
|
-
unitDisableAbility(
|
|
949
|
+
local handle = self.handle
|
|
950
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
951
|
+
Timer:run(
|
|
952
|
+
unitDisableAbility,
|
|
953
|
+
handle,
|
|
954
|
+
abilityId,
|
|
955
|
+
false,
|
|
956
|
+
false
|
|
957
|
+
)
|
|
934
958
|
end
|
|
935
959
|
function Unit.prototype.getDistanceTo(self, target)
|
|
936
960
|
local handle = self.handle
|
|
@@ -1195,6 +1219,14 @@ __TS__SetDescriptor(
|
|
|
1195
1219
|
end},
|
|
1196
1220
|
true
|
|
1197
1221
|
)
|
|
1222
|
+
__TS__SetDescriptor(
|
|
1223
|
+
Unit.prototype,
|
|
1224
|
+
"isStunned",
|
|
1225
|
+
{get = function(self)
|
|
1226
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1227
|
+
end},
|
|
1228
|
+
true
|
|
1229
|
+
)
|
|
1198
1230
|
__TS__SetDescriptor(
|
|
1199
1231
|
Unit.prototype,
|
|
1200
1232
|
"combatClassifications",
|
|
@@ -1268,6 +1300,19 @@ __TS__SetDescriptor(
|
|
|
1268
1300
|
},
|
|
1269
1301
|
true
|
|
1270
1302
|
)
|
|
1303
|
+
__TS__SetDescriptor(
|
|
1304
|
+
Unit.prototype,
|
|
1305
|
+
"primaryAttribute",
|
|
1306
|
+
{
|
|
1307
|
+
get = function(self)
|
|
1308
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1309
|
+
end,
|
|
1310
|
+
set = function(self, primaryAttribute)
|
|
1311
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1312
|
+
end
|
|
1313
|
+
},
|
|
1314
|
+
true
|
|
1315
|
+
)
|
|
1271
1316
|
__TS__SetDescriptor(
|
|
1272
1317
|
Unit.prototype,
|
|
1273
1318
|
"strengthBase",
|
|
@@ -1392,7 +1437,7 @@ __TS__SetDescriptor(
|
|
|
1392
1437
|
return not self[106]
|
|
1393
1438
|
end,
|
|
1394
1439
|
set = function(self, isTeamGlowVisible)
|
|
1395
|
-
|
|
1440
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1396
1441
|
local ____temp_6
|
|
1397
1442
|
if not isTeamGlowVisible then
|
|
1398
1443
|
____temp_6 = true
|
|
@@ -1408,9 +1453,9 @@ __TS__SetDescriptor(
|
|
|
1408
1453
|
Unit.prototype,
|
|
1409
1454
|
"color",
|
|
1410
1455
|
{set = function(self, color)
|
|
1411
|
-
|
|
1456
|
+
SetUnitColor(self.handle, color.handle)
|
|
1412
1457
|
if self[106] then
|
|
1413
|
-
|
|
1458
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1414
1459
|
end
|
|
1415
1460
|
end},
|
|
1416
1461
|
true
|
|
@@ -1579,7 +1624,7 @@ __TS__SetDescriptor(
|
|
|
1579
1624
|
"x",
|
|
1580
1625
|
{
|
|
1581
1626
|
get = function(self)
|
|
1582
|
-
return getUnitX(self.handle)
|
|
1627
|
+
return self[107] or getUnitX(self.handle)
|
|
1583
1628
|
end,
|
|
1584
1629
|
set = function(self, v)
|
|
1585
1630
|
SetUnitX(self.handle, v)
|
|
@@ -1592,7 +1637,7 @@ __TS__SetDescriptor(
|
|
|
1592
1637
|
"y",
|
|
1593
1638
|
{
|
|
1594
1639
|
get = function(self)
|
|
1595
|
-
return getUnitY(self.handle)
|
|
1640
|
+
return self[108] or getUnitY(self.handle)
|
|
1596
1641
|
end,
|
|
1597
1642
|
set = function(self, v)
|
|
1598
1643
|
SetUnitY(self.handle, v)
|
|
@@ -1678,10 +1723,10 @@ __TS__SetDescriptor(
|
|
|
1678
1723
|
"gold",
|
|
1679
1724
|
{
|
|
1680
1725
|
get = function(self)
|
|
1681
|
-
return
|
|
1726
|
+
return GetResourceAmount(self.handle)
|
|
1682
1727
|
end,
|
|
1683
1728
|
set = function(self, gold)
|
|
1684
|
-
|
|
1729
|
+
SetResourceAmount(self.handle, gold)
|
|
1685
1730
|
end
|
|
1686
1731
|
},
|
|
1687
1732
|
true
|
|
@@ -1809,6 +1854,19 @@ __TS__SetDescriptor(
|
|
|
1809
1854
|
end},
|
|
1810
1855
|
true
|
|
1811
1856
|
)
|
|
1857
|
+
__TS__SetDescriptor(
|
|
1858
|
+
Unit.prototype,
|
|
1859
|
+
"movementType",
|
|
1860
|
+
{
|
|
1861
|
+
get = function(self)
|
|
1862
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1863
|
+
end,
|
|
1864
|
+
set = function(self, movementType)
|
|
1865
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1866
|
+
end
|
|
1867
|
+
},
|
|
1868
|
+
true
|
|
1869
|
+
)
|
|
1812
1870
|
__TS__SetDescriptor(
|
|
1813
1871
|
Unit.prototype,
|
|
1814
1872
|
"pathing",
|
|
@@ -2315,10 +2373,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2315
2373
|
____exports.UnitTriggerEvent,
|
|
2316
2374
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2317
2375
|
function()
|
|
2318
|
-
local
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2376
|
+
local handle = getOrderedUnit()
|
|
2377
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2378
|
+
local unit = ____exports.Unit:of(handle)
|
|
2379
|
+
if unit.state == 1 then
|
|
2380
|
+
return unit, getIssuedOrderId()
|
|
2381
|
+
end
|
|
2322
2382
|
end
|
|
2323
2383
|
return IgnoreEvent
|
|
2324
2384
|
end
|
|
@@ -2349,13 +2409,18 @@ Unit.onDamaging = (function()
|
|
|
2349
2409
|
if source and source.typeId == dummyUnitId then
|
|
2350
2410
|
source = nil
|
|
2351
2411
|
end
|
|
2352
|
-
local target = BlzGetEventDamageTarget()
|
|
2412
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2413
|
+
local metadata = damageMetadataByTarget[target]
|
|
2414
|
+
damageMetadataByTarget[target] = nil
|
|
2353
2415
|
local data = {
|
|
2354
2416
|
amount = GetEventDamage(),
|
|
2355
|
-
attackType = BlzGetEventAttackType(),
|
|
2417
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2356
2418
|
damageType = BlzGetEventDamageType(),
|
|
2357
2419
|
weaponType = BlzGetEventWeaponType(),
|
|
2358
|
-
|
|
2420
|
+
metadata = metadata,
|
|
2421
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2422
|
+
originalAmount = GetEventDamage(),
|
|
2423
|
+
originalMetadata = metadata
|
|
2359
2424
|
}
|
|
2360
2425
|
if data.isAttack and source then
|
|
2361
2426
|
local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
|
|
@@ -2369,18 +2434,22 @@ Unit.onDamaging = (function()
|
|
|
2369
2434
|
invoke(
|
|
2370
2435
|
event,
|
|
2371
2436
|
source,
|
|
2372
|
-
|
|
2437
|
+
target,
|
|
2373
2438
|
setmetatable(
|
|
2374
2439
|
{},
|
|
2375
2440
|
{
|
|
2376
2441
|
__index = data,
|
|
2377
2442
|
__newindex = function(self, key, value)
|
|
2378
|
-
damageSetters[key]
|
|
2443
|
+
local damageSetter = damageSetters[key]
|
|
2444
|
+
if damageSetter ~= nil then
|
|
2445
|
+
damageSetter(value)
|
|
2446
|
+
end
|
|
2379
2447
|
data[key] = value
|
|
2380
2448
|
end
|
|
2381
2449
|
}
|
|
2382
2450
|
)
|
|
2383
2451
|
)
|
|
2452
|
+
damagingEventByTarget[target] = data
|
|
2384
2453
|
return
|
|
2385
2454
|
end
|
|
2386
2455
|
BlzSetEventDamage(0)
|
|
@@ -2388,7 +2457,7 @@ Unit.onDamaging = (function()
|
|
|
2388
2457
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2389
2458
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2390
2459
|
local sourceOwner = source.owner.handle
|
|
2391
|
-
local targetOwner =
|
|
2460
|
+
local targetOwner = target.owner.handle
|
|
2392
2461
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2393
2462
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2394
2463
|
Timer:run(function()
|
|
@@ -2404,23 +2473,19 @@ Unit.onDamaging = (function()
|
|
|
2404
2473
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2405
2474
|
local condition = ____value[1]
|
|
2406
2475
|
local action = ____value[2]
|
|
2407
|
-
if condition(
|
|
2408
|
-
source,
|
|
2409
|
-
____exports.Unit:of(target),
|
|
2410
|
-
data
|
|
2411
|
-
) then
|
|
2476
|
+
if condition(source, target, data) then
|
|
2412
2477
|
action(
|
|
2413
2478
|
source,
|
|
2414
|
-
|
|
2479
|
+
target,
|
|
2415
2480
|
setmetatable(
|
|
2416
2481
|
{fire = function()
|
|
2417
2482
|
UnitDamageTarget(
|
|
2418
2483
|
source.handle,
|
|
2419
|
-
target,
|
|
2484
|
+
target.handle,
|
|
2420
2485
|
data.amount,
|
|
2421
2486
|
true,
|
|
2422
2487
|
true,
|
|
2423
|
-
data.attackType,
|
|
2488
|
+
attackTypeToNative(data.attackType),
|
|
2424
2489
|
data.damageType,
|
|
2425
2490
|
data.weaponType
|
|
2426
2491
|
)
|
|
@@ -2447,13 +2512,18 @@ Unit.onDamage = __TS__New(
|
|
|
2447
2512
|
if source and source.typeId == dummyUnitId then
|
|
2448
2513
|
source = nil
|
|
2449
2514
|
end
|
|
2515
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2516
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2517
|
+
damagingEventByTarget[target] = nil
|
|
2450
2518
|
local data = {
|
|
2451
2519
|
amount = GetEventDamage(),
|
|
2452
|
-
attackType = BlzGetEventAttackType(),
|
|
2520
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2453
2521
|
damageType = BlzGetEventDamageType(),
|
|
2454
2522
|
weaponType = BlzGetEventWeaponType(),
|
|
2523
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2455
2524
|
isAttack = BlzGetEventIsAttack(),
|
|
2456
|
-
originalAmount = GetEventDamage(),
|
|
2525
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2526
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2457
2527
|
preventDeath = damageEventPreventDeath
|
|
2458
2528
|
}
|
|
2459
2529
|
local evData = setmetatable(
|
|
@@ -2466,7 +2536,6 @@ Unit.onDamage = __TS__New(
|
|
|
2466
2536
|
end
|
|
2467
2537
|
}
|
|
2468
2538
|
)
|
|
2469
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2470
2539
|
invoke(event, source, target, evData)
|
|
2471
2540
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2472
2541
|
local bonusHealth = math.ceil(evData.amount)
|
|
@@ -2509,8 +2578,9 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2509
2578
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2510
2579
|
function()
|
|
2511
2580
|
local unit = getTriggerUnit()
|
|
2512
|
-
|
|
2513
|
-
|
|
2581
|
+
local item = getManipulatedItem()
|
|
2582
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2583
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2514
2584
|
end
|
|
2515
2585
|
return IgnoreEvent
|
|
2516
2586
|
end
|
|
@@ -2520,8 +2590,9 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2520
2590
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2521
2591
|
function()
|
|
2522
2592
|
local unit = getTriggerUnit()
|
|
2523
|
-
|
|
2524
|
-
|
|
2593
|
+
local item = getManipulatedItem()
|
|
2594
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2595
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2525
2596
|
end
|
|
2526
2597
|
return IgnoreEvent
|
|
2527
2598
|
end
|
|
@@ -2529,7 +2600,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2529
2600
|
Unit.itemUsedEvent = __TS__New(
|
|
2530
2601
|
____exports.UnitTriggerEvent,
|
|
2531
2602
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2532
|
-
function()
|
|
2603
|
+
function()
|
|
2604
|
+
local unit = getTriggerUnit()
|
|
2605
|
+
local item = getManipulatedItem()
|
|
2606
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2607
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2608
|
+
end
|
|
2609
|
+
return IgnoreEvent
|
|
2610
|
+
end
|
|
2533
2611
|
)
|
|
2534
2612
|
Unit.itemStackedEvent = __TS__New(
|
|
2535
2613
|
____exports.UnitTriggerEvent,
|
|
@@ -2538,7 +2616,28 @@ Unit.itemStackedEvent = __TS__New(
|
|
|
2538
2616
|
)
|
|
2539
2617
|
__TS__ObjectDefineProperty(
|
|
2540
2618
|
Unit,
|
|
2541
|
-
"
|
|
2619
|
+
"itemUseOrderEvent",
|
|
2620
|
+
{get = function(self)
|
|
2621
|
+
local event = __TS__New(Event)
|
|
2622
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2623
|
+
local slot = order - orderId("useslot0")
|
|
2624
|
+
local function listener(unit)
|
|
2625
|
+
local item = unit.items[slot + 1]
|
|
2626
|
+
if item ~= nil then
|
|
2627
|
+
invoke(event, unit, item)
|
|
2628
|
+
end
|
|
2629
|
+
end
|
|
2630
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2631
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2632
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2633
|
+
end
|
|
2634
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2635
|
+
return event
|
|
2636
|
+
end}
|
|
2637
|
+
)
|
|
2638
|
+
__TS__ObjectDefineProperty(
|
|
2639
|
+
Unit,
|
|
2640
|
+
"itemMoveOrderEvent",
|
|
2542
2641
|
{get = function(self)
|
|
2543
2642
|
local event = __TS__New(Event)
|
|
2544
2643
|
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
@@ -2556,7 +2655,7 @@ __TS__ObjectDefineProperty(
|
|
|
2556
2655
|
end
|
|
2557
2656
|
end)
|
|
2558
2657
|
end
|
|
2559
|
-
rawset(self, "
|
|
2658
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2560
2659
|
return event
|
|
2561
2660
|
end}
|
|
2562
2661
|
)
|
|
@@ -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 {};
|
package/engine/lightning.lua
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
5
|
local ____exports = {}
|
|
5
|
-
local ____handle = require("core.types.handle")
|
|
6
|
-
local Handle = ____handle.Handle
|
|
7
6
|
local ____timer = require("core.types.timer")
|
|
8
7
|
local Timer = ____timer.Timer
|
|
9
8
|
local ____functions = require("utility.functions")
|
|
10
9
|
local forwardByN = ____functions.forwardByN
|
|
11
10
|
local ____unit_2Dmissile_2Ddata = require("engine.internal.unit-missile-data")
|
|
12
11
|
local MISSILE_DATA_BY_UNIT_TYPE_ID = ____unit_2Dmissile_2Ddata.MISSILE_DATA_BY_UNIT_TYPE_ID
|
|
12
|
+
local ____destroyable = require("destroyable")
|
|
13
|
+
local AbstractDestroyable = ____destroyable.AbstractDestroyable
|
|
13
14
|
local ____type = _G.type
|
|
14
15
|
local select = _G.select
|
|
15
16
|
local cos = math.cos
|
|
@@ -27,6 +28,11 @@ local getUnitZ = BlzGetUnitZ
|
|
|
27
28
|
local getUnitFlyHeight = GetUnitFlyHeight
|
|
28
29
|
local getLocationZ = GetLocationZ
|
|
29
30
|
local moveLocation = MoveLocation
|
|
31
|
+
local getLightningColorA = GetLightningColorA
|
|
32
|
+
local getLightningColorR = GetLightningColorR
|
|
33
|
+
local getLightningColorG = GetLightningColorG
|
|
34
|
+
local getLightningColorB = GetLightningColorB
|
|
35
|
+
local setLightningColor = SetLightningColor
|
|
30
36
|
local location = Location(0, 0)
|
|
31
37
|
local unitToUnitLightnings = setmetatable({}, {__mode = "k"})
|
|
32
38
|
local unitToPointLightnings = setmetatable({}, {__mode = "k"})
|
|
@@ -36,9 +42,10 @@ local temporaryLightningsCount = 0
|
|
|
36
42
|
____exports.Lightning = __TS__Class()
|
|
37
43
|
local Lightning = ____exports.Lightning
|
|
38
44
|
Lightning.name = "Lightning"
|
|
39
|
-
__TS__ClassExtends(Lightning,
|
|
45
|
+
__TS__ClassExtends(Lightning, AbstractDestroyable)
|
|
40
46
|
function Lightning.prototype.____constructor(self, handle, typeId)
|
|
41
|
-
|
|
47
|
+
AbstractDestroyable.prototype.____constructor(self)
|
|
48
|
+
self.handle = handle
|
|
42
49
|
self.typeId = typeId
|
|
43
50
|
end
|
|
44
51
|
function Lightning.prototype.onDestroy(self)
|
|
@@ -46,7 +53,7 @@ function Lightning.prototype.onDestroy(self)
|
|
|
46
53
|
unitToPointLightnings[self] = nil
|
|
47
54
|
pointToUnitLightnings[self] = nil
|
|
48
55
|
destroyLightning(self.handle)
|
|
49
|
-
return
|
|
56
|
+
return AbstractDestroyable.prototype.onDestroy(self)
|
|
50
57
|
end
|
|
51
58
|
function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY, targetXOrTargetUnitOrTargetYOrTargetZ, targetY, targetZ)
|
|
52
59
|
if type(checkVisibility) ~= "boolean" then
|
|
@@ -62,7 +69,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
62
69
|
)
|
|
63
70
|
end
|
|
64
71
|
if targetZ ~= nil then
|
|
65
|
-
return
|
|
72
|
+
return __TS__New(
|
|
73
|
+
self,
|
|
66
74
|
addLightningEx(
|
|
67
75
|
util.id2s(typeId),
|
|
68
76
|
checkVisibility,
|
|
@@ -79,7 +87,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
79
87
|
if targetXOrTargetUnitOrTargetYOrTargetZ ~= nil then
|
|
80
88
|
if ____type(targetXOrTargetUnitOrTargetYOrTargetZ) == "number" then
|
|
81
89
|
if ____type(sourceXOrSourceUnit) == "number" then
|
|
82
|
-
return
|
|
90
|
+
return __TS__New(
|
|
91
|
+
self,
|
|
83
92
|
addLightning(
|
|
84
93
|
util.id2s(typeId),
|
|
85
94
|
checkVisibility,
|
|
@@ -92,7 +101,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
92
101
|
)
|
|
93
102
|
end
|
|
94
103
|
local unit = sourceXOrSourceUnit.handle
|
|
95
|
-
local lightning =
|
|
104
|
+
local lightning = __TS__New(
|
|
105
|
+
self,
|
|
96
106
|
addLightningEx(
|
|
97
107
|
util.id2s(typeId),
|
|
98
108
|
checkVisibility,
|
|
@@ -117,7 +127,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
117
127
|
return lightning
|
|
118
128
|
end
|
|
119
129
|
local unit = targetXOrTargetUnitOrTargetYOrTargetZ.handle
|
|
120
|
-
local lightning =
|
|
130
|
+
local lightning = __TS__New(
|
|
131
|
+
self,
|
|
121
132
|
addLightningEx(
|
|
122
133
|
util.id2s(typeId),
|
|
123
134
|
checkVisibility,
|
|
@@ -146,7 +157,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
146
157
|
local unit = sourceXOrSourceUnit.handle
|
|
147
158
|
moveLocation(location, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY)
|
|
148
159
|
local z = getLocationZ(location)
|
|
149
|
-
local lightning =
|
|
160
|
+
local lightning = __TS__New(
|
|
161
|
+
self,
|
|
150
162
|
addLightningEx(
|
|
151
163
|
util.id2s(typeId),
|
|
152
164
|
checkVisibility,
|
|
@@ -173,7 +185,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
173
185
|
local unit = sourceZOrTargetXOrTargetUnitOrTargetY.handle
|
|
174
186
|
moveLocation(location, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit)
|
|
175
187
|
local z = getLocationZ(location)
|
|
176
|
-
local lightning =
|
|
188
|
+
local lightning = __TS__New(
|
|
189
|
+
self,
|
|
177
190
|
addLightningEx(
|
|
178
191
|
util.id2s(typeId),
|
|
179
192
|
checkVisibility,
|
|
@@ -199,7 +212,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
199
212
|
end
|
|
200
213
|
local sourceUnit = sourceXOrSourceUnit.handle
|
|
201
214
|
local targetUnit = sourceYOrTargetXOrTargetUnit.handle
|
|
202
|
-
local lightning =
|
|
215
|
+
local lightning = __TS__New(
|
|
216
|
+
self,
|
|
203
217
|
addLightningEx(
|
|
204
218
|
util.id2s(typeId),
|
|
205
219
|
checkVisibility,
|
|
@@ -225,9 +239,19 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
225
239
|
return lightning
|
|
226
240
|
end
|
|
227
241
|
function Lightning.flash(self, ...)
|
|
228
|
-
local
|
|
242
|
+
local parameterOrDuration, durationOrFading = select(-2, ...)
|
|
243
|
+
local hasFading = ____type(durationOrFading) ~= "number"
|
|
244
|
+
local parametersToForwardCount = select("#", ...) - (hasFading and 2 or 1)
|
|
229
245
|
local lightning = forwardByN[parametersToForwardCount](____exports.Lightning.create, self, ...)
|
|
230
|
-
local duration
|
|
246
|
+
local duration
|
|
247
|
+
if hasFading then
|
|
248
|
+
duration = parameterOrDuration
|
|
249
|
+
if durationOrFading then
|
|
250
|
+
lightning[110] = true
|
|
251
|
+
end
|
|
252
|
+
else
|
|
253
|
+
duration = durationOrFading
|
|
254
|
+
end
|
|
231
255
|
lightning[109] = duration
|
|
232
256
|
temporaryLightningsCount = temporaryLightningsCount + 1
|
|
233
257
|
temporaryLightnings[temporaryLightningsCount] = lightning
|
|
@@ -295,6 +319,16 @@ Timer.onPeriod[UPDATE_PERIOD]:addListener(function()
|
|
|
295
319
|
temporaryLightnings[temporaryLightningsCount] = nil
|
|
296
320
|
temporaryLightningsCount = temporaryLightningsCount - 1
|
|
297
321
|
else
|
|
322
|
+
if lightning[110] then
|
|
323
|
+
local handle = lightning.handle
|
|
324
|
+
setLightningColor(
|
|
325
|
+
handle,
|
|
326
|
+
getLightningColorR(handle),
|
|
327
|
+
getLightningColorG(handle),
|
|
328
|
+
getLightningColorB(handle),
|
|
329
|
+
getLightningColorA(handle) * (1 - UPDATE_PERIOD / duration)
|
|
330
|
+
)
|
|
331
|
+
end
|
|
298
332
|
lightning[109] = duration - UPDATE_PERIOD
|
|
299
333
|
i = i + 1
|
|
300
334
|
end
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
local animationNames = {
|
|
3
|
+
attack = true,
|
|
4
|
+
birth = true,
|
|
5
|
+
death = true,
|
|
6
|
+
decay = true,
|
|
7
|
+
dissipate = true,
|
|
8
|
+
morph = true,
|
|
9
|
+
portrait = true,
|
|
10
|
+
sleep = true,
|
|
11
|
+
spell = true,
|
|
12
|
+
stand = true,
|
|
13
|
+
walk = true
|
|
14
|
+
}
|
|
15
|
+
____exports.isAnimationName = function(value)
|
|
16
|
+
return animationNames[value] ~= nil
|
|
17
|
+
end
|
|
2
18
|
return ____exports
|