warscript 0.0.1-dev.d7e0522 → 0.0.1-dev.da5fb2e

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 (70) hide show
  1. package/core/types/frame.lua +10 -12
  2. package/core/types/player.lua +3 -1
  3. package/core/types/playerCamera.d.ts +2 -0
  4. package/core/types/playerCamera.lua +79 -5
  5. package/core/types/timer.d.ts +2 -1
  6. package/core/types/timer.lua +21 -2
  7. package/decl/native.d.ts +4 -2
  8. package/engine/behavior.d.ts +5 -0
  9. package/engine/behavior.lua +106 -27
  10. package/engine/behaviour/ability/apply-buff.lua +1 -1
  11. package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
  12. package/engine/behaviour/ability/emulate-impact.lua +11 -3
  13. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  14. package/engine/behaviour/ability/restore-mana.lua +6 -6
  15. package/engine/behaviour/ability.lua +8 -17
  16. package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
  17. package/engine/behaviour/unit/stun-immunity.lua +43 -27
  18. package/engine/behaviour/unit.d.ts +19 -2
  19. package/engine/behaviour/unit.lua +88 -7
  20. package/engine/buff.d.ts +2 -4
  21. package/engine/buff.lua +68 -83
  22. package/engine/internal/ability.d.ts +5 -1
  23. package/engine/internal/ability.lua +43 -11
  24. package/engine/internal/item/ability.lua +51 -1
  25. package/engine/internal/item+owner.lua +12 -6
  26. package/engine/internal/item.d.ts +1 -0
  27. package/engine/internal/item.lua +20 -11
  28. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  29. package/engine/internal/misc/frame-coordinates.lua +21 -0
  30. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  31. package/engine/internal/misc/get-terrain-z.lua +11 -0
  32. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  33. package/engine/internal/misc/player-local-handle.lua +5 -0
  34. package/engine/internal/unit/ability.d.ts +35 -0
  35. package/engine/internal/unit/ability.lua +62 -0
  36. package/engine/internal/unit/order.d.ts +20 -0
  37. package/engine/internal/unit/order.lua +136 -0
  38. package/engine/internal/unit+ability.lua +10 -1
  39. package/engine/internal/unit-missile-launch.lua +8 -1
  40. package/engine/internal/unit.d.ts +4 -4
  41. package/engine/internal/unit.lua +84 -70
  42. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  43. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  44. package/engine/object-data/entry/ability-type.lua +1 -3
  45. package/engine/object-data/entry/unit-type.d.ts +11 -2
  46. package/engine/object-data/entry/unit-type.lua +59 -1
  47. package/engine/object-field/ability.d.ts +3 -3
  48. package/engine/object-field/ability.lua +7 -6
  49. package/engine/object-field/unit.d.ts +11 -0
  50. package/engine/object-field/unit.lua +34 -0
  51. package/engine/object-field.d.ts +8 -5
  52. package/engine/object-field.lua +90 -76
  53. package/engine/standard/fields/unit.d.ts +4 -0
  54. package/engine/standard/fields/unit.lua +7 -0
  55. package/engine/text-tag.d.ts +36 -2
  56. package/engine/text-tag.lua +249 -10
  57. package/engine/unit.d.ts +1 -0
  58. package/engine/unit.lua +1 -0
  59. package/package.json +2 -2
  60. package/patch-lualib.lua +1 -1
  61. package/utility/callback-array.d.ts +13 -0
  62. package/utility/callback-array.lua +46 -0
  63. package/utility/functions.d.ts +7 -0
  64. package/utility/functions.lua +12 -0
  65. package/utility/lua-maps.d.ts +1 -0
  66. package/utility/lua-maps.lua +4 -0
  67. package/utility/lua-sets.d.ts +1 -0
  68. package/utility/lua-sets.lua +4 -0
  69. package/core/types/order.d.ts +0 -26
  70. package/core/types/order.lua +0 -65
@@ -160,8 +160,7 @@ export declare class Unit extends Handle<junit> {
160
160
  isInRangeOf(unit: Unit, range: number): boolean;
161
161
  isAllyOf(unit: Unit): boolean;
162
162
  isEnemyOf(unit: Unit): boolean;
163
- playAnimation(animation: string, rarity?: jraritycontrol): void;
164
- playAnimation(animation: number): void;
163
+ playAnimation(...parameters: [animation: number] | [animation: string, rarity?: jraritycontrol]): void;
165
164
  resetAnimation(): void;
166
165
  queueAnimation(animation: string): void;
167
166
  get weapons(): [UnitWeapon, UnitWeapon];
@@ -267,7 +266,7 @@ export declare class Unit extends Handle<junit> {
267
266
  dropItemTarget(item: Item, target: Widget): boolean;
268
267
  dropItemSlot(item: Item, slot: number): boolean;
269
268
  itemInSlot(slot: number): Item | null;
270
- addAbility(abilityId: number): UnitAbility | null;
269
+ addAbility(abilityId: number): UnitAbility | undefined;
271
270
  makeAbilityPermanent(abilityId: number, permanent: true): boolean;
272
271
  setAbilityLevel(abilityId: number, level: number): number;
273
272
  getAbilityLevel(abilityId: number): number;
@@ -278,6 +277,7 @@ export declare class Unit extends Handle<junit> {
278
277
  getAbilityRemainingCooldown(abilityId: number): number;
279
278
  startAbilityCooldown(abilityId: number, cooldown: number): void;
280
279
  endAbilityCooldown(abilityId: number): void;
280
+ interruptMovement(): void;
281
281
  interruptAttack(): void;
282
282
  interruptCast(abilityId: number): void;
283
283
  getDistanceTo(target: Unit | Vec2): number;
@@ -353,7 +353,7 @@ export declare class Unit extends Handle<junit> {
353
353
  static itemDroppedEvent: UnitTriggerEvent<[Item]>;
354
354
  static itemPickedUpEvent: UnitTriggerEvent<[Item]>;
355
355
  static itemUsedEvent: UnitTriggerEvent<[Item]>;
356
- static itemStackedEvent: UnitTriggerEvent<[Item]>;
356
+ static itemStackedEvent: UnitTriggerEvent<[target: Item, source: Item]>;
357
357
  static get itemChargesChangedEvent(): Event<[unit: Unit, item: Item]>;
358
358
  static get itemUseOrderEvent(): Event<[unit: Unit, item: Item]>;
359
359
  static get itemMoveOrderEvent(): Event<[
@@ -60,6 +60,8 @@ local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage
60
60
  local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
61
61
  local ____attributes = require("attributes")
62
62
  local isAttribute = ____attributes.isAttribute
63
+ local ____ability = require("engine.internal.item.ability")
64
+ local doUnitAbilityAction = ____ability.doUnitAbilityAction
63
65
  local match = string.match
64
66
  local ____tostring = _G.tostring
65
67
  local setUnitAnimation = SetUnitAnimation
@@ -123,10 +125,6 @@ local getOrderedUnit = GetOrderedUnit
123
125
  local getIssuedOrderId = GetIssuedOrderId
124
126
  local isUnitInvulnerable = BlzIsUnitInvulnerable
125
127
  local unitAlive = UnitAlive
126
- local unitAddType = UnitAddType
127
- local unitRemoveType = UnitRemoveType
128
- local isUnitIllusion = IsUnitIllusion
129
- local isUnitType = IsUnitType
130
128
  local isUnitAlly = IsUnitAlly
131
129
  local isUnitEnemy = IsUnitEnemy
132
130
  local getOwningPlayer = GetOwningPlayer
@@ -665,15 +663,24 @@ end
665
663
  local nextSyncId = 1
666
664
  local unitBySyncId = setmetatable({}, {__mode = "v"})
667
665
  local damagingEventByTarget = setmetatable({}, {__mode = "k"})
666
+ local function addAbility(unit, abilityTypeId)
667
+ local ____unitAddAbility_result_0
668
+ if unitAddAbility(unit, abilityTypeId) then
669
+ ____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
670
+ else
671
+ ____unitAddAbility_result_0 = nil
672
+ end
673
+ return ____unitAddAbility_result_0
674
+ end
668
675
  ____exports.Unit = __TS__Class()
669
676
  local Unit = ____exports.Unit
670
677
  Unit.name = "Unit"
671
678
  __TS__ClassExtends(Unit, Handle)
672
679
  function Unit.prototype.____constructor(self, handle)
673
680
  Handle.prototype.____constructor(self, handle)
674
- local ____nextSyncId_0 = nextSyncId
675
- nextSyncId = ____nextSyncId_0 + 1
676
- self.syncId = ____nextSyncId_0
681
+ local ____nextSyncId_1 = nextSyncId
682
+ nextSyncId = ____nextSyncId_1 + 1
683
+ self.syncId = ____nextSyncId_1
677
684
  self._owner = Player:of(getOwningPlayer(handle))
678
685
  assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
679
686
  assert(unitAddAbility(handle, morphDetectAbilityId))
@@ -774,17 +781,17 @@ function Unit.prototype.addModifier(self, property, modifier)
774
781
  end}
775
782
  end
776
783
  function Unit.prototype.hasCombatClassification(self, combatClassification)
777
- local ____combatClassification_1 = combatClassification
778
- return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_1 == ____combatClassification_1
784
+ local ____combatClassification_2 = combatClassification
785
+ return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
779
786
  end
780
787
  function Unit.prototype.addClassification(self, classification)
781
- return unitAddType(self.handle, classification)
788
+ return UnitAddType(self.handle, classification)
782
789
  end
783
790
  function Unit.prototype.removeClassification(self, classification)
784
- return unitRemoveType(self.handle, classification)
791
+ return UnitRemoveType(self.handle, classification)
785
792
  end
786
793
  function Unit.prototype.hasClassification(self, classification)
787
- return isUnitType(self.handle, classification)
794
+ return IsUnitType(self.handle, classification)
788
795
  end
789
796
  function Unit.prototype.isVisibleTo(self, player)
790
797
  return isUnitVisible(self.handle, player.handle)
@@ -793,13 +800,13 @@ function Unit.prototype.isInvisibleTo(self, player)
793
800
  return isUnitInvisible(self.handle, player.handle)
794
801
  end
795
802
  function Unit.prototype.isInRangeOf(self, x, y, range)
796
- local ____temp_2
803
+ local ____temp_3
797
804
  if type(x) == "number" then
798
- ____temp_2 = isUnitInRangeXY(self.handle, x, y, range)
805
+ ____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
799
806
  else
800
- ____temp_2 = isUnitInRange(self.handle, x.handle, y)
807
+ ____temp_3 = isUnitInRange(self.handle, x.handle, y)
801
808
  end
802
- return ____temp_2
809
+ return ____temp_3
803
810
  end
804
811
  function Unit.prototype.isAllyOf(self, unit)
805
812
  return isUnitAlly(
@@ -855,14 +862,14 @@ function Unit.prototype.kill(self)
855
862
  killUnit(self.handle)
856
863
  end
857
864
  function Unit.prototype.revive(self, x, y, doEffect)
858
- local ____ReviveHero_5 = ReviveHero
859
- local ____array_4 = __TS__SparseArrayNew(self.handle, x, y)
860
- local ____doEffect_3 = doEffect
861
- if ____doEffect_3 == nil then
862
- ____doEffect_3 = false
865
+ local ____ReviveHero_6 = ReviveHero
866
+ local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
867
+ local ____doEffect_4 = doEffect
868
+ if ____doEffect_4 == nil then
869
+ ____doEffect_4 = false
863
870
  end
864
- __TS__SparseArrayPush(____array_4, ____doEffect_3)
865
- ____ReviveHero_5(__TS__SparseArraySpread(____array_4))
871
+ __TS__SparseArrayPush(____array_5, ____doEffect_4)
872
+ ____ReviveHero_6(__TS__SparseArraySpread(____array_5))
866
873
  end
867
874
  function Unit.prototype.healTarget(self, target, amount)
868
875
  if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
@@ -905,17 +912,16 @@ function Unit.prototype.itemInSlot(self, slot)
905
912
  return Item:of(unitItemInSlot(self.handle, slot))
906
913
  end
907
914
  function Unit.prototype.addAbility(self, abilityId)
908
- if unitAddAbility(self.handle, abilityId) then
909
- local ability = UnitAbility:of(
910
- checkNotNull(getUnitAbility(self.handle, abilityId)),
911
- abilityId,
912
- self
913
- )
915
+ local ability = UnitAbility:of(
916
+ doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
917
+ abilityId,
918
+ self
919
+ )
920
+ if ability ~= nil then
914
921
  local abilities = self.abilities
915
922
  abilities[#abilities + 1] = ability
916
- return ability
917
923
  end
918
- return nil
924
+ return ability
919
925
  end
920
926
  function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
921
927
  return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
@@ -930,28 +936,17 @@ function Unit.prototype.hasAbility(self, abilityId)
930
936
  return getUnitAbilityLevel(self.handle, abilityId) > 0
931
937
  end
932
938
  function Unit.prototype.getAbilityById(self, abilityId)
933
- local handle = self.handle
934
- if unitAddAbility(handle, abilityId) then
935
- assert(unitRemoveAbility(handle, abilityId))
936
- return nil
937
- end
938
- return UnitAbility:of(
939
- getUnitAbility(self.handle, abilityId),
940
- abilityId,
941
- self
942
- )
939
+ local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
940
+ return UnitAbility:of(ability, abilityId, self)
943
941
  end
944
942
  function Unit.prototype.removeAbility(self, abilityId)
945
- if unitRemoveAbility(self.handle, abilityId) then
946
- local abilities = self.abilities
947
- for i = 1, #abilities do
948
- if abilities[i].typeId == abilityId then
949
- abilities[i]:destroy()
950
- tremove(abilities, i)
951
- return true
952
- end
943
+ local abilities = self.abilities
944
+ for i = 1, #abilities do
945
+ if abilities[i].typeId == abilityId then
946
+ abilities[i]:destroy()
947
+ tremove(abilities, i)
948
+ return true
953
949
  end
954
- return true
955
950
  end
956
951
  return false
957
952
  end
@@ -967,6 +962,21 @@ end
967
962
  function Unit.prototype.endAbilityCooldown(self, abilityId)
968
963
  BlzEndUnitAbilityCooldown(self.handle, abilityId)
969
964
  end
965
+ function Unit.prototype.interruptMovement(self)
966
+ local handle = self.handle
967
+ unitDisableAbility(
968
+ handle,
969
+ fourCC("Amov"),
970
+ true,
971
+ false
972
+ )
973
+ unitDisableAbility(
974
+ handle,
975
+ fourCC("Amov"),
976
+ false,
977
+ false
978
+ )
979
+ end
970
980
  function Unit.prototype.interruptAttack(self)
971
981
  unitInterruptAttack(self.handle)
972
982
  end
@@ -1240,7 +1250,7 @@ __TS__SetDescriptor(
1240
1250
  Unit.prototype,
1241
1251
  "isIllusion",
1242
1252
  {get = function(self)
1243
- return isUnitIllusion(self.handle)
1253
+ return IsUnitIllusion(self.handle)
1244
1254
  end},
1245
1255
  true
1246
1256
  )
@@ -1463,13 +1473,13 @@ __TS__SetDescriptor(
1463
1473
  end,
1464
1474
  set = function(self, isTeamGlowVisible)
1465
1475
  BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
1466
- local ____temp_6
1476
+ local ____temp_7
1467
1477
  if not isTeamGlowVisible then
1468
- ____temp_6 = true
1478
+ ____temp_7 = true
1469
1479
  else
1470
- ____temp_6 = nil
1480
+ ____temp_7 = nil
1471
1481
  end
1472
- self[106] = ____temp_6
1482
+ self[106] = ____temp_7
1473
1483
  end
1474
1484
  },
1475
1485
  true
@@ -2216,25 +2226,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
2216
2226
  InitializingEvent,
2217
2227
  function(event)
2218
2228
  local function listener(unit, id)
2219
- local ____GetSpellTargetUnit_result_9
2229
+ local ____GetSpellTargetUnit_result_10
2220
2230
  if GetSpellTargetUnit() then
2221
- ____GetSpellTargetUnit_result_9 = ____exports.Unit:of(GetSpellTargetUnit())
2231
+ ____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
2222
2232
  else
2223
- local ____GetSpellTargetItem_result_8
2233
+ local ____GetSpellTargetItem_result_9
2224
2234
  if GetSpellTargetItem() then
2225
- ____GetSpellTargetItem_result_8 = Item:of(GetSpellTargetItem())
2235
+ ____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
2226
2236
  else
2227
- local ____GetSpellTargetDestructable_result_7
2237
+ local ____GetSpellTargetDestructable_result_8
2228
2238
  if GetSpellTargetDestructable() then
2229
- ____GetSpellTargetDestructable_result_7 = Destructable:of(GetSpellTargetDestructable())
2239
+ ____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
2230
2240
  else
2231
- ____GetSpellTargetDestructable_result_7 = nil
2241
+ ____GetSpellTargetDestructable_result_8 = nil
2232
2242
  end
2233
- ____GetSpellTargetItem_result_8 = ____GetSpellTargetDestructable_result_7
2243
+ ____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
2234
2244
  end
2235
- ____GetSpellTargetUnit_result_9 = ____GetSpellTargetItem_result_8
2245
+ ____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
2236
2246
  end
2237
- local target = ____GetSpellTargetUnit_result_9
2247
+ local target = ____GetSpellTargetUnit_result_10
2238
2248
  if target then
2239
2249
  invoke(event, unit, id, target)
2240
2250
  end
@@ -2657,10 +2667,14 @@ Unit.itemPickedUpEvent = __TS__New(
2657
2667
  ____exports.UnitTriggerEvent,
2658
2668
  EVENT_PLAYER_UNIT_PICKUP_ITEM,
2659
2669
  function()
2660
- local unit = getTriggerUnit()
2661
- local item = getManipulatedItem()
2662
- if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
2663
- return ____exports.Unit:of(unit), Item:of(item)
2670
+ local unitHandle = getTriggerUnit()
2671
+ local itemHandle = getManipulatedItem()
2672
+ if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
2673
+ local unit = ____exports.Unit:of(unitHandle)
2674
+ local item = Item:of(itemHandle)
2675
+ if item.owner ~= unit then
2676
+ return unit, item
2677
+ end
2664
2678
  end
2665
2679
  return IgnoreEvent
2666
2680
  end
@@ -2680,7 +2694,7 @@ Unit.itemUsedEvent = __TS__New(
2680
2694
  Unit.itemStackedEvent = __TS__New(
2681
2695
  ____exports.UnitTriggerEvent,
2682
2696
  EVENT_PLAYER_UNIT_STACK_ITEM,
2683
- function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
2697
+ function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
2684
2698
  )
2685
2699
  __TS__ObjectDefineProperty(
2686
2700
  Unit,
@@ -0,0 +1,11 @@
1
+ /** @noSelfInFile */
2
+ export declare const enum ArmorType {
3
+ LIGHT = 0,
4
+ MEDIUM = 1,
5
+ HEAVY = 2,
6
+ FORTIFIED = 3,
7
+ NORMAL = 4,
8
+ HERO = 5,
9
+ DIVINE = 6,
10
+ UNARMORED = 7
11
+ }
@@ -0,0 +1,46 @@
1
+ local ____exports = {}
2
+ local ____records = require("utility.records")
3
+ local invertRecord = ____records.invertRecord
4
+ local stringByArmorType = {
5
+ [0] = "small",
6
+ [1] = "medium",
7
+ [2] = "large",
8
+ [3] = "fort",
9
+ [4] = "normal",
10
+ [5] = "hero",
11
+ [6] = "divine",
12
+ [7] = "none"
13
+ }
14
+ local armorTypeByString = invertRecord(stringByArmorType)
15
+ local nativeByArmorType = {
16
+ [0] = DEFENSE_TYPE_LIGHT,
17
+ [1] = DEFENSE_TYPE_MEDIUM,
18
+ [2] = DEFENSE_TYPE_LARGE,
19
+ [3] = DEFENSE_TYPE_FORT,
20
+ [4] = DEFENSE_TYPE_NORMAL,
21
+ [5] = DEFENSE_TYPE_HERO,
22
+ [6] = DEFENSE_TYPE_DIVINE,
23
+ [7] = DEFENSE_TYPE_NONE
24
+ }
25
+ local armorTypeByNative = invertRecord(nativeByArmorType)
26
+ ---
27
+ -- @internal For use by internal systems only.
28
+ ____exports.armorTypeToString = function(armorType)
29
+ return stringByArmorType[armorType]
30
+ end
31
+ ---
32
+ -- @internal For use by internal systems only.
33
+ ____exports.stringToArmorType = function(____string)
34
+ return armorTypeByString[____string] or 7
35
+ end
36
+ ---
37
+ -- @internal For use by internal systems only.
38
+ ____exports.armorTypeToNative = function(armorType)
39
+ return nativeByArmorType[armorType]
40
+ end
41
+ ---
42
+ -- @internal For use by internal systems only.
43
+ ____exports.nativeToArmorType = function(armorType)
44
+ return armorTypeByNative[armorType]
45
+ end
46
+ return ____exports
@@ -979,9 +979,7 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
979
979
  4,
980
980
  function(caster, ability)
981
981
  if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
982
- Timer:run(function()
983
- caster:playAnimation(animationFQN)
984
- end)
982
+ Timer:run(caster, "playAnimation", animationFQN)
985
983
  end
986
984
  end
987
985
  )
@@ -13,6 +13,7 @@ import type { AbilityTypeId } from "./ability-type";
13
13
  import type { UpgradeId } from "./upgrade";
14
14
  import { AnimationQualifier } from "../auxiliary/animation-qualifier";
15
15
  import { AttackType } from "../auxiliary/attack-type";
16
+ import { ArmorType } from "../auxiliary/armor-type";
16
17
  export type UnitTypeId = ObjectDataEntryId & number & {
17
18
  readonly __unitTypeId: unique symbol;
18
19
  };
@@ -144,6 +145,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
144
145
  set runSpeedSD(runSpeedSD: number);
145
146
  get runSpeedHD(): number;
146
147
  set runSpeedHD(runSpeedHD: number);
148
+ get selectionCircleHeight(): number;
149
+ set selectionCircleHeight(height: number);
147
150
  get selectionCircleScale(): number;
148
151
  set selectionCircleScale(selectionCircleScale: number);
149
152
  get selectionCircleScaleSD(): number;
@@ -182,16 +185,20 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
182
185
  set walkSpeedSD(walkSpeedSD: number);
183
186
  get walkSpeedHD(): number;
184
187
  set walkSpeedHD(walkSpeedHD: number);
188
+ get armor(): number;
189
+ set armor(armor: number);
185
190
  get armorSoundType(): ArmorSoundType;
186
191
  set armorSoundType(armorSoundType: ArmorSoundType);
187
192
  get armorSoundTypeSD(): ArmorSoundType;
188
193
  set armorSoundTypeSD(armorSoundTypeSD: ArmorSoundType);
189
194
  get armorSoundTypeHD(): ArmorSoundType;
190
195
  set armorSoundTypeHD(armorSoundTypeHD: ArmorSoundType);
196
+ get armorType(): ArmorType;
197
+ set armorType(armorType: ArmorType);
191
198
  get combatClassifications(): CombatClassifications;
192
199
  set combatClassifications(combatClassifications: CombatClassifications);
193
- get unitClassifications(): UnitClassifications;
194
- set unitClassifications(unitClassifications: UnitClassifications);
200
+ get classifications(): UnitClassifications;
201
+ set classifications(unitClassifications: UnitClassifications);
195
202
  get weapons(): TupleOf<UnitTypeWeapon, 2>;
196
203
  get firstWeapon(): UnitTypeWeapon;
197
204
  get secondWeapon(): UnitTypeWeapon;
@@ -225,6 +232,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
225
232
  set goldCost(goldCost: number);
226
233
  get healthRegenerationRate(): number;
227
234
  set healthRegenerationRate(healthRegenerationRate: number);
235
+ get level(): number;
236
+ set level(level: number);
228
237
  get manaRegenerationRate(): number;
229
238
  set manaRegenerationRate(manaRegenerationRate: number);
230
239
  get maximumHealth(): number;
@@ -27,6 +27,9 @@ local attackTypeToString = ____attack_2Dtype.attackTypeToString
27
27
  local stringToAttackType = ____attack_2Dtype.stringToAttackType
28
28
  local ____config = require("config")
29
29
  local WarscriptConfig = ____config.WarscriptConfig
30
+ local ____armor_2Dtype = require("engine.object-data.auxiliary.armor-type")
31
+ local armorTypeToString = ____armor_2Dtype.armorTypeToString
32
+ local stringToArmorType = ____armor_2Dtype.stringToArmorType
30
33
  local getOrCreateUnitTypeWeapons
31
34
  ____exports.UnitTypeWeapon = __TS__Class()
32
35
  local UnitTypeWeapon = ____exports.UnitTypeWeapon
@@ -936,6 +939,19 @@ __TS__SetDescriptor(
936
939
  },
937
940
  true
938
941
  )
942
+ __TS__SetDescriptor(
943
+ UnitType.prototype,
944
+ "selectionCircleHeight",
945
+ {
946
+ get = function(self)
947
+ return self:getNumberField("uslz")
948
+ end,
949
+ set = function(self, height)
950
+ self:setNumberField("uslz", height)
951
+ end
952
+ },
953
+ true
954
+ )
939
955
  __TS__SetDescriptor(
940
956
  UnitType.prototype,
941
957
  "selectionCircleScale",
@@ -1183,6 +1199,19 @@ __TS__SetDescriptor(
1183
1199
  },
1184
1200
  true
1185
1201
  )
1202
+ __TS__SetDescriptor(
1203
+ UnitType.prototype,
1204
+ "armor",
1205
+ {
1206
+ get = function(self)
1207
+ return self:getNumberField("udef")
1208
+ end,
1209
+ set = function(self, armor)
1210
+ self:setNumberField("udef", armor)
1211
+ end
1212
+ },
1213
+ true
1214
+ )
1186
1215
  __TS__SetDescriptor(
1187
1216
  UnitType.prototype,
1188
1217
  "armorSoundType",
@@ -1222,6 +1251,22 @@ __TS__SetDescriptor(
1222
1251
  },
1223
1252
  true
1224
1253
  )
1254
+ __TS__SetDescriptor(
1255
+ UnitType.prototype,
1256
+ "armorType",
1257
+ {
1258
+ get = function(self)
1259
+ return stringToArmorType(self:getStringField("udty"))
1260
+ end,
1261
+ set = function(self, armorType)
1262
+ self:setStringField(
1263
+ "udty",
1264
+ armorTypeToString(armorType)
1265
+ )
1266
+ end
1267
+ },
1268
+ true
1269
+ )
1225
1270
  __TS__SetDescriptor(
1226
1271
  UnitType.prototype,
1227
1272
  "combatClassifications",
@@ -1240,7 +1285,7 @@ __TS__SetDescriptor(
1240
1285
  )
1241
1286
  __TS__SetDescriptor(
1242
1287
  UnitType.prototype,
1243
- "unitClassifications",
1288
+ "classifications",
1244
1289
  {
1245
1290
  get = function(self)
1246
1291
  return stringArrayToUnitClassifications(self:getStringsField("utyp"))
@@ -1476,6 +1521,19 @@ __TS__SetDescriptor(
1476
1521
  },
1477
1522
  true
1478
1523
  )
1524
+ __TS__SetDescriptor(
1525
+ UnitType.prototype,
1526
+ "level",
1527
+ {
1528
+ get = function(self)
1529
+ return self:getNumberField("ulev")
1530
+ end,
1531
+ set = function(self, level)
1532
+ self:setNumberField("ulev", level)
1533
+ end
1534
+ },
1535
+ true
1536
+ )
1479
1537
  __TS__SetDescriptor(
1480
1538
  UnitType.prototype,
1481
1539
  "manaRegenerationRate",
@@ -12,7 +12,7 @@ import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
12
12
  export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
13
13
  protected get instanceClass(): typeof Ability;
14
14
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
15
- protected hasNativeFieldValue(instance: Ability): boolean;
15
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
16
16
  static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<AbilityField>>;
17
17
  }
18
18
  export declare class AbilityBooleanField extends AbilityField<boolean, jabilitybooleanfield> {
@@ -48,7 +48,7 @@ export declare class AbilityStringField extends AbilityField<string, jabilitystr
48
48
  export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectArrayField<AbilityType, Ability, ValueType, NativeFieldType> {
49
49
  protected get instanceClass(): typeof Ability;
50
50
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
51
- protected hasNativeFieldValue(instance: Ability): boolean;
51
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
52
52
  }
53
53
  export declare class AbilityStringArrayField extends AbilityArrayField<string, jabilitystringlevelfield> {
54
54
  protected get defaultValue(): string;
@@ -68,7 +68,7 @@ export declare abstract class AbilityLevelField<ValueType extends number | strin
68
68
  protected get instanceClass(): typeof Ability;
69
69
  protected getLevelCount(entry: AbilityType | Ability): number;
70
70
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
71
- protected hasNativeFieldValue(instance: Ability): boolean;
71
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
72
72
  static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<ReadonlyObjectLevelFieldType<AbilityLevelField>>;
73
73
  }
74
74
  export declare class AbilityBooleanLevelField extends AbilityLevelField<boolean, boolean, jabilityintegerlevelfield> {
@@ -7,6 +7,7 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
7
7
  local ____exports = {}
8
8
  local ____ability = require("engine.internal.ability")
9
9
  local Ability = ____ability.Ability
10
+ local abilityTypeHasField = ____ability.abilityTypeHasField
10
11
  local ____object_2Dfield = require("engine.object-field")
11
12
  local ObjectArrayField = ____object_2Dfield.ObjectArrayField
12
13
  local ObjectField = ____object_2Dfield.ObjectField
@@ -29,8 +30,8 @@ __TS__ClassExtends(AbilityField, ObjectField)
29
30
  function AbilityField.prototype.getObjectDataEntryId(self, instance)
30
31
  return instance.typeId
31
32
  end
32
- function AbilityField.prototype.hasNativeFieldValue(self, instance)
33
- return instance:hasField(self.nativeField)
33
+ function AbilityField.prototype.hasNativeFieldValue(self, abilityTypeId)
34
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
34
35
  end
35
36
  __TS__SetDescriptor(
36
37
  AbilityField.prototype,
@@ -197,8 +198,8 @@ __TS__ClassExtends(AbilityArrayField, ObjectArrayField)
197
198
  function AbilityArrayField.prototype.getObjectDataEntryId(self, instance)
198
199
  return instance.typeId
199
200
  end
200
- function AbilityArrayField.prototype.hasNativeFieldValue(self, instance)
201
- return instance:hasField(self.nativeField)
201
+ function AbilityArrayField.prototype.hasNativeFieldValue(self, abilityTypeId)
202
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
202
203
  end
203
204
  __TS__SetDescriptor(
204
205
  AbilityArrayField.prototype,
@@ -269,8 +270,8 @@ end
269
270
  function AbilityLevelField.prototype.getObjectDataEntryId(self, instance)
270
271
  return instance.typeId
271
272
  end
272
- function AbilityLevelField.prototype.hasNativeFieldValue(self, instance)
273
- return instance:hasField(self.nativeField)
273
+ function AbilityLevelField.prototype.hasNativeFieldValue(self, abilityTypeId)
274
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
274
275
  end
275
276
  __TS__SetDescriptor(
276
277
  AbilityLevelField.prototype,
@@ -4,6 +4,7 @@ import { ObjectField, ObjectLevelField, ObjectLevelFieldValueChangeEvent, Readon
4
4
  import { UnitType, UnitTypeId } from "../object-data/entry/unit-type";
5
5
  import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
6
6
  import { AttackType } from "../object-data/auxiliary/attack-type";
7
+ import { UnitClassifications } from "../object-data/auxiliary/unit-classification";
7
8
  export declare abstract class UnitField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = any> extends ObjectField<UnitType, Unit, ValueType, NativeFieldType> {
8
9
  protected get instanceClass(): typeof Unit;
9
10
  protected getObjectDataEntryId(instance: Unit): UnitTypeId;
@@ -56,4 +57,14 @@ export declare abstract class UnitEnumWeaponField<T extends number> extends Unit
56
57
  export declare class UnitAttackTypeWeaponField extends UnitEnumWeaponField<AttackType> {
57
58
  protected values: ReadonlyNonEmptyLinkedSet<AttackType>;
58
59
  }
60
+ export declare class UnitClassificationsField extends UnitField<UnitClassifications, junitintegerfield> {
61
+ protected get defaultValue(): UnitClassifications;
62
+ protected getNativeFieldById(id: number): junitintegerfield;
63
+ protected getNativeFieldValue(instance: Unit): UnitClassifications;
64
+ protected setNativeFieldValue(instance: Unit, value: UnitClassifications): boolean;
65
+ }
66
+ export declare class UnitPropulsionWindowField extends UnitFloatField {
67
+ protected getNativeFieldValue(instance: Unit): number;
68
+ protected setNativeFieldValue(instance: Unit, value: number): boolean;
69
+ }
59
70
  export {};