warscript 0.0.1-dev.c8224f3 → 0.0.1-dev.c8f98de

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 (54) hide show
  1. package/config.d.ts +5 -0
  2. package/config.lua +10 -0
  3. package/core/types/sound.d.ts +1 -0
  4. package/core/types/sound.lua +32 -2
  5. package/engine/behaviour/ability/apply-buff.d.ts +5 -0
  6. package/engine/behaviour/ability/apply-buff.lua +32 -0
  7. package/engine/behaviour/ability.d.ts +2 -1
  8. package/engine/behaviour/ability.lua +16 -3
  9. package/engine/buff.d.ts +50 -40
  10. package/engine/buff.lua +261 -225
  11. package/engine/internal/item.d.ts +2 -2
  12. package/engine/internal/item.lua +56 -25
  13. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  14. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  15. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  16. package/engine/internal/object-data/evasion-probability.lua +16 -0
  17. package/engine/internal/unit/add-item-to-slot.lua +4 -2
  18. package/engine/internal/unit/bonus.d.ts +2 -0
  19. package/engine/internal/unit/bonus.lua +17 -0
  20. package/engine/lightning.d.ts +4 -3
  21. package/engine/lightning.lua +21 -12
  22. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  23. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  24. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  25. package/engine/object-data/entry/ability-type/blank-configurable.lua +21 -1
  26. package/engine/object-data/entry/ability-type/curse.lua +2 -2
  27. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  28. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  29. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  30. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  31. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  32. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  33. package/engine/object-data/entry/ability-type.d.ts +6 -6
  34. package/engine/object-data/entry/ability-type.lua +16 -15
  35. package/engine/object-data/entry/buff-type/applicable.lua +11 -35
  36. package/engine/object-data/entry/buff-type.d.ts +1 -1
  37. package/engine/object-data/entry/buff-type.lua +2 -2
  38. package/engine/object-data/entry/destructible-type.d.ts +1 -1
  39. package/engine/object-data/entry/item-type.d.ts +1 -1
  40. package/engine/object-data/entry/item-type.lua +4 -4
  41. package/engine/object-data/entry/lightning-type.d.ts +1 -1
  42. package/engine/object-data/entry/sound-preset.d.ts +16 -0
  43. package/engine/object-data/entry/sound-preset.lua +36 -0
  44. package/engine/object-data/entry/unit-type.d.ts +8 -1
  45. package/engine/object-data/entry/unit-type.lua +61 -8
  46. package/engine/object-data/entry/upgrade.d.ts +1 -1
  47. package/engine/object-data/entry/upgrade.lua +4 -4
  48. package/engine/object-data/entry.d.ts +16 -14
  49. package/engine/object-data/entry.lua +60 -32
  50. package/engine/standard/entries/sound-preset.d.ts +10 -0
  51. package/engine/standard/entries/sound-preset.lua +10 -0
  52. package/objutil/unit.lua +8 -0
  53. package/package.json +2 -2
  54. package/utility/reflection.lua +11 -7
@@ -78,9 +78,9 @@ export declare class Item extends Handle<jitem> {
78
78
  hasAbility(abilityTypeId: AbilityTypeId): boolean;
79
79
  getAbility(abilityTypeId: AbilityTypeId): ItemAbility | undefined;
80
80
  get abilities(): readonly ItemAbility[];
81
- static getInRange(pos: Vec2, range: number): Item[];
81
+ static getInRange(x: number, y: number, range: number): Item[];
82
82
  static getInRect(rect: ReadonlyRect): Item[];
83
83
  static get onCreate(): Event<[Item]>;
84
- static get onDestroy(): Event<[Item]>;
84
+ static get destroyEvent(): Event<[Item]>;
85
85
  }
86
86
  export {};
@@ -15,6 +15,12 @@ local ____ability = require("engine.internal.ability")
15
15
  local ItemAbility = ____ability.ItemAbility
16
16
  local ____ability = require("engine.internal.item.ability")
17
17
  local doAbilityAction = ____ability.doAbilityAction
18
+ local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
19
+ local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
20
+ local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slot")
21
+ local SLOT_FILLER_ITEM_TYPE_ID = ____add_2Ditem_2Dto_2Dslot.SLOT_FILLER_ITEM_TYPE_ID
22
+ local ____vec2 = require("math.vec2")
23
+ local distance = ____vec2.distance
18
24
  local itemAddAbility = BlzItemAddAbility
19
25
  local itemRemoveAbility = BlzItemRemoveAbility
20
26
  local getItemAbility = BlzGetItemAbility
@@ -24,6 +30,12 @@ local getAbilityId = BlzGetAbilityId
24
30
  local getWidgetLife = GetWidgetLife
25
31
  local removeItem = RemoveItem
26
32
  local getHandleId = GetHandleId
33
+ local setRect = SetRect
34
+ local enumItemsInRect = EnumItemsInRect
35
+ local getEnumItem = GetEnumItem
36
+ local getItemTypeId = GetItemTypeId
37
+ local getItemX = GetItemX
38
+ local getItemY = GetItemY
27
39
  local getItemIntegerField = BlzGetItemIntegerField
28
40
  local setItemBooleanField = BlzSetItemBooleanField
29
41
  local getItemBooleanField = BlzGetItemBooleanField
@@ -53,6 +65,32 @@ local function getItemAbilities(handle, item)
53
65
  end
54
66
  return abilities
55
67
  end
68
+ local targetCollection
69
+ local targetCollectionNextIndex
70
+ local centerX
71
+ local centerY
72
+ local enumRange
73
+ local function collectIntoTarget()
74
+ local item = getEnumItem()
75
+ local typeId = getItemTypeId(item)
76
+ if typeId ~= DUMMY_ITEM_ID and typeId ~= SLOT_FILLER_ITEM_TYPE_ID then
77
+ targetCollection[targetCollectionNextIndex] = ____exports.Item:of(item)
78
+ targetCollectionNextIndex = targetCollectionNextIndex + 1
79
+ end
80
+ end
81
+ local function collectIntoTargetRange()
82
+ local item = getEnumItem()
83
+ local typeId = getItemTypeId(item)
84
+ if distance(
85
+ getItemX(item),
86
+ getItemY(item),
87
+ centerX,
88
+ centerY
89
+ ) <= enumRange and typeId ~= DUMMY_ITEM_ID and typeId ~= SLOT_FILLER_ITEM_TYPE_ID then
90
+ targetCollection[targetCollectionNextIndex] = ____exports.Item:of(item)
91
+ targetCollectionNextIndex = targetCollectionNextIndex + 1
92
+ end
93
+ end
56
94
  ____exports.Item = __TS__Class()
57
95
  local Item = ____exports.Item
58
96
  Item.name = "Item"
@@ -111,34 +149,27 @@ function Item.prototype.getAbility(self, abilityTypeId)
111
149
  local ability = self[101][abilityTypeId] ~= nil and doAbilityAction(self.handle, getItemAbility, abilityTypeId)
112
150
  return ability and ItemAbility:of(ability, abilityTypeId, self) or nil
113
151
  end
114
- function Item.getInRange(self, pos, range)
115
- local collection = {}
116
- SetRect(
152
+ function Item.getInRange(self, x, y, range)
153
+ targetCollection = {}
154
+ targetCollectionNextIndex = 1
155
+ centerX = x
156
+ centerY = y
157
+ enumRange = range
158
+ setRect(
117
159
  enumRect,
118
- pos.x - range,
119
- pos.y - range,
120
- pos.x + range,
121
- pos.y + range
160
+ x - range,
161
+ y - range,
162
+ x + range,
163
+ y + range
122
164
  )
123
- EnumItemsInRect(
124
- enumRect,
125
- nil,
126
- function()
127
- collection[#collection + 1] = self:of(GetEnumItem())
128
- end
129
- )
130
- return collection
165
+ enumItemsInRect(enumRect, nil, collectIntoTargetRange)
166
+ return targetCollection
131
167
  end
132
168
  function Item.getInRect(self, rect)
133
- local collection = {}
134
- EnumItemsInRect(
135
- rect.handle,
136
- nil,
137
- function()
138
- collection[#collection + 1] = self:of(GetEnumItem())
139
- end
140
- )
141
- return collection
169
+ targetCollection = {}
170
+ targetCollectionNextIndex = 1
171
+ enumItemsInRect(rect.handle, nil, collectIntoTarget)
172
+ return targetCollection
142
173
  end
143
174
  __TS__SetDescriptor(
144
175
  Item.prototype,
@@ -551,7 +582,7 @@ __TS__ObjectDefineProperty(
551
582
  )
552
583
  __TS__ObjectDefineProperty(
553
584
  Item,
554
- "onDestroy",
585
+ "destroyEvent",
555
586
  {get = function(self)
556
587
  return self.onDestroyEvent
557
588
  end}
@@ -1,2 +1,2 @@
1
1
  /** @noSelfInFile */
2
- export declare const AUTO_ATTACK_SPEED_INCREASE_FACTOR_ABILITY_FIELD: jabilityreallevelfield;
2
+ export {};
@@ -10,5 +10,7 @@ ____exports.AUTO_ATTACK_SPEED_INCREASE_DUMMY_ABILITY_TYPE_ID = compiletime(funct
10
10
  abilityType.autoAttackSpeedIncreaseFactor = 0
11
11
  return abilityType.id
12
12
  end)
13
+ ---
14
+ -- @internal For use by internal systems.
13
15
  ____exports.AUTO_ATTACK_SPEED_INCREASE_FACTOR_ABILITY_FIELD = ABILITY_RLF_ATTACK_SPEED_INCREASE_ISX1
14
16
  return ____exports
@@ -0,0 +1,2 @@
1
+ /** @noSelfInFile */
2
+ export {};
@@ -0,0 +1,16 @@
1
+ local ____exports = {}
2
+ local ____evasion = require("engine.object-data.entry.ability-type.evasion")
3
+ local EvasionAbilityType = ____evasion.EvasionAbilityType
4
+ ---
5
+ -- @internal For use by internal systems.
6
+ ____exports.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = compiletime(function()
7
+ local abilityType = EvasionAbilityType:create()
8
+ abilityType.isInternal = true
9
+ abilityType.isButtonVisible = false
10
+ abilityType.evasionProbability = 0
11
+ return abilityType.id
12
+ end)
13
+ ---
14
+ -- @internal For use by internal systems.
15
+ ____exports.EVASION_PROBABILITY_ABILITY_FIELD = ABILITY_RLF_CHANCE_TO_EVADE_EEV1
16
+ return ____exports
@@ -9,7 +9,9 @@ local setItemVisible = SetItemVisible
9
9
  local unitAddItem = UnitAddItem
10
10
  local unitItemInSlot = UnitItemInSlot
11
11
  local unitRemoveItem = UnitRemoveItem
12
- local FILLER_ITEM_TYPE_ID = compiletime(function()
12
+ ---
13
+ -- @internal For use by internal systems only.
14
+ ____exports.SLOT_FILLER_ITEM_TYPE_ID = compiletime(function()
13
15
  local itemType = BlankItemType:create()
14
16
  itemType.name = "[Warscript/Dummy] Slot Filler"
15
17
  return itemType.id
@@ -19,7 +21,7 @@ end)
19
21
  ____exports.fillerItems = array(
20
22
  6,
21
23
  function()
22
- local item = CreateItem(FILLER_ITEM_TYPE_ID, 0, 0)
24
+ local item = CreateItem(____exports.SLOT_FILLER_ITEM_TYPE_ID, 0, 0)
23
25
  setItemVisible(item, false)
24
26
  ignoreEventsItems[item] = true
25
27
  return item
@@ -11,6 +11,7 @@ export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
11
11
  export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
12
12
  export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
13
13
  export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
14
+ export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
14
15
  export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
15
16
  abilityTypeId: AbilityTypeId;
16
17
  field: jabilityintegerlevelfield;
@@ -34,6 +35,7 @@ export declare namespace UnitBonusType {
34
35
  const AUTO_ATTACK_DAMAGE: UnitBonusType<UnitAutoAttackDamageBonusId>;
35
36
  const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
36
37
  const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
38
+ const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
37
39
  }
38
40
  export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
39
41
  export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
@@ -21,8 +21,18 @@ local AUTO_ATTACK_DAMAGE_INCREASE_DUMMY_ABILITY_TYPE_ID = ____auto_2Dattack_2Dda
21
21
  local ____movement_2Dspeed_2Dincrease_2Dfactor = require("engine.internal.object-data.movement-speed-increase-factor")
22
22
  local MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_ABILITY_FIELD
23
23
  local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspeed_2Dincrease_2Dfactor.MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
24
+ local ____evasion_2Dprobability = require("engine.internal.object-data.evasion-probability")
25
+ local EVASION_PROBABILITY_ABILITY_FIELD = ____evasion_2Dprobability.EVASION_PROBABILITY_ABILITY_FIELD
26
+ local EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = ____evasion_2Dprobability.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID
24
27
  local damageFactorByUnit = {}
25
28
  local receivedDamageFactorByUnit = {}
29
+ local function atLeastOnceProbability(array)
30
+ local oppositeEventProbability = 1
31
+ for i = 1, #array do
32
+ oppositeEventProbability = oppositeEventProbability * (1 - array[i])
33
+ end
34
+ return 1 - oppositeEventProbability
35
+ end
26
36
  ____exports.UnitBonusType = {}
27
37
  local UnitBonusType = ____exports.UnitBonusType
28
38
  do
@@ -56,6 +66,13 @@ do
56
66
  }
57
67
  UnitBonusType.DAMAGE_FACTOR = {reduce = product, valueByUnit = damageFactorByUnit, initialValue = 1}
58
68
  UnitBonusType.RECEIVED_DAMAGE_FACTOR = {reduce = product, valueByUnit = receivedDamageFactorByUnit, initialValue = 1}
69
+ UnitBonusType.EVASION_PROBABILITY = {
70
+ abilityTypeId = EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID,
71
+ field = EVASION_PROBABILITY_ABILITY_FIELD,
72
+ integer = false,
73
+ reduce = atLeastOnceProbability,
74
+ initialValue = 0
75
+ }
59
76
  end
60
77
  local bonusesByUnitByBonusType = {}
61
78
  local nextId = 1
@@ -1,7 +1,7 @@
1
1
  /** @noSelfInFile */
2
2
  import { LightningTypeId } from "./object-data/entry/lightning-type";
3
- import { Handle, HandleDestructor } from "../core/types/handle";
4
3
  import { Unit } from "../core/types/unit";
4
+ import { AbstractDestroyable, Destructor } from "../destroyable";
5
5
  declare const enum LightningPropertyKey {
6
6
  CHECK_VISIBILITY = 100,
7
7
  SOURCE_UNIT = 101,
@@ -16,7 +16,8 @@ declare const enum LightningPropertyKey {
16
16
  FADING = 110
17
17
  }
18
18
  export type LightningConstructor<T extends Lightning> = typeof Lightning & (new (handle: jlightning, typeId: LightningTypeId) => T);
19
- export declare class Lightning extends Handle<jlightning> {
19
+ export declare class Lightning extends AbstractDestroyable {
20
+ readonly handle: jlightning;
20
21
  readonly typeId: LightningTypeId;
21
22
  private [LightningPropertyKey.CHECK_VISIBILITY]?;
22
23
  private [LightningPropertyKey.SOURCE_UNIT]?;
@@ -30,7 +31,7 @@ export declare class Lightning extends Handle<jlightning> {
30
31
  private [LightningPropertyKey.DURATION]?;
31
32
  private [LightningPropertyKey.FADING]?;
32
33
  constructor(handle: jlightning, typeId: LightningTypeId);
33
- protected onDestroy(): HandleDestructor;
34
+ protected onDestroy(): Destructor;
34
35
  static create<T extends Lightning>(this: LightningConstructor<T>, typeId: LightningTypeId, ...parameters: [
35
36
  ...checkVisibility: [boolean] | [],
36
37
  ...sourceAndTarget: [sourceX: number, sourceY: number, targetX: number, targetY: number] | [
@@ -1,15 +1,16 @@
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
4
5
  local ____exports = {}
5
- local ____handle = require("core.types.handle")
6
- local Handle = ____handle.Handle
7
6
  local ____timer = require("core.types.timer")
8
7
  local Timer = ____timer.Timer
9
8
  local ____functions = require("utility.functions")
10
9
  local forwardByN = ____functions.forwardByN
11
10
  local ____unit_2Dmissile_2Ddata = require("engine.internal.unit-missile-data")
12
11
  local MISSILE_DATA_BY_UNIT_TYPE_ID = ____unit_2Dmissile_2Ddata.MISSILE_DATA_BY_UNIT_TYPE_ID
12
+ local ____destroyable = require("destroyable")
13
+ local AbstractDestroyable = ____destroyable.AbstractDestroyable
13
14
  local ____type = _G.type
14
15
  local select = _G.select
15
16
  local cos = math.cos
@@ -41,9 +42,10 @@ local temporaryLightningsCount = 0
41
42
  ____exports.Lightning = __TS__Class()
42
43
  local Lightning = ____exports.Lightning
43
44
  Lightning.name = "Lightning"
44
- __TS__ClassExtends(Lightning, Handle)
45
+ __TS__ClassExtends(Lightning, AbstractDestroyable)
45
46
  function Lightning.prototype.____constructor(self, handle, typeId)
46
- Handle.prototype.____constructor(self, handle)
47
+ AbstractDestroyable.prototype.____constructor(self)
48
+ self.handle = handle
47
49
  self.typeId = typeId
48
50
  end
49
51
  function Lightning.prototype.onDestroy(self)
@@ -51,7 +53,7 @@ function Lightning.prototype.onDestroy(self)
51
53
  unitToPointLightnings[self] = nil
52
54
  pointToUnitLightnings[self] = nil
53
55
  destroyLightning(self.handle)
54
- return Handle.prototype.onDestroy(self)
56
+ return AbstractDestroyable.prototype.onDestroy(self)
55
57
  end
56
58
  function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY, targetXOrTargetUnitOrTargetYOrTargetZ, targetY, targetZ)
57
59
  if type(checkVisibility) ~= "boolean" then
@@ -67,7 +69,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
67
69
  )
68
70
  end
69
71
  if targetZ ~= nil then
70
- return self:of(
72
+ return __TS__New(
73
+ self,
71
74
  addLightningEx(
72
75
  util.id2s(typeId),
73
76
  checkVisibility,
@@ -84,7 +87,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
84
87
  if targetXOrTargetUnitOrTargetYOrTargetZ ~= nil then
85
88
  if ____type(targetXOrTargetUnitOrTargetYOrTargetZ) == "number" then
86
89
  if ____type(sourceXOrSourceUnit) == "number" then
87
- return self:of(
90
+ return __TS__New(
91
+ self,
88
92
  addLightning(
89
93
  util.id2s(typeId),
90
94
  checkVisibility,
@@ -97,7 +101,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
97
101
  )
98
102
  end
99
103
  local unit = sourceXOrSourceUnit.handle
100
- local lightning = self:of(
104
+ local lightning = __TS__New(
105
+ self,
101
106
  addLightningEx(
102
107
  util.id2s(typeId),
103
108
  checkVisibility,
@@ -122,7 +127,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
122
127
  return lightning
123
128
  end
124
129
  local unit = targetXOrTargetUnitOrTargetYOrTargetZ.handle
125
- local lightning = self:of(
130
+ local lightning = __TS__New(
131
+ self,
126
132
  addLightningEx(
127
133
  util.id2s(typeId),
128
134
  checkVisibility,
@@ -151,7 +157,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
151
157
  local unit = sourceXOrSourceUnit.handle
152
158
  moveLocation(location, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY)
153
159
  local z = getLocationZ(location)
154
- local lightning = self:of(
160
+ local lightning = __TS__New(
161
+ self,
155
162
  addLightningEx(
156
163
  util.id2s(typeId),
157
164
  checkVisibility,
@@ -178,7 +185,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
178
185
  local unit = sourceZOrTargetXOrTargetUnitOrTargetY.handle
179
186
  moveLocation(location, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit)
180
187
  local z = getLocationZ(location)
181
- local lightning = self:of(
188
+ local lightning = __TS__New(
189
+ self,
182
190
  addLightningEx(
183
191
  util.id2s(typeId),
184
192
  checkVisibility,
@@ -204,7 +212,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
204
212
  end
205
213
  local sourceUnit = sourceXOrSourceUnit.handle
206
214
  local targetUnit = sourceYOrTargetXOrTargetUnit.handle
207
- local lightning = self:of(
215
+ local lightning = __TS__New(
216
+ self,
208
217
  addLightningEx(
209
218
  util.id2s(typeId),
210
219
  checkVisibility,
@@ -12,3 +12,4 @@ export declare const enum AnimationName {
12
12
  STAND = "stand",
13
13
  WALK = "walk"
14
14
  }
15
+ export declare const isAnimationName: (value: string) => value is AnimationName;
@@ -1,2 +1,18 @@
1
1
  local ____exports = {}
2
+ local animationNames = {
3
+ attack = true,
4
+ birth = true,
5
+ death = true,
6
+ decay = true,
7
+ dissipate = true,
8
+ morph = true,
9
+ portrait = true,
10
+ sleep = true,
11
+ spell = true,
12
+ stand = true,
13
+ walk = true
14
+ }
15
+ ____exports.isAnimationName = function(value)
16
+ return animationNames[value] ~= nil
17
+ end
2
18
  return ____exports
@@ -12,5 +12,5 @@ export type TechTreeDependency = {
12
12
  level: number;
13
13
  };
14
14
  export type TechTreeDependencyInput = TechTreeDependency | UnitTypeId | UpgradeId;
15
- export declare const extractTechTreeDependencyInputObjectDataEntryId: (techTreeDependencyInput: TechTreeDependencyInput) => ObjectDataEntryId;
15
+ export declare const extractTechTreeDependencyInputObjectDataEntryId: (techTreeDependencyInput: TechTreeDependencyInput) => ObjectDataEntryId & number;
16
16
  export declare const extractTechTreeDependencyInputLevel: (techTreeDependencyInput: TechTreeDependencyInput) => number;
@@ -6,6 +6,8 @@ local __TS__New = ____lualib.__TS__New
6
6
  local ____exports = {}
7
7
  local ____channel = require("engine.object-data.entry.ability-type.channel")
8
8
  local ChannelAbilityType = ____channel.ChannelAbilityType
9
+ local ____animation_2Dname = require("engine.object-data.auxiliary.animation-name")
10
+ local isAnimationName = ____animation_2Dname.isAnimationName
9
11
  local ____order_2Dtype_2Dstring_2Did_2Dfactory = require("engine.object-data.utility.order-type-string-id-factory")
10
12
  local orderTypeStringIdFactory = ____order_2Dtype_2Dstring_2Did_2Dfactory.orderTypeStringIdFactory
11
13
  local ____timer = require("core.types.timer")
@@ -21,6 +23,9 @@ local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.A
21
23
  local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
22
24
  local ____linked_2Dset = require("utility.linked-set")
23
25
  local LinkedSet = ____linked_2Dset.LinkedSet
26
+ local ____sound = require("core.types.sound")
27
+ local Sound3D = ____sound.Sound3D
28
+ local SoundPreset = ____sound.SoundPreset
24
29
  local isChannelingAbilityTypeIds = {}
25
30
  local usesAttackAnimationByAbilityTypeId = {}
26
31
  ____exports.BlankConfigurableAbilityType = __TS__Class()
@@ -211,11 +216,26 @@ for abilityTypeId, usesAttackAnimation in pairs(postcompile(function()
211
216
  for abilityTypeId, usesAttackAnimation in pairs(usesAttackAnimationByAbilityTypeId) do
212
217
  if usesAttackAnimation then
213
218
  local abilityType = checkNotNull(____exports.BlankConfigurableAbilityType:of(abilityTypeId))
214
- abilityType.channelingAnimation = {"attack"}
219
+ if isAnimationName(abilityType.channelingAnimation[1]) then
220
+ if abilityType.channelingAnimation[1] ~= "attack" then
221
+ abilityType.channelingAnimation = {"attack"}
222
+ end
223
+ else
224
+ abilityType.channelingAnimation = {
225
+ "attack",
226
+ table.unpack(abilityType.channelingAnimation)
227
+ }
228
+ end
215
229
  end
216
230
  end
217
231
  return usesAttackAnimationByAbilityTypeId
218
232
  end)) do
233
+ Unit.abilityCastingFinishEvent[abilityTypeId]:addListener(function(caster, ability)
234
+ local effectSound = ability:getField(ABILITY_SF_EFFECT_SOUND)
235
+ if effectSound ~= "" then
236
+ Sound3D:playFromLabel(effectSound, SoundPreset.Ability, caster)
237
+ end
238
+ end)
219
239
  if usesAttackAnimation then
220
240
  Unit.abilityCastingStartEvent[abilityTypeId]:addListener(
221
241
  4,
@@ -15,10 +15,10 @@ __TS__SetDescriptor(
15
15
  "missProbability",
16
16
  {
17
17
  get = function(self)
18
- return self:getNumberLevelField("Crs")
18
+ return self:getNumberLevelField("Crs\0")
19
19
  end,
20
20
  set = function(self, missProbability)
21
- self:setNumberLevelField("Crs", missProbability)
21
+ self:setNumberLevelField("Crs\0", missProbability)
22
22
  end
23
23
  },
24
24
  true
@@ -54,10 +54,10 @@ __TS__SetDescriptor(
54
54
  "plagueWardUnitTypeId",
55
55
  {
56
56
  get = function(self)
57
- return self:getObjectDataEntryIdLevelField("Aplu")
57
+ return self:getObjectDataEntryNumericIdLevelField("Aplu")
58
58
  end,
59
59
  set = function(self, plagueWardUnitTypeId)
60
- self:setObjectDataEntryIdLevelField("Aplu", plagueWardUnitTypeId)
60
+ self:setObjectDataEntryNumericIdLevelField("Aplu", plagueWardUnitTypeId)
61
61
  end
62
62
  },
63
63
  true
@@ -55,7 +55,7 @@ __TS__SetDescriptor(
55
55
  get = function(self)
56
56
  local abilityUpgrades = {}
57
57
  for i = 0, 3 do
58
- local abilityUpgrade = self:getObjectDataEntryIdsLevelField("Neg" .. tostring(3 + i))
58
+ local abilityUpgrade = self:getObjectDataEntryNumericIdsLevelField("Neg" .. tostring(3 + i))
59
59
  for level = 0, #abilityUpgrade - 1 do
60
60
  local levelAbilityUpgrade = abilityUpgrade[level + 1]
61
61
  if #levelAbilityUpgrade == 2 then
@@ -71,7 +71,7 @@ __TS__SetDescriptor(
71
71
  local ____opt_0 = abilityUpgrades[1]
72
72
  local isArray = __TS__ArrayIsArray(____opt_0 and ____opt_0[1])
73
73
  for i = 0, #abilityUpgrades - 1 do
74
- self:setObjectDataEntryIdsLevelField(
74
+ self:setObjectDataEntryNumericIdsLevelField(
75
75
  "Neg" .. tostring(3 + i),
76
76
  isArray and map(
77
77
  abilityUpgrades,
@@ -15,10 +15,10 @@ __TS__SetDescriptor(
15
15
  "summonedUnitTypeId",
16
16
  {
17
17
  get = function(self)
18
- return self:getObjectDataEntryIdLevelField("Osf1")
18
+ return self:getObjectDataEntryNumericIdLevelField("Osf1")
19
19
  end,
20
20
  set = function(self, summonedUnitTypeId)
21
- self:setObjectDataEntryIdLevelField("Osf1", summonedUnitTypeId)
21
+ self:setObjectDataEntryNumericIdLevelField("Osf1", summonedUnitTypeId)
22
22
  end
23
23
  },
24
24
  true
@@ -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
@@ -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
@@ -6,12 +6,12 @@ import { AnimationQualifier } from "../auxiliary/animation-qualifier";
6
6
  import { AttachmentPreset, AttachmentPresetInput } from "../auxiliary/attachment-preset";
7
7
  import { CombatClassifications } from "../auxiliary/combat-classification";
8
8
  import { Race } from "../auxiliary/race";
9
- import { SoundPresetName } from "../auxiliary/sound-preset-name";
10
9
  import { TechTreeDependency, TechTreeDependencyInput } from "../auxiliary/tech-tree-dependency";
11
10
  import { ObjectDataEntry, ObjectDataEntryId, ObjectDataEntryLevelFieldValueSupplier } from "../entry";
12
11
  import { BuffTypeId } from "./buff-type";
13
12
  import { LightningTypeId } from "./lightning-type";
14
- export type AbilityTypeId = ObjectDataEntryId & {
13
+ import { SoundPresetId } from "./sound-preset";
14
+ export type AbilityTypeId = ObjectDataEntryId & number & {
15
15
  readonly __abilityTypeId: unique symbol;
16
16
  };
17
17
  export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId> {
@@ -111,10 +111,10 @@ export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId>
111
111
  set turnOffTooltipText(turnOffTooltipText: ObjectDataEntryLevelFieldValueSupplier<string>);
112
112
  get turnOffTooltipExtendedText(): string[];
113
113
  set turnOffTooltipExtendedText(turnOffTooltipExtendedText: ObjectDataEntryLevelFieldValueSupplier<string>);
114
- get soundPresetName(): SoundPresetName;
115
- set soundPresetName(soundPresetName: SoundPresetName);
116
- get loopingSoundPresetName(): SoundPresetName;
117
- set loopingSoundPresetName(loopingSoundPresetName: SoundPresetName);
114
+ get casterEffectSoundPresetId(): SoundPresetId | undefined;
115
+ set casterEffectSoundPresetId(casterEffectSoundPresetId: SoundPresetId | undefined);
116
+ get casterEffectLoopingSoundPresetId(): SoundPresetId;
117
+ set casterEffectLoopingSoundPresetId(casterEffectLoopingSoundPresetId: SoundPresetId);
118
118
  get allowedTargetCombatClassifications(): CombatClassifications[];
119
119
  set allowedTargetCombatClassifications(allowedTargetCombatClassifications: ObjectDataEntryLevelFieldValueSupplier<CombatClassifications>);
120
120
  get areaOfEffect(): number[];