warscript 0.0.1-dev.46a1ede → 0.0.1-dev.475a555
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 +5 -0
- package/attributes.lua +8 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- 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.lua +6 -1
- package/decl/native.d.ts +840 -786
- 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.lua +16 -2
- package/engine/behaviour/ability.d.ts +5 -1
- package/engine/behaviour/ability.lua +19 -5
- package/engine/behaviour/unit.d.ts +17 -0
- package/engine/behaviour/unit.lua +114 -4
- package/engine/buff.d.ts +15 -7
- package/engine/buff.lua +145 -104
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +17 -0
- package/engine/internal/item/ability.lua +12 -10
- package/engine/internal/item.d.ts +5 -2
- package/engine/internal/item.lua +75 -3
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- 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/unit/ability.d.ts +5 -0
- package/engine/internal/unit/ability.lua +14 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- 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-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +27 -4
- package/engine/internal/unit.lua +184 -37
- 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/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- 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 +81 -21
- 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 +1 -1
- package/engine/object-data/entry/item-type.lua +4 -4
- 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-field/ability.d.ts +1 -1
- package/engine/object-field/unit.d.ts +46 -3
- package/engine/object-field/unit.lua +173 -7
- package/engine/object-field.d.ts +15 -4
- package/engine/object-field.lua +184 -90
- 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/text-tag.d.ts +12 -1
- package/engine/text-tag.lua +44 -10
- 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/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +4 -0
- package/utility/lua-maps.lua +20 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
- package/utility/reflection.lua +11 -7
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/buff.lua
CHANGED
|
@@ -102,12 +102,14 @@ local buffParametersKeys = {
|
|
|
102
102
|
attackSpeedIncreaseFactor = true,
|
|
103
103
|
movementSpeedIncreaseFactor = true,
|
|
104
104
|
evasionProbability = true,
|
|
105
|
+
missProbability = true,
|
|
105
106
|
damageFactor = true,
|
|
106
107
|
receivedDamageFactor = true,
|
|
107
108
|
receivedMagicDamageFactor = true,
|
|
108
109
|
durationIncreaseOnAutoAttack = true,
|
|
109
110
|
maximumDuration = true,
|
|
110
111
|
maximumRemainingDuration = true,
|
|
112
|
+
turnsIntoGhost = true,
|
|
111
113
|
stuns = true,
|
|
112
114
|
ignoresStunImmunity = true,
|
|
113
115
|
providesStunImmunity = true,
|
|
@@ -173,6 +175,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
173
175
|
end
|
|
174
176
|
end
|
|
175
177
|
local buffBooleanParameters = {
|
|
178
|
+
"turnsIntoGhost",
|
|
176
179
|
"stuns",
|
|
177
180
|
"ignoresStunImmunity",
|
|
178
181
|
"disablesAutoAttack",
|
|
@@ -320,7 +323,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
320
323
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
321
324
|
polarity = resistanceTypeOrPolarity
|
|
322
325
|
resistanceType = abilityOrParametersOrResistanceType
|
|
323
|
-
if __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
326
|
+
if __TS__InstanceOf(parametersOrAbility, Ability) or parametersOrAbility == nil then
|
|
324
327
|
ability = parametersOrAbility
|
|
325
328
|
else
|
|
326
329
|
ability = nil
|
|
@@ -330,7 +333,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
330
333
|
typeId = typeIdOrTypeIds
|
|
331
334
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
332
335
|
resistanceType = resistanceTypeOrPolarity
|
|
333
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
336
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) or abilityOrParametersOrResistanceType == nil then
|
|
334
337
|
ability = abilityOrParametersOrResistanceType
|
|
335
338
|
parameters = parametersOrAbility
|
|
336
339
|
else
|
|
@@ -339,7 +342,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
339
342
|
end
|
|
340
343
|
end
|
|
341
344
|
self.typeId = typeId
|
|
342
|
-
if not __TS__InstanceOf(ability, Ability) then
|
|
345
|
+
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
343
346
|
parameters = ability
|
|
344
347
|
ability = nil
|
|
345
348
|
end
|
|
@@ -367,14 +370,19 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
367
370
|
end
|
|
368
371
|
self.polarity = resolveEnumValue(ability, level, polarity)
|
|
369
372
|
self.resistanceType = resolveEnumValue(ability, level, resistanceType)
|
|
373
|
+
local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
|
|
374
|
+
if missProbability ~= nil then
|
|
375
|
+
missProbability = resolveNumberValue(ability, level, missProbability)
|
|
376
|
+
self[142] = missProbability
|
|
377
|
+
end
|
|
370
378
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
371
379
|
if buffByTypeId == nil then
|
|
372
380
|
buffByTypeId = {}
|
|
373
381
|
buffByTypeIdByUnit[_unit] = buffByTypeId
|
|
374
382
|
end
|
|
375
|
-
local
|
|
376
|
-
if
|
|
377
|
-
|
|
383
|
+
local ____opt_15 = buffByTypeId[typeId]
|
|
384
|
+
if ____opt_15 ~= nil then
|
|
385
|
+
____opt_15:destroy()
|
|
378
386
|
end
|
|
379
387
|
local uniqueGroup = parameters and parameters.uniqueGroup or defaultParameters and defaultParameters.uniqueGroup
|
|
380
388
|
if uniqueGroup ~= nil then
|
|
@@ -388,13 +396,16 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
388
396
|
level,
|
|
389
397
|
duration,
|
|
390
398
|
spellStealPriority,
|
|
391
|
-
learnLevelMinimum
|
|
399
|
+
learnLevelMinimum,
|
|
400
|
+
missProbability
|
|
392
401
|
) then
|
|
402
|
+
self[100] = 1
|
|
393
403
|
UnitBehavior.prototype.destroy(self)
|
|
394
404
|
error(unsuccessfulApplicationMarker, 0)
|
|
395
405
|
end
|
|
396
406
|
local handle = BlzGetUnitAbility(_unit.handle, typeId)
|
|
397
407
|
if handle == nil then
|
|
408
|
+
self[100] = 1
|
|
398
409
|
UnitBehavior.prototype.destroy(self)
|
|
399
410
|
error(unsuccessfulApplicationMarker, 0)
|
|
400
411
|
end
|
|
@@ -410,13 +421,13 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
410
421
|
self[106] = BlzGetAbilityStringLevelField(self.handle, ABILITY_SLF_SPECIAL, 0)
|
|
411
422
|
if parameters ~= nil or (next(defaultParameters)) ~= nil then
|
|
412
423
|
for ____, buffBooleanParameter in ipairs(buffBooleanParameters) do
|
|
413
|
-
local
|
|
414
|
-
local
|
|
415
|
-
local
|
|
416
|
-
if
|
|
417
|
-
|
|
424
|
+
local ____ability_24 = ability
|
|
425
|
+
local ____level_25 = level
|
|
426
|
+
local ____temp_23 = parameters and parameters[buffBooleanParameter]
|
|
427
|
+
if ____temp_23 == nil then
|
|
428
|
+
____temp_23 = defaultParameters[buffBooleanParameter]
|
|
418
429
|
end
|
|
419
|
-
if resolveBooleanValue(
|
|
430
|
+
if resolveBooleanValue(____ability_24, ____level_25, ____temp_23) then
|
|
420
431
|
self[buffBooleanParameter] = true
|
|
421
432
|
end
|
|
422
433
|
end
|
|
@@ -497,8 +508,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
497
508
|
self[100] = 1
|
|
498
509
|
end
|
|
499
510
|
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
500
|
-
local
|
|
501
|
-
local bonusId =
|
|
511
|
+
local ____opt_38 = self._bonusIdByBonusType
|
|
512
|
+
local bonusId = ____opt_38 and ____opt_38[bonusType]
|
|
502
513
|
return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
|
|
503
514
|
end
|
|
504
515
|
function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
@@ -514,45 +525,45 @@ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrPa
|
|
|
514
525
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
515
526
|
else
|
|
516
527
|
local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
|
|
517
|
-
local
|
|
518
|
-
local
|
|
519
|
-
local
|
|
528
|
+
local ____Effect_42 = Effect
|
|
529
|
+
local ____Effect_flash_43 = Effect.flash
|
|
530
|
+
local ____array_41 = __TS__SparseArrayNew(
|
|
520
531
|
self[105],
|
|
521
532
|
isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
|
|
522
533
|
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
523
534
|
)
|
|
524
|
-
local
|
|
535
|
+
local ____isWidgetProvided_40
|
|
525
536
|
if isWidgetProvided then
|
|
526
|
-
|
|
537
|
+
____isWidgetProvided_40 = yOrParametersOrDuration
|
|
527
538
|
else
|
|
528
|
-
|
|
539
|
+
____isWidgetProvided_40 = widgetOrXOrParametersOrDuration
|
|
529
540
|
end
|
|
530
|
-
__TS__SparseArrayPush(
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
__TS__SparseArraySpread(
|
|
541
|
+
__TS__SparseArrayPush(____array_41, ____isWidgetProvided_40)
|
|
542
|
+
____Effect_flash_43(
|
|
543
|
+
____Effect_42,
|
|
544
|
+
__TS__SparseArraySpread(____array_41)
|
|
534
545
|
)
|
|
535
546
|
end
|
|
536
547
|
end
|
|
537
548
|
function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
538
549
|
local isWidgetProvided = type(widgetOrDuration) == "table"
|
|
539
|
-
local
|
|
540
|
-
local
|
|
541
|
-
local
|
|
550
|
+
local ____Effect_46 = Effect
|
|
551
|
+
local ____Effect_flash_47 = Effect.flash
|
|
552
|
+
local ____array_45 = __TS__SparseArrayNew(
|
|
542
553
|
self[106],
|
|
543
554
|
isWidgetProvided and widgetOrDuration or self._unit,
|
|
544
555
|
stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
|
|
545
556
|
)
|
|
546
|
-
local
|
|
557
|
+
local ____isWidgetProvided_44
|
|
547
558
|
if isWidgetProvided then
|
|
548
|
-
|
|
559
|
+
____isWidgetProvided_44 = duration
|
|
549
560
|
else
|
|
550
|
-
|
|
561
|
+
____isWidgetProvided_44 = widgetOrDuration
|
|
551
562
|
end
|
|
552
|
-
__TS__SparseArrayPush(
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
__TS__SparseArraySpread(
|
|
563
|
+
__TS__SparseArrayPush(____array_45, ____isWidgetProvided_44)
|
|
564
|
+
____Effect_flash_47(
|
|
565
|
+
____Effect_46,
|
|
566
|
+
__TS__SparseArraySpread(____array_45)
|
|
556
567
|
)
|
|
557
568
|
end
|
|
558
569
|
function Buff.prototype.onCreate(self)
|
|
@@ -583,15 +594,21 @@ function Buff.prototype.onDestroy(self)
|
|
|
583
594
|
behavior:destroy()
|
|
584
595
|
end
|
|
585
596
|
end
|
|
586
|
-
if self[
|
|
597
|
+
if self[139] then
|
|
598
|
+
unit:decrementInvulnerabilityCounter()
|
|
599
|
+
end
|
|
600
|
+
if self[138] then
|
|
587
601
|
unit:decrementDisableAutoAttackCounter()
|
|
588
602
|
end
|
|
589
|
-
if self[
|
|
590
|
-
if self[
|
|
603
|
+
if self[136] then
|
|
604
|
+
if self[137] then
|
|
591
605
|
unit:decrementStunCounter()
|
|
592
606
|
end
|
|
593
607
|
unit:decrementStunCounter()
|
|
594
608
|
end
|
|
609
|
+
if self[135] then
|
|
610
|
+
unit:decrementGhostCounter()
|
|
611
|
+
end
|
|
595
612
|
if self._abilityTypeIds ~= nil then
|
|
596
613
|
for abilityTypeId in pairs(self._abilityTypeIds) do
|
|
597
614
|
unit:removeAbility(abilityTypeId)
|
|
@@ -631,8 +648,8 @@ function Buff.apply(self, ...)
|
|
|
631
648
|
end
|
|
632
649
|
end
|
|
633
650
|
function Buff.getByTypeId(self, unit, typeId)
|
|
634
|
-
local
|
|
635
|
-
local buff =
|
|
651
|
+
local ____opt_48 = buffByTypeIdByUnit[unit]
|
|
652
|
+
local buff = ____opt_48 and ____opt_48[typeId]
|
|
636
653
|
if __TS__InstanceOf(buff, self) then
|
|
637
654
|
return buff
|
|
638
655
|
end
|
|
@@ -646,9 +663,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
646
663
|
if self[121] ~= nil then
|
|
647
664
|
(self[102] or unit):healTarget(unit, self[120] or 0)
|
|
648
665
|
end
|
|
649
|
-
if self[
|
|
666
|
+
if self[141] then
|
|
650
667
|
unit:explode()
|
|
651
|
-
elseif self[
|
|
668
|
+
elseif self[140] then
|
|
652
669
|
unit:kill()
|
|
653
670
|
end
|
|
654
671
|
end
|
|
@@ -790,8 +807,8 @@ __TS__SetDescriptor(
|
|
|
790
807
|
return
|
|
791
808
|
end
|
|
792
809
|
self[112] = damageInterval
|
|
793
|
-
local
|
|
794
|
-
local elapsed =
|
|
810
|
+
local ____opt_50 = self._timer
|
|
811
|
+
local elapsed = ____opt_50 and ____opt_50.elapsed or 0
|
|
795
812
|
local timer = self[114]
|
|
796
813
|
if timer == nil then
|
|
797
814
|
timer = Timer:create()
|
|
@@ -870,8 +887,8 @@ __TS__SetDescriptor(
|
|
|
870
887
|
return
|
|
871
888
|
end
|
|
872
889
|
self[117] = healingInterval
|
|
873
|
-
local
|
|
874
|
-
local elapsed =
|
|
890
|
+
local ____opt_52 = self._timer
|
|
891
|
+
local elapsed = ____opt_52 and ____opt_52.elapsed or 0
|
|
875
892
|
local timer = self[119]
|
|
876
893
|
if timer == nil then
|
|
877
894
|
timer = Timer:create()
|
|
@@ -952,30 +969,53 @@ __TS__SetDescriptor(
|
|
|
952
969
|
},
|
|
953
970
|
true
|
|
954
971
|
)
|
|
972
|
+
__TS__SetDescriptor(
|
|
973
|
+
Buff.prototype,
|
|
974
|
+
"turnsIntoGhost",
|
|
975
|
+
{
|
|
976
|
+
get = function(self)
|
|
977
|
+
local ____self__135_54 = self[135]
|
|
978
|
+
if ____self__135_54 == nil then
|
|
979
|
+
____self__135_54 = false
|
|
980
|
+
end
|
|
981
|
+
return ____self__135_54
|
|
982
|
+
end,
|
|
983
|
+
set = function(self, turnsIntoGhost)
|
|
984
|
+
if not turnsIntoGhost and self[135] then
|
|
985
|
+
self.object:decrementGhostCounter()
|
|
986
|
+
self[135] = nil
|
|
987
|
+
elseif turnsIntoGhost and not self[135] then
|
|
988
|
+
self.object:incrementGhostCounter()
|
|
989
|
+
self[135] = true
|
|
990
|
+
end
|
|
991
|
+
end
|
|
992
|
+
},
|
|
993
|
+
true
|
|
994
|
+
)
|
|
955
995
|
__TS__SetDescriptor(
|
|
956
996
|
Buff.prototype,
|
|
957
997
|
"stuns",
|
|
958
998
|
{
|
|
959
999
|
get = function(self)
|
|
960
|
-
local
|
|
961
|
-
if
|
|
962
|
-
|
|
1000
|
+
local ____self__136_55 = self[136]
|
|
1001
|
+
if ____self__136_55 == nil then
|
|
1002
|
+
____self__136_55 = false
|
|
963
1003
|
end
|
|
964
|
-
return
|
|
1004
|
+
return ____self__136_55
|
|
965
1005
|
end,
|
|
966
1006
|
set = function(self, stuns)
|
|
967
|
-
if not stuns and self[
|
|
968
|
-
if self[
|
|
1007
|
+
if not stuns and self[136] then
|
|
1008
|
+
if self[137] then
|
|
969
1009
|
self.object:decrementStunCounter()
|
|
970
1010
|
end
|
|
971
1011
|
self.object:decrementStunCounter()
|
|
972
|
-
self[
|
|
973
|
-
elseif stuns and not self[
|
|
974
|
-
if self[
|
|
1012
|
+
self[136] = nil
|
|
1013
|
+
elseif stuns and not self[136] then
|
|
1014
|
+
if self[137] then
|
|
975
1015
|
self.object:incrementStunCounter()
|
|
976
1016
|
end
|
|
977
1017
|
self.object:incrementStunCounter()
|
|
978
|
-
self[
|
|
1018
|
+
self[136] = true
|
|
979
1019
|
end
|
|
980
1020
|
end
|
|
981
1021
|
},
|
|
@@ -986,23 +1026,23 @@ __TS__SetDescriptor(
|
|
|
986
1026
|
"ignoresStunImmunity",
|
|
987
1027
|
{
|
|
988
1028
|
get = function(self)
|
|
989
|
-
local
|
|
990
|
-
if
|
|
991
|
-
|
|
1029
|
+
local ____self__137_56 = self[137]
|
|
1030
|
+
if ____self__137_56 == nil then
|
|
1031
|
+
____self__137_56 = false
|
|
992
1032
|
end
|
|
993
|
-
return
|
|
1033
|
+
return ____self__137_56
|
|
994
1034
|
end,
|
|
995
1035
|
set = function(self, ignoresStunImmunity)
|
|
996
|
-
if not ignoresStunImmunity and self[
|
|
997
|
-
if self[
|
|
1036
|
+
if not ignoresStunImmunity and self[137] then
|
|
1037
|
+
if self[136] then
|
|
998
1038
|
self.object:decrementStunCounter()
|
|
999
1039
|
end
|
|
1000
|
-
self[
|
|
1001
|
-
elseif ignoresStunImmunity and not self[
|
|
1002
|
-
if self[
|
|
1040
|
+
self[137] = nil
|
|
1041
|
+
elseif ignoresStunImmunity and not self[137] then
|
|
1042
|
+
if self[136] then
|
|
1003
1043
|
self.object:incrementStunCounter()
|
|
1004
1044
|
end
|
|
1005
|
-
self[
|
|
1045
|
+
self[137] = true
|
|
1006
1046
|
end
|
|
1007
1047
|
end
|
|
1008
1048
|
},
|
|
@@ -1013,19 +1053,19 @@ __TS__SetDescriptor(
|
|
|
1013
1053
|
"disablesAutoAttack",
|
|
1014
1054
|
{
|
|
1015
1055
|
get = function(self)
|
|
1016
|
-
local
|
|
1017
|
-
if
|
|
1018
|
-
|
|
1056
|
+
local ____self__138_57 = self[138]
|
|
1057
|
+
if ____self__138_57 == nil then
|
|
1058
|
+
____self__138_57 = false
|
|
1019
1059
|
end
|
|
1020
|
-
return
|
|
1060
|
+
return ____self__138_57
|
|
1021
1061
|
end,
|
|
1022
1062
|
set = function(self, disablesAutoAttack)
|
|
1023
|
-
if not disablesAutoAttack and self[
|
|
1063
|
+
if not disablesAutoAttack and self[138] then
|
|
1024
1064
|
self.object:decrementDisableAutoAttackCounter()
|
|
1025
|
-
self[
|
|
1026
|
-
elseif disablesAutoAttack and not self[
|
|
1065
|
+
self[138] = nil
|
|
1066
|
+
elseif disablesAutoAttack and not self[138] then
|
|
1027
1067
|
self.object:incrementDisableAutoAttackCounter()
|
|
1028
|
-
self[
|
|
1068
|
+
self[138] = true
|
|
1029
1069
|
end
|
|
1030
1070
|
end
|
|
1031
1071
|
},
|
|
@@ -1036,19 +1076,19 @@ __TS__SetDescriptor(
|
|
|
1036
1076
|
"providesInvulnerability",
|
|
1037
1077
|
{
|
|
1038
1078
|
get = function(self)
|
|
1039
|
-
local
|
|
1040
|
-
if
|
|
1041
|
-
|
|
1079
|
+
local ____self__139_58 = self[139]
|
|
1080
|
+
if ____self__139_58 == nil then
|
|
1081
|
+
____self__139_58 = false
|
|
1042
1082
|
end
|
|
1043
|
-
return
|
|
1083
|
+
return ____self__139_58
|
|
1044
1084
|
end,
|
|
1045
1085
|
set = function(self, providesInvulnerability)
|
|
1046
|
-
if not providesInvulnerability and self[
|
|
1086
|
+
if not providesInvulnerability and self[139] then
|
|
1047
1087
|
self.object:decrementInvulnerabilityCounter()
|
|
1048
|
-
self[
|
|
1049
|
-
elseif providesInvulnerability and not self[
|
|
1088
|
+
self[139] = nil
|
|
1089
|
+
elseif providesInvulnerability and not self[139] then
|
|
1050
1090
|
self.object:incrementInvulnerabilityCounter()
|
|
1051
|
-
self[
|
|
1091
|
+
self[139] = true
|
|
1052
1092
|
end
|
|
1053
1093
|
end
|
|
1054
1094
|
},
|
|
@@ -1059,17 +1099,17 @@ __TS__SetDescriptor(
|
|
|
1059
1099
|
"killsOnExpiration",
|
|
1060
1100
|
{
|
|
1061
1101
|
get = function(self)
|
|
1062
|
-
local
|
|
1063
|
-
if
|
|
1064
|
-
|
|
1102
|
+
local ____self__140_59 = self[140]
|
|
1103
|
+
if ____self__140_59 == nil then
|
|
1104
|
+
____self__140_59 = false
|
|
1065
1105
|
end
|
|
1066
|
-
return
|
|
1106
|
+
return ____self__140_59
|
|
1067
1107
|
end,
|
|
1068
1108
|
set = function(self, killsOnExpiration)
|
|
1069
|
-
if not killsOnExpiration and self[
|
|
1070
|
-
self[
|
|
1071
|
-
elseif killsOnExpiration and not self[
|
|
1072
|
-
self[
|
|
1109
|
+
if not killsOnExpiration and self[140] then
|
|
1110
|
+
self[140] = nil
|
|
1111
|
+
elseif killsOnExpiration and not self[140] then
|
|
1112
|
+
self[140] = true
|
|
1073
1113
|
end
|
|
1074
1114
|
end
|
|
1075
1115
|
},
|
|
@@ -1080,17 +1120,17 @@ __TS__SetDescriptor(
|
|
|
1080
1120
|
"explodesOnExpiration",
|
|
1081
1121
|
{
|
|
1082
1122
|
get = function(self)
|
|
1083
|
-
local
|
|
1084
|
-
if
|
|
1085
|
-
|
|
1123
|
+
local ____self__141_60 = self[141]
|
|
1124
|
+
if ____self__141_60 == nil then
|
|
1125
|
+
____self__141_60 = false
|
|
1086
1126
|
end
|
|
1087
|
-
return
|
|
1127
|
+
return ____self__141_60
|
|
1088
1128
|
end,
|
|
1089
1129
|
set = function(self, killsOnExpiration)
|
|
1090
|
-
if not killsOnExpiration and self[
|
|
1091
|
-
self[
|
|
1092
|
-
elseif killsOnExpiration and not self[
|
|
1093
|
-
self[
|
|
1130
|
+
if not killsOnExpiration and self[141] then
|
|
1131
|
+
self[141] = nil
|
|
1132
|
+
elseif killsOnExpiration and not self[141] then
|
|
1133
|
+
self[141] = true
|
|
1094
1134
|
end
|
|
1095
1135
|
end
|
|
1096
1136
|
},
|
|
@@ -1212,13 +1252,13 @@ __TS__SetDescriptor(
|
|
|
1212
1252
|
"remainingDuration",
|
|
1213
1253
|
{
|
|
1214
1254
|
get = function(self)
|
|
1215
|
-
local
|
|
1216
|
-
return
|
|
1255
|
+
local ____opt_61 = self._timer
|
|
1256
|
+
return ____opt_61 and ____opt_61.remaining or 0
|
|
1217
1257
|
end,
|
|
1218
1258
|
set = function(self, remainingDuration)
|
|
1219
|
-
local
|
|
1220
|
-
local
|
|
1221
|
-
local remainingDurationDelta =
|
|
1259
|
+
local ____remainingDuration_65 = remainingDuration
|
|
1260
|
+
local ____opt_63 = self._timer
|
|
1261
|
+
local remainingDurationDelta = ____remainingDuration_65 - (____opt_63 and ____opt_63.remaining or 0)
|
|
1222
1262
|
if remainingDurationDelta ~= 0 then
|
|
1223
1263
|
self[103] = self[103] + remainingDurationDelta
|
|
1224
1264
|
if remainingDuration <= 0 then
|
|
@@ -1232,7 +1272,8 @@ __TS__SetDescriptor(
|
|
|
1232
1272
|
self._level,
|
|
1233
1273
|
remainingDuration,
|
|
1234
1274
|
self._spellStealPriority,
|
|
1235
|
-
self._learnLevelMinimum
|
|
1275
|
+
self._learnLevelMinimum,
|
|
1276
|
+
self[142]
|
|
1236
1277
|
) then
|
|
1237
1278
|
local timer = self._timer
|
|
1238
1279
|
if timer == nil then
|
|
@@ -55,9 +55,13 @@ export declare class UnrecognizedAbility extends Ability {
|
|
|
55
55
|
export declare class UnitAbility extends Ability {
|
|
56
56
|
readonly owner: Unit;
|
|
57
57
|
private readonly u;
|
|
58
|
+
private d?;
|
|
58
59
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
59
60
|
incrementHideCounter(): void;
|
|
60
61
|
decrementHideCounter(): void;
|
|
62
|
+
incrementDisableCounter(): void;
|
|
63
|
+
decrementDisableCounter(): void;
|
|
64
|
+
get isDisabled(): boolean;
|
|
61
65
|
get level(): number;
|
|
62
66
|
set level(v: number);
|
|
63
67
|
get cooldownRemaining(): number;
|
|
@@ -38,6 +38,7 @@ local getHandleId = GetHandleId
|
|
|
38
38
|
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
39
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
40
|
local unitHideAbility = BlzUnitHideAbility
|
|
41
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
41
42
|
local match = string.match
|
|
42
43
|
local ____type = _G.type
|
|
43
44
|
local ____tostring = _G.tostring
|
|
@@ -402,9 +403,25 @@ end
|
|
|
402
403
|
function UnitAbility.prototype.decrementHideCounter(self)
|
|
403
404
|
unitHideAbility(self.u, self.typeId, false)
|
|
404
405
|
end
|
|
406
|
+
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
407
|
+
unitDisableAbility(self.u, self.typeId, true, false)
|
|
408
|
+
self.d = (self.d or 0) + 1
|
|
409
|
+
end
|
|
410
|
+
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
411
|
+
unitDisableAbility(self.u, self.typeId, false, false)
|
|
412
|
+
self.d = (self.d or 0) - 1
|
|
413
|
+
end
|
|
405
414
|
function UnitAbility.prototype.interruptCast(self)
|
|
406
415
|
self.owner:interruptCast(self.typeId)
|
|
407
416
|
end
|
|
417
|
+
__TS__SetDescriptor(
|
|
418
|
+
UnitAbility.prototype,
|
|
419
|
+
"isDisabled",
|
|
420
|
+
{get = function(self)
|
|
421
|
+
return self.d ~= nil and self.d > 0
|
|
422
|
+
end},
|
|
423
|
+
true
|
|
424
|
+
)
|
|
408
425
|
__TS__SetDescriptor(
|
|
409
426
|
UnitAbility.prototype,
|
|
410
427
|
"level",
|
|
@@ -55,22 +55,24 @@ local COOLDOWN_STARTER_ITEM_TYPE_ID = compiletime(function()
|
|
|
55
55
|
itemType.activelyUsed = true
|
|
56
56
|
return itemType.id
|
|
57
57
|
end)
|
|
58
|
-
|
|
58
|
+
---
|
|
59
|
+
-- @internal For use by internal systems only.
|
|
60
|
+
____exports.itemAbilityDummy = assert(CreateUnit(
|
|
59
61
|
Player.neutralVictim.handle,
|
|
60
62
|
dummyUnitId,
|
|
61
63
|
0,
|
|
62
64
|
0,
|
|
63
65
|
270
|
|
64
66
|
))
|
|
65
|
-
local cooldownStarterItem = UnitAddItemById(
|
|
67
|
+
local cooldownStarterItem = UnitAddItemById(____exports.itemAbilityDummy, COOLDOWN_STARTER_ITEM_TYPE_ID)
|
|
66
68
|
local cooldownStarterAbility = BlzGetItemAbility(cooldownStarterItem, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
67
|
-
ShowUnit(
|
|
69
|
+
ShowUnit(____exports.itemAbilityDummy, false)
|
|
68
70
|
local function startItemCooldownInternal(handle, cooldown)
|
|
69
71
|
local cooldownGroup = getItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP)
|
|
70
72
|
setItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
71
73
|
setAbilityRealLevelField(cooldownStarterAbility, ABILITY_RLF_COOLDOWN, 0, cooldown)
|
|
72
|
-
unitResetCooldown(
|
|
73
|
-
unitUseItem(
|
|
74
|
+
unitResetCooldown(____exports.itemAbilityDummy)
|
|
75
|
+
unitUseItem(____exports.itemAbilityDummy, cooldownStarterItem)
|
|
74
76
|
Timer:run(restoreCooldownGroup, handle, cooldownGroup)
|
|
75
77
|
end
|
|
76
78
|
restoreCooldownGroup = function(handle, cooldownGroup)
|
|
@@ -85,7 +87,7 @@ ____exports.startItemCooldown = function(handle, owner, cooldown)
|
|
|
85
87
|
end
|
|
86
88
|
---
|
|
87
89
|
-- @internal For use by internal systems only.
|
|
88
|
-
____exports.abilityActionDummy =
|
|
90
|
+
____exports.abilityActionDummy = ____exports.itemAbilityDummy
|
|
89
91
|
---
|
|
90
92
|
-- @internal For use by internal systems only.
|
|
91
93
|
____exports.doAbilityAction = function(handle, action, ...)
|
|
@@ -104,11 +106,11 @@ ____exports.doAbilityAction = function(handle, action, ...)
|
|
|
104
106
|
end
|
|
105
107
|
x = getItemX(handle)
|
|
106
108
|
y = getItemY(handle)
|
|
107
|
-
unitAddItem(
|
|
109
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
108
110
|
end
|
|
109
111
|
local result = action(handle, ...)
|
|
110
112
|
if not isOwned then
|
|
111
|
-
unitRemoveItem(
|
|
113
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
112
114
|
setItemPosition(handle, x, y)
|
|
113
115
|
if isPowerup then
|
|
114
116
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
@@ -139,9 +141,9 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
139
141
|
isPowerup = true
|
|
140
142
|
end
|
|
141
143
|
unitRemoveItem(owner, handle)
|
|
142
|
-
unitAddItem(
|
|
144
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
143
145
|
local result = action(handle, ...)
|
|
144
|
-
unitRemoveItem(
|
|
146
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
145
147
|
unitAddItemToSlot(owner, handle, slot)
|
|
146
148
|
if isPowerup then
|
|
147
149
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
@@ -5,8 +5,8 @@ import { Event } from "../../event";
|
|
|
5
5
|
import { ReadonlyRect } from "../../core/types/rect";
|
|
6
6
|
import { ItemAbility } from "./ability";
|
|
7
7
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
8
|
+
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
8
9
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
9
|
-
export declare const addAndGetAbility: (handle: jitem, abilityTypeId: AbilityTypeId) => jability | null;
|
|
10
10
|
declare const enum ItemPropertyKey {
|
|
11
11
|
ABILITIES = 100,
|
|
12
12
|
LUA_INDEX_BY_ABILITY_TYPE_ID = 101
|
|
@@ -17,7 +17,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
17
17
|
constructor(handle: jitem);
|
|
18
18
|
protected onDestroy(): HandleDestructor;
|
|
19
19
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
20
|
-
get typeId():
|
|
20
|
+
get typeId(): ItemTypeId;
|
|
21
21
|
set skinId(v: number);
|
|
22
22
|
get skinId(): number;
|
|
23
23
|
set name(v: string);
|
|
@@ -73,6 +73,8 @@ export declare class Item extends Handle<jitem> {
|
|
|
73
73
|
set position(v: Vec2);
|
|
74
74
|
set charges(v: number);
|
|
75
75
|
get charges(): number;
|
|
76
|
+
consumeCharge(): boolean;
|
|
77
|
+
consumeCharges(count: number): boolean;
|
|
76
78
|
addAbility(abilityTypeId: AbilityTypeId): ItemAbility | undefined;
|
|
77
79
|
removeAbility(abilityTypeId: AbilityTypeId): boolean;
|
|
78
80
|
hasAbility(abilityTypeId: AbilityTypeId): boolean;
|
|
@@ -82,5 +84,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
82
84
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
83
85
|
static get onCreate(): Event<[Item]>;
|
|
84
86
|
static get destroyEvent(): Event<[Item]>;
|
|
87
|
+
static readonly chargesChangedEvent: Event<[Item]>;
|
|
85
88
|
}
|
|
86
89
|
export {};
|