warscript 0.0.1-dev.c677d41 → 0.0.1-dev.c762beb

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 (52) hide show
  1. package/core/types/handle.lua +1 -1
  2. package/core/types/sound.lua +1 -1
  3. package/engine/behaviour/ability/damage.d.ts +3 -0
  4. package/engine/behaviour/ability/damage.lua +8 -2
  5. package/engine/behaviour/ability.d.ts +9 -5
  6. package/engine/behaviour/ability.lua +29 -0
  7. package/engine/buff.d.ts +49 -17
  8. package/engine/buff.lua +241 -118
  9. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  10. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  11. package/engine/internal/object-data/health-bonus.lua +16 -0
  12. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  13. package/engine/internal/object-data/mana-bonus.lua +16 -0
  14. package/engine/internal/unit/bonus.d.ts +4 -0
  15. package/engine/internal/unit/bonus.lua +23 -3
  16. package/engine/internal/unit/item.lua +1 -1
  17. package/engine/internal/unit/range-event.d.ts +12 -0
  18. package/engine/internal/unit/range-event.lua +90 -0
  19. package/engine/internal/unit+bonus.lua +3 -3
  20. package/engine/internal/unit.d.ts +1 -1
  21. package/engine/internal/unit.lua +9 -30
  22. package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
  23. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
  24. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  25. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  26. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  27. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  28. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  29. package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
  30. package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
  31. package/engine/object-data/entry/ability-type.d.ts +2 -0
  32. package/engine/object-data/entry/ability-type.lua +84 -4
  33. package/engine/object-data/entry/buff-type/applicable.lua +113 -109
  34. package/engine/object-field/ability.lua +2 -2
  35. package/engine/object-field.d.ts +1 -1
  36. package/engine/object-field.lua +9 -7
  37. package/engine/random.d.ts +1 -0
  38. package/engine/random.lua +8 -0
  39. package/engine/unit.d.ts +1 -0
  40. package/engine/unit.lua +1 -0
  41. package/lualib_bundle.lua +118 -47
  42. package/objutil/object.lua +1 -1
  43. package/operation.lua +23 -17
  44. package/package.json +4 -4
  45. package/utility/linked-map.d.ts +9 -1
  46. package/utility/linked-map.lua +35 -0
  47. package/utility/linked-set.d.ts +2 -1
  48. package/utility/linked-set.lua +17 -0
  49. /package/engine/internal/object-data/{armor-increase.d.ts → armor-bonus.d.ts} +0 -0
  50. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  51. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  52. /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,26 +588,8 @@ 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
- )
591
+ function Buff.prototype.expire(self)
592
+ expireBuff(self)
587
593
  end
588
594
  function Buff.prototype.onCreate(self)
589
595
  end
@@ -613,25 +619,25 @@ function Buff.prototype.onDestroy(self)
613
619
  behavior:destroy()
614
620
  end
615
621
  end
616
- local previousAbilityCooldownModifier = self[144]
622
+ local previousAbilityCooldownModifier = self[148]
617
623
  if previousAbilityCooldownModifier then
618
624
  for ____, ability in ipairs(self._unit.abilities) do
619
625
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
620
626
  end
621
627
  end
622
- if self[139] then
628
+ if self[143] then
623
629
  unit:decrementInvulnerabilityCounter()
624
630
  end
625
- if self[138] then
631
+ if self[142] then
626
632
  unit:decrementDisableAutoAttackCounter()
627
633
  end
628
- if self[136] then
629
- if self[137] then
634
+ if self[140] then
635
+ if self[141] then
630
636
  unit:decrementForceStunCounter()
631
637
  end
632
638
  unit:decrementStunCounter()
633
639
  end
634
- if self[135] then
640
+ if self[139] then
635
641
  unit:decrementGhostCounter()
636
642
  end
637
643
  if self._abilityTypeIds ~= nil then
@@ -668,8 +674,8 @@ function Buff.apply(self, ...)
668
674
  end
669
675
  end
670
676
  function Buff.getByTypeId(self, unit, typeId)
671
- local ____opt_46 = buffByTypeIdByUnit[unit]
672
- local buff = ____opt_46 and ____opt_46[typeId]
677
+ local ____opt_42 = buffByTypeIdByUnit[unit]
678
+ local buff = ____opt_42 and ____opt_42[typeId]
673
679
  if __TS__InstanceOf(buff, self) then
674
680
  return buff
675
681
  end
@@ -683,9 +689,9 @@ function Buff.prototype.onExpiration(self)
683
689
  if self[121] ~= nil then
684
690
  (self[102] or unit):healTarget(unit, self[120] or 0)
685
691
  end
686
- if self[141] then
692
+ if self[145] then
687
693
  unit:explode()
688
- elseif self[140] then
694
+ elseif self[144] then
689
695
  unit:kill()
690
696
  end
691
697
  end
@@ -740,6 +746,18 @@ function Buff.prototype.onDamageDealt(self, target, event)
740
746
  end
741
747
  function Buff.prototype.onDamageReceived(self, source, event)
742
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
743
761
  local damageReceivedEventCount = (self[133] or 0) + 1
744
762
  self[133] = damageReceivedEventCount
745
763
  if damageReceivedEventCount == self[134] then
@@ -827,8 +845,8 @@ __TS__SetDescriptor(
827
845
  return
828
846
  end
829
847
  self[112] = damageInterval
830
- local ____opt_48 = self._timer
831
- 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
832
850
  local timer = self[114]
833
851
  if timer == nil then
834
852
  timer = Timer:create()
@@ -907,8 +925,8 @@ __TS__SetDescriptor(
907
925
  return
908
926
  end
909
927
  self[117] = healingInterval
910
- local ____opt_50 = self._timer
911
- 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
912
930
  local timer = self[119]
913
931
  if timer == nil then
914
932
  timer = Timer:create()
@@ -989,24 +1007,50 @@ __TS__SetDescriptor(
989
1007
  },
990
1008
  true
991
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
+ )
992
1036
  __TS__SetDescriptor(
993
1037
  Buff.prototype,
994
1038
  "turnsIntoGhost",
995
1039
  {
996
1040
  get = function(self)
997
- local ____self__135_52 = self[135]
998
- if ____self__135_52 == nil then
999
- ____self__135_52 = false
1041
+ local ____self__139_49 = self[139]
1042
+ if ____self__139_49 == nil then
1043
+ ____self__139_49 = false
1000
1044
  end
1001
- return ____self__135_52
1045
+ return ____self__139_49
1002
1046
  end,
1003
1047
  set = function(self, turnsIntoGhost)
1004
- if not turnsIntoGhost and self[135] then
1048
+ if not turnsIntoGhost and self[139] then
1005
1049
  self.object:decrementGhostCounter()
1006
- self[135] = nil
1007
- elseif turnsIntoGhost and not self[135] then
1050
+ self[139] = nil
1051
+ elseif turnsIntoGhost and not self[139] then
1008
1052
  self.object:incrementGhostCounter()
1009
- self[135] = true
1053
+ self[139] = true
1010
1054
  end
1011
1055
  end
1012
1056
  },
@@ -1017,25 +1061,25 @@ __TS__SetDescriptor(
1017
1061
  "stuns",
1018
1062
  {
1019
1063
  get = function(self)
1020
- local ____self__136_53 = self[136]
1021
- if ____self__136_53 == nil then
1022
- ____self__136_53 = false
1064
+ local ____self__140_50 = self[140]
1065
+ if ____self__140_50 == nil then
1066
+ ____self__140_50 = false
1023
1067
  end
1024
- return ____self__136_53
1068
+ return ____self__140_50
1025
1069
  end,
1026
1070
  set = function(self, stuns)
1027
- if not stuns and self[136] then
1028
- if self[137] then
1071
+ if not stuns and self[140] then
1072
+ if self[141] then
1029
1073
  self.object:decrementForceStunCounter()
1030
1074
  end
1031
1075
  self.object:decrementStunCounter()
1032
- self[136] = nil
1033
- elseif stuns and not self[136] then
1034
- if self[137] then
1076
+ self[140] = nil
1077
+ elseif stuns and not self[140] then
1078
+ if self[141] then
1035
1079
  self.object:incrementForceStunCounter()
1036
1080
  end
1037
1081
  self.object:incrementStunCounter()
1038
- self[136] = true
1082
+ self[140] = true
1039
1083
  end
1040
1084
  end
1041
1085
  },
@@ -1046,23 +1090,23 @@ __TS__SetDescriptor(
1046
1090
  "ignoresStunImmunity",
1047
1091
  {
1048
1092
  get = function(self)
1049
- local ____self__137_54 = self[137]
1050
- if ____self__137_54 == nil then
1051
- ____self__137_54 = false
1093
+ local ____self__141_51 = self[141]
1094
+ if ____self__141_51 == nil then
1095
+ ____self__141_51 = false
1052
1096
  end
1053
- return ____self__137_54
1097
+ return ____self__141_51
1054
1098
  end,
1055
1099
  set = function(self, ignoresStunImmunity)
1056
- if not ignoresStunImmunity and self[137] then
1057
- if self[136] then
1100
+ if not ignoresStunImmunity and self[141] then
1101
+ if self[140] then
1058
1102
  self.object:decrementForceStunCounter()
1059
1103
  end
1060
- self[137] = nil
1061
- elseif ignoresStunImmunity and not self[137] then
1062
- if self[136] then
1104
+ self[141] = nil
1105
+ elseif ignoresStunImmunity and not self[141] then
1106
+ if self[140] then
1063
1107
  self.object:incrementForceStunCounter()
1064
1108
  end
1065
- self[137] = true
1109
+ self[141] = true
1066
1110
  end
1067
1111
  end
1068
1112
  },
@@ -1073,19 +1117,19 @@ __TS__SetDescriptor(
1073
1117
  "disablesAutoAttack",
1074
1118
  {
1075
1119
  get = function(self)
1076
- local ____self__138_55 = self[138]
1077
- if ____self__138_55 == nil then
1078
- ____self__138_55 = false
1120
+ local ____self__142_52 = self[142]
1121
+ if ____self__142_52 == nil then
1122
+ ____self__142_52 = false
1079
1123
  end
1080
- return ____self__138_55
1124
+ return ____self__142_52
1081
1125
  end,
1082
1126
  set = function(self, disablesAutoAttack)
1083
- if not disablesAutoAttack and self[138] then
1127
+ if not disablesAutoAttack and self[142] then
1084
1128
  self.object:decrementDisableAutoAttackCounter()
1085
- self[138] = nil
1086
- elseif disablesAutoAttack and not self[138] then
1129
+ self[142] = nil
1130
+ elseif disablesAutoAttack and not self[142] then
1087
1131
  self.object:incrementDisableAutoAttackCounter()
1088
- self[138] = true
1132
+ self[142] = true
1089
1133
  end
1090
1134
  end
1091
1135
  },
@@ -1096,19 +1140,19 @@ __TS__SetDescriptor(
1096
1140
  "providesInvulnerability",
1097
1141
  {
1098
1142
  get = function(self)
1099
- local ____self__139_56 = self[139]
1100
- if ____self__139_56 == nil then
1101
- ____self__139_56 = false
1143
+ local ____self__143_53 = self[143]
1144
+ if ____self__143_53 == nil then
1145
+ ____self__143_53 = false
1102
1146
  end
1103
- return ____self__139_56
1147
+ return ____self__143_53
1104
1148
  end,
1105
1149
  set = function(self, providesInvulnerability)
1106
- if not providesInvulnerability and self[139] then
1150
+ if not providesInvulnerability and self[143] then
1107
1151
  self.object:decrementInvulnerabilityCounter()
1108
- self[139] = nil
1109
- elseif providesInvulnerability and not self[139] then
1152
+ self[143] = nil
1153
+ elseif providesInvulnerability and not self[143] then
1110
1154
  self.object:incrementInvulnerabilityCounter()
1111
- self[139] = true
1155
+ self[143] = true
1112
1156
  end
1113
1157
  end
1114
1158
  },
@@ -1119,17 +1163,17 @@ __TS__SetDescriptor(
1119
1163
  "killsOnExpiration",
1120
1164
  {
1121
1165
  get = function(self)
1122
- local ____self__140_57 = self[140]
1123
- if ____self__140_57 == nil then
1124
- ____self__140_57 = false
1166
+ local ____self__144_54 = self[144]
1167
+ if ____self__144_54 == nil then
1168
+ ____self__144_54 = false
1125
1169
  end
1126
- return ____self__140_57
1170
+ return ____self__144_54
1127
1171
  end,
1128
1172
  set = function(self, killsOnExpiration)
1129
- if not killsOnExpiration and self[140] then
1130
- self[140] = nil
1131
- elseif killsOnExpiration and not self[140] then
1132
- 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
1133
1177
  end
1134
1178
  end
1135
1179
  },
@@ -1140,17 +1184,17 @@ __TS__SetDescriptor(
1140
1184
  "explodesOnExpiration",
1141
1185
  {
1142
1186
  get = function(self)
1143
- local ____self__141_58 = self[141]
1144
- if ____self__141_58 == nil then
1145
- ____self__141_58 = false
1187
+ local ____self__145_55 = self[145]
1188
+ if ____self__145_55 == nil then
1189
+ ____self__145_55 = false
1146
1190
  end
1147
- return ____self__141_58
1191
+ return ____self__145_55
1148
1192
  end,
1149
1193
  set = function(self, killsOnExpiration)
1150
- if not killsOnExpiration and self[141] then
1151
- self[141] = nil
1152
- elseif killsOnExpiration and not self[141] then
1153
- 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
1154
1198
  end
1155
1199
  end
1156
1200
  },
@@ -1275,9 +1319,23 @@ __TS__SetDescriptor(
1275
1319
  __TS__SetDescriptor(
1276
1320
  Buff.prototype,
1277
1321
  "duration",
1278
- {get = function(self)
1279
- return self[103]
1280
- end},
1322
+ {
1323
+ get = function(self)
1324
+ return self[103]
1325
+ end,
1326
+ set = function(self, duration)
1327
+ if duration <= 0 then
1328
+ local timer = self._timer
1329
+ if timer ~= nil then
1330
+ timer:destroy()
1331
+ self._timer = nil
1332
+ end
1333
+ self[103] = 0
1334
+ else
1335
+ self.remainingDuration = self.remainingDuration + (duration - self[103])
1336
+ end
1337
+ end
1338
+ },
1281
1339
  true
1282
1340
  )
1283
1341
  __TS__SetDescriptor(
@@ -1285,13 +1343,13 @@ __TS__SetDescriptor(
1285
1343
  "remainingDuration",
1286
1344
  {
1287
1345
  get = function(self)
1288
- local ____opt_59 = self._timer
1289
- 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
1290
1348
  end,
1291
1349
  set = function(self, remainingDuration)
1292
- local ____remainingDuration_63 = remainingDuration
1293
- local ____opt_61 = self._timer
1294
- 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)
1295
1353
  if remainingDurationDelta ~= 0 then
1296
1354
  self[103] = self[103] + remainingDurationDelta
1297
1355
  if remainingDuration <= 0 then
@@ -1306,7 +1364,7 @@ __TS__SetDescriptor(
1306
1364
  remainingDuration,
1307
1365
  self._spellStealPriority,
1308
1366
  self._learnLevelMinimum,
1309
- self[142]
1367
+ self[146]
1310
1368
  ) then
1311
1369
  local timer = self._timer
1312
1370
  if timer == nil then
@@ -1321,15 +1379,80 @@ __TS__SetDescriptor(
1321
1379
  },
1322
1380
  true
1323
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
+ )
1324
1447
  __TS__SetDescriptor(
1325
1448
  Buff.prototype,
1326
1449
  "abilityCooldownFactor",
1327
1450
  {
1328
1451
  get = function(self)
1329
- return self[143] or 1
1452
+ return self[147] or 1
1330
1453
  end,
1331
1454
  set = function(self, abilityCooldownFactor)
1332
- local previousAbilityCooldownModifier = self[144]
1455
+ local previousAbilityCooldownModifier = self[148]
1333
1456
  if previousAbilityCooldownModifier then
1334
1457
  for ____, ability in ipairs(self._unit.abilities) do
1335
1458
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
@@ -1341,8 +1464,8 @@ __TS__SetDescriptor(
1341
1464
  for ____, ability in ipairs(self._unit.abilities) do
1342
1465
  COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
1343
1466
  end
1344
- self[144] = modifier
1345
- self[143] = abilityCooldownFactor
1467
+ self[148] = modifier
1468
+ self[147] = abilityCooldownFactor
1346
1469
  end
1347
1470
  },
1348
1471
  true
@@ -1,6 +1,6 @@
1
1
  local ____exports = {}
2
- local ____attribute_2Dincrease = require("engine.object-data.entry.ability-type.attribute-increase")
3
- local AttributeBonusAbilityType = ____attribute_2Dincrease.AttributeBonusAbilityType
2
+ local ____attribute_2Dbonus = require("engine.object-data.entry.ability-type.attribute-bonus")
3
+ local AttributeBonusAbilityType = ____attribute_2Dbonus.AttributeBonusAbilityType
4
4
  ---
5
5
  -- @internal For use by internal systems.
6
6
  ____exports.ATTRIBUTE_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
@@ -0,0 +1,2 @@
1
+ /** @noSelfInFile */
2
+ export {};
@@ -0,0 +1,16 @@
1
+ local ____exports = {}
2
+ local ____health_2Dbonus = require("engine.object-data.entry.ability-type.health-bonus")
3
+ local HealthBonusAbilityType = ____health_2Dbonus.HealthBonusAbilityType
4
+ ---
5
+ -- @internal For use by internal systems only.
6
+ ____exports.HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
7
+ local abilityType = HealthBonusAbilityType:create()
8
+ abilityType.isInternal = true
9
+ abilityType.isButtonVisible = false
10
+ abilityType.healthBonus = 0
11
+ return abilityType.id
12
+ end)
13
+ ---
14
+ -- @internal For use by internal systems only.
15
+ ____exports.HEALTH_BONUS_DUMMY_ABILITY_FIELD = ABILITY_ILF_MAX_LIFE_GAINED
16
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /** @noSelfInFile */
2
+ export {};
@@ -0,0 +1,16 @@
1
+ local ____exports = {}
2
+ local ____mana_2Dbonus = require("engine.object-data.entry.ability-type.mana-bonus")
3
+ local ManaBonusAbilityType = ____mana_2Dbonus.ManaBonusAbilityType
4
+ ---
5
+ -- @internal For use by internal systems only.
6
+ ____exports.MANA_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
7
+ local abilityType = ManaBonusAbilityType:create()
8
+ abilityType.isInternal = true
9
+ abilityType.isButtonVisible = false
10
+ abilityType.manaBonus = 0
11
+ return abilityType.id
12
+ end)
13
+ ---
14
+ -- @internal For use by internal systems only.
15
+ ____exports.MANA_BONUS_DUMMY_ABILITY_FIELD = ABILITY_ILF_MAX_MANA_GAINED
16
+ return ____exports