warscript 0.0.1-dev.5ca835c → 0.0.1-dev.5d49132

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 (56) hide show
  1. package/core/types/player.d.ts +1 -0
  2. package/core/types/player.lua +4 -1
  3. package/destroyable.d.ts +1 -0
  4. package/destroyable.lua +9 -0
  5. package/engine/behavior.d.ts +4 -2
  6. package/engine/behavior.lua +69 -11
  7. package/engine/behaviour/ability/apply-buff.lua +4 -4
  8. package/engine/behaviour/ability.d.ts +2 -1
  9. package/engine/behaviour/ability.lua +2 -1
  10. package/engine/behaviour/unit/stun-immunity.d.ts +7 -5
  11. package/engine/behaviour/unit/stun-immunity.lua +6 -5
  12. package/engine/behaviour/unit.d.ts +7 -3
  13. package/engine/behaviour/unit.lua +101 -24
  14. package/engine/buff.d.ts +9 -3
  15. package/engine/buff.lua +62 -34
  16. package/engine/internal/mechanics/cast-ability.lua +6 -3
  17. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
  18. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
  19. package/engine/internal/unit/attributes.d.ts +17 -0
  20. package/engine/internal/unit/attributes.lua +46 -0
  21. package/engine/internal/unit/bonus.d.ts +2 -0
  22. package/engine/internal/unit/bonus.lua +10 -0
  23. package/engine/internal/unit/fly-height.lua +3 -3
  24. package/engine/internal/unit/interrupts.d.ts +12 -0
  25. package/engine/internal/unit/interrupts.lua +28 -0
  26. package/engine/internal/unit/scale.lua +3 -3
  27. package/engine/internal/unit-missile-launch.lua +12 -5
  28. package/engine/internal/unit.d.ts +2 -8
  29. package/engine/internal/unit.lua +79 -97
  30. package/engine/local-client.d.ts +1 -1
  31. package/engine/local-client.lua +4 -4
  32. package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
  33. package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
  34. package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
  35. package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
  36. package/engine/object-data/entry/destructible-type.d.ts +27 -1
  37. package/engine/object-data/entry/destructible-type.lua +155 -0
  38. package/engine/object-data/entry/unit-type.d.ts +4 -0
  39. package/engine/object-data/entry/unit-type.lua +76 -32
  40. package/engine/object-field/unit.d.ts +7 -4
  41. package/engine/object-field/unit.lua +4 -0
  42. package/engine/object-field.d.ts +2 -0
  43. package/engine/object-field.lua +171 -115
  44. package/engine/standard/fields/ability.d.ts +2 -2
  45. package/engine/standard/fields/ability.lua +2 -2
  46. package/engine/standard/fields/unit.d.ts +11 -5
  47. package/engine/standard/fields/unit.lua +13 -4
  48. package/engine/unit.d.ts +2 -0
  49. package/engine/unit.lua +2 -0
  50. package/objutil/buff.lua +9 -7
  51. package/package.json +2 -2
  52. package/patch-lua.lua +15 -0
  53. package/utility/linked-map.d.ts +26 -0
  54. package/utility/linked-map.lua +66 -0
  55. package/utility/linked-set.lua +4 -0
  56. package/utility/records.lua +20 -1
package/engine/buff.lua CHANGED
@@ -42,6 +42,7 @@ local BuffType = ____buff_2Dtype.BuffType
42
42
  local ____unit = require("engine.behaviour.unit")
43
43
  local UnitBehavior = ____unit.UnitBehavior
44
44
  local ____arrays = require("utility.arrays")
45
+ local emptyArray = ____arrays.emptyArray
45
46
  local forEach = ____arrays.forEach
46
47
  local ____event = require("event")
47
48
  local Event = ____event.Event
@@ -53,6 +54,10 @@ local ____destructable = require("core.types.destructable")
53
54
  local Destructable = ____destructable.Destructable
54
55
  local ____ability = require("engine.standard.fields.ability")
55
56
  local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
57
+ local ____ability = require("engine.behaviour.ability")
58
+ local AbilityBehavior = ____ability.AbilityBehavior
59
+ local ____records = require("utility.records")
60
+ local sortedKeysUnnested = ____records.sortedKeysUnnested
56
61
  local getUnitAbility = BlzGetUnitAbility
57
62
  local stringValueByBuffTypeIdByFieldId = postcompile(function()
58
63
  local stringValueByBuffTypeIdByFieldId = {}
@@ -101,6 +106,7 @@ local buffParametersKeys = {
101
106
  armorIncreaseFactor = true,
102
107
  attackSpeedIncreaseFactor = true,
103
108
  movementSpeedIncreaseFactor = true,
109
+ manaRegenerationRateIncreaseFactor = true,
104
110
  evasionProbability = true,
105
111
  missProbability = true,
106
112
  damageFactor = true,
@@ -188,6 +194,7 @@ local buffNumberParameters = {
188
194
  "durationIncreaseOnAutoAttack",
189
195
  "attackSpeedIncreaseFactor",
190
196
  "movementSpeedIncreaseFactor",
197
+ "manaRegenerationRateIncreaseFactor",
191
198
  "evasionProbability",
192
199
  "armorIncrease",
193
200
  "damageFactor",
@@ -322,33 +329,38 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
322
329
  local polarity
323
330
  local resistanceType
324
331
  local ability
332
+ local abilityBehavior
325
333
  if type(typeIdOrTypeIds) ~= "number" then
326
334
  typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
327
335
  polarity = resistanceTypeOrPolarity
328
336
  resistanceType = abilityOrParametersOrResistanceType
329
- if __TS__InstanceOf(parametersOrAbility, Ability) or parametersOrAbility == nil then
337
+ if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
338
+ abilityBehavior = parametersOrAbility
339
+ ability = abilityBehavior.ability
340
+ elseif __TS__InstanceOf(parametersOrAbility, Ability) then
330
341
  ability = parametersOrAbility
331
- else
332
- ability = nil
342
+ elseif parametersOrAbility ~= nil then
333
343
  parameters = parametersOrAbility
334
344
  end
335
345
  else
336
346
  typeId = typeIdOrTypeIds
337
347
  polarity = polarityOrTypeIdSelectionPolicy
338
348
  resistanceType = resistanceTypeOrPolarity
339
- if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) or abilityOrParametersOrResistanceType == nil then
349
+ if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
350
+ abilityBehavior = abilityOrParametersOrResistanceType
351
+ ability = abilityBehavior.ability
352
+ parameters = parametersOrAbility
353
+ elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
340
354
  ability = abilityOrParametersOrResistanceType
341
355
  parameters = parametersOrAbility
342
- else
343
- ability = nil
356
+ elseif abilityOrParametersOrResistanceType ~= nil then
344
357
  parameters = abilityOrParametersOrResistanceType
358
+ else
359
+ parameters = parametersOrAbility
345
360
  end
346
361
  end
362
+ self.sourceAbilityBehavior = abilityBehavior
347
363
  self.typeId = typeId
348
- if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
349
- parameters = ability
350
- ability = nil
351
- end
352
364
  local defaultParameters = self.constructor.defaultParameters
353
365
  local level = parameters and parameters.level or defaultParameters.level
354
366
  local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
@@ -459,24 +471,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
459
471
  abilityTypeIds = {}
460
472
  self._abilityTypeIds = abilityTypeIds
461
473
  end
462
- for abilityTypeId, abilityParameters in pairs(parametersAbilityTypeIds) do
474
+ for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
475
+ local abilityParameters = parametersAbilityTypeIds[abilityTypeId]
463
476
  local addedAbility = _unit:addAbility(abilityTypeId)
464
477
  if addedAbility ~= nil then
465
478
  _unit:makeAbilityPermanent(abilityTypeId, true)
466
479
  _unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
467
- for abilityParameterKey, abilityParameterValue in pairs(abilityParameters) do
468
- if abilityParameterKey == "isButtonVisible" then
469
- if not resolveBooleanValue(ability, level, abilityParameterValue) then
470
- _unit:hideAbility(abilityTypeId, true)
471
- end
472
- elseif abilityParameterKey ~= "level" then
473
- abilityParameterKey:setValue(
474
- addedAbility,
475
- resolveNumberValue(ability, level, abilityParameterValue)
476
- )
477
- end
480
+ if abilityParameters.isButtonVisible == false then
481
+ _unit:hideAbility(abilityTypeId, true)
482
+ end
483
+ for ____, field in ipairs(abilityParameters.fields or emptyArray()) do
484
+ field[1]:setValue(
485
+ addedAbility,
486
+ resolveNumberValue(ability, level, field[2])
487
+ )
478
488
  end
479
- abilityTypeIds[abilityTypeId] = true
489
+ abilityTypeIds[#abilityTypeIds + 1] = abilityTypeId
480
490
  end
481
491
  end
482
492
  local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
@@ -488,18 +498,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
488
498
  self._behaviors = behaviors
489
499
  end
490
500
  end
491
- local additionalParameters = {}
492
- for key, value in pairs(parameters) do
493
- if not buffParametersKeys[key] then
494
- if ability then
495
- additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, value)
496
- else
497
- additionalParameters[key] = value
501
+ if parameters ~= nil then
502
+ local additionalParameters = {}
503
+ for ____, key in ipairs(sortedKeysUnnested(parameters)) do
504
+ if not buffParametersKeys[key] then
505
+ if ability then
506
+ additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, parameters[key])
507
+ else
508
+ additionalParameters[key] = parameters[key]
509
+ end
498
510
  end
499
511
  end
500
- end
501
- if (next(additionalParameters)) ~= nil then
502
- self.parameters = additionalParameters
512
+ if (next(additionalParameters)) ~= nil then
513
+ self.parameters = additionalParameters
514
+ end
503
515
  end
504
516
  end
505
517
  if duration ~= nil and duration > 0 then
@@ -623,7 +635,7 @@ function Buff.prototype.onDestroy(self)
623
635
  unit:decrementGhostCounter()
624
636
  end
625
637
  if self._abilityTypeIds ~= nil then
626
- for abilityTypeId in pairs(self._abilityTypeIds) do
638
+ for ____, abilityTypeId in ipairs(self._abilityTypeIds) do
627
639
  unit:removeAbility(abilityTypeId)
628
640
  end
629
641
  end
@@ -1247,6 +1259,19 @@ __TS__SetDescriptor(
1247
1259
  },
1248
1260
  true
1249
1261
  )
1262
+ __TS__SetDescriptor(
1263
+ Buff.prototype,
1264
+ "manaRegenerationRateIncreaseFactor",
1265
+ {
1266
+ get = function(self)
1267
+ return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
1268
+ end,
1269
+ set = function(self, manaRegenerationRateIncreaseFactor)
1270
+ self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
1271
+ end
1272
+ },
1273
+ true
1274
+ )
1250
1275
  __TS__SetDescriptor(
1251
1276
  Buff.prototype,
1252
1277
  "duration",
@@ -1380,5 +1405,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
1380
1405
  buffCreatedEvent:addListener(function(buff)
1381
1406
  UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
1382
1407
  end)
1408
+ buffBeingDestroyedEvent:addListener(function(buff)
1409
+ UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
1410
+ end)
1383
1411
  end)(Buff)
1384
1412
  return ____exports
@@ -74,9 +74,12 @@ ____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ..
74
74
  unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
75
75
  if latestInventoryAbilityTypeId ~= 0 then
76
76
  unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
77
- for slot, nativeItem in pairs(nativeItemBySlot) do
78
- unitAddItem(nativeUnit, nativeItem)
79
- unitDropItemSlot(nativeUnit, nativeItem, slot)
77
+ for slot = 0, inventorySize - 1 do
78
+ local nativeItem = nativeItemBySlot[slot]
79
+ if nativeItem ~= nil then
80
+ unitAddItem(nativeUnit, nativeItem)
81
+ unitDropItemSlot(nativeUnit, nativeItem, slot)
82
+ end
80
83
  end
81
84
  end
82
85
  end
@@ -0,0 +1,2 @@
1
+ /** @noSelfInFile */
2
+ export {};
@@ -0,0 +1,16 @@
1
+ local ____exports = {}
2
+ local ____mana_2Dregeneration = require("engine.object-data.entry.ability-type.mana-regeneration")
3
+ local ManaRegenerationAbilityType = ____mana_2Dregeneration.ManaRegenerationAbilityType
4
+ ---
5
+ -- @internal For use by internal systems.
6
+ ____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = compiletime(function()
7
+ local abilityType = ManaRegenerationAbilityType:create()
8
+ abilityType.isInternal = true
9
+ abilityType.isButtonVisible = false
10
+ abilityType.manaRegenerationRateIncreaseFactor = 4
11
+ return abilityType.id
12
+ end)
13
+ ---
14
+ -- @internal For use by internal systems.
15
+ ____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ABILITY_RLF_MANA_REGENERATION_BONUS_AS_FRACTION_OF_NORMAL
16
+ return ____exports
@@ -0,0 +1,17 @@
1
+ /** @noSelfInFile */
2
+ declare module "../unit" {
3
+ interface Unit {
4
+ strengthBase: number;
5
+ }
6
+ }
7
+ declare module "../unit" {
8
+ interface Unit {
9
+ agilityBase: number;
10
+ }
11
+ }
12
+ declare module "../unit" {
13
+ interface Unit {
14
+ intelligenceBase: number;
15
+ }
16
+ }
17
+ export {};
@@ -0,0 +1,46 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
3
+ local ____exports = {}
4
+ local ____unit = require("engine.internal.unit")
5
+ local Unit = ____unit.Unit
6
+ local ____unit = require("engine.standard.fields.unit")
7
+ local AGILITY_UNIT_FIELD = ____unit.AGILITY_UNIT_FIELD
8
+ local INTELLIGENCE_UNIT_FIELD = ____unit.INTELLIGENCE_UNIT_FIELD
9
+ local STRENGTH_UNIT_FIELD = ____unit.STRENGTH_UNIT_FIELD
10
+ __TS__ObjectDefineProperty(
11
+ Unit.prototype,
12
+ "strengthBase",
13
+ {
14
+ get = function(self)
15
+ return STRENGTH_UNIT_FIELD:getValue(self)
16
+ end,
17
+ set = function(self, value)
18
+ STRENGTH_UNIT_FIELD:setValue(self, value)
19
+ end
20
+ }
21
+ )
22
+ __TS__ObjectDefineProperty(
23
+ Unit.prototype,
24
+ "agilityBase",
25
+ {
26
+ get = function(self)
27
+ return AGILITY_UNIT_FIELD:getValue(self)
28
+ end,
29
+ set = function(self, value)
30
+ AGILITY_UNIT_FIELD:setValue(self, value)
31
+ end
32
+ }
33
+ )
34
+ __TS__ObjectDefineProperty(
35
+ Unit.prototype,
36
+ "intelligenceBase",
37
+ {
38
+ get = function(self)
39
+ return INTELLIGENCE_UNIT_FIELD:getValue(self)
40
+ end,
41
+ set = function(self, value)
42
+ INTELLIGENCE_UNIT_FIELD:setValue(self, value)
43
+ end
44
+ }
45
+ )
46
+ return ____exports
@@ -12,6 +12,7 @@ export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
12
12
  export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
13
13
  export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
14
14
  export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
15
+ export type UnitManaRegenerationRateFactorBonusId = UnitBonusId<"manaRegenerationRateFactor">;
15
16
  export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
16
17
  abilityTypeId: AbilityTypeId;
17
18
  field: jabilityintegerlevelfield;
@@ -36,6 +37,7 @@ export declare namespace UnitBonusType {
36
37
  const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
37
38
  const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
38
39
  const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
40
+ const MANA_REGENERATION_RATE_FACTOR: UnitBonusType<UnitManaRegenerationRateFactorBonusId>;
39
41
  }
40
42
  export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
41
43
  export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
@@ -24,6 +24,9 @@ local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspee
24
24
  local ____evasion_2Dprobability = require("engine.internal.object-data.evasion-probability")
25
25
  local EVASION_PROBABILITY_ABILITY_FIELD = ____evasion_2Dprobability.EVASION_PROBABILITY_ABILITY_FIELD
26
26
  local EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = ____evasion_2Dprobability.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID
27
+ local ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor = require("engine.internal.object-data.mana-regeneration-rate-increase-factor")
28
+ local MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD
29
+ local MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
27
30
  local damageFactorByUnit = {}
28
31
  local receivedDamageFactorByUnit = {}
29
32
  local function atLeastOnceProbability(array)
@@ -73,6 +76,13 @@ do
73
76
  reduce = atLeastOnceProbability,
74
77
  initialValue = 0
75
78
  }
79
+ UnitBonusType.MANA_REGENERATION_RATE_FACTOR = {
80
+ abilityTypeId = MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID,
81
+ field = MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD,
82
+ integer = false,
83
+ reduce = sum,
84
+ initialValue = 0
85
+ }
76
86
  end
77
87
  local bonusesByUnitByBonusType = {}
78
88
  local nextId = 1
@@ -4,16 +4,16 @@ local ____exports = {}
4
4
  local ____unit = require("engine.internal.unit")
5
5
  local Unit = ____unit.Unit
6
6
  local ____unit = require("engine.standard.fields.unit")
7
- local FLY_HEIGHT_UNIT_FLOAT_FIELD = ____unit.FLY_HEIGHT_UNIT_FLOAT_FIELD
7
+ local FLY_HEIGHT_UNIT_FIELD = ____unit.FLY_HEIGHT_UNIT_FIELD
8
8
  __TS__ObjectDefineProperty(
9
9
  Unit.prototype,
10
10
  "flyHeight",
11
11
  {
12
12
  get = function(self)
13
- return FLY_HEIGHT_UNIT_FLOAT_FIELD:getValue(self)
13
+ return FLY_HEIGHT_UNIT_FIELD:getValue(self)
14
14
  end,
15
15
  set = function(self, value)
16
- FLY_HEIGHT_UNIT_FLOAT_FIELD:setValue(self, value)
16
+ FLY_HEIGHT_UNIT_FIELD:setValue(self, value)
17
17
  end
18
18
  }
19
19
  )
@@ -0,0 +1,12 @@
1
+ /** @noSelfInFile */
2
+ declare module "../unit" {
3
+ interface Unit {
4
+ interruptAttack(this: Unit): void;
5
+ }
6
+ }
7
+ declare module "../unit" {
8
+ interface Unit {
9
+ interruptMovement(this: Unit): void;
10
+ }
11
+ }
12
+ export {};
@@ -0,0 +1,28 @@
1
+ local ____exports = {}
2
+ local ____unit = require("engine.internal.unit")
3
+ local Unit = ____unit.Unit
4
+ local ____unit_2Dmissile_2Dlaunch = require("engine.internal.unit-missile-launch")
5
+ local resetAutoAttackTimer = ____unit_2Dmissile_2Dlaunch.resetAutoAttackTimer
6
+ local unitDisableAbility = BlzUnitDisableAbility
7
+ local unitInterruptAttack = BlzUnitInterruptAttack
8
+ Unit.prototype.interruptAttack = function(self)
9
+ unitInterruptAttack(self.handle)
10
+ resetAutoAttackTimer(self)
11
+ end
12
+ Unit.prototype.interruptMovement = function(self)
13
+ local handle = self.handle
14
+ unitDisableAbility(
15
+ handle,
16
+ fourCC("Amov"),
17
+ true,
18
+ false
19
+ )
20
+ unitDisableAbility(
21
+ handle,
22
+ fourCC("Amov"),
23
+ false,
24
+ false
25
+ )
26
+ resetAutoAttackTimer(self)
27
+ end
28
+ return ____exports
@@ -4,16 +4,16 @@ local ____exports = {}
4
4
  local ____unit = require("engine.internal.unit")
5
5
  local Unit = ____unit.Unit
6
6
  local ____unit = require("engine.standard.fields.unit")
7
- local SCALING_VALUE_UNIT_FLOAT_FIELD = ____unit.SCALING_VALUE_UNIT_FLOAT_FIELD
7
+ local SCALING_VALUE_UNIT_FIELD = ____unit.SCALING_VALUE_UNIT_FIELD
8
8
  __TS__ObjectDefineProperty(
9
9
  Unit.prototype,
10
10
  "scale",
11
11
  {
12
12
  get = function(self)
13
- return SCALING_VALUE_UNIT_FLOAT_FIELD:getValue(self)
13
+ return SCALING_VALUE_UNIT_FIELD:getValue(self)
14
14
  end,
15
15
  set = function(self, value)
16
- SCALING_VALUE_UNIT_FLOAT_FIELD:setValue(self, value)
16
+ SCALING_VALUE_UNIT_FIELD:setValue(self, value)
17
17
  end
18
18
  }
19
19
  )
@@ -36,11 +36,18 @@ local instantOrderIds = luaSetOf(
36
36
  orderId("undivineshield"),
37
37
  orderId("unimmolation")
38
38
  )
39
- local function reset(source, orderId)
40
- if not (instantOrderIds[orderId] ~= nil) and units:remove(source) then
41
- source[targetAttribute] = nil
42
- source[impactDelayAttribute] = nil
43
- source[passedTimeAttribute] = nil
39
+ ---
40
+ -- @internal For use by internal systems only.
41
+ ____exports.resetAutoAttackTimer = function(unit)
42
+ if units:remove(unit) then
43
+ unit[targetAttribute] = nil
44
+ unit[impactDelayAttribute] = nil
45
+ unit[passedTimeAttribute] = nil
46
+ end
47
+ end
48
+ local function reset(unit, orderId)
49
+ if not (instantOrderIds[orderId] ~= nil) then
50
+ ____exports.resetAutoAttackTimer(unit)
44
51
  end
45
52
  end
46
53
  Unit.onImmediateOrder:addListener(reset)
@@ -139,6 +139,7 @@ export declare class Unit extends Handle<junit> {
139
139
  private _fields?;
140
140
  private getEvent;
141
141
  constructor(handle: junit);
142
+ private saveData;
142
143
  protected onDestroy(): HandleDestructor;
143
144
  addAttackHandler(condition: AttackHandlerCondition, action: AttackHandlerAction): AttackHandler;
144
145
  removeAttackHandler(handler: AttackHandler): boolean;
@@ -177,16 +178,10 @@ export declare class Unit extends Handle<junit> {
177
178
  set xp(v: number);
178
179
  get primaryAttribute(): UnitAttribute;
179
180
  set primaryAttribute(primaryAttribute: UnitAttribute);
180
- get strengthBase(): number;
181
- set strengthBase(strengthBase: number);
182
181
  get strengthBonus(): number;
183
182
  get strength(): number;
184
- get agilityBase(): number;
185
- set agilityBase(agilityBase: number);
186
183
  get agilityBonus(): number;
187
184
  get agility(): number;
188
- get intelligenceBase(): number;
189
- set intelligenceBase(intelligenceBase: number);
190
185
  get intelligenceBonus(): number;
191
186
  get intelligence(): number;
192
187
  get name(): string;
@@ -277,8 +272,6 @@ export declare class Unit extends Handle<junit> {
277
272
  getAbilityRemainingCooldown(abilityId: number): number;
278
273
  startAbilityCooldown(abilityId: number, cooldown: number): void;
279
274
  endAbilityCooldown(abilityId: number): void;
280
- interruptMovement(): void;
281
- interruptAttack(): void;
282
275
  interruptCast(abilityId: number): void;
283
276
  getDistanceTo(target: Unit | Vec2): number;
284
277
  getCollisionDistanceTo(...target: [Unit] | [targetX: number, targetY: number]): number;
@@ -318,6 +311,7 @@ export declare class Unit extends Handle<junit> {
318
311
  static getInCollisionRange(x: number, y: number, range: number, predicate?: (unit: Unit) => boolean): Unit[];
319
312
  static getInSector(pos: Vec2, range: number, offsetAngle: number, centralAngle: number): Unit[];
320
313
  static getSelectionOf(player: Player, target?: Unit[]): Unit[];
314
+ static readonly levelChangedEvent: UnitTriggerEvent<[]>;
321
315
  static readonly deathEvent: UnitTriggerEvent<[Unit]>;
322
316
  static readonly onDecay: UnitTriggerEvent<[]>;
323
317
  static readonly onResurrect: InitializingEvent<[Unit], void>;