warscript 0.0.1-dev.1bb9186 → 0.0.1-dev.1bb9c4e

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 (88) hide show
  1. package/config.d.ts +5 -0
  2. package/config.lua +10 -0
  3. package/core/types/effect.d.ts +1 -3
  4. package/core/types/effect.lua +26 -29
  5. package/core/types/sound.d.ts +17 -24
  6. package/core/types/sound.lua +99 -24
  7. package/core/types/timer.d.ts +6 -7
  8. package/core/types/timer.lua +18 -21
  9. package/core/util.lua +6 -1
  10. package/engine/behaviour/ability/apply-buff.d.ts +5 -0
  11. package/engine/behaviour/ability/apply-buff.lua +32 -0
  12. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  13. package/engine/behaviour/ability/damage.d.ts +3 -0
  14. package/engine/behaviour/ability/damage.lua +2 -2
  15. package/engine/behaviour/ability/emulate-impact.lua +7 -0
  16. package/engine/behaviour/ability.d.ts +7 -2
  17. package/engine/behaviour/ability.lua +34 -7
  18. package/engine/behaviour/unit.d.ts +2 -0
  19. package/engine/buff.d.ts +56 -41
  20. package/engine/buff.lua +295 -228
  21. package/engine/internal/item.d.ts +2 -2
  22. package/engine/internal/item.lua +56 -25
  23. package/engine/internal/mechanics/ability-duration.lua +1 -1
  24. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  25. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  26. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  27. package/engine/internal/object-data/evasion-probability.lua +16 -0
  28. package/engine/internal/unit/add-item-to-slot.lua +4 -2
  29. package/engine/internal/unit/bonus.d.ts +2 -0
  30. package/engine/internal/unit/bonus.lua +17 -0
  31. package/engine/internal/unit.d.ts +6 -1
  32. package/engine/internal/unit.lua +8 -2
  33. package/engine/lightning.d.ts +4 -3
  34. package/engine/lightning.lua +28 -20
  35. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  36. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  37. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
  38. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  39. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  40. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  41. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  42. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  43. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  44. package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
  45. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  46. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  47. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  48. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  49. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  50. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  51. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  52. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  53. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  54. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  55. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  56. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  57. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  58. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  59. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  60. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  61. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  62. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  63. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  64. package/engine/object-data/entry/ability-type/web.lua +52 -0
  65. package/engine/object-data/entry/ability-type.d.ts +19 -17
  66. package/engine/object-data/entry/ability-type.lua +81 -21
  67. package/engine/object-data/entry/buff-type/applicable.lua +18 -37
  68. package/engine/object-data/entry/buff-type.d.ts +6 -12
  69. package/engine/object-data/entry/buff-type.lua +13 -29
  70. package/engine/object-data/entry/destructible-type.d.ts +1 -1
  71. package/engine/object-data/entry/item-type.d.ts +1 -1
  72. package/engine/object-data/entry/item-type.lua +4 -4
  73. package/engine/object-data/entry/lightning-type.d.ts +1 -1
  74. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  75. package/engine/object-data/entry/sound-preset.lua +140 -0
  76. package/engine/object-data/entry/unit-type.d.ts +8 -1
  77. package/engine/object-data/entry/unit-type.lua +61 -8
  78. package/engine/object-data/entry/upgrade.d.ts +1 -1
  79. package/engine/object-data/entry/upgrade.lua +4 -4
  80. package/engine/object-data/entry.d.ts +16 -14
  81. package/engine/object-data/entry.lua +60 -32
  82. package/engine/standard/entries/buff-type.d.ts +3 -0
  83. package/engine/standard/entries/buff-type.lua +3 -0
  84. package/engine/standard/entries/sound-preset.d.ts +10 -0
  85. package/engine/standard/entries/sound-preset.lua +10 -0
  86. package/objutil/unit.lua +8 -0
  87. package/package.json +2 -2
  88. 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}
@@ -8,6 +8,6 @@ local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_AB
8
8
  -- @internal For use by internal systems only.
9
9
  ____exports.getAbilityDuration = function(ability, target)
10
10
  local level = ability.level
11
- return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
11
+ return target ~= nil and (target.isHero or target:getField(UNIT_IF_LEVEL) >= 6 or target:hasClassification(UnitClassification.RESISTANT)) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
12
12
  end
13
13
  return ____exports
@@ -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
@@ -100,7 +100,9 @@ declare const enum UnitPropertyKey {
100
100
  DELAY_HEALTH_CHECKS_COUNTER = 103,
101
101
  DELAY_HEALTH_CHECKS_HEALTH_BONUS = 104,
102
102
  PREVENT_DEATH_HEALTH_BONUS = 105,
103
- IS_TEAM_GLOW_HIDDEN = 106
103
+ IS_TEAM_GLOW_HIDDEN = 106,
104
+ LAST_X = 107,
105
+ LAST_Y = 108
104
106
  }
105
107
  export type UnitSyncId = number & {
106
108
  readonly __unitSyncId: unique symbol;
@@ -113,6 +115,8 @@ export declare class Unit extends Handle<junit> {
113
115
  private [UnitPropertyKey.DELAY_HEALTH_CHECKS_HEALTH_BONUS]?;
114
116
  private [UnitPropertyKey.PREVENT_DEATH_HEALTH_BONUS]?;
115
117
  private [UnitPropertyKey.IS_TEAM_GLOW_HIDDEN]?;
118
+ private [UnitPropertyKey.LAST_X]?;
119
+ private [UnitPropertyKey.LAST_Y]?;
116
120
  private _owner?;
117
121
  private _timeScale?;
118
122
  private events?;
@@ -148,6 +152,7 @@ export declare class Unit extends Handle<junit> {
148
152
  isEnemyOf(unit: Unit): boolean;
149
153
  playAnimation(animation: string, rarity?: jraritycontrol): void;
150
154
  playAnimation(animation: number): void;
155
+ resetAnimation(): void;
151
156
  queueAnimation(animation: string): void;
152
157
  get weapons(): [UnitWeapon, UnitWeapon];
153
158
  get firstWeapon(): UnitWeapon;
@@ -58,6 +58,7 @@ local ____tostring = _G.tostring
58
58
  local setUnitAnimation = SetUnitAnimation
59
59
  local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
60
60
  local setUnitAnimationByIndex = SetUnitAnimationByIndex
61
+ local resetUnitAnimation = ResetUnitAnimation
61
62
  local queueUnitAnimation = QueueUnitAnimation
62
63
  local getUnitIntegerField = BlzGetUnitIntegerField
63
64
  local getUnitRealField = BlzGetUnitRealField
@@ -680,6 +681,8 @@ function Unit.prototype.getEvent(self, event, collector)
680
681
  end
681
682
  function Unit.prototype.onDestroy(self)
682
683
  local handle = self.handle
684
+ self[107] = getUnitX(handle)
685
+ self[108] = getUnitY(handle)
683
686
  if not self._owner then
684
687
  self._owner = Player:of(getOwningPlayer(handle))
685
688
  end
@@ -795,6 +798,9 @@ function Unit.prototype.playAnimation(self, animation, rarity)
795
798
  setUnitAnimation(self.handle, animation)
796
799
  end
797
800
  end
801
+ function Unit.prototype.resetAnimation(self)
802
+ resetUnitAnimation(self.handle)
803
+ end
798
804
  function Unit.prototype.queueAnimation(self, animation)
799
805
  queueUnitAnimation(self.handle, animation)
800
806
  end
@@ -1597,7 +1603,7 @@ __TS__SetDescriptor(
1597
1603
  "x",
1598
1604
  {
1599
1605
  get = function(self)
1600
- return getUnitX(self.handle)
1606
+ return self[107] or getUnitX(self.handle)
1601
1607
  end,
1602
1608
  set = function(self, v)
1603
1609
  SetUnitX(self.handle, v)
@@ -1610,7 +1616,7 @@ __TS__SetDescriptor(
1610
1616
  "y",
1611
1617
  {
1612
1618
  get = function(self)
1613
- return getUnitY(self.handle)
1619
+ return self[108] or getUnitY(self.handle)
1614
1620
  end,
1615
1621
  set = function(self, v)
1616
1622
  SetUnitY(self.handle, v)
@@ -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,17 +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
13
- local ____math = require("math")
14
- local ceil = ____math.ceil
12
+ local ____destroyable = require("destroyable")
13
+ local AbstractDestroyable = ____destroyable.AbstractDestroyable
15
14
  local ____type = _G.type
16
15
  local select = _G.select
17
16
  local cos = math.cos
@@ -43,9 +42,10 @@ local temporaryLightningsCount = 0
43
42
  ____exports.Lightning = __TS__Class()
44
43
  local Lightning = ____exports.Lightning
45
44
  Lightning.name = "Lightning"
46
- __TS__ClassExtends(Lightning, Handle)
45
+ __TS__ClassExtends(Lightning, AbstractDestroyable)
47
46
  function Lightning.prototype.____constructor(self, handle, typeId)
48
- Handle.prototype.____constructor(self, handle)
47
+ AbstractDestroyable.prototype.____constructor(self)
48
+ self.handle = handle
49
49
  self.typeId = typeId
50
50
  end
51
51
  function Lightning.prototype.onDestroy(self)
@@ -53,7 +53,7 @@ function Lightning.prototype.onDestroy(self)
53
53
  unitToPointLightnings[self] = nil
54
54
  pointToUnitLightnings[self] = nil
55
55
  destroyLightning(self.handle)
56
- return Handle.prototype.onDestroy(self)
56
+ return AbstractDestroyable.prototype.onDestroy(self)
57
57
  end
58
58
  function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY, targetXOrTargetUnitOrTargetYOrTargetZ, targetY, targetZ)
59
59
  if type(checkVisibility) ~= "boolean" then
@@ -69,7 +69,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
69
69
  )
70
70
  end
71
71
  if targetZ ~= nil then
72
- return self:of(
72
+ return __TS__New(
73
+ self,
73
74
  addLightningEx(
74
75
  util.id2s(typeId),
75
76
  checkVisibility,
@@ -86,7 +87,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
86
87
  if targetXOrTargetUnitOrTargetYOrTargetZ ~= nil then
87
88
  if ____type(targetXOrTargetUnitOrTargetYOrTargetZ) == "number" then
88
89
  if ____type(sourceXOrSourceUnit) == "number" then
89
- return self:of(
90
+ return __TS__New(
91
+ self,
90
92
  addLightning(
91
93
  util.id2s(typeId),
92
94
  checkVisibility,
@@ -99,7 +101,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
99
101
  )
100
102
  end
101
103
  local unit = sourceXOrSourceUnit.handle
102
- local lightning = self:of(
104
+ local lightning = __TS__New(
105
+ self,
103
106
  addLightningEx(
104
107
  util.id2s(typeId),
105
108
  checkVisibility,
@@ -124,7 +127,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
124
127
  return lightning
125
128
  end
126
129
  local unit = targetXOrTargetUnitOrTargetYOrTargetZ.handle
127
- local lightning = self:of(
130
+ local lightning = __TS__New(
131
+ self,
128
132
  addLightningEx(
129
133
  util.id2s(typeId),
130
134
  checkVisibility,
@@ -153,7 +157,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
153
157
  local unit = sourceXOrSourceUnit.handle
154
158
  moveLocation(location, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY)
155
159
  local z = getLocationZ(location)
156
- local lightning = self:of(
160
+ local lightning = __TS__New(
161
+ self,
157
162
  addLightningEx(
158
163
  util.id2s(typeId),
159
164
  checkVisibility,
@@ -180,7 +185,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
180
185
  local unit = sourceZOrTargetXOrTargetUnitOrTargetY.handle
181
186
  moveLocation(location, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit)
182
187
  local z = getLocationZ(location)
183
- local lightning = self:of(
188
+ local lightning = __TS__New(
189
+ self,
184
190
  addLightningEx(
185
191
  util.id2s(typeId),
186
192
  checkVisibility,
@@ -206,7 +212,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
206
212
  end
207
213
  local sourceUnit = sourceXOrSourceUnit.handle
208
214
  local targetUnit = sourceYOrTargetXOrTargetUnit.handle
209
- local lightning = self:of(
215
+ local lightning = __TS__New(
216
+ self,
210
217
  addLightningEx(
211
218
  util.id2s(typeId),
212
219
  checkVisibility,
@@ -232,17 +239,18 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
232
239
  return lightning
233
240
  end
234
241
  function Lightning.flash(self, ...)
235
- local parametersToForwardCount = select("#", ...) - 1
236
- local lightning = forwardByN[parametersToForwardCount](____exports.Lightning.create, self, ...)
237
242
  local parameterOrDuration, durationOrFading = select(-2, ...)
243
+ local hasFading = ____type(durationOrFading) ~= "number"
244
+ local parametersToForwardCount = select("#", ...) - (hasFading and 2 or 1)
245
+ local lightning = forwardByN[parametersToForwardCount](____exports.Lightning.create, self, ...)
238
246
  local duration
239
- if ____type(durationOrFading) == "number" then
240
- duration = durationOrFading
241
- else
247
+ if hasFading then
242
248
  duration = parameterOrDuration
243
249
  if durationOrFading then
244
250
  lightning[110] = true
245
251
  end
252
+ else
253
+ duration = durationOrFading
246
254
  end
247
255
  lightning[109] = duration
248
256
  temporaryLightningsCount = temporaryLightningsCount + 1
@@ -318,7 +326,7 @@ Timer.onPeriod[UPDATE_PERIOD]:addListener(function()
318
326
  getLightningColorR(handle),
319
327
  getLightningColorG(handle),
320
328
  getLightningColorB(handle),
321
- ceil(getLightningColorA(handle) * (1 - UPDATE_PERIOD / duration))
329
+ getLightningColorA(handle) * (1 - UPDATE_PERIOD / duration)
322
330
  )
323
331
  end
324
332
  lightning[109] = duration - UPDATE_PERIOD
@@ -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
@@ -2,13 +2,18 @@
2
2
  import { ModelNodeName } from "./model-node-name";
3
3
  import { ModelNodeQualifier } from "./model-node-qualifier";
4
4
  import { Optional } from "../../../utility/types";
5
+ import { EffectParameters } from "../../../core/types/effect";
5
6
  export type AttachmentPreset = {
6
7
  modelPath: string;
7
8
  nodeName: ModelNodeName;
8
9
  nodeQualifiers: ModelNodeQualifier[];
9
10
  };
10
- export type AttachmentPresetInput = Optional<AttachmentPreset, "nodeQualifiers"> | string;
11
- export declare const toAttachmentPreset: (attachmentPresetInput: AttachmentPresetInput) => AttachmentPreset;
11
+ export type EffectPresetWithParameters = AttachmentPreset & {
12
+ parameters?: EffectParameters;
13
+ };
14
+ export type AttachmentPresetInput<T extends AttachmentPreset = AttachmentPreset> = Optional<T, "nodeName" | "nodeQualifiers"> | string;
15
+ export type EffectPresetWithParametersInput = AttachmentPresetInput<EffectPresetWithParameters>;
16
+ export declare const toEffectPreset: (effectPresetInput: EffectPresetWithParametersInput) => EffectPresetWithParameters;
12
17
  export declare const extractAttachmentPresetInputModelPath: (attachmentPresetInput: AttachmentPresetInput | undefined) => string;
13
18
  export declare const extractAttachmentPresetInputNodeFQN: (attachmentPresetInput: AttachmentPresetInput | undefined) => string;
14
19
  export declare const splitAttachmentNodeFQN: (attachmentNodeFQN: string) => LuaMultiReturn<[attachmentNodeName: ModelNodeName, attachmentNodeQualifiers: ModelNodeQualifier[]]>;
@@ -1,9 +1,10 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayJoin = ____lualib.__TS__ArrayJoin
2
3
  local __TS__StringSplit = ____lualib.__TS__StringSplit
3
4
  local __TS__ArraySlice = ____lualib.__TS__ArraySlice
4
5
  local ____exports = {}
5
- ____exports.toAttachmentPreset = function(attachmentPresetInput)
6
- return type(attachmentPresetInput) == "string" and ({modelPath = attachmentPresetInput, nodeName = "origin", nodeQualifiers = {}}) or ({modelPath = attachmentPresetInput.modelPath, nodeName = attachmentPresetInput.nodeName, nodeQualifiers = attachmentPresetInput.nodeQualifiers or ({})})
6
+ ____exports.toEffectPreset = function(effectPresetInput)
7
+ return type(effectPresetInput) == "string" and ({modelPath = effectPresetInput, nodeName = "origin", nodeQualifiers = {}}) or ({modelPath = effectPresetInput.modelPath, nodeName = effectPresetInput.nodeName or "origin", nodeQualifiers = effectPresetInput.nodeQualifiers or ({}), parameters = effectPresetInput.parameters})
7
8
  end
8
9
  ____exports.extractAttachmentPresetInputModelPath = function(attachmentPresetInput)
9
10
  return type(attachmentPresetInput) == "string" and attachmentPresetInput or (attachmentPresetInput and attachmentPresetInput.modelPath or "")
@@ -12,7 +13,7 @@ ____exports.extractAttachmentPresetInputNodeFQN = function(attachmentPresetInput
12
13
  if type(attachmentPresetInput) == "string" or attachmentPresetInput == nil then
13
14
  return ""
14
15
  end
15
- return table.concat(
16
+ return __TS__ArrayJoin(
16
17
  {
17
18
  attachmentPresetInput.nodeName,
18
19
  table.unpack(attachmentPresetInput.nodeQualifiers or ({}))
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ export declare const enum SoundEax {
3
+ DEFAULT = "DefaultEAXON",
4
+ ACKNOWLEDGEMENTS = "HeroAcksEAX",
5
+ ENVIRONMENT = "DoodadsEAX",
6
+ DRUMS = "KotoDrumsEAX",
7
+ ATTACKS = "CombatSoundsEAX",
8
+ ABILITIES = "SpellsEAX",
9
+ MISSILES = "MissilesEAX"
10
+ }
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ 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;
@@ -7,4 +7,6 @@ export declare class BerserkAbilityType extends AbilityType {
7
7
  set movementSpeedIncreaseFactor(movementSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
8
8
  get attackSpeedIncreaseFactor(): number[];
9
9
  set attackSpeedIncreaseFactor(attackSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ get receivedDamageIncreaseFactor(): number[];
11
+ set receivedDamageIncreaseFactor(receivedDamageIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
12
  }
@@ -36,4 +36,17 @@ __TS__SetDescriptor(
36
36
  },
37
37
  true
38
38
  )
39
+ __TS__SetDescriptor(
40
+ BerserkAbilityType.prototype,
41
+ "receivedDamageIncreaseFactor",
42
+ {
43
+ get = function(self)
44
+ return self:getNumberLevelField("bsk3")
45
+ end,
46
+ set = function(self, receivedDamageIncreaseFactor)
47
+ self:setNumberLevelField("bsk3", receivedDamageIncreaseFactor)
48
+ end
49
+ },
50
+ true
51
+ )
39
52
  return ____exports
@@ -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")
@@ -211,7 +213,16 @@ for abilityTypeId, usesAttackAnimation in pairs(postcompile(function()
211
213
  for abilityTypeId, usesAttackAnimation in pairs(usesAttackAnimationByAbilityTypeId) do
212
214
  if usesAttackAnimation then
213
215
  local abilityType = checkNotNull(____exports.BlankConfigurableAbilityType:of(abilityTypeId))
214
- abilityType.channelingAnimation = {"attack"}
216
+ if isAnimationName(abilityType.channelingAnimation[1]) then
217
+ if abilityType.channelingAnimation[1] ~= "attack" then
218
+ abilityType.channelingAnimation = {"attack"}
219
+ end
220
+ else
221
+ abilityType.channelingAnimation = {
222
+ "attack",
223
+ table.unpack(abilityType.channelingAnimation)
224
+ }
225
+ end
215
226
  end
216
227
  end
217
228
  return usesAttackAnimationByAbilityTypeId
@@ -0,0 +1,14 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class CarrionSwarmAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get damagePerTarget(): number[];
7
+ set damagePerTarget(damagePerTarget: ObjectDataEntryLevelFieldValueSupplier<number>);
8
+ get maximumTotalDamage(): number[];
9
+ set maximumTotalDamage(maximumTotalDamage: ObjectDataEntryLevelFieldValueSupplier<number>);
10
+ get distance(): number[];
11
+ set distance(distance: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ get finalAreaOfEffect(): number[];
13
+ set finalAreaOfEffect(finalAreaOfEffect: ObjectDataEntryLevelFieldValueSupplier<number>);
14
+ }