warscript 0.0.1-dev.5abc199 → 0.0.1-dev.5c35450

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.
Files changed (57) hide show
  1. package/core/types/frame.lua +47 -1
  2. package/core/types/item.d.ts +1 -0
  3. package/core/types/item.lua +1 -0
  4. package/core/types/sound.lua +1 -1
  5. package/engine/behaviour/ability/damage.d.ts +3 -0
  6. package/engine/behaviour/ability/damage.lua +8 -2
  7. package/engine/behaviour/ability/emulate-impact.lua +5 -4
  8. package/engine/behaviour/ability.d.ts +5 -5
  9. package/engine/buff.d.ts +41 -13
  10. package/engine/buff.lua +222 -116
  11. package/engine/internal/ability.lua +25 -15
  12. package/engine/internal/item/fields.d.ts +12 -0
  13. package/engine/internal/item/fields.lua +33 -0
  14. package/engine/internal/item.d.ts +0 -4
  15. package/engine/internal/item.lua +0 -37
  16. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  17. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  18. package/engine/internal/object-data/health-bonus.lua +16 -0
  19. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  20. package/engine/internal/object-data/mana-bonus.lua +16 -0
  21. package/engine/internal/unit/bonus.d.ts +4 -0
  22. package/engine/internal/unit/bonus.lua +23 -3
  23. package/engine/internal/unit+bonus.lua +3 -3
  24. package/engine/local-client.d.ts +5 -0
  25. package/engine/local-client.lua +56 -1
  26. package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
  27. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
  28. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  29. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  30. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  31. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  32. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  33. package/engine/object-data/entry/ability-type.lua +4 -0
  34. package/engine/object-data/entry/buff-type/applicable.lua +113 -109
  35. package/engine/object-field/ability.lua +2 -2
  36. package/engine/object-field/item.d.ts +22 -0
  37. package/engine/object-field/item.lua +118 -0
  38. package/engine/object-field.d.ts +1 -1
  39. package/engine/object-field.lua +9 -7
  40. package/engine/standard/fields/item.d.ts +4 -0
  41. package/engine/standard/fields/item.lua +6 -0
  42. package/lualib_bundle.lua +1 -1
  43. package/math.d.ts +2 -0
  44. package/math.lua +14 -0
  45. package/objutil/object.lua +1 -1
  46. package/operation.lua +1 -4
  47. package/package.json +4 -4
  48. package/utility/linked-map.d.ts +2 -1
  49. package/utility/linked-map.lua +6 -0
  50. package/utility/linked-set.d.ts +1 -0
  51. package/utility/linked-set.lua +6 -0
  52. package/utility/unordered-map.d.ts +27 -0
  53. package/utility/unordered-map.lua +99 -0
  54. /package/engine/internal/object-data/{armor-increase.d.ts → armor-bonus.d.ts} +0 -0
  55. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  56. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  57. /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
package/engine/buff.lua CHANGED
@@ -103,7 +103,8 @@ local buffParametersKeys = {
103
103
  damageIncrease = true,
104
104
  damageIncreaseFactor = true,
105
105
  armorIncrease = true,
106
- armorIncreaseFactor = true,
106
+ maxHealthIncrease = true,
107
+ maxManaIncrease = true,
107
108
  attackSpeedIncreaseFactor = true,
108
109
  movementSpeedIncreaseFactor = true,
109
110
  manaRegenerationRateIncreaseFactor = true,
@@ -126,6 +127,9 @@ local buffParametersKeys = {
126
127
  maximumAutoAttackCount = true,
127
128
  maximumDamageDealtEventCount = true,
128
129
  maximumDamageReceivedEventCount = true,
130
+ absorbedDamageFactor = true,
131
+ maximumDamageAbsorbed = true,
132
+ destroysOnMaximumDamageAbsorbed = true,
129
133
  uniqueGroup = true,
130
134
  damageOnExpiration = true,
131
135
  healingOnExpiration = true,
@@ -182,6 +186,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
182
186
  end
183
187
  end
184
188
  local buffBooleanParameters = {
189
+ "destroysOnMaximumDamageAbsorbed",
185
190
  "turnsIntoGhost",
186
191
  "stuns",
187
192
  "ignoresStunImmunity",
@@ -197,6 +202,8 @@ local buffNumberParameters = {
197
202
  "manaRegenerationRateIncreaseFactor",
198
203
  "evasionProbability",
199
204
  "armorIncrease",
205
+ "maxHealthIncrease",
206
+ "maxManaIncrease",
200
207
  "damageFactor",
201
208
  "receivedDamageFactor",
202
209
  "maximumAutoAttackCount",
@@ -210,6 +217,8 @@ local buffNumberParameters = {
210
217
  "healingOverDuration",
211
218
  "damageOnExpiration",
212
219
  "healingOnExpiration",
220
+ "absorbedDamageFactor",
221
+ "maximumDamageAbsorbed",
213
222
  "abilityCooldownFactor"
214
223
  }
215
224
  local unsuccessfulApplicationMarker = {}
@@ -388,14 +397,15 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
388
397
  local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
389
398
  if missProbability ~= nil then
390
399
  missProbability = resolveNumberValue(ability, level, missProbability)
391
- self[142] = missProbability
400
+ self[146] = missProbability
392
401
  end
393
402
  local buffByTypeId = buffByTypeIdByUnit[_unit]
394
403
  if buffByTypeId == nil then
395
404
  buffByTypeId = {}
396
405
  buffByTypeIdByUnit[_unit] = buffByTypeId
397
406
  end
398
- local ____opt_15 = buffByTypeId[typeId]
407
+ self.previousBuff = buffByTypeId[typeId]
408
+ local ____opt_15 = self.previousBuff
399
409
  if ____opt_15 ~= nil then
400
410
  ____opt_15:destroy()
401
411
  end
@@ -525,7 +535,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
525
535
  end
526
536
  function Buff.prototype.onAbilityGained(self, ability)
527
537
  if __TS__InstanceOf(ability, UnitAbility) then
528
- local abilityCooldownModifier = self[144]
538
+ local abilityCooldownModifier = self[148]
529
539
  if abilityCooldownModifier then
530
540
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
531
541
  end
@@ -533,24 +543,38 @@ function Buff.prototype.onAbilityGained(self, ability)
533
543
  end
534
544
  function Buff.prototype.onAbilityLost(self, ability)
535
545
  if __TS__InstanceOf(ability, UnitAbility) then
536
- local abilityCooldownModifier = self[144]
546
+ local abilityCooldownModifier = self[148]
537
547
  if abilityCooldownModifier then
538
548
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
539
549
  end
540
550
  end
541
551
  end
542
552
  function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
553
+ self:flash(
554
+ self[105],
555
+ stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin",
556
+ widgetOrXOrParametersOrDuration,
557
+ yOrParametersOrDuration,
558
+ parametersOrDuration
559
+ )
560
+ end
561
+ function Buff.prototype.flashSpecialEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
562
+ self:flash(
563
+ self[106],
564
+ stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin",
565
+ widgetOrXOrParametersOrDuration,
566
+ yOrParametersOrDuration,
567
+ parametersOrDuration
568
+ )
569
+ end
570
+ function Buff.prototype.flash(self, modelPath, attachmentPoint, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
543
571
  if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
544
- Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
572
+ Effect:flash(modelPath, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
545
573
  else
546
574
  local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
547
575
  local ____Effect_40 = Effect
548
576
  local ____Effect_flash_41 = Effect.flash
549
- local ____array_39 = __TS__SparseArrayNew(
550
- self[105],
551
- isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
552
- stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
553
- )
577
+ local ____array_39 = __TS__SparseArrayNew(modelPath, isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit, attachmentPoint)
554
578
  local ____isWidgetProvided_38
555
579
  if isWidgetProvided then
556
580
  ____isWidgetProvided_38 = yOrParametersOrDuration
@@ -564,27 +588,6 @@ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrPa
564
588
  )
565
589
  end
566
590
  end
567
- function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
568
- local isWidgetProvided = type(widgetOrDuration) == "table"
569
- local ____Effect_44 = Effect
570
- local ____Effect_flash_45 = Effect.flash
571
- local ____array_43 = __TS__SparseArrayNew(
572
- self[106],
573
- isWidgetProvided and widgetOrDuration or self._unit,
574
- stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
575
- )
576
- local ____isWidgetProvided_42
577
- if isWidgetProvided then
578
- ____isWidgetProvided_42 = duration
579
- else
580
- ____isWidgetProvided_42 = widgetOrDuration
581
- end
582
- __TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
583
- ____Effect_flash_45(
584
- ____Effect_44,
585
- __TS__SparseArraySpread(____array_43)
586
- )
587
- end
588
591
  function Buff.prototype.expire(self)
589
592
  expireBuff(self)
590
593
  end
@@ -616,25 +619,25 @@ function Buff.prototype.onDestroy(self)
616
619
  behavior:destroy()
617
620
  end
618
621
  end
619
- local previousAbilityCooldownModifier = self[144]
622
+ local previousAbilityCooldownModifier = self[148]
620
623
  if previousAbilityCooldownModifier then
621
624
  for ____, ability in ipairs(self._unit.abilities) do
622
625
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
623
626
  end
624
627
  end
625
- if self[139] then
628
+ if self[143] then
626
629
  unit:decrementInvulnerabilityCounter()
627
630
  end
628
- if self[138] then
631
+ if self[142] then
629
632
  unit:decrementDisableAutoAttackCounter()
630
633
  end
631
- if self[136] then
632
- if self[137] then
634
+ if self[140] then
635
+ if self[141] then
633
636
  unit:decrementForceStunCounter()
634
637
  end
635
638
  unit:decrementStunCounter()
636
639
  end
637
- if self[135] then
640
+ if self[139] then
638
641
  unit:decrementGhostCounter()
639
642
  end
640
643
  if self._abilityTypeIds ~= nil then
@@ -671,8 +674,8 @@ function Buff.apply(self, ...)
671
674
  end
672
675
  end
673
676
  function Buff.getByTypeId(self, unit, typeId)
674
- local ____opt_46 = buffByTypeIdByUnit[unit]
675
- local buff = ____opt_46 and ____opt_46[typeId]
677
+ local ____opt_42 = buffByTypeIdByUnit[unit]
678
+ local buff = ____opt_42 and ____opt_42[typeId]
676
679
  if __TS__InstanceOf(buff, self) then
677
680
  return buff
678
681
  end
@@ -686,9 +689,9 @@ function Buff.prototype.onExpiration(self)
686
689
  if self[121] ~= nil then
687
690
  (self[102] or unit):healTarget(unit, self[120] or 0)
688
691
  end
689
- if self[141] then
692
+ if self[145] then
690
693
  unit:explode()
691
- elseif self[140] then
694
+ elseif self[144] then
692
695
  unit:kill()
693
696
  end
694
697
  end
@@ -743,6 +746,18 @@ function Buff.prototype.onDamageDealt(self, target, event)
743
746
  end
744
747
  function Buff.prototype.onDamageReceived(self, source, event)
745
748
  if event.originalAmount ~= 0 then
749
+ local absorbedDamage = min(event.amount * (self[135] or 1), (self[136] or 0) - (self[137] or 0))
750
+ if absorbedDamage > 0 then
751
+ event.amount = event.amount - absorbedDamage
752
+ self[137] = (self[137] or 0) + absorbedDamage
753
+ local ____self__138_44 = self[138]
754
+ if ____self__138_44 == nil then
755
+ ____self__138_44 = true
756
+ end
757
+ if ____self__138_44 and self[137] >= (self[136] or 0) then
758
+ self:destroy()
759
+ end
760
+ end
746
761
  local damageReceivedEventCount = (self[133] or 0) + 1
747
762
  self[133] = damageReceivedEventCount
748
763
  if damageReceivedEventCount == self[134] then
@@ -830,8 +845,8 @@ __TS__SetDescriptor(
830
845
  return
831
846
  end
832
847
  self[112] = damageInterval
833
- local ____opt_48 = self._timer
834
- local elapsed = ____opt_48 and ____opt_48.elapsed or 0
848
+ local ____opt_45 = self._timer
849
+ local elapsed = ____opt_45 and ____opt_45.elapsed or 0
835
850
  local timer = self[114]
836
851
  if timer == nil then
837
852
  timer = Timer:create()
@@ -910,8 +925,8 @@ __TS__SetDescriptor(
910
925
  return
911
926
  end
912
927
  self[117] = healingInterval
913
- local ____opt_50 = self._timer
914
- local elapsed = ____opt_50 and ____opt_50.elapsed or 0
928
+ local ____opt_47 = self._timer
929
+ local elapsed = ____opt_47 and ____opt_47.elapsed or 0
915
930
  local timer = self[119]
916
931
  if timer == nil then
917
932
  timer = Timer:create()
@@ -992,24 +1007,50 @@ __TS__SetDescriptor(
992
1007
  },
993
1008
  true
994
1009
  )
1010
+ __TS__SetDescriptor(
1011
+ Buff.prototype,
1012
+ "maxHealthIncrease",
1013
+ {
1014
+ get = function(self)
1015
+ return self:getUnitBonus(UnitBonusType.HEALTH)
1016
+ end,
1017
+ set = function(self, maxHealthIncrease)
1018
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.HEALTH, maxHealthIncrease)
1019
+ end
1020
+ },
1021
+ true
1022
+ )
1023
+ __TS__SetDescriptor(
1024
+ Buff.prototype,
1025
+ "maxManaIncrease",
1026
+ {
1027
+ get = function(self)
1028
+ return self:getUnitBonus(UnitBonusType.MANA)
1029
+ end,
1030
+ set = function(self, maxManaIncrease)
1031
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA, maxManaIncrease)
1032
+ end
1033
+ },
1034
+ true
1035
+ )
995
1036
  __TS__SetDescriptor(
996
1037
  Buff.prototype,
997
1038
  "turnsIntoGhost",
998
1039
  {
999
1040
  get = function(self)
1000
- local ____self__135_52 = self[135]
1001
- if ____self__135_52 == nil then
1002
- ____self__135_52 = false
1041
+ local ____self__139_49 = self[139]
1042
+ if ____self__139_49 == nil then
1043
+ ____self__139_49 = false
1003
1044
  end
1004
- return ____self__135_52
1045
+ return ____self__139_49
1005
1046
  end,
1006
1047
  set = function(self, turnsIntoGhost)
1007
- if not turnsIntoGhost and self[135] then
1048
+ if not turnsIntoGhost and self[139] then
1008
1049
  self.object:decrementGhostCounter()
1009
- self[135] = nil
1010
- elseif turnsIntoGhost and not self[135] then
1050
+ self[139] = nil
1051
+ elseif turnsIntoGhost and not self[139] then
1011
1052
  self.object:incrementGhostCounter()
1012
- self[135] = true
1053
+ self[139] = true
1013
1054
  end
1014
1055
  end
1015
1056
  },
@@ -1020,25 +1061,25 @@ __TS__SetDescriptor(
1020
1061
  "stuns",
1021
1062
  {
1022
1063
  get = function(self)
1023
- local ____self__136_53 = self[136]
1024
- if ____self__136_53 == nil then
1025
- ____self__136_53 = false
1064
+ local ____self__140_50 = self[140]
1065
+ if ____self__140_50 == nil then
1066
+ ____self__140_50 = false
1026
1067
  end
1027
- return ____self__136_53
1068
+ return ____self__140_50
1028
1069
  end,
1029
1070
  set = function(self, stuns)
1030
- if not stuns and self[136] then
1031
- if self[137] then
1071
+ if not stuns and self[140] then
1072
+ if self[141] then
1032
1073
  self.object:decrementForceStunCounter()
1033
1074
  end
1034
1075
  self.object:decrementStunCounter()
1035
- self[136] = nil
1036
- elseif stuns and not self[136] then
1037
- if self[137] then
1076
+ self[140] = nil
1077
+ elseif stuns and not self[140] then
1078
+ if self[141] then
1038
1079
  self.object:incrementForceStunCounter()
1039
1080
  end
1040
1081
  self.object:incrementStunCounter()
1041
- self[136] = true
1082
+ self[140] = true
1042
1083
  end
1043
1084
  end
1044
1085
  },
@@ -1049,23 +1090,23 @@ __TS__SetDescriptor(
1049
1090
  "ignoresStunImmunity",
1050
1091
  {
1051
1092
  get = function(self)
1052
- local ____self__137_54 = self[137]
1053
- if ____self__137_54 == nil then
1054
- ____self__137_54 = false
1093
+ local ____self__141_51 = self[141]
1094
+ if ____self__141_51 == nil then
1095
+ ____self__141_51 = false
1055
1096
  end
1056
- return ____self__137_54
1097
+ return ____self__141_51
1057
1098
  end,
1058
1099
  set = function(self, ignoresStunImmunity)
1059
- if not ignoresStunImmunity and self[137] then
1060
- if self[136] then
1100
+ if not ignoresStunImmunity and self[141] then
1101
+ if self[140] then
1061
1102
  self.object:decrementForceStunCounter()
1062
1103
  end
1063
- self[137] = nil
1064
- elseif ignoresStunImmunity and not self[137] then
1065
- if self[136] then
1104
+ self[141] = nil
1105
+ elseif ignoresStunImmunity and not self[141] then
1106
+ if self[140] then
1066
1107
  self.object:incrementForceStunCounter()
1067
1108
  end
1068
- self[137] = true
1109
+ self[141] = true
1069
1110
  end
1070
1111
  end
1071
1112
  },
@@ -1076,19 +1117,19 @@ __TS__SetDescriptor(
1076
1117
  "disablesAutoAttack",
1077
1118
  {
1078
1119
  get = function(self)
1079
- local ____self__138_55 = self[138]
1080
- if ____self__138_55 == nil then
1081
- ____self__138_55 = false
1120
+ local ____self__142_52 = self[142]
1121
+ if ____self__142_52 == nil then
1122
+ ____self__142_52 = false
1082
1123
  end
1083
- return ____self__138_55
1124
+ return ____self__142_52
1084
1125
  end,
1085
1126
  set = function(self, disablesAutoAttack)
1086
- if not disablesAutoAttack and self[138] then
1127
+ if not disablesAutoAttack and self[142] then
1087
1128
  self.object:decrementDisableAutoAttackCounter()
1088
- self[138] = nil
1089
- elseif disablesAutoAttack and not self[138] then
1129
+ self[142] = nil
1130
+ elseif disablesAutoAttack and not self[142] then
1090
1131
  self.object:incrementDisableAutoAttackCounter()
1091
- self[138] = true
1132
+ self[142] = true
1092
1133
  end
1093
1134
  end
1094
1135
  },
@@ -1099,19 +1140,19 @@ __TS__SetDescriptor(
1099
1140
  "providesInvulnerability",
1100
1141
  {
1101
1142
  get = function(self)
1102
- local ____self__139_56 = self[139]
1103
- if ____self__139_56 == nil then
1104
- ____self__139_56 = false
1143
+ local ____self__143_53 = self[143]
1144
+ if ____self__143_53 == nil then
1145
+ ____self__143_53 = false
1105
1146
  end
1106
- return ____self__139_56
1147
+ return ____self__143_53
1107
1148
  end,
1108
1149
  set = function(self, providesInvulnerability)
1109
- if not providesInvulnerability and self[139] then
1150
+ if not providesInvulnerability and self[143] then
1110
1151
  self.object:decrementInvulnerabilityCounter()
1111
- self[139] = nil
1112
- elseif providesInvulnerability and not self[139] then
1152
+ self[143] = nil
1153
+ elseif providesInvulnerability and not self[143] then
1113
1154
  self.object:incrementInvulnerabilityCounter()
1114
- self[139] = true
1155
+ self[143] = true
1115
1156
  end
1116
1157
  end
1117
1158
  },
@@ -1122,17 +1163,17 @@ __TS__SetDescriptor(
1122
1163
  "killsOnExpiration",
1123
1164
  {
1124
1165
  get = function(self)
1125
- local ____self__140_57 = self[140]
1126
- if ____self__140_57 == nil then
1127
- ____self__140_57 = false
1166
+ local ____self__144_54 = self[144]
1167
+ if ____self__144_54 == nil then
1168
+ ____self__144_54 = false
1128
1169
  end
1129
- return ____self__140_57
1170
+ return ____self__144_54
1130
1171
  end,
1131
1172
  set = function(self, killsOnExpiration)
1132
- if not killsOnExpiration and self[140] then
1133
- self[140] = nil
1134
- elseif killsOnExpiration and not self[140] then
1135
- self[140] = true
1173
+ if not killsOnExpiration and self[144] then
1174
+ self[144] = nil
1175
+ elseif killsOnExpiration and not self[144] then
1176
+ self[144] = true
1136
1177
  end
1137
1178
  end
1138
1179
  },
@@ -1143,17 +1184,17 @@ __TS__SetDescriptor(
1143
1184
  "explodesOnExpiration",
1144
1185
  {
1145
1186
  get = function(self)
1146
- local ____self__141_58 = self[141]
1147
- if ____self__141_58 == nil then
1148
- ____self__141_58 = false
1187
+ local ____self__145_55 = self[145]
1188
+ if ____self__145_55 == nil then
1189
+ ____self__145_55 = false
1149
1190
  end
1150
- return ____self__141_58
1191
+ return ____self__145_55
1151
1192
  end,
1152
1193
  set = function(self, killsOnExpiration)
1153
- if not killsOnExpiration and self[141] then
1154
- self[141] = nil
1155
- elseif killsOnExpiration and not self[141] then
1156
- self[141] = true
1194
+ if not killsOnExpiration and self[145] then
1195
+ self[145] = nil
1196
+ elseif killsOnExpiration and not self[145] then
1197
+ self[145] = true
1157
1198
  end
1158
1199
  end
1159
1200
  },
@@ -1302,13 +1343,13 @@ __TS__SetDescriptor(
1302
1343
  "remainingDuration",
1303
1344
  {
1304
1345
  get = function(self)
1305
- local ____opt_59 = self._timer
1306
- return ____opt_59 and ____opt_59.remaining or 0
1346
+ local ____opt_56 = self._timer
1347
+ return ____opt_56 and ____opt_56.remaining or 0
1307
1348
  end,
1308
1349
  set = function(self, remainingDuration)
1309
- local ____remainingDuration_63 = remainingDuration
1310
- local ____opt_61 = self._timer
1311
- local remainingDurationDelta = ____remainingDuration_63 - (____opt_61 and ____opt_61.remaining or 0)
1350
+ local ____remainingDuration_60 = remainingDuration
1351
+ local ____opt_58 = self._timer
1352
+ local remainingDurationDelta = ____remainingDuration_60 - (____opt_58 and ____opt_58.remaining or 0)
1312
1353
  if remainingDurationDelta ~= 0 then
1313
1354
  self[103] = self[103] + remainingDurationDelta
1314
1355
  if remainingDuration <= 0 then
@@ -1323,7 +1364,7 @@ __TS__SetDescriptor(
1323
1364
  remainingDuration,
1324
1365
  self._spellStealPriority,
1325
1366
  self._learnLevelMinimum,
1326
- self[142]
1367
+ self[146]
1327
1368
  ) then
1328
1369
  local timer = self._timer
1329
1370
  if timer == nil then
@@ -1338,15 +1379,80 @@ __TS__SetDescriptor(
1338
1379
  },
1339
1380
  true
1340
1381
  )
1382
+ __TS__SetDescriptor(
1383
+ Buff.prototype,
1384
+ "absorbedDamageFactor",
1385
+ {
1386
+ get = function(self)
1387
+ return self[135] or 1
1388
+ end,
1389
+ set = function(self, absorbedDamageFactor)
1390
+ if absorbedDamageFactor == 1 then
1391
+ self[135] = nil
1392
+ else
1393
+ self[135] = absorbedDamageFactor
1394
+ end
1395
+ end
1396
+ },
1397
+ true
1398
+ )
1399
+ __TS__SetDescriptor(
1400
+ Buff.prototype,
1401
+ "maximumDamageAbsorbed",
1402
+ {
1403
+ get = function(self)
1404
+ return self[136] or 0
1405
+ end,
1406
+ set = function(self, maximumDamageAbsorbed)
1407
+ if maximumDamageAbsorbed == 0 then
1408
+ self[136] = nil
1409
+ else
1410
+ self[136] = maximumDamageAbsorbed
1411
+ end
1412
+ end
1413
+ },
1414
+ true
1415
+ )
1416
+ __TS__SetDescriptor(
1417
+ Buff.prototype,
1418
+ "damageAbsorbed",
1419
+ {get = function(self)
1420
+ return self[137] or 0
1421
+ end},
1422
+ true
1423
+ )
1424
+ __TS__SetDescriptor(
1425
+ Buff.prototype,
1426
+ "destroysOnMaximumDamageAbsorbed",
1427
+ {
1428
+ get = function(self)
1429
+ local ____self__138_61 = self[138]
1430
+ if ____self__138_61 == nil then
1431
+ ____self__138_61 = true
1432
+ end
1433
+ return ____self__138_61
1434
+ end,
1435
+ set = function(self, destroysOnMaximumDamageAbsorbed)
1436
+ local ____destroysOnMaximumDamageAbsorbed_62
1437
+ if destroysOnMaximumDamageAbsorbed then
1438
+ ____destroysOnMaximumDamageAbsorbed_62 = nil
1439
+ else
1440
+ ____destroysOnMaximumDamageAbsorbed_62 = false
1441
+ end
1442
+ self[138] = ____destroysOnMaximumDamageAbsorbed_62
1443
+ end
1444
+ },
1445
+ true
1446
+ )
1341
1447
  __TS__SetDescriptor(
1342
1448
  Buff.prototype,
1343
1449
  "abilityCooldownFactor",
1344
1450
  {
1345
1451
  get = function(self)
1346
- return self[143] or 1
1452
+ return self[147] or 1
1347
1453
  end,
1348
1454
  set = function(self, abilityCooldownFactor)
1349
- local previousAbilityCooldownModifier = self[144]
1455
+ local previousAbilityCooldownModifier = self[148]
1350
1456
  if previousAbilityCooldownModifier then
1351
1457
  for ____, ability in ipairs(self._unit.abilities) do
1352
1458
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
@@ -1358,8 +1464,8 @@ __TS__SetDescriptor(
1358
1464
  for ____, ability in ipairs(self._unit.abilities) do
1359
1465
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
1360
1466
  end
1361
- self[144] = modifier
1362
- self[143] = abilityCooldownFactor
1467
+ self[148] = modifier
1468
+ self[147] = abilityCooldownFactor
1363
1469
  end
1364
1470
  },
1365
1471
  true
@@ -14,6 +14,8 @@ local abilityActionDummy = ____ability.abilityActionDummy
14
14
  local doAbilityAction = ____ability.doAbilityAction
15
15
  local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
16
16
  local startItemCooldown = ____ability.startItemCooldown
17
+ local ____timer = require("core.types.timer")
18
+ local Timer = ____timer.Timer
17
19
  local getUnitAbilityLevel = GetUnitAbilityLevel
18
20
  local setUnitAbilityLevel = SetUnitAbilityLevel
19
21
  local setAbilityIntegerField = BlzSetAbilityIntegerField
@@ -35,8 +37,6 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
35
37
  local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
36
38
  local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
37
39
  local getHandleId = GetHandleId
38
- local getItemBooleanField = BlzGetItemBooleanField
39
- local setItemBooleanField = BlzSetItemBooleanField
40
40
  local unitHideAbility = BlzUnitHideAbility
41
41
  local unitDisableAbility = BlzUnitDisableAbility
42
42
  local match = string.match
@@ -516,11 +516,21 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
516
516
  )
517
517
  end
518
518
  function ItemAbility.prototype.interruptCast(self)
519
- local handle = self.owner.handle
520
- local activelyUsed = getItemBooleanField(handle, ITEM_BF_ACTIVELY_USED)
521
- if activelyUsed then
522
- setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, false)
523
- setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, true)
519
+ local item = self.owner
520
+ local itemHandle = item.handle
521
+ local ____opt_1 = item.owner
522
+ local itemOwnerHandle = ____opt_1 and ____opt_1.handle
523
+ local cooldownRemaining = doAbilityActionForceDummy(itemHandle, itemOwnerHandle, getAbilityCooldown, self.typeId)
524
+ if cooldownRemaining == 0 then
525
+ local cooldown = doAbilityAction(
526
+ itemHandle,
527
+ getAbilityField,
528
+ self,
529
+ ABILITY_RLF_COOLDOWN,
530
+ 0
531
+ )
532
+ startItemCooldown(itemHandle, itemOwnerHandle, 1)
533
+ Timer:run(startItemCooldown, itemHandle, itemOwnerHandle, cooldown)
524
534
  end
525
535
  end
526
536
  function ItemAbility.prototype.onDestroy(self)
@@ -543,17 +553,17 @@ __TS__SetDescriptor(
543
553
  {
544
554
  get = function(self)
545
555
  local item = self.owner
546
- local ____doAbilityActionForceDummy_4 = doAbilityActionForceDummy
547
- local ____item_handle_3 = item.handle
548
- local ____opt_1 = item.owner
549
- return ____doAbilityActionForceDummy_4(____item_handle_3, ____opt_1 and ____opt_1.handle, getAbilityCooldown, self.typeId)
556
+ local ____doAbilityActionForceDummy_6 = doAbilityActionForceDummy
557
+ local ____item_handle_5 = item.handle
558
+ local ____opt_3 = item.owner
559
+ return ____doAbilityActionForceDummy_6(____item_handle_5, ____opt_3 and ____opt_3.handle, getAbilityCooldown, self.typeId)
550
560
  end,
551
561
  set = function(self, cooldownRemaining)
552
562
  local item = self.owner
553
- local ____startItemCooldown_8 = startItemCooldown
554
- local ____item_handle_7 = item.handle
555
- local ____opt_5 = item.owner
556
- ____startItemCooldown_8(____item_handle_7, ____opt_5 and ____opt_5.handle, cooldownRemaining)
563
+ local ____startItemCooldown_10 = startItemCooldown
564
+ local ____item_handle_9 = item.handle
565
+ local ____opt_7 = item.owner
566
+ ____startItemCooldown_10(____item_handle_9, ____opt_7 and ____opt_7.handle, cooldownRemaining)
557
567
  end
558
568
  },
559
569
  true
@@ -0,0 +1,12 @@
1
+ /** @noSelfInFile */
2
+ declare module "../item" {
3
+ interface Item {
4
+ canBeSold: boolean;
5
+ }
6
+ }
7
+ declare module "../item" {
8
+ interface Item {
9
+ isActivelyUsed: boolean;
10
+ }
11
+ }
12
+ export {};