warscript 0.0.1-dev.6f480d0 → 0.0.1-dev.70ae346

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 (193) hide show
  1. package/attributes.d.ts +12 -0
  2. package/attributes.lua +16 -0
  3. package/binaryreader.d.ts +1 -0
  4. package/binaryreader.lua +3 -0
  5. package/config.d.ts +5 -0
  6. package/config.lua +10 -0
  7. package/core/types/effect.d.ts +13 -3
  8. package/core/types/effect.lua +116 -17
  9. package/core/types/frame.d.ts +8 -1
  10. package/core/types/frame.lua +93 -1
  11. package/core/types/group.d.ts +0 -1
  12. package/core/types/handle.d.ts +2 -1
  13. package/core/types/handle.lua +5 -0
  14. package/core/types/image.d.ts +0 -1
  15. package/core/types/missile.d.ts +2 -2
  16. package/core/types/missile.lua +8 -2
  17. package/core/types/sound.d.ts +1 -0
  18. package/core/types/sound.lua +32 -2
  19. package/core/types/unit.lua +8 -0
  20. package/core/util.d.ts +1 -1
  21. package/core/util.lua +12 -0
  22. package/decl/index.d.ts +1 -0
  23. package/engine/ability.d.ts +1 -1
  24. package/engine/behavior.d.ts +10 -10
  25. package/engine/behavior.lua +6 -6
  26. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  27. package/engine/behaviour/ability/always-enabled.lua +31 -0
  28. package/engine/behaviour/ability/apply-buff.d.ts +8 -5
  29. package/engine/behaviour/ability/apply-buff.lua +32 -0
  30. package/engine/behaviour/ability/apply-unit-behavior.d.ts +5 -1
  31. package/engine/behaviour/ability/damage.d.ts +33 -11
  32. package/engine/behaviour/ability/damage.lua +89 -31
  33. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  34. package/engine/behaviour/ability/emulate-impact.lua +28 -0
  35. package/engine/behaviour/ability/heal.d.ts +33 -6
  36. package/engine/behaviour/ability/heal.lua +89 -10
  37. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  38. package/engine/behaviour/ability/instant-impact.lua +4 -15
  39. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  40. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  41. package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
  42. package/engine/behaviour/ability/remove-buffs.lua +28 -0
  43. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  44. package/engine/behaviour/ability/restore-mana.lua +29 -0
  45. package/engine/behaviour/ability.d.ts +22 -3
  46. package/engine/behaviour/ability.lua +134 -13
  47. package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
  48. package/engine/behaviour/unit.d.ts +8 -2
  49. package/engine/behaviour/unit.lua +27 -0
  50. package/engine/buff.d.ts +97 -40
  51. package/engine/buff.lua +431 -209
  52. package/engine/game-map.d.ts +7 -0
  53. package/engine/game-map.lua +32 -0
  54. package/engine/internal/ability.d.ts +16 -13
  55. package/engine/internal/ability.lua +80 -76
  56. package/engine/internal/item/ability.lua +106 -0
  57. package/engine/internal/item+owner.lua +2 -2
  58. package/engine/internal/item.d.ts +2 -2
  59. package/engine/internal/item.lua +56 -25
  60. package/engine/internal/mechanics/ability-duration.d.ts +1 -3
  61. package/engine/internal/mechanics/ability-duration.lua +2 -0
  62. package/engine/internal/mechanics/cast-ability.d.ts +2 -0
  63. package/engine/internal/mechanics/cast-ability.lua +86 -0
  64. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  65. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  66. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  67. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  68. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  69. package/engine/internal/object-data/evasion-probability.lua +16 -0
  70. package/engine/internal/unit/ability.d.ts +10 -1
  71. package/engine/internal/unit/ability.lua +36 -14
  72. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  73. package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
  74. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  75. package/engine/internal/unit/add-item-to-slot.lua +52 -0
  76. package/engine/internal/unit/bonus.d.ts +11 -8
  77. package/engine/internal/unit/bonus.lua +23 -1
  78. package/engine/internal/unit/detach-missiles.d.ts +7 -0
  79. package/engine/internal/unit/detach-missiles.lua +30 -0
  80. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  81. package/engine/internal/unit/ignore-events-items.lua +5 -0
  82. package/engine/internal/unit/item.d.ts +24 -0
  83. package/engine/internal/unit/item.lua +78 -0
  84. package/engine/internal/unit/main-selected.d.ts +13 -0
  85. package/engine/internal/unit/main-selected.lua +51 -0
  86. package/engine/internal/unit+ability.lua +2 -2
  87. package/engine/internal/unit+transport.lua +4 -10
  88. package/engine/internal/unit-missile-launch.lua +25 -6
  89. package/engine/internal/unit.d.ts +59 -16
  90. package/engine/internal/unit.lua +373 -132
  91. package/engine/internal/utility.lua +12 -0
  92. package/engine/lightning.d.ts +12 -5
  93. package/engine/lightning.lua +48 -14
  94. package/engine/local-client.d.ts +7 -2
  95. package/engine/local-client.lua +82 -0
  96. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  97. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  98. package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
  99. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  100. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  101. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  102. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  103. package/engine/object-data/entry/ability-type/blank-configurable.lua +21 -1
  104. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  105. package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
  106. package/engine/object-data/entry/ability-type/blink.lua +39 -0
  107. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  108. package/engine/object-data/entry/ability-type/curse.lua +2 -2
  109. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  110. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  111. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  112. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  113. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  114. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  115. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  116. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  117. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  118. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  119. package/engine/object-data/entry/ability-type.d.ts +6 -7
  120. package/engine/object-data/entry/ability-type.lua +24 -27
  121. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  122. package/engine/object-data/entry/buff-type/applicable.lua +34 -102
  123. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  124. package/engine/object-data/entry/buff-type.d.ts +1 -2
  125. package/engine/object-data/entry/buff-type.lua +2 -2
  126. package/engine/object-data/entry/destructible-type.d.ts +1 -2
  127. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  128. package/engine/object-data/entry/item-type.d.ts +15 -2
  129. package/engine/object-data/entry/item-type.lua +93 -2
  130. package/engine/object-data/entry/lightning-type.d.ts +1 -2
  131. package/engine/object-data/entry/sound-preset.d.ts +16 -0
  132. package/engine/object-data/entry/sound-preset.lua +36 -0
  133. package/engine/object-data/entry/unit-type.d.ts +50 -3
  134. package/engine/object-data/entry/unit-type.lua +439 -58
  135. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  136. package/engine/object-data/entry/upgrade.d.ts +1 -2
  137. package/engine/object-data/entry/upgrade.lua +4 -4
  138. package/engine/object-data/entry.d.ts +18 -17
  139. package/engine/object-data/entry.lua +60 -32
  140. package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
  141. package/engine/object-field/ability.d.ts +26 -3
  142. package/engine/object-field/ability.lua +54 -1
  143. package/engine/object-field.d.ts +2 -3
  144. package/engine/object-field.lua +4 -0
  145. package/engine/random.d.ts +1 -0
  146. package/engine/random.lua +9 -0
  147. package/engine/standard/entries/sound-preset.d.ts +10 -0
  148. package/engine/standard/entries/sound-preset.lua +10 -0
  149. package/engine/standard/entries/unit-type.d.ts +42 -1
  150. package/engine/standard/entries/unit-type.lua +42 -1
  151. package/engine/standard/fields/ability.d.ts +3 -1
  152. package/engine/standard/fields/ability.lua +3 -1
  153. package/engine/unit.d.ts +4 -0
  154. package/engine/unit.lua +13 -2
  155. package/event.d.ts +2 -3
  156. package/event.lua +9 -5
  157. package/global/vec2.lua +1 -0
  158. package/index.d.ts +1 -0
  159. package/index.lua +1 -0
  160. package/lualib_bundle.lua +146 -42
  161. package/math/vec2.d.ts +2 -9
  162. package/math.d.ts +0 -2
  163. package/net/socket.d.ts +7 -1
  164. package/net/socket.lua +45 -4
  165. package/network.d.ts +1 -0
  166. package/network.lua +3 -2
  167. package/objutil/ability.d.ts +0 -1
  168. package/objutil/buff.d.ts +0 -1
  169. package/objutil/buff.lua +1 -1
  170. package/objutil/object.d.ts +0 -1
  171. package/objutil/unit.d.ts +0 -1
  172. package/objutil/unit.lua +8 -0
  173. package/package.json +13 -14
  174. package/patch-lua.d.ts +0 -0
  175. package/patch-lua.lua +10 -0
  176. package/property.d.ts +55 -0
  177. package/property.lua +374 -0
  178. package/string.d.ts +30 -0
  179. package/string.lua +14 -0
  180. package/util/stream.d.ts +0 -1
  181. package/utility/arrays.d.ts +11 -5
  182. package/utility/arrays.lua +34 -3
  183. package/utility/bit-set.d.ts +0 -2
  184. package/utility/lazy.d.ts +2 -0
  185. package/utility/lazy.lua +14 -0
  186. package/utility/linked-set.d.ts +11 -3
  187. package/utility/linked-set.lua +5 -2
  188. package/utility/lua-maps.d.ts +1 -2
  189. package/utility/lua-sets.d.ts +1 -2
  190. package/utility/reflection.lua +11 -7
  191. package/utility/types.d.ts +3 -2
  192. package/core/mapbounds.d.ts +0 -8
  193. package/core/mapbounds.lua +0 -12
@@ -15,10 +15,10 @@ __TS__SetDescriptor(
15
15
  "normalFormUnitTypeId",
16
16
  {
17
17
  get = function(self)
18
- return self:getObjectDataEntryIdLevelField("Eme1")
18
+ return self:getObjectDataEntryNumericIdLevelField("Eme1")
19
19
  end,
20
20
  set = function(self, normalFormUnitTypeId)
21
- self:setObjectDataEntryIdLevelField("Eme1", normalFormUnitTypeId)
21
+ self:setObjectDataEntryNumericIdLevelField("Eme1", normalFormUnitTypeId)
22
22
  end
23
23
  },
24
24
  true
@@ -119,10 +119,10 @@ __TS__SetDescriptor(
119
119
  "alternateFormUnitTypeId",
120
120
  {
121
121
  get = function(self)
122
- return self:getObjectDataEntryIdLevelField("Emeu")
122
+ return self:getObjectDataEntryNumericIdLevelField("Emeu")
123
123
  end,
124
124
  set = function(self, alternateFormUnitTypeId)
125
- self:setObjectDataEntryIdLevelField("Emeu", alternateFormUnitTypeId)
125
+ self:setObjectDataEntryNumericIdLevelField("Emeu", alternateFormUnitTypeId)
126
126
  end
127
127
  },
128
128
  true
@@ -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
@@ -15,10 +15,10 @@ __TS__SetDescriptor(
15
15
  "summonedUnitTypeId",
16
16
  {
17
17
  get = function(self)
18
- return self:getObjectDataEntryIdLevelField("Hwe1")
18
+ return self:getObjectDataEntryNumericIdLevelField("Hwe1")
19
19
  end,
20
20
  set = function(self, summonedUnitTypeId)
21
- self:setObjectDataEntryIdLevelField("Hwe1", summonedUnitTypeId)
21
+ self:setObjectDataEntryNumericIdLevelField("Hwe1", summonedUnitTypeId)
22
22
  end
23
23
  },
24
24
  true
@@ -15,10 +15,10 @@ __TS__SetDescriptor(
15
15
  "summonedUnitTypeId",
16
16
  {
17
17
  get = function(self)
18
- return self:getObjectDataEntryIdLevelField("Hwe1")
18
+ return self:getObjectDataEntryNumericIdLevelField("Hwe1")
19
19
  end,
20
20
  set = function(self, summonedUnitTypeId)
21
- self:setObjectDataEntryIdLevelField("Hwe1", summonedUnitTypeId)
21
+ self:setObjectDataEntryNumericIdLevelField("Hwe1", summonedUnitTypeId)
22
22
  end
23
23
  },
24
24
  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";
@@ -7,12 +6,12 @@ import { AnimationQualifier } from "../auxiliary/animation-qualifier";
7
6
  import { AttachmentPreset, AttachmentPresetInput } from "../auxiliary/attachment-preset";
8
7
  import { CombatClassifications } from "../auxiliary/combat-classification";
9
8
  import { Race } from "../auxiliary/race";
10
- import { SoundPresetName } from "../auxiliary/sound-preset-name";
11
9
  import { TechTreeDependency, TechTreeDependencyInput } from "../auxiliary/tech-tree-dependency";
12
10
  import { ObjectDataEntry, ObjectDataEntryId, ObjectDataEntryLevelFieldValueSupplier } from "../entry";
13
11
  import { BuffTypeId } from "./buff-type";
14
12
  import { LightningTypeId } from "./lightning-type";
15
- export type AbilityTypeId = ObjectDataEntryId & {
13
+ import { SoundPresetId } from "./sound-preset";
14
+ export type AbilityTypeId = ObjectDataEntryId & number & {
16
15
  readonly __abilityTypeId: unique symbol;
17
16
  };
18
17
  export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId> {
@@ -112,10 +111,10 @@ export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId>
112
111
  set turnOffTooltipText(turnOffTooltipText: ObjectDataEntryLevelFieldValueSupplier<string>);
113
112
  get turnOffTooltipExtendedText(): string[];
114
113
  set turnOffTooltipExtendedText(turnOffTooltipExtendedText: ObjectDataEntryLevelFieldValueSupplier<string>);
115
- get soundPresetName(): SoundPresetName;
116
- set soundPresetName(soundPresetName: SoundPresetName);
117
- get loopingSoundPresetName(): SoundPresetName;
118
- set loopingSoundPresetName(loopingSoundPresetName: SoundPresetName);
114
+ get casterEffectSoundPresetId(): SoundPresetId | undefined;
115
+ set casterEffectSoundPresetId(casterEffectSoundPresetId: SoundPresetId | undefined);
116
+ get casterEffectLoopingSoundPresetId(): SoundPresetId;
117
+ set casterEffectLoopingSoundPresetId(casterEffectLoopingSoundPresetId: SoundPresetId);
119
118
  get allowedTargetCombatClassifications(): CombatClassifications[];
120
119
  set allowedTargetCombatClassifications(allowedTargetCombatClassifications: ObjectDataEntryLevelFieldValueSupplier<CombatClassifications>);
121
120
  get areaOfEffect(): number[];
@@ -1,7 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
- local __TS__New = ____lualib.__TS__New
5
4
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
6
5
  local ____exports = {}
7
6
  local ____unit = require("engine.internal.unit")
@@ -31,7 +30,7 @@ local ____entry = require("engine.object-data.entry")
31
30
  local extractObjectDataEntryLevelFieldValue = ____entry.extractObjectDataEntryLevelFieldValue
32
31
  local ObjectDataEntry = ____entry.ObjectDataEntry
33
32
  local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.utility.object-data-entry-id-generator")
34
- local ObjectDataEntryIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.ObjectDataEntryIdGenerator
33
+ local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilityTypeIdGenerator
35
34
  local ____upgrade = require("engine.object-data.entry.upgrade")
36
35
  local Upgrade = ____upgrade.Upgrade
37
36
  local castAnimationFQNByAbilityTypeId = {}
@@ -53,10 +52,7 @@ end
53
52
  function AbilityType.getObjectData(self, map)
54
53
  return map.objects.ability
55
54
  end
56
- AbilityType.idGenerator = __TS__New(
57
- ObjectDataEntryIdGenerator,
58
- fourCC("A000")
59
- )
55
+ AbilityType.idGenerator = abilityTypeIdGenerator
60
56
  __TS__SetDescriptor(
61
57
  AbilityType.prototype,
62
58
  "channelingAnimation",
@@ -275,10 +271,10 @@ __TS__SetDescriptor(
275
271
  "lightningTypeIds",
276
272
  {
277
273
  get = function(self)
278
- return self:getObjectDataEntryIdsField("alig")
274
+ return self:getObjectDataEntryNumericIdsField("alig")
279
275
  end,
280
276
  set = function(self, lightningTypeIds)
281
- self:setObjectDataEntryIdsField("alig", lightningTypeIds)
277
+ self:setObjectDataEntryNumericIdsField("alig", lightningTypeIds)
282
278
  end
283
279
  },
284
280
  true
@@ -512,7 +508,7 @@ __TS__SetDescriptor(
512
508
  "techTreeDependencies",
513
509
  {
514
510
  get = function(self)
515
- local techTreeDependencyIds = self:getObjectDataEntryIdsField("areq")
511
+ local techTreeDependencyIds = self:getObjectDataEntryNumericIdsField("areq")
516
512
  local techTreeDependencyInternalLevels = self:getNumbersField("arqa")
517
513
  return mapIndexed(
518
514
  techTreeDependencyIds,
@@ -532,7 +528,7 @@ __TS__SetDescriptor(
532
528
  map(techTreeDependencies, extractTechTreeDependencyInputLevel),
533
529
  function(techTreeDependencyLevel) return techTreeDependencyLevel + 1 end
534
530
  )
535
- self:setObjectDataEntryIdsField("areq", techTreeDependencyIds)
531
+ self:setObjectDataEntryNumericIdsField("areq", techTreeDependencyIds)
536
532
  self:setNumbersField("arqa", techTreeDependencyInternalLevels)
537
533
  end
538
534
  },
@@ -722,26 +718,27 @@ __TS__SetDescriptor(
722
718
  )
723
719
  __TS__SetDescriptor(
724
720
  AbilityType.prototype,
725
- "soundPresetName",
721
+ "casterEffectSoundPresetId",
726
722
  {
727
723
  get = function(self)
728
- return self:getStringField("aefs")
724
+ local casterEffectSoundPresetId = self:getStringField("aefs")
725
+ return casterEffectSoundPresetId ~= "" and casterEffectSoundPresetId or nil
729
726
  end,
730
- set = function(self, soundPresetName)
731
- self:setStringField("aefs", soundPresetName)
727
+ set = function(self, casterEffectSoundPresetId)
728
+ self:setStringField("aefs", casterEffectSoundPresetId or "")
732
729
  end
733
730
  },
734
731
  true
735
732
  )
736
733
  __TS__SetDescriptor(
737
734
  AbilityType.prototype,
738
- "loopingSoundPresetName",
735
+ "casterEffectLoopingSoundPresetId",
739
736
  {
740
737
  get = function(self)
741
738
  return self:getStringField("aefl")
742
739
  end,
743
- set = function(self, loopingSoundPresetName)
744
- self:setStringField("aefl", loopingSoundPresetName)
740
+ set = function(self, casterEffectLoopingSoundPresetId)
741
+ self:setStringField("aefl", casterEffectLoopingSoundPresetId)
745
742
  end
746
743
  },
747
744
  true
@@ -800,10 +797,10 @@ __TS__SetDescriptor(
800
797
  "buffTypeIds",
801
798
  {
802
799
  get = function(self)
803
- return self:getObjectDataEntryIdsLevelField("abuf")
800
+ return self:getObjectDataEntryNumericIdsLevelField("abuf")
804
801
  end,
805
802
  set = function(self, buffTypeIds)
806
- self:setObjectDataEntryIdsLevelField("abuf", buffTypeIds)
803
+ self:setObjectDataEntryNumericIdsLevelField("abuf", buffTypeIds)
807
804
  end
808
805
  },
809
806
  true
@@ -852,10 +849,10 @@ __TS__SetDescriptor(
852
849
  "effectBuffTypeIds",
853
850
  {
854
851
  get = function(self)
855
- return self:getObjectDataEntryIdsLevelField("aeff")
852
+ return self:getObjectDataEntryNumericIdsLevelField("aeff")
856
853
  end,
857
854
  set = function(self, effectBuffTypeIds)
858
- self:setObjectDataEntryIdsLevelField("aeff", effectBuffTypeIds)
855
+ self:setObjectDataEntryNumericIdsLevelField("aeff", effectBuffTypeIds)
859
856
  end
860
857
  },
861
858
  true
@@ -999,7 +996,7 @@ local function handleAbilityCastingStartEvent(caster, ability)
999
996
  end
1000
997
  casterCastingEffectsByCaster[caster] = effects
1001
998
  end
1002
- local function handleAbilityStopEvent(caster)
999
+ local function handleAbilityStopCastingEvent(caster)
1003
1000
  local effects = casterCastingEffectsByCaster[caster]
1004
1001
  if effects ~= nil then
1005
1002
  for i = 1, #effects do
@@ -1010,8 +1007,8 @@ local function handleAbilityStopEvent(caster)
1010
1007
  end
1011
1008
  for abilityTypeId in pairs(casterCastingEffectModelPathsByAbilityTypeId) do
1012
1009
  Unit.abilityCastingStartEvent[abilityTypeId]:addListener(4, handleAbilityCastingStartEvent)
1013
- Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityStopEvent)
1014
- Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopEvent)
1010
+ Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
1011
+ Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
1015
1012
  end
1016
1013
  local casterChannelingEffectModelPathsByAbilityTypeId = postcompile(function()
1017
1014
  return mapValues(
@@ -1042,7 +1039,7 @@ local function handleAbilityChannelingStartEvent(caster, ability)
1042
1039
  end
1043
1040
  casterChannelingEffectsByCaster[caster] = effects
1044
1041
  end
1045
- local function handleAbilityStopEventV2(caster)
1042
+ local function handleAbilityStopChannelingEvent(caster)
1046
1043
  local effects = casterChannelingEffectsByCaster[caster]
1047
1044
  if effects ~= nil then
1048
1045
  for i = 1, #effects do
@@ -1053,7 +1050,7 @@ local function handleAbilityStopEventV2(caster)
1053
1050
  end
1054
1051
  for abilityTypeId in pairs(casterChannelingEffectModelPathsByAbilityTypeId) do
1055
1052
  Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityChannelingStartEvent)
1056
- Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopEventV2)
1057
- Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopEventV2)
1053
+ Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1054
+ Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1058
1055
  end
1059
1056
  return ____exports
@@ -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";
@@ -7,10 +7,11 @@ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
7
7
  local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
8
8
  local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
9
9
  local ____exports = {}
10
+ local preparePhysicalPositiveApplicatorAbility
10
11
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
11
12
  local AbilityType = ____ability_2Dtype.AbilityType
12
- local ____cripple = require("engine.object-data.entry.ability-type.cripple")
13
- local CrippleAbilityType = ____cripple.CrippleAbilityType
13
+ local ____curse = require("engine.object-data.entry.ability-type.curse")
14
+ local CurseAbilityType = ____curse.CurseAbilityType
14
15
  local ____searing_2Darrows = require("engine.object-data.entry.ability-type.searing-arrows")
15
16
  local SearingArrowsAbilityType = ____searing_2Darrows.SearingArrowsAbilityType
16
17
  local ____slow_2Dpoison = require("engine.object-data.entry.ability-type.slow-poison")
@@ -29,41 +30,23 @@ local ____arrays = require("utility.arrays")
29
30
  local chunked = ____arrays.chunked
30
31
  local map = ____arrays.map
31
32
  local max = ____arrays.max
32
- local toLuaSet = ____arrays.toLuaSet
33
33
  local ____blood_2Dlust = require("engine.object-data.entry.ability-type.blood-lust")
34
34
  local BloodLustAbilityType = ____blood_2Dlust.BloodLustAbilityType
35
35
  local ____berserk = require("engine.object-data.entry.ability-type.berserk")
36
36
  local BerserkAbilityType = ____berserk.BerserkAbilityType
37
- local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
38
- local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
39
- local ____dummy_2Dinventory = require("engine.internal.object-data.dummy-inventory")
40
- local INVENTORY_ABILITY_TYPE_ID = ____dummy_2Dinventory.INVENTORY_ABILITY_TYPE_ID
41
37
  local ____blank = require("engine.object-data.entry.upgrade.blank")
42
38
  local BlankUpgrade = ____blank.BlankUpgrade
43
- local ____dummy_2Dunits = require("engine.internal.misc.dummy-units")
44
- local INVENTORY_DUMMY_NATIVE_UNIT = ____dummy_2Dunits.INVENTORY_DUMMY_NATIVE_UNIT
45
- local ____preconditions = require("utility.preconditions")
46
- local checkNotNull = ____preconditions.checkNotNull
47
39
  local ____unit_2Dtype = require("engine.object-data.entry.unit-type")
48
40
  local UnitType = ____unit_2Dtype.UnitType
49
41
  local ____permanent_2Dimmolation = require("engine.object-data.entry.ability-type.permanent-immolation")
50
42
  local PermanentImmolationAbilityType = ____permanent_2Dimmolation.PermanentImmolationAbilityType
51
- local createItem = CreateItem
52
- local getAbilityId = BlzGetAbilityId
53
- local getItemAbility = BlzGetItemAbility
54
- local getOwningPlayer = GetOwningPlayer
55
- local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
56
- local itemAddAbility = BlzItemAddAbility
57
- local removeItem = RemoveItem
43
+ local ____cast_2Dability = require("engine.internal.mechanics.cast-ability")
44
+ local castAbility = ____cast_2Dability.castAbility
58
45
  local setAbilityIntegerField = BlzSetAbilityIntegerField
59
46
  local setAbilityRealLevelField = BlzSetAbilityRealLevelField
60
- local setItemBooleanField = BlzSetItemBooleanField
61
47
  local setPlayerTechResearched = SetPlayerTechResearched
62
48
  local unitAddAbility = UnitAddAbility
63
- local unitAddItem = UnitAddItem
64
49
  local unitDisableAbility = BlzUnitDisableAbility
65
- local unitDropItemSlot = UnitDropItemSlot
66
- local unitInventorySize = UnitInventorySize
67
50
  local unitRemoveAbility = UnitRemoveAbility
68
51
  local compiletimeApplicableBuffTypes = {}
69
52
  ____exports.ApplicableBuffType = __TS__Class()
@@ -91,7 +74,7 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
91
74
  abilityType.buttonPositionY = -11
92
75
  abilityType.casterAttachmentPresets = {}
93
76
  abilityType.targetEffectPresets = {}
94
- abilityType.soundPresetName = ""
77
+ abilityType.casterEffectSoundPresetId = nil
95
78
  abilityType.learnLevelMinimum = 6
96
79
  abilityType.race = "other"
97
80
  abilityType.shouldCheckTechTreeDependencies = false
@@ -118,12 +101,10 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
118
101
  local applicatorAbilityTypeIdByApplicatorType = {}
119
102
  if applicableBuffType.resistanceType == 1 or applicableBuffType.resistanceType == nil then
120
103
  if applicableBuffType.polarity == 2 or applicableBuffType.polarity == nil then
121
- local applicatorAbilityType = prepareAbilityType(CrippleAbilityType, applicableBuffType)
122
- applicatorAbilityType.movementSpeedDecreaseFactor = 0
123
- applicatorAbilityType.attackSpeedDecreaseFactor = 0
124
- applicatorAbilityType.damageDecreaseFactor = 0
104
+ local applicatorAbilityType = prepareAbilityType(CurseAbilityType, applicableBuffType)
105
+ applicatorAbilityType.missProbability = 0
125
106
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
126
- applicatorAbilityTypeIdByApplicatorType[852189] = applicatorAbilityType.id
107
+ applicatorAbilityTypeIdByApplicatorType[852190] = applicatorAbilityType.id
127
108
  end
128
109
  if applicableBuffType.polarity == 1 or applicableBuffType.polarity == nil then
129
110
  local applicatorAbilityType = prepareAbilityType(BloodLustAbilityType, applicableBuffType)
@@ -209,15 +190,6 @@ local EVASION_ABILITY_TYPE_IDS = postcompile(function()
209
190
  "AIcs"
210
191
  }, fourCC))
211
192
  end)
212
- local INVENTORY_ABILITY_TYPE_IDS = postcompile(function()
213
- return toLuaSet(AbilityType:getAllIdsByBaseIds(map({
214
- "AInv",
215
- "Aihn",
216
- "Aien",
217
- "Aion",
218
- "Aiun"
219
- }, fourCC)))
220
- end)
221
193
  local SEARING_ARROWS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
222
194
  local abilityType = SearingArrowsAbilityType:create()
223
195
  abilityType.isInternal = true
@@ -249,8 +221,8 @@ Unit.abilityCastingStartEvent[SEARING_ARROWS_DUMMY_ABILITY_TYPE_ID]:addListener(
249
221
  )
250
222
  ---
251
223
  -- @internal For use by internal systems only.
252
- ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, resistanceType, level, duration, spellStealPriority, learnLevelMinimum, movementSpeedIncreaseFactor)
253
- local applicatorType = polarity == 1 and (resistanceType == 1 and 852101 or 852100) or (polarity == 2 and (resistanceType == 1 and 852189 or 852173) or 0)
224
+ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, resistanceType, level, duration, spellStealPriority, learnLevelMinimum, missProbability)
225
+ local applicatorType = polarity == 1 and (resistanceType == 1 and 852101 or 852100) or (polarity == 2 and (resistanceType == 1 and 852190 or 852173) or 0)
254
226
  local ____opt_1 = applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId[applicableBuffTypeId]
255
227
  local applicatorAbilityTypeId = ____opt_1 and ____opt_1[applicatorType]
256
228
  if applicatorAbilityTypeId == nil then
@@ -260,75 +232,24 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
260
232
  return unitAddAbility(unit.handle, applicatorAbilityTypeId)
261
233
  end
262
234
  if applicatorType == 852100 then
263
- local success
264
- local nativeUnit = unit.handle
265
- local nativeItem = createItem(DUMMY_ITEM_ID, 0, 0)
266
- unitAddItem(INVENTORY_DUMMY_NATIVE_UNIT, nativeItem)
267
- itemAddAbility(nativeItem, applicatorAbilityTypeId)
268
- local applicatorAbility = checkNotNull(getItemAbility(nativeItem, applicatorAbilityTypeId))
269
- if level == nil then
270
- level = 0
271
- setAbilityIntegerField(applicatorAbility, ABILITY_IF_LEVELS, 1)
272
- end
273
- setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_NORMAL, level, duration or 0)
274
- setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_DURATION_HERO, level, duration or 0)
275
- if movementSpeedIncreaseFactor ~= nil then
276
- setAbilityRealLevelField(applicatorAbility, ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1, level, movementSpeedIncreaseFactor)
277
- end
278
- setItemBooleanField(nativeItem, ITEM_BF_ACTIVELY_USED, true)
279
- setItemBooleanField(nativeItem, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
280
- if level > 0 then
235
+ local nativePlayer = unit.owner.handle
236
+ if level ~= nil and level > 0 then
281
237
  local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
282
238
  if upgradeId ~= nil then
283
- setPlayerTechResearched(
284
- getOwningPlayer(nativeUnit),
285
- upgradeId,
286
- level
287
- )
239
+ setPlayerTechResearched(nativePlayer, upgradeId, level)
288
240
  end
289
241
  end
290
- if not unitAddItem(nativeUnit, nativeItem) then
291
- local latestInventoryAbilityTypeId = 0
292
- local nativeItemBySlot = {}
293
- local inventorySize = unitInventorySize(nativeUnit)
294
- if inventorySize ~= 0 then
295
- for slot = 0, inventorySize - 1 do
296
- nativeItemBySlot[slot] = UnitRemoveItemFromSlot(nativeUnit, slot)
297
- end
298
- local unitNativeAbility = getUnitAbilityByIndex(nativeUnit, 0)
299
- local i = 1
300
- while unitNativeAbility ~= nil do
301
- local abilityTypeId = getAbilityId(unitNativeAbility)
302
- if INVENTORY_ABILITY_TYPE_IDS[abilityTypeId] ~= nil then
303
- latestInventoryAbilityTypeId = abilityTypeId
304
- end
305
- unitNativeAbility = getUnitAbilityByIndex(nativeUnit, i)
306
- i = i + 1
307
- end
308
- unitRemoveAbility(nativeUnit, latestInventoryAbilityTypeId)
309
- end
310
- unitAddAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
311
- success = unitAddItem(nativeUnit, nativeItem)
312
- unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
313
- if latestInventoryAbilityTypeId ~= 0 then
314
- unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
315
- for slot, nativeItem in pairs(nativeItemBySlot) do
316
- unitAddItem(nativeUnit, nativeItem)
317
- unitDropItemSlot(nativeUnit, nativeItem, slot)
318
- end
319
- end
320
- else
321
- success = true
322
- end
323
- removeItem(nativeItem)
324
- if level ~= nil and level > 1 then
242
+ local success = castAbility(
243
+ unit.handle,
244
+ applicatorAbilityTypeId,
245
+ preparePhysicalPositiveApplicatorAbility,
246
+ level,
247
+ duration or 0
248
+ )
249
+ if level ~= nil and level > 0 then
325
250
  local upgradeId = applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId]
326
251
  if upgradeId ~= nil then
327
- setPlayerTechResearched(
328
- getOwningPlayer(nativeUnit),
329
- upgradeId,
330
- 0
331
- )
252
+ setPlayerTechResearched(nativePlayer, upgradeId, 0)
332
253
  end
333
254
  end
334
255
  return success
@@ -353,6 +274,9 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
353
274
  ability:setField(ABILITY_RLF_DURATION_HERO, level, actualDuration)
354
275
  ability:setField(ABILITY_IF_PRIORITY, spellStealPriority or 0)
355
276
  ability:setField(ABILITY_IF_REQUIRED_LEVEL, learnLevelMinimum or 6)
277
+ if missProbability ~= nil and applicatorType == 852190 then
278
+ ability:setField(ABILITY_RLF_CHANCE_TO_MISS_CRS, missProbability)
279
+ end
356
280
  end,
357
281
  applicatorType,
358
282
  unit
@@ -364,6 +288,14 @@ ____exports.internalApplyBuff = function(unit, applicableBuffTypeId, polarity, r
364
288
  end
365
289
  return success
366
290
  end
291
+ preparePhysicalPositiveApplicatorAbility = function(ability, level, duration)
292
+ if level == nil then
293
+ setAbilityIntegerField(ability, ABILITY_IF_LEVELS, 1)
294
+ level = 1
295
+ end
296
+ setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_NORMAL, level, duration)
297
+ setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_HERO, level, duration)
298
+ end
367
299
  ---
368
300
  -- @internal For use by internal systems only.
369
301
  ____exports.removeBuff = function(unit, applicableBuffTypeId)
@@ -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";
@@ -6,7 +5,7 @@ import { Race } from "../auxiliary/race";
6
5
  import { SoundPresetName } from "../auxiliary/sound-preset-name";
7
6
  import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
8
7
  import { LightningTypeId } from "./lightning-type";
9
- export type BuffTypeId = ObjectDataEntryId & {
8
+ export type BuffTypeId = ObjectDataEntryId & number & {
10
9
  readonly __buffTypeId: unique symbol;
11
10
  };
12
11
  export declare abstract class BuffType<Id extends BuffTypeId = BuffTypeId> extends ObjectDataEntry<Id> {
@@ -94,10 +94,10 @@ __TS__SetDescriptor(
94
94
  "lightningTypeIds",
95
95
  {
96
96
  get = function(self)
97
- return self:getObjectDataEntryIdsField("flig")
97
+ return self:getObjectDataEntryNumericIdsField("flig")
98
98
  end,
99
99
  set = function(self, lightningTypeIds)
100
- self:setObjectDataEntryIdsField("flig", lightningTypeIds)
100
+ self:setObjectDataEntryNumericIdsField("flig", lightningTypeIds)
101
101
  end
102
102
  },
103
103
  true
@@ -1,9 +1,8 @@
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";
5
4
  import { ObjectDataEntry, ObjectDataEntryId } from "../entry";
6
- export type DestructibleTypeId = ObjectDataEntryId & {
5
+ export type DestructibleTypeId = ObjectDataEntryId & number & {
7
6
  readonly __destructibleTypeId: unique symbol;
8
7
  };
9
8
  export declare abstract class DestructibleType extends ObjectDataEntry<DestructibleTypeId> {
@@ -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,9 +1,8 @@
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";
5
4
  import type { AbilityTypeId } from "./ability-type";
6
- export type ItemTypeId = ObjectDataEntryId & {
5
+ export type ItemTypeId = ObjectDataEntryId & number & {
7
6
  readonly __itemTypeId: unique symbol;
8
7
  };
9
8
  export declare class ItemType extends ObjectDataEntry<ItemTypeId> {
@@ -46,4 +45,18 @@ 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 cooldownGroupId(): number;
49
+ set cooldownGroupId(cooldownGroupId: number);
50
+ get goldCost(): number;
51
+ set goldCost(goldCost: number);
52
+ get lumberCost(): number;
53
+ set lumberCost(lumberCost: number);
54
+ get activelyUsed(): boolean;
55
+ set activelyUsed(activelyUsed: boolean);
56
+ get perishable(): boolean;
57
+ set perishable(perishable: boolean);
58
+ get initialStackSize(): number;
59
+ set initialStackSize(initialStackSize: number);
60
+ get maximumStackSize(): number;
61
+ set maximumStackSize(maximumStackSize: number);
49
62
  }