warscript 0.0.1-dev.c963f13 → 0.0.1-dev.ccc2b77

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 (114) hide show
  1. package/attributes.d.ts +0 -1
  2. package/binaryreader.d.ts +1 -0
  3. package/binaryreader.lua +3 -0
  4. package/core/types/frame.d.ts +5 -1
  5. package/core/types/frame.lua +34 -1
  6. package/core/types/group.d.ts +0 -1
  7. package/core/types/image.d.ts +0 -1
  8. package/core/types/missile.d.ts +2 -2
  9. package/core/types/missile.lua +8 -2
  10. package/core/types/unit.lua +8 -0
  11. package/core/util.d.ts +1 -1
  12. package/core/util.lua +6 -0
  13. package/decl/index.d.ts +1 -0
  14. package/engine/ability.d.ts +1 -1
  15. package/engine/behavior.d.ts +10 -10
  16. package/engine/behavior.lua +6 -6
  17. package/engine/behaviour/ability/apply-buff.d.ts +3 -5
  18. package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
  19. package/engine/behaviour/ability/damage.d.ts +33 -11
  20. package/engine/behaviour/ability/damage.lua +89 -31
  21. package/engine/behaviour/ability/heal.d.ts +33 -6
  22. package/engine/behaviour/ability/heal.lua +89 -10
  23. package/engine/behaviour/ability/instant-impact.lua +4 -0
  24. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  25. package/engine/behaviour/ability/restore-mana.lua +29 -0
  26. package/engine/behaviour/ability.d.ts +8 -1
  27. package/engine/behaviour/ability.lua +62 -0
  28. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  29. package/engine/behaviour/unit.d.ts +8 -2
  30. package/engine/behaviour/unit.lua +27 -0
  31. package/engine/buff.d.ts +62 -20
  32. package/engine/buff.lua +247 -72
  33. package/engine/game-map.d.ts +7 -0
  34. package/engine/game-map.lua +32 -0
  35. package/engine/internal/ability.d.ts +1 -11
  36. package/engine/internal/ability.lua +2 -78
  37. package/engine/internal/item+owner.lua +2 -2
  38. package/engine/internal/unit/bonus.d.ts +9 -8
  39. package/engine/internal/unit/bonus.lua +6 -1
  40. package/engine/internal/unit/item.d.ts +23 -0
  41. package/engine/internal/unit/item.lua +74 -0
  42. package/engine/internal/unit+ability.lua +2 -2
  43. package/engine/internal/unit+transport.lua +4 -10
  44. package/engine/internal/unit-missile-launch.lua +25 -6
  45. package/engine/internal/unit.d.ts +33 -12
  46. package/engine/internal/unit.lua +231 -87
  47. package/engine/local-client.d.ts +7 -2
  48. package/engine/local-client.lua +81 -0
  49. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  50. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  51. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  52. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  53. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  54. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  55. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  56. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  57. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  58. package/engine/object-data/entry/ability-type.d.ts +0 -1
  59. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  60. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  61. package/engine/object-data/entry/buff-type.d.ts +0 -1
  62. package/engine/object-data/entry/destructible-type.d.ts +0 -1
  63. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  64. package/engine/object-data/entry/item-type.d.ts +12 -1
  65. package/engine/object-data/entry/item-type.lua +78 -0
  66. package/engine/object-data/entry/lightning-type.d.ts +0 -1
  67. package/engine/object-data/entry/unit-type.d.ts +0 -1
  68. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  69. package/engine/object-data/entry/upgrade.d.ts +0 -1
  70. package/engine/object-data/entry.d.ts +2 -3
  71. package/engine/object-field/ability.d.ts +18 -1
  72. package/engine/object-field/ability.lua +51 -1
  73. package/engine/object-field.d.ts +0 -1
  74. package/engine/random.d.ts +1 -0
  75. package/engine/random.lua +9 -0
  76. package/engine/standard/entries/unit-type.d.ts +18 -0
  77. package/engine/standard/entries/unit-type.lua +18 -0
  78. package/engine/standard/fields/ability.d.ts +1 -1
  79. package/engine/standard/fields/ability.lua +1 -1
  80. package/engine/unit.d.ts +1 -0
  81. package/engine/unit.lua +10 -2
  82. package/event.d.ts +2 -3
  83. package/event.lua +9 -5
  84. package/index.d.ts +1 -0
  85. package/index.lua +1 -0
  86. package/lualib_bundle.lua +146 -42
  87. package/math/vec2.d.ts +2 -9
  88. package/math.d.ts +0 -2
  89. package/net/socket.d.ts +7 -1
  90. package/net/socket.lua +45 -4
  91. package/network.d.ts +1 -0
  92. package/network.lua +3 -2
  93. package/objutil/ability.d.ts +0 -1
  94. package/objutil/buff.d.ts +0 -1
  95. package/objutil/buff.lua +1 -1
  96. package/objutil/object.d.ts +0 -1
  97. package/objutil/unit.d.ts +0 -1
  98. package/package.json +13 -13
  99. package/patch-lua.d.ts +0 -0
  100. package/patch-lua.lua +10 -0
  101. package/property.d.ts +55 -0
  102. package/property.lua +374 -0
  103. package/string.d.ts +16 -0
  104. package/string.lua +5 -0
  105. package/util/stream.d.ts +0 -1
  106. package/utility/arrays.d.ts +3 -4
  107. package/utility/bit-set.d.ts +0 -2
  108. package/utility/linked-set.d.ts +11 -3
  109. package/utility/linked-set.lua +5 -2
  110. package/utility/lua-maps.d.ts +1 -2
  111. package/utility/lua-sets.d.ts +1 -2
  112. package/utility/types.d.ts +1 -0
  113. package/core/mapbounds.d.ts +0 -8
  114. package/core/mapbounds.lua +0 -12
@@ -0,0 +1,39 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ ____exports.MineAbilityType = __TS__Class()
9
+ local MineAbilityType = ____exports.MineAbilityType
10
+ MineAbilityType.name = "MineAbilityType"
11
+ __TS__ClassExtends(MineAbilityType, AbilityType)
12
+ MineAbilityType.BASE_ID = fourCC("Amin")
13
+ __TS__SetDescriptor(
14
+ MineAbilityType.prototype,
15
+ "activationDelay",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Min1")
19
+ end,
20
+ set = function(self, activationDelay)
21
+ self:setNumberLevelField("Min1", activationDelay)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ MineAbilityType.prototype,
28
+ "invisibilityDelay",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Min2")
32
+ end,
33
+ set = function(self, invisibilityDelay)
34
+ self:setNumberLevelField("Min2", invisibilityDelay)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ return ____exports
@@ -7,8 +7,8 @@ export declare class SpiritTouchAbilityType extends AbilityType {
7
7
  set manaGain(manaGain: ObjectDataEntryLevelFieldValueSupplier<number>);
8
8
  get manaRequirement(): number[];
9
9
  set manaRequirement(manaRequirement: ObjectDataEntryLevelFieldValueSupplier<number>);
10
- get maximumTargetCount(): number[];
11
- set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
12
10
  get maximumManaCostFactor(): number[];
13
11
  set maximumManaCostFactor(maximumManaCostFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ get maximumTargetCount(): number[];
13
+ set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
14
14
  }
@@ -38,26 +38,26 @@ __TS__SetDescriptor(
38
38
  )
39
39
  __TS__SetDescriptor(
40
40
  SpiritTouchAbilityType.prototype,
41
- "maximumTargetCount",
41
+ "maximumManaCostFactor",
42
42
  {
43
43
  get = function(self)
44
44
  return self:getNumberLevelField("Rpb5")
45
45
  end,
46
- set = function(self, maximumTargetCount)
47
- self:setNumberLevelField("Rpb5", maximumTargetCount)
46
+ set = function(self, maximumManaCostFactor)
47
+ self:setNumberLevelField("Rpb5", maximumManaCostFactor)
48
48
  end
49
49
  },
50
50
  true
51
51
  )
52
52
  __TS__SetDescriptor(
53
53
  SpiritTouchAbilityType.prototype,
54
- "maximumManaCostFactor",
54
+ "maximumTargetCount",
55
55
  {
56
56
  get = function(self)
57
57
  return self:getNumberLevelField("Rpb6")
58
58
  end,
59
- set = function(self, maximumManaCostFactor)
60
- self:setNumberLevelField("Rpb6", maximumManaCostFactor)
59
+ set = function(self, maximumTargetCount)
60
+ self:setNumberLevelField("Rpb6", maximumTargetCount)
61
61
  end
62
62
  },
63
63
  true
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import "../../internal/unit/ability";
4
3
  import { TupleOf } from "../../../utility/types";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { BuffPolarity } from "../../auxiliary/buff-polarity";
4
3
  import { BuffResistanceType } from "../../auxiliary/buff-resistance-type";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { BuffType, BuffTypeId } from "../buff-type";
4
3
  export declare class BlankBuffType extends BuffType {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { AttachmentPreset, AttachmentPresetInput } from "../auxiliary/attachment-preset";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
4
3
  import { CombatClassifications } from "../auxiliary/combat-classification";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ItemType, ItemTypeId } from "../item-type";
4
3
  export declare class BlankItemType extends ItemType {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
4
3
  import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
@@ -46,4 +45,16 @@ export declare class ItemType extends ObjectDataEntry<ItemTypeId> {
46
45
  set tooltipText(tooltipText: string);
47
46
  get tooltipExtendedText(): string;
48
47
  set tooltipExtendedText(tooltipText: string);
48
+ get goldCost(): number;
49
+ set goldCost(goldCost: number);
50
+ get lumberCost(): number;
51
+ set lumberCost(lumberCost: number);
52
+ get activelyUsed(): boolean;
53
+ set activelyUsed(activelyUsed: boolean);
54
+ get perishable(): boolean;
55
+ set perishable(perishable: boolean);
56
+ get initialStackSize(): number;
57
+ set initialStackSize(initialStackSize: number);
58
+ get maximumStackSize(): number;
59
+ set maximumStackSize(maximumStackSize: number);
49
60
  }
@@ -256,4 +256,82 @@ __TS__SetDescriptor(
256
256
  },
257
257
  true
258
258
  )
259
+ __TS__SetDescriptor(
260
+ ItemType.prototype,
261
+ "goldCost",
262
+ {
263
+ get = function(self)
264
+ return self:getNumberField("igol")
265
+ end,
266
+ set = function(self, goldCost)
267
+ self:setNumberField("igol", goldCost)
268
+ end
269
+ },
270
+ true
271
+ )
272
+ __TS__SetDescriptor(
273
+ ItemType.prototype,
274
+ "lumberCost",
275
+ {
276
+ get = function(self)
277
+ return self:getNumberField("ilum")
278
+ end,
279
+ set = function(self, lumberCost)
280
+ self:setNumberField("ilum", lumberCost)
281
+ end
282
+ },
283
+ true
284
+ )
285
+ __TS__SetDescriptor(
286
+ ItemType.prototype,
287
+ "activelyUsed",
288
+ {
289
+ get = function(self)
290
+ return self:getBooleanField("iusa")
291
+ end,
292
+ set = function(self, activelyUsed)
293
+ self:setBooleanField("iusa", activelyUsed)
294
+ end
295
+ },
296
+ true
297
+ )
298
+ __TS__SetDescriptor(
299
+ ItemType.prototype,
300
+ "perishable",
301
+ {
302
+ get = function(self)
303
+ return self:getBooleanField("iper")
304
+ end,
305
+ set = function(self, perishable)
306
+ self:setBooleanField("iper", perishable)
307
+ end
308
+ },
309
+ true
310
+ )
311
+ __TS__SetDescriptor(
312
+ ItemType.prototype,
313
+ "initialStackSize",
314
+ {
315
+ get = function(self)
316
+ return self:getNumberField("iuse")
317
+ end,
318
+ set = function(self, initialStackSize)
319
+ self:setNumberField("iuse", initialStackSize)
320
+ end
321
+ },
322
+ true
323
+ )
324
+ __TS__SetDescriptor(
325
+ ItemType.prototype,
326
+ "maximumStackSize",
327
+ {
328
+ get = function(self)
329
+ return self:getNumberField("ista")
330
+ end,
331
+ set = function(self, maximumStackSize)
332
+ self:setNumberField("ista", maximumStackSize)
333
+ end
334
+ },
335
+ true
336
+ )
259
337
  return ____exports
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { ObjectDataEntry, ObjectDataEntryConstructor, ObjectDataEntryId } from "../entry";
4
3
  import { Color } from "../../../core/types/color";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { ArmorSoundType } from "../auxiliary/armor-sound-type";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { Upgrade, UpgradeId } from "../upgrade";
4
3
  export declare class BlankUpgrade extends Upgrade {
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { TechTreeDependency, TechTreeDependencyInput } from "../auxiliary/tech-tree-dependency";
@@ -1,4 +1,3 @@
1
- /// <reference types="warpack-types/warpack" />
2
1
  /** @noSelfInFile */
3
2
  import { AttachmentPreset, AttachmentPresetInput } from "./auxiliary/attachment-preset";
4
3
  import { MutableKeys } from "../../utility/types";
@@ -10,8 +9,8 @@ export type ObjectDataEntryConstructor<T extends ObjectDataEntry> = OmitConstruc
10
9
  export type ObjectDataEntryAbstractConstructor<T extends ObjectDataEntry> = OmitConstructor<typeof ObjectDataEntry> & (abstract new (object: WarObject) => T);
11
10
  export type ObjectDataEntryProperties<T extends ObjectDataEntry> = Partial<T[MutableKeys<T>]>;
12
11
  export type ObjectDataEntryLevelFieldValueSupplier<ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType> = ValueType | readonly ValueType[] | ((level: number, currentValue: InputValueType) => ValueType);
13
- export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | Record<string, any> | undefined, InputValueType = ValueType>(supplier: ObjectDataEntryLevelFieldValueSupplier<ValueType, InputValueType>, level: number, currentValue: InputValueType) => ValueType;
14
- export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | Record<string, any> | undefined, S extends T[]>(supplier: ObjectDataEntryLevelFieldValueSupplier<S, S>, level: number, currentValue: S) => S;
12
+ export declare const extractObjectDataEntryLevelFieldValue: <ValueType extends string | number | boolean | undefined | Record<string, any>, InputValueType = ValueType>(supplier: ObjectDataEntryLevelFieldValueSupplier<ValueType, InputValueType>, level: number, currentValue: InputValueType) => ValueType;
13
+ export declare const extractObjectDataEntryLevelArrayFieldValue: <T extends string | number | boolean | undefined | Record<string, any>, S extends T[]>(supplier: ObjectDataEntryLevelFieldValueSupplier<S>, level: number, currentValue: S) => S;
15
14
  export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = ObjectDataEntryId> {
16
15
  protected readonly object: WarObject;
17
16
  static readonly BASE_ID: ObjectDataEntryId;
@@ -6,6 +6,9 @@ import { ObjectDataEntryId } from "../object-data/entry";
6
6
  import { LightningTypeId } from "../object-data/entry/lightning-type";
7
7
  import { CombatClassifications } from "../object-data/auxiliary/combat-classification";
8
8
  import { UnitTypeId } from "../object-data/entry/unit-type";
9
+ import { BuffResistanceType } from "../object-data/auxiliary/buff-resistance-type";
10
+ import { BuffPolarity } from "../object-data/auxiliary/buff-polarity";
11
+ import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
9
12
  export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
10
13
  protected get instanceClass(): typeof Ability;
11
14
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
@@ -107,6 +110,20 @@ export declare class AbilityAbilityTypeIdLevelField extends AbilityObjectDataEnt
107
110
  }
108
111
  export declare class AbilityUnitTypeIdLevelField extends AbilityObjectDataEntryIdLevelField<UnitTypeId> {
109
112
  }
113
+ export declare abstract class AbilityEnumLevelField<T extends number> extends AbilityLevelField<T, T, jabilityintegerlevelfield> {
114
+ protected abstract values: ReadonlyNonEmptyLinkedSet<T>;
115
+ protected get defaultValue(): T;
116
+ protected getNativeFieldById(id: number): jabilityintegerlevelfield;
117
+ protected getNativeFieldValue(instance: Ability, level: number): T;
118
+ protected setNativeFieldValue(instance: Ability, level: number, value: T): boolean;
119
+ static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityBooleanLevelField>;
120
+ }
121
+ export declare class AbilityBuffPolarityLevelField extends AbilityEnumLevelField<BuffPolarity> {
122
+ protected values: ReadonlyNonEmptyLinkedSet<BuffPolarity>;
123
+ }
124
+ export declare class AbilityBuffResistanceTypeLevelField extends AbilityEnumLevelField<BuffResistanceType> {
125
+ protected values: ReadonlyNonEmptyLinkedSet<BuffResistanceType>;
126
+ }
110
127
  export declare class AbilityCombatClassificationsLevelField extends AbilityLevelField<CombatClassifications, CombatClassifications, jabilityintegerlevelfield> {
111
128
  protected get defaultValue(): CombatClassifications;
112
129
  protected getNativeFieldById(id: number): jabilityintegerlevelfield;
@@ -114,4 +131,4 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
114
131
  protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
115
132
  }
116
133
  export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
117
- export declare const resolveCurrentAbilityDependentValue: <ValueType extends string | number | boolean>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
134
+ export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
@@ -13,6 +13,8 @@ local ObjectField = ____object_2Dfield.ObjectField
13
13
  local ObjectLevelField = ____object_2Dfield.ObjectLevelField
14
14
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
15
15
  local AbilityType = ____ability_2Dtype.AbilityType
16
+ local ____linked_2Dset = require("utility.linked-set")
17
+ local nonEmptyLinkedSetOf = ____linked_2Dset.nonEmptyLinkedSetOf
16
18
  local convertAbilityBooleanField = _G.ConvertAbilityBooleanField
17
19
  local convertAbilityIntegerField = _G.ConvertAbilityIntegerField
18
20
  local convertAbilityRealField = _G.ConvertAbilityRealField
@@ -259,7 +261,7 @@ local AbilityLevelField = ____exports.AbilityLevelField
259
261
  AbilityLevelField.name = "AbilityLevelField"
260
262
  __TS__ClassExtends(AbilityLevelField, ObjectLevelField)
261
263
  function AbilityLevelField.prototype.getLevelCount(self, entry)
262
- return __TS__InstanceOf(entry, Ability) and #entry.levels or entry.levelCount
264
+ return entry.levelCount
263
265
  end
264
266
  function AbilityLevelField.prototype.getObjectDataEntryId(self, instance)
265
267
  return instance.typeId
@@ -431,6 +433,54 @@ ____exports.AbilityUnitTypeIdLevelField = __TS__Class()
431
433
  local AbilityUnitTypeIdLevelField = ____exports.AbilityUnitTypeIdLevelField
432
434
  AbilityUnitTypeIdLevelField.name = "AbilityUnitTypeIdLevelField"
433
435
  __TS__ClassExtends(AbilityUnitTypeIdLevelField, ____exports.AbilityObjectDataEntryIdLevelField)
436
+ ____exports.AbilityEnumLevelField = __TS__Class()
437
+ local AbilityEnumLevelField = ____exports.AbilityEnumLevelField
438
+ AbilityEnumLevelField.name = "AbilityEnumLevelField"
439
+ __TS__ClassExtends(AbilityEnumLevelField, ____exports.AbilityLevelField)
440
+ function AbilityEnumLevelField.prototype.getNativeFieldById(self, id)
441
+ return convertAbilityIntegerLevelField(id)
442
+ end
443
+ function AbilityEnumLevelField.prototype.getNativeFieldValue(self, instance, level)
444
+ local value = instance:getField(self.nativeField, level)
445
+ if self.values:contains(value) then
446
+ return value
447
+ end
448
+ return self.values:first()
449
+ end
450
+ function AbilityEnumLevelField.prototype.setNativeFieldValue(self, instance, level, value)
451
+ return instance:setField(self.nativeField, level, value)
452
+ end
453
+ __TS__SetDescriptor(
454
+ AbilityEnumLevelField.prototype,
455
+ "defaultValue",
456
+ {get = function(self)
457
+ return self.values:first()
458
+ end},
459
+ true
460
+ )
461
+ __TS__ObjectDefineProperty(
462
+ AbilityEnumLevelField,
463
+ "valueChangeEvent",
464
+ {get = function(self)
465
+ return self:getOrCreateValueChangeEvent()
466
+ end}
467
+ )
468
+ ____exports.AbilityBuffPolarityLevelField = __TS__Class()
469
+ local AbilityBuffPolarityLevelField = ____exports.AbilityBuffPolarityLevelField
470
+ AbilityBuffPolarityLevelField.name = "AbilityBuffPolarityLevelField"
471
+ __TS__ClassExtends(AbilityBuffPolarityLevelField, ____exports.AbilityEnumLevelField)
472
+ function AbilityBuffPolarityLevelField.prototype.____constructor(self, ...)
473
+ AbilityBuffPolarityLevelField.____super.prototype.____constructor(self, ...)
474
+ self.values = nonEmptyLinkedSetOf(0, 1, 2)
475
+ end
476
+ ____exports.AbilityBuffResistanceTypeLevelField = __TS__Class()
477
+ local AbilityBuffResistanceTypeLevelField = ____exports.AbilityBuffResistanceTypeLevelField
478
+ AbilityBuffResistanceTypeLevelField.name = "AbilityBuffResistanceTypeLevelField"
479
+ __TS__ClassExtends(AbilityBuffResistanceTypeLevelField, ____exports.AbilityEnumLevelField)
480
+ function AbilityBuffResistanceTypeLevelField.prototype.____constructor(self, ...)
481
+ AbilityBuffResistanceTypeLevelField.____super.prototype.____constructor(self, ...)
482
+ self.values = nonEmptyLinkedSetOf(1, 2, 3)
483
+ end
434
484
  local allowedTargetCombatClassificationsByLevelByAbilityTypeId = postcompile(function()
435
485
  local allowedTargetCombatClassificationsByLevelByAbilityTypeId = {}
436
486
  for ____, abilityType in ipairs(AbilityType:getAll()) do
@@ -1,4 +1,3 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
2
  import { DispatchingEvent } from "../event";
4
3
  import { AbstractConstructor } from "../utility/types";
@@ -8,3 +8,4 @@ export declare const randomFloat: {
8
8
  (upperBound?: number): number;
9
9
  (lowerBound: number, upperBound: number): number;
10
10
  };
11
+ export declare const randomXY: (centerX: number, centerY: number, range: number) => LuaMultiReturn<[x: number, y: number]>;
package/engine/random.lua CHANGED
@@ -1,9 +1,18 @@
1
1
  local ____exports = {}
2
2
  local ____math = require("math")
3
3
  local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
4
+ local PI = ____math.PI
4
5
  local getRandomInt = GetRandomInt
5
6
  local getRandomReal = GetRandomReal
7
+ local cos = math.cos
8
+ local sin = math.sin
9
+ local sqrt = math.sqrt
6
10
  ____exports.randomAngle = function() return getRandomReal(0, 360) end
7
11
  ____exports.randomInteger = function(m, n) return n ~= nil and getRandomInt(m, n) or getRandomInt(0, m or MAXIMUM_INTEGER) end
8
12
  ____exports.randomFloat = function(m, n) return n ~= nil and getRandomReal(m, n) or getRandomReal(0, m or MAXIMUM_INTEGER) end
13
+ ____exports.randomXY = function(centerX, centerY, range)
14
+ local r = range * sqrt(getRandomReal(0, 1))
15
+ local t = getRandomReal(0, 1) * 2 * PI
16
+ return centerX + r * cos(t), centerY + r * sin(t)
17
+ end
9
18
  return ____exports
@@ -13,7 +13,9 @@ export declare const ARCHMAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
13
13
  export declare const BLOOD_MAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
14
14
  export declare const MOUNTAIN_KING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
15
15
  export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
16
+ export declare const ARCHER_HIGH_ELF_UNIT_TYPE_ID: StandardUnitTypeId;
16
17
  export declare const CAPTAIN_UNIT_TYPE_ID: StandardUnitTypeId;
18
+ export declare const SWORDSMAN_UNIT_TYPE_ID: StandardUnitTypeId;
17
19
  export declare const ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
18
20
  export declare const ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
19
21
  export declare const ANTONIDAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
@@ -45,7 +47,22 @@ export declare const SPIRIT_WALKER_UNIT_TYPE_ID: StandardUnitTypeId;
45
47
  export declare const TAUREN_UNIT_TYPE_ID: StandardUnitTypeId;
46
48
  export declare const WIND_RIDER_UNIT_TYPE_ID: StandardUnitTypeId;
47
49
  export declare const WITCH_DOCTOR_UNIT_TYPE_ID: StandardUnitTypeId;
50
+ export declare const ARCHER_UNIT_TYPE_ID: StandardUnitTypeId;
51
+ export declare const CHIMAERA_UNIT_TYPE_ID: StandardUnitTypeId;
52
+ export declare const DRUID_OF_THE_CLAW_UNIT_TYPE_ID: StandardUnitTypeId;
53
+ export declare const DRUID_OF_THE_TALON_UNIT_TYPE_ID: StandardUnitTypeId;
54
+ export declare const DRYAD_UNIT_TYPE_ID: StandardUnitTypeId;
55
+ export declare const FAERIE_DRAGON_UNIT_TYPE_ID: StandardUnitTypeId;
56
+ export declare const GLAIVE_THROWER_UNIT_TYPE_ID: StandardUnitTypeId;
57
+ export declare const HIPPOGRYPH_UNIT_TYPE_ID: StandardUnitTypeId;
58
+ export declare const HIPPOGRYPH_RIDER_UNIT_TYPE_ID: StandardUnitTypeId;
59
+ export declare const HUNTRESS_UNIT_TYPE_ID: StandardUnitTypeId;
60
+ export declare const MOUNTAIN_GIANT_THROWER_UNIT_TYPE_ID: StandardUnitTypeId;
61
+ export declare const WISP_UNIT_TYPE_ID: StandardUnitTypeId;
48
62
  export declare const DEMON_HUNTER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
63
+ export declare const KEEPER_OF_THE_GROVE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
64
+ export declare const MOON_PRIESTESS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
65
+ export declare const WARDEN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
49
66
  export declare const DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
50
67
  export declare const ABOMINATION_UNIT_TYPE_ID: StandardUnitTypeId;
51
68
  export declare const GHOUL_UNIT_TYPE_ID: StandardUnitTypeId;
@@ -81,6 +98,7 @@ export declare const WENDIGO_UNIT_TYPE_ID: StandardUnitTypeId;
81
98
  export declare const WENDIGO_SHAMAN_UNIT_TYPE_ID: StandardUnitTypeId;
82
99
  export declare const WILDKIN_UNIT_TYPE_ID: StandardUnitTypeId;
83
100
  export declare const WRAITH_UNIT_TYPE_ID: StandardUnitTypeId;
101
+ export declare const GOBLIN_LAND_MINE_UNIT_TYPE_ID: StandardUnitTypeId;
84
102
  export declare const CIRCLE_OF_POWER_UNIT_TYPE_ID: StandardUnitTypeId;
85
103
  export declare const CIRCLE_OF_POWER_MEDIUM_UNIT_TYPE_ID: StandardUnitTypeId;
86
104
  export declare const CIRCLE_OF_POWER_LARGE_UNIT_TYPE_ID: StandardUnitTypeId;
@@ -12,7 +12,9 @@ ____exports.ARCHMAGE_HERO_UNIT_TYPE_ID = fourCC("Hamg")
12
12
  ____exports.BLOOD_MAGE_HERO_UNIT_TYPE_ID = fourCC("Hblm")
13
13
  ____exports.MOUNTAIN_KING_HERO_UNIT_TYPE_ID = fourCC("Hmkg")
14
14
  ____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
15
+ ____exports.ARCHER_HIGH_ELF_UNIT_TYPE_ID = fourCC("nhea")
15
16
  ____exports.CAPTAIN_UNIT_TYPE_ID = fourCC("hcth")
17
+ ____exports.SWORDSMAN_UNIT_TYPE_ID = fourCC("hhes")
16
18
  ____exports.ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID = fourCC("Hapm")
17
19
  ____exports.ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID = fourCC("Hssa")
18
20
  ____exports.ANTONIDAS_HERO_UNIT_TYPE_ID = fourCC("Hant")
@@ -44,7 +46,22 @@ ____exports.SPIRIT_WALKER_UNIT_TYPE_ID = fourCC("ospw")
44
46
  ____exports.TAUREN_UNIT_TYPE_ID = fourCC("otau")
45
47
  ____exports.WIND_RIDER_UNIT_TYPE_ID = fourCC("owyv")
46
48
  ____exports.WITCH_DOCTOR_UNIT_TYPE_ID = fourCC("odoc")
49
+ ____exports.ARCHER_UNIT_TYPE_ID = fourCC("earc")
50
+ ____exports.CHIMAERA_UNIT_TYPE_ID = fourCC("echm")
51
+ ____exports.DRUID_OF_THE_CLAW_UNIT_TYPE_ID = fourCC("edoc")
52
+ ____exports.DRUID_OF_THE_TALON_UNIT_TYPE_ID = fourCC("edot")
53
+ ____exports.DRYAD_UNIT_TYPE_ID = fourCC("edry")
54
+ ____exports.FAERIE_DRAGON_UNIT_TYPE_ID = fourCC("efdr")
55
+ ____exports.GLAIVE_THROWER_UNIT_TYPE_ID = fourCC("ebal")
56
+ ____exports.HIPPOGRYPH_UNIT_TYPE_ID = fourCC("ehip")
57
+ ____exports.HIPPOGRYPH_RIDER_UNIT_TYPE_ID = fourCC("ehpr")
58
+ ____exports.HUNTRESS_UNIT_TYPE_ID = fourCC("esen")
59
+ ____exports.MOUNTAIN_GIANT_THROWER_UNIT_TYPE_ID = fourCC("emtg")
60
+ ____exports.WISP_UNIT_TYPE_ID = fourCC("ewsp")
47
61
  ____exports.DEMON_HUNTER_HERO_UNIT_TYPE_ID = fourCC("Edem")
62
+ ____exports.KEEPER_OF_THE_GROVE_HERO_UNIT_TYPE_ID = fourCC("Ekee")
63
+ ____exports.MOON_PRIESTESS_HERO_UNIT_TYPE_ID = fourCC("Emoo")
64
+ ____exports.WARDEN_HERO_UNIT_TYPE_ID = fourCC("Ewar")
48
65
  ____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
49
66
  ____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
50
67
  ____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
@@ -80,6 +97,7 @@ ____exports.WENDIGO_UNIT_TYPE_ID = fourCC("nwen")
80
97
  ____exports.WENDIGO_SHAMAN_UNIT_TYPE_ID = fourCC("nwns")
81
98
  ____exports.WILDKIN_UNIT_TYPE_ID = fourCC("nowb")
82
99
  ____exports.WRAITH_UNIT_TYPE_ID = fourCC("ngh2")
100
+ ____exports.GOBLIN_LAND_MINE_UNIT_TYPE_ID = fourCC("nglm")
83
101
  ____exports.CIRCLE_OF_POWER_UNIT_TYPE_ID = fourCC("ncop")
84
102
  ____exports.CIRCLE_OF_POWER_MEDIUM_UNIT_TYPE_ID = fourCC("ncp2")
85
103
  ____exports.CIRCLE_OF_POWER_LARGE_UNIT_TYPE_ID = fourCC("ncp3")
@@ -16,7 +16,7 @@ export declare const LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD: AbilityIntege
16
16
  export declare const HERO_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
17
17
  export declare const ITEM_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
18
18
  export declare const CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
19
- export declare const ARF_MISSILE_ARC_ABILITY_FLOAT_FIELD: AbilityFloatField & symbol;
19
+ export declare const MISSILE_ARC_ABILITY_FLOAT_FIELD: AbilityFloatField & symbol;
20
20
  export declare const NAME_ABILITY_STRING_FIELD: AbilityStringField & symbol;
21
21
  export declare const ICON_ACTIVATED_ABILITY_STRING_FIELD: AbilityStringField & symbol;
22
22
  export declare const ICON_RESEARCH_ABILITY_STRING_FIELD: AbilityStringField & symbol;
@@ -27,7 +27,7 @@ ____exports.LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD = AbilityIntegerField:c
27
27
  ____exports.HERO_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aher"))
28
28
  ____exports.ITEM_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aite"))
29
29
  ____exports.CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("achd"))
30
- ____exports.ARF_MISSILE_ARC_ABILITY_FLOAT_FIELD = AbilityFloatField:create(fourCC("amac"))
30
+ ____exports.MISSILE_ARC_ABILITY_FLOAT_FIELD = AbilityFloatField:create(fourCC("amac"))
31
31
  ____exports.NAME_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("anam"))
32
32
  ____exports.ICON_ACTIVATED_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("auar"))
33
33
  ____exports.ICON_RESEARCH_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("arar"))
package/engine/unit.d.ts CHANGED
@@ -4,6 +4,7 @@ import "./internal/unit/ability";
4
4
  import "./internal/unit/allowed-targets";
5
5
  import "./internal/unit/buff";
6
6
  import "./internal/unit/expiration-timer";
7
+ import "./internal/unit/item";
7
8
  import "./internal/unit+ability";
8
9
  import "./internal/unit+damage";
9
10
  import "./internal/unit+rally";
package/engine/unit.lua CHANGED
@@ -4,6 +4,7 @@ require("engine.internal.unit.ability")
4
4
  require("engine.internal.unit.allowed-targets")
5
5
  require("engine.internal.unit.buff")
6
6
  require("engine.internal.unit.expiration-timer")
7
+ require("engine.internal.unit.item")
7
8
  require("engine.internal.unit+ability")
8
9
  require("engine.internal.unit+damage")
9
10
  require("engine.internal.unit+rally")
@@ -18,8 +19,7 @@ require("engine.internal.unit.detach-missiles")
18
19
  require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
19
20
  do
20
21
  local ____unit = require("engine.internal.unit")
21
- local Unit = ____unit.Unit
22
- ____exports.Unit = Unit
22
+ ____exports.Unit = ____unit.Unit
23
23
  end
24
24
  do
25
25
  local ____export = require("engine.internal.unit+damage")
@@ -29,4 +29,12 @@ do
29
29
  end
30
30
  end
31
31
  end
32
+ do
33
+ local ____export = require("engine.internal.unit+rally")
34
+ for ____exportKey, ____exportValue in pairs(____export) do
35
+ if ____exportKey ~= "default" then
36
+ ____exports[____exportKey] = ____exportValue
37
+ end
38
+ end
39
+ end
32
40
  return ____exports
package/event.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- /// <reference types="@typescript-to-lua/language-extensions" />
2
1
  /** @noSelfInFile */
3
- export type EventListener<T extends any[]> = (...args: T) => void;
2
+ export type EventListener<T extends any[]> = (this: void, ...args: T) => void;
4
3
  export declare const enum EventListenerPriority {
5
4
  LOWEST = 0,
6
5
  LOW = 1,
@@ -38,7 +37,7 @@ export type EventDispatchTable<EventType extends Event<any>, KeyType extends num
38
37
  };
39
38
  export type DispatchingEvent<P extends any[], T extends Event<P> = Event<P>, S extends Event<P> = Event<P>> = T & EventDispatchTable<S>;
40
39
  export declare const createDispatchingEvent: {
41
- <T extends Event<any>, S extends Event<EventParameters<T>>>(underlyingEvent: T, extractKey: (...args: EventParameters<T>) => number, ...createEvent: [...(Event<any> extends S ? [(() => S)?] : [() => S])]): DispatchingEvent<EventParameters<T>, T>;
40
+ <T extends Event<any>, S extends Event<EventParameters<T>>>(underlyingEvent: T, extractKey: (this: void, ...args: EventParameters<T>) => number, invokeEvent?: (this: void, event: S, ...args: EventParameters<T>) => unknown, ...createEvent: [...(Event<any> extends S ? [((this: void) => S)?] : [(this: void) => S])]): DispatchingEvent<EventParameters<T>, T, S>;
42
41
  };
43
42
  export declare class DependentInitializingEvent<T extends any[], R extends any[]> extends InitializingEvent<R, EventListener<T>> {
44
43
  constructor(underlyingEvent: Event<T>, priority: EventListenerPriority, collector: (...args: T) => LuaMultiReturn<[false] | [true, ...R]>);
package/event.lua CHANGED
@@ -146,8 +146,13 @@ function TriggerEvent.prototype.____constructor(self, r, c)
146
146
  end
147
147
  )
148
148
  end
149
- ____exports.createDispatchingEvent = function(underlyingEvent, extractKey, createEvent)
150
- local actualCreateEvent = createEvent or (function() return __TS__New(____exports.Event) end)
149
+ ____exports.createDispatchingEvent = function(underlyingEvent, extractKey, invokeEvent, createEvent)
150
+ if invokeEvent == nil then
151
+ invokeEvent = ____exports.Event.invoke
152
+ end
153
+ if createEvent == nil then
154
+ createEvent = function() return __TS__New(____exports.Event) end
155
+ end
151
156
  local initialized = false
152
157
  return setmetatable(
153
158
  {},
@@ -157,17 +162,16 @@ ____exports.createDispatchingEvent = function(underlyingEvent, extractKey, creat
157
162
  return underlyingEvent[id]
158
163
  end
159
164
  if not initialized then
160
- local invoke = ____exports.Event.invoke
161
165
  underlyingEvent:addListener(function(...)
162
166
  local key = extractKey(...)
163
167
  local event = rawget(self, key)
164
168
  if event then
165
- invoke(event, ...)
169
+ invokeEvent(event, ...)
166
170
  end
167
171
  end)
168
172
  initialized = true
169
173
  end
170
- local event = actualCreateEvent()
174
+ local event = createEvent()
171
175
  rawset(self, id, event)
172
176
  return event
173
177
  end,
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** @noSelfInFile */
2
2
  import "./types";
3
+ import "./patch-lua";
3
4
  import "./patch-lualib";
4
5
  import "./patch-natives";
5
6
  import "./global/math";
package/index.lua CHANGED
@@ -1,5 +1,6 @@
1
1
  local ____exports = {}
2
2
  require("types")
3
+ require("patch-lua")
3
4
  require("patch-lualib")
4
5
  require("patch-natives")
5
6
  require("global.math")