warscript 0.0.1-dev.524fae9 → 0.0.1-dev.5354486

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 (40) hide show
  1. package/decl/native.d.ts +1 -0
  2. package/engine/ability-type-extended-tooltip.d.ts +8 -0
  3. package/engine/ability-type-extended-tooltip.lua +44 -0
  4. package/engine/behaviour/ability/emulate-impact.d.ts +14 -0
  5. package/engine/behaviour/ability/emulate-impact.lua +74 -1
  6. package/engine/behaviour/ability/instant-impact.d.ts +12 -1
  7. package/engine/behaviour/ability/instant-impact.lua +17 -2
  8. package/engine/behaviour/ability.d.ts +6 -0
  9. package/engine/behaviour/ability.lua +64 -8
  10. package/engine/buff.d.ts +53 -44
  11. package/engine/buff.lua +254 -227
  12. package/engine/internal/object-data/returned-melee-damage-factor.lua +21 -0
  13. package/engine/internal/unit/ability.lua +19 -15
  14. package/engine/internal/unit/bonus.d.ts +3 -0
  15. package/engine/internal/unit/bonus.lua +11 -0
  16. package/engine/internal/unit+ability.lua +10 -0
  17. package/engine/internal/unit.lua +3 -0
  18. package/engine/object-data/entry/ability-type/barrage.d.ts +12 -0
  19. package/engine/object-data/entry/ability-type/barrage.lua +52 -0
  20. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -3
  21. package/engine/object-data/entry/ability-type/blank-configurable.lua +2 -32
  22. package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.d.ts +23 -0
  23. package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
  24. package/engine/object-data/entry/ability-type/channel.d.ts +2 -2
  25. package/engine/object-data/entry/ability-type/channel.lua +3 -3
  26. package/engine/object-data/entry/ability-type/exhume-corpses.d.ts +14 -0
  27. package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
  28. package/engine/object-data/entry/ability-type.d.ts +8 -2
  29. package/engine/object-data/entry/ability-type.lua +42 -3
  30. package/engine/object-data/entry/buff-type/applicable.lua +10 -3
  31. package/engine/object-data/entry/unit-type.d.ts +10 -0
  32. package/engine/object-data/entry/unit-type.lua +34 -20
  33. package/engine/random.lua +1 -1
  34. package/engine/standard/fields/ability.d.ts +2 -2
  35. package/engine/standard/fields/ability.lua +2 -2
  36. package/package.json +2 -2
  37. package/utility/arrays.d.ts +6 -1
  38. package/utility/arrays.lua +5 -0
  39. package/engine/internal/unit/pseudo-passive-abilities.lua +0 -11
  40. /package/engine/internal/{unit/pseudo-passive-abilities.d.ts → object-data/returned-melee-damage-factor.d.ts} +0 -0
@@ -0,0 +1,21 @@
1
+ local ____exports = {}
2
+ local ____spiked_2Dcarapace = require("engine.object-data.entry.ability-type.spiked-carapace")
3
+ local SpikedCarapaceAbilityType = ____spiked_2Dcarapace.SpikedCarapaceAbilityType
4
+ ---
5
+ -- @internal For use by internal systems.
6
+ --
7
+ -- Spiked Carapace returns the given factor of melee attack damage to the attacker; the engine
8
+ -- decides what counts as a melee attack.
9
+ ____exports.RETURNED_MELEE_DAMAGE_FACTOR_DUMMY_ABILITY_TYPE_ID = compiletime(function()
10
+ local abilityType = SpikedCarapaceAbilityType:create()
11
+ abilityType.isInternal = true
12
+ abilityType.isButtonVisible = false
13
+ abilityType.returnedDamageFactor = 0
14
+ abilityType.receivedDamageFactor = 1
15
+ abilityType.armorIncrease = 0
16
+ return abilityType.id
17
+ end)
18
+ ---
19
+ -- @internal For use by internal systems.
20
+ ____exports.RETURNED_MELEE_DAMAGE_FACTOR_ABILITY_FIELD = ABILITY_RLF_RETURNED_DAMAGE_FACTOR
21
+ return ____exports
@@ -28,9 +28,6 @@ local ____lua_2Dsets = require("utility.lua-sets")
28
28
  local luaSetOf = ____lua_2Dsets.luaSetOf
29
29
  local ____attributes = require("attributes")
30
30
  local attribute = ____attributes.attribute
31
- local ____pseudo_2Dpassive_2Dabilities = require("engine.internal.unit.pseudo-passive-abilities")
32
- local pseudoPassiveAbilityOrderTypeStringId = ____pseudo_2Dpassive_2Dabilities.pseudoPassiveAbilityOrderTypeStringId
33
- local pseudoPassiveAbilityTypeIds = ____pseudo_2Dpassive_2Dabilities.pseudoPassiveAbilityTypeIds
34
31
  local eventInvoke = Event.invoke
35
32
  local condition = Condition
36
33
  local createTrigger = CreateTrigger
@@ -93,7 +90,7 @@ local function createCommonEvent(underlyingEvent)
93
90
  underlyingEvent,
94
91
  3,
95
92
  function(caster, ability)
96
- return not (pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil), caster, ability
93
+ return true, caster, ability
97
94
  end
98
95
  )
99
96
  end
@@ -173,7 +170,7 @@ local function createNoTargetEvent(underlyingEvent)
173
170
  underlyingEvent,
174
171
  1,
175
172
  function(caster, ability, targetUnit, targetItem, targetDestructible, x, y)
176
- if x == 0 and y == 0 and targetUnit == nil and targetItem == nil and targetDestructible == nil and not (pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil) then
173
+ if x == 0 and y == 0 and targetUnit == nil and targetItem == nil and targetDestructible == nil then
177
174
  return true, caster, ability
178
175
  else
179
176
  return false
@@ -384,11 +381,7 @@ rawset(
384
381
  if unit ~= nil then
385
382
  local ability = unit:getAbility(abilityTypeId)
386
383
  if ability ~= nil then
387
- if pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil then
388
- ability:interruptCast()
389
- else
390
- eventInvoke(event, unit, ability, orderTypeStringId)
391
- end
384
+ eventInvoke(event, unit, ability, orderTypeStringId)
392
385
  end
393
386
  end
394
387
  end)
@@ -404,6 +397,22 @@ local function invokeImpactEvent(unit, ability, ...)
404
397
  ability[impactCallbackIdAttribute] = nil
405
398
  eventInvoke(internalAbilityImpactEvent, unit, ability, ...)
406
399
  end
400
+ --- Invokes the impact events of a cast that never reaches its native impact, with the
401
+ -- cast's target: the common event and the one matching the target kind, as a real impact.
402
+ --
403
+ -- @internal For use by internal systems only.
404
+ ____exports.emulateAbilityImpactEvent = function(caster, ability, targetUnit, targetItem, targetDestructible, x, y)
405
+ eventInvoke(
406
+ internalAbilityImpactEvent,
407
+ caster,
408
+ ability,
409
+ targetUnit and targetUnit.handle,
410
+ targetItem and targetItem.handle,
411
+ targetDestructible and targetDestructible.handle,
412
+ x,
413
+ y
414
+ )
415
+ end
407
416
  internalAbilityChannelingStartEvent:addListener(
408
417
  999999,
409
418
  function(unit, ability, ...)
@@ -484,9 +493,4 @@ internalAbilityChannelingStartEvent:addListener(
484
493
  end
485
494
  end
486
495
  )
487
- local function doNothing()
488
- end
489
- for pseudoPassiveAbilityTypeId in pairs(pseudoPassiveAbilityTypeIds) do
490
- Unit.abilityCommandEvent[pseudoPassiveAbilityTypeId][pseudoPassiveAbilityOrderTypeStringId]:addListener(999999, doNothing)
491
- end
492
496
  return ____exports
@@ -13,6 +13,7 @@ export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
13
13
  export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
14
14
  export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
15
15
  export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
16
+ export type UnitReturnedMeleeDamageFactorBonusId = UnitBonusId<"returnedMeleeDamageFactor">;
16
17
  export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
17
18
  export type UnitManaRegenerationRateFactorBonusId = UnitBonusId<"manaRegenerationRateFactor">;
18
19
  export type UnitHealthRegenerationRateBonusId = UnitBonusId<"healthRegenerationRate">;
@@ -46,6 +47,8 @@ export declare namespace UnitBonusType {
46
47
  const AUTO_ATTACK_DAMAGE: UnitBonusType<UnitAutoAttackDamageBonusId>;
47
48
  const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
48
49
  const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
50
+ /** The factor of melee attack damage returned to the attacker, as Spiked Carapace. */
51
+ const RETURNED_MELEE_DAMAGE_FACTOR: UnitBonusType<UnitReturnedMeleeDamageFactorBonusId>;
49
52
  const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
50
53
  const MANA_REGENERATION_RATE_FACTOR: UnitBonusType<UnitManaRegenerationRateFactorBonusId>;
51
54
  /** Supported range: -1000 to 1000; the total is clamped to it. */
@@ -42,6 +42,9 @@ local FRACTIONAL_HEALTH_REGENERATION_RATE_INCREASE_DUMMY_ABILITY_TYPE_ID = ____h
42
42
  local HEALTH_REGENERATION_RATE_DECREASE_DUMMY_ABILITY_TYPE_ID = ____health_2Dregeneration_2Drate_2Dincrease.HEALTH_REGENERATION_RATE_DECREASE_DUMMY_ABILITY_TYPE_ID
43
43
  local HEALTH_REGENERATION_RATE_DECREASE_DUMMY_VALUE = ____health_2Dregeneration_2Drate_2Dincrease.HEALTH_REGENERATION_RATE_DECREASE_DUMMY_VALUE
44
44
  local HEALTH_REGENERATION_RATE_INCREASE_DUMMY_ABILITY_TYPE_IDS = ____health_2Dregeneration_2Drate_2Dincrease.HEALTH_REGENERATION_RATE_INCREASE_DUMMY_ABILITY_TYPE_IDS
45
+ local ____returned_2Dmelee_2Ddamage_2Dfactor = require("engine.internal.object-data.returned-melee-damage-factor")
46
+ local RETURNED_MELEE_DAMAGE_FACTOR_ABILITY_FIELD = ____returned_2Dmelee_2Ddamage_2Dfactor.RETURNED_MELEE_DAMAGE_FACTOR_ABILITY_FIELD
47
+ local RETURNED_MELEE_DAMAGE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____returned_2Dmelee_2Ddamage_2Dfactor.RETURNED_MELEE_DAMAGE_FACTOR_DUMMY_ABILITY_TYPE_ID
45
48
  local damageFactorByUnit = {}
46
49
  local receivedDamageFactorByUnit = {}
47
50
  local function atLeastOnceProbability(array)
@@ -98,6 +101,14 @@ do
98
101
  }
99
102
  UnitBonusType.DAMAGE_FACTOR = {reduce = product, valueByUnit = damageFactorByUnit, initialValue = 1}
100
103
  UnitBonusType.RECEIVED_DAMAGE_FACTOR = {reduce = product, valueByUnit = receivedDamageFactorByUnit, initialValue = 1}
104
+ --- The factor of melee attack damage returned to the attacker, as Spiked Carapace.
105
+ UnitBonusType.RETURNED_MELEE_DAMAGE_FACTOR = {
106
+ abilityTypeId = RETURNED_MELEE_DAMAGE_FACTOR_DUMMY_ABILITY_TYPE_ID,
107
+ field = RETURNED_MELEE_DAMAGE_FACTOR_ABILITY_FIELD,
108
+ integer = false,
109
+ reduce = sum,
110
+ initialValue = 0
111
+ }
101
112
  UnitBonusType.EVASION_PROBABILITY = {
102
113
  abilityTypeId = EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID,
103
114
  field = EVASION_PROBABILITY_ABILITY_FIELD,
@@ -29,6 +29,7 @@ local abilityLevelChangedEvent = createDispatchingEvent(
29
29
  )
30
30
  rawset(Unit, "abilityLevelChangedEvent", abilityLevelChangedEvent)
31
31
  local getUnitAbilityLevel = GetUnitAbilityLevel
32
+ local unitDisableAbility = BlzUnitDisableAbility
32
33
  local function invokeAbilityLevelChangedEvent(unitHandle, abilityTypeId)
33
34
  local unit = Unit:of(unitHandle)
34
35
  if unit ~= nil then
@@ -86,6 +87,15 @@ UnitAbility.onCreate:addListener(
86
87
  Event.invoke(abilityGainedEvent, ability.owner, ability)
87
88
  end
88
89
  )
90
+ UnitAbility.onDestroy:addListener(
91
+ 999999,
92
+ function(ability)
93
+ local owner = ability.owner
94
+ if owner.state ~= 2 then
95
+ unitDisableAbility(owner.handle, ability.typeId, true, false)
96
+ end
97
+ end
98
+ )
89
99
  UnitAbility.destroyEvent:addListener(
90
100
  4,
91
101
  function(ability)
@@ -999,6 +999,9 @@ function Unit.prototype.removeAbility(self, abilityTypeId)
999
999
  if abilities[i].typeId == abilityTypeId then
1000
1000
  local ability = abilities[i]
1001
1001
  tremove(abilities, i)
1002
+ if ability.state == 2 then
1003
+ break
1004
+ end
1002
1005
  ability:destroy()
1003
1006
  return true
1004
1007
  end
@@ -0,0 +1,12 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class BarrageAbilityType 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 maximumTargetCount(): number[];
11
+ set maximumTargetCount(maximumTargetCount: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ }
@@ -0,0 +1,52 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ ____exports.BarrageAbilityType = __TS__Class()
9
+ local BarrageAbilityType = ____exports.BarrageAbilityType
10
+ BarrageAbilityType.name = "BarrageAbilityType"
11
+ __TS__ClassExtends(BarrageAbilityType, AbilityType)
12
+ BarrageAbilityType.BASE_ID = fourCC("Aroc")
13
+ __TS__SetDescriptor(
14
+ BarrageAbilityType.prototype,
15
+ "damagePerTarget",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Efk1")
19
+ end,
20
+ set = function(self, damagePerTarget)
21
+ self:setNumberLevelField("Efk1", damagePerTarget)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ __TS__SetDescriptor(
27
+ BarrageAbilityType.prototype,
28
+ "maximumTotalDamage",
29
+ {
30
+ get = function(self)
31
+ return self:getNumberLevelField("Efk2")
32
+ end,
33
+ set = function(self, maximumTotalDamage)
34
+ self:setNumberLevelField("Efk2", maximumTotalDamage)
35
+ end
36
+ },
37
+ true
38
+ )
39
+ __TS__SetDescriptor(
40
+ BarrageAbilityType.prototype,
41
+ "maximumTargetCount",
42
+ {
43
+ get = function(self)
44
+ return self:getNumberLevelField("Efk3")
45
+ end,
46
+ set = function(self, maximumTargetCount)
47
+ self:setNumberLevelField("Efk3", maximumTargetCount)
48
+ end
49
+ },
50
+ true
51
+ )
52
+ return ____exports
@@ -7,14 +7,11 @@ export declare class BlankConfigurableAbilityType extends ChannelAbilityType {
7
7
  private readonly autoOrderTypeStringIdByTargetingType;
8
8
  private _usesAttackAnimation;
9
9
  private _isChanneling;
10
- private _isPassive;
11
10
  constructor(object: WarObject);
12
11
  get usesAttackAnimation(): boolean;
13
12
  set usesAttackAnimation(usesAttackAnimation: boolean);
14
13
  get isChanneling(): boolean;
15
14
  set isChanneling(isChanneling: boolean);
16
- get isPassive(): boolean;
17
- set isPassive(isPassive: boolean);
18
15
  get targetingType(): ChannelAbilityTypeTargetingType[];
19
16
  set targetingType(targetingType: ObjectDataEntryLevelFieldValueSupplier<ChannelAbilityTypeTargetingType>);
20
17
  get baseOrderTypeStringId(): string[];
@@ -23,9 +23,6 @@ local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.A
23
23
  local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
24
24
  local ____linked_2Dset = require("utility.linked-set")
25
25
  local LinkedSet = ____linked_2Dset.LinkedSet
26
- local ____pseudo_2Dpassive_2Dabilities = require("engine.internal.unit.pseudo-passive-abilities")
27
- local compiletimePseudoPassiveAbilityTypeIds = ____pseudo_2Dpassive_2Dabilities.compiletimePseudoPassiveAbilityTypeIds
28
- local pseudoPassiveAbilityOrderTypeStringId = ____pseudo_2Dpassive_2Dabilities.pseudoPassiveAbilityOrderTypeStringId
29
26
  local isChannelingAbilityTypeIds = {}
30
27
  local usesAttackAnimationByAbilityTypeId = {}
31
28
  ____exports.BlankConfigurableAbilityType = __TS__Class()
@@ -38,10 +35,9 @@ function BlankConfigurableAbilityType.prototype.____constructor(self, object)
38
35
  self.autoOrderTypeStringIdByTargetingType = {}
39
36
  self._usesAttackAnimation = false
40
37
  self._isChanneling = false
41
- self._isPassive = false
42
38
  self.buttonPositionX = 0
43
39
  self.buttonPositionY = 0
44
- self.casterAttachmentPresets = {}
40
+ self.casterEffectPresets = {}
45
41
  self.effectModelPaths = {}
46
42
  self.targetEffectPresets = {}
47
43
  self.levelCount = 1
@@ -50,7 +46,7 @@ function BlankConfigurableAbilityType.prototype.____constructor(self, object)
50
46
  self.isPhysical = false
51
47
  self.isUniversal = false
52
48
  self.isUniqueCast = true
53
- self.casterAttachmentPresetsDuration = 0
49
+ self.casterEffectPresetsDuration = 0
54
50
  self.disablesOtherAbilities = false
55
51
  self:setAutoOrderTypeStringIds()
56
52
  usesAttackAnimationByAbilityTypeId[self.id] = false
@@ -109,24 +105,6 @@ __TS__SetDescriptor(
109
105
  },
110
106
  true
111
107
  )
112
- __TS__SetDescriptor(
113
- BlankConfigurableAbilityType.prototype,
114
- "isPassive",
115
- {
116
- get = function(self)
117
- return self._isPassive
118
- end,
119
- set = function(self, isPassive)
120
- if isPassive then
121
- compiletimePseudoPassiveAbilityTypeIds[self.id] = true
122
- else
123
- compiletimePseudoPassiveAbilityTypeIds[self.id] = nil
124
- end
125
- self._isPassive = isPassive
126
- end
127
- },
128
- true
129
- )
130
108
  __TS__SetDescriptor(
131
109
  BlankConfigurableAbilityType.prototype,
132
110
  "targetingType",
@@ -231,14 +209,6 @@ do
231
209
  end
232
210
  )
233
211
  end
234
- local _ = postcompile(function()
235
- for abilityTypeId in pairs(compiletimePseudoPassiveAbilityTypeIds) do
236
- local abilityType = checkNotNull(____exports.BlankConfigurableAbilityType:of(abilityTypeId))
237
- abilityType.hotkey = ""
238
- abilityType.baseOrderTypeStringId = pseudoPassiveAbilityOrderTypeStringId
239
- abilityType.targetingType = 0
240
- end
241
- end)
242
212
  for abilityTypeId, usesAttackAnimation in pairs(postcompile(function()
243
213
  for abilityTypeId, usesAttackAnimation in pairs(usesAttackAnimationByAbilityTypeId) do
244
214
  if usesAttackAnimation then
@@ -0,0 +1,23 @@
1
+ /** @noSelfInFile */
2
+ import { ExhumeCorpsesAbilityType } from "./exhume-corpses";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ /**
5
+ * A passive ability whose cooldown can be started (`Ability.startCooldown`): Exhume
6
+ * Corpses (`Aexh`) is the only passive base ability that shows a cooldown.
7
+ *
8
+ * The corpse fields of the underlying Exhume Corpses are fixed at zero and its native
9
+ * durations at a practically infinite value. {@link buffDuration} and
10
+ * {@link heroBuffDuration} are kept for scripts separately from the native fields.
11
+ *
12
+ * The game ignores per-ability extended tooltips of this base ability, so the type's own
13
+ * tooltip is replaced locally with the one of the locally main selected unit's ability.
14
+ * Read the type's tooltip with `getAbilityTypeExtendedTooltip`, not with the native.
15
+ */
16
+ export declare class BlankPassiveAbilityWithCooldownAbilityType extends ExhumeCorpsesAbilityType {
17
+ static readonly IS_SYNTHETIC = true;
18
+ constructor(object: WarObject);
19
+ get buffDuration(): number[];
20
+ set buffDuration(buffDuration: ObjectDataEntryLevelFieldValueSupplier<number>);
21
+ get heroBuffDuration(): number[];
22
+ set heroBuffDuration(heroBuffDuration: ObjectDataEntryLevelFieldValueSupplier<number>);
23
+ }
@@ -0,0 +1,112 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____exhume_2Dcorpses = require("engine.object-data.entry.ability-type.exhume-corpses")
7
+ local ExhumeCorpsesAbilityType = ____exhume_2Dcorpses.ExhumeCorpsesAbilityType
8
+ local ____ability = require("engine.standard.fields.ability")
9
+ local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
10
+ local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
11
+ local TOOLTIP_NORMAL_EXTENDED_ABILITY_STRING_LEVEL_FIELD = ____ability.TOOLTIP_NORMAL_EXTENDED_ABILITY_STRING_LEVEL_FIELD
12
+ local ____ability_2Dtype_2Dextended_2Dtooltip = require("engine.ability-type-extended-tooltip")
13
+ local overrideAbilityTypeExtendedTooltipLocally = ____ability_2Dtype_2Dextended_2Dtooltip.overrideAbilityTypeExtendedTooltipLocally
14
+ local ____local_2Dclient = require("engine.local-client")
15
+ local LocalClient = ____local_2Dclient.LocalClient
16
+ local ____timer = require("core.types.timer")
17
+ local Timer = ____timer.Timer
18
+ local NATIVE_DURATION = 2147483
19
+ local compiletimeAbilityTypeIds = {}
20
+ --- A passive ability whose cooldown can be started (`Ability.startCooldown`): Exhume
21
+ -- Corpses (`Aexh`) is the only passive base ability that shows a cooldown.
22
+ --
23
+ -- The corpse fields of the underlying Exhume Corpses are fixed at zero and its native
24
+ -- durations at a practically infinite value. {@link buffDuration} and
25
+ -- {@link heroBuffDuration} are kept for scripts separately from the native fields.
26
+ --
27
+ -- The game ignores per-ability extended tooltips of this base ability, so the type's own
28
+ -- tooltip is replaced locally with the one of the locally main selected unit's ability.
29
+ -- Read the type's tooltip with `getAbilityTypeExtendedTooltip`, not with the native.
30
+ ____exports.BlankPassiveAbilityWithCooldownAbilityType = __TS__Class()
31
+ local BlankPassiveAbilityWithCooldownAbilityType = ____exports.BlankPassiveAbilityWithCooldownAbilityType
32
+ BlankPassiveAbilityWithCooldownAbilityType.name = "BlankPassiveAbilityWithCooldownAbilityType"
33
+ __TS__ClassExtends(BlankPassiveAbilityWithCooldownAbilityType, ExhumeCorpsesAbilityType)
34
+ function BlankPassiveAbilityWithCooldownAbilityType.prototype.____constructor(self, object)
35
+ ExhumeCorpsesAbilityType.prototype.____constructor(self, object)
36
+ self.levelCount = 1
37
+ self.iconPath = ""
38
+ self.targetEffectPresets = {}
39
+ self.maximumCorpseCount = function() return 0 end
40
+ self.corpseUnitTypeId = function() return 0 end
41
+ self:setNumberLevelField(
42
+ "adur",
43
+ function() return NATIVE_DURATION end
44
+ )
45
+ self:setNumberLevelField(
46
+ "ahdu",
47
+ function() return NATIVE_DURATION end
48
+ )
49
+ self.buffDuration = function() return 0 end
50
+ self.heroBuffDuration = function() return 0 end
51
+ self.buffTypeIds = function() return {} end
52
+ self.techTreeDependencies = {}
53
+ compiletimeAbilityTypeIds[self.id] = true
54
+ end
55
+ BlankPassiveAbilityWithCooldownAbilityType.IS_SYNTHETIC = true
56
+ __TS__SetDescriptor(
57
+ BlankPassiveAbilityWithCooldownAbilityType.prototype,
58
+ "buffDuration",
59
+ {
60
+ get = function(self)
61
+ return DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(self)
62
+ end,
63
+ set = function(self, buffDuration)
64
+ DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:setValue(self, buffDuration)
65
+ end
66
+ },
67
+ true
68
+ )
69
+ __TS__SetDescriptor(
70
+ BlankPassiveAbilityWithCooldownAbilityType.prototype,
71
+ "heroBuffDuration",
72
+ {
73
+ get = function(self)
74
+ return DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(self)
75
+ end,
76
+ set = function(self, heroBuffDuration)
77
+ DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:setValue(self, heroBuffDuration)
78
+ end
79
+ },
80
+ true
81
+ )
82
+ local abilityTypeIds = postcompile(function() return compiletimeAbilityTypeIds end)
83
+ if (next(abilityTypeIds)) ~= nil then
84
+ local overriddenLevelCountByAbilityTypeId = {}
85
+ Timer.onPeriod[1 / 32]:addListener(
86
+ 0,
87
+ function()
88
+ local unit = LocalClient.mainSelectedUnit
89
+ for abilityTypeId in pairs(abilityTypeIds) do
90
+ local ability = unit and unit:getAbility(abilityTypeId)
91
+ local levelCount = ability and ability.levelCount or 0
92
+ if ability ~= nil then
93
+ for level = 0, levelCount - 1 do
94
+ overrideAbilityTypeExtendedTooltipLocally(
95
+ abilityTypeId,
96
+ level,
97
+ TOOLTIP_NORMAL_EXTENDED_ABILITY_STRING_LEVEL_FIELD:getValue(ability, level)
98
+ )
99
+ end
100
+ end
101
+ local overriddenLevelCount = overriddenLevelCountByAbilityTypeId[abilityTypeId] or 0
102
+ for level = levelCount, overriddenLevelCount - 1 do
103
+ overrideAbilityTypeExtendedTooltipLocally(abilityTypeId, level, nil)
104
+ end
105
+ if levelCount ~= overriddenLevelCount then
106
+ overriddenLevelCountByAbilityTypeId[abilityTypeId] = levelCount
107
+ end
108
+ end
109
+ end
110
+ )
111
+ end
112
+ return ____exports
@@ -33,8 +33,8 @@ export declare class ChannelAbilityType extends AbilityType {
33
33
  */
34
34
  get isUniqueCast(): boolean[];
35
35
  set isUniqueCast(isUniqueCast: ObjectDataEntryLevelFieldValueSupplier<boolean>);
36
- get casterAttachmentPresetsDuration(): number[];
37
- set casterAttachmentPresetsDuration(casterAttachmentsDuration: ObjectDataEntryLevelFieldValueSupplier<number>);
36
+ get casterEffectPresetsDuration(): number[];
37
+ set casterEffectPresetsDuration(casterEffectPresetsDuration: ObjectDataEntryLevelFieldValueSupplier<number>);
38
38
  /**
39
39
  * Whether the ability should disable and hide other abilities while being channeled.
40
40
  */
@@ -100,13 +100,13 @@ __TS__SetDescriptor(
100
100
  )
101
101
  __TS__SetDescriptor(
102
102
  ChannelAbilityType.prototype,
103
- "casterAttachmentPresetsDuration",
103
+ "casterEffectPresetsDuration",
104
104
  {
105
105
  get = function(self)
106
106
  return self:getNumberLevelField("Ncl4")
107
107
  end,
108
- set = function(self, casterAttachmentsDuration)
109
- self:setNumberLevelField("Ncl4", casterAttachmentsDuration)
108
+ set = function(self, casterEffectPresetsDuration)
109
+ self:setNumberLevelField("Ncl4", casterEffectPresetsDuration)
110
110
  end
111
111
  },
112
112
  true
@@ -0,0 +1,14 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ import { UnitTypeId } from "../unit-type";
5
+ /** Meat Wagon's Exhume Corpses (`Aexh`). */
6
+ export declare class ExhumeCorpsesAbilityType extends AbilityType {
7
+ static readonly BASE_ID: AbilityTypeId;
8
+ /** Maximum Number of Corpses */
9
+ get maximumCorpseCount(): number[];
10
+ set maximumCorpseCount(maximumCorpseCount: ObjectDataEntryLevelFieldValueSupplier<number>);
11
+ /** Unit Type */
12
+ get corpseUnitTypeId(): UnitTypeId[];
13
+ set corpseUnitTypeId(corpseUnitTypeId: ObjectDataEntryLevelFieldValueSupplier<UnitTypeId>);
14
+ }
@@ -0,0 +1,40 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ --- Meat Wagon's Exhume Corpses (`Aexh`).
9
+ ____exports.ExhumeCorpsesAbilityType = __TS__Class()
10
+ local ExhumeCorpsesAbilityType = ____exports.ExhumeCorpsesAbilityType
11
+ ExhumeCorpsesAbilityType.name = "ExhumeCorpsesAbilityType"
12
+ __TS__ClassExtends(ExhumeCorpsesAbilityType, AbilityType)
13
+ ExhumeCorpsesAbilityType.BASE_ID = fourCC("Aexh")
14
+ __TS__SetDescriptor(
15
+ ExhumeCorpsesAbilityType.prototype,
16
+ "maximumCorpseCount",
17
+ {
18
+ get = function(self)
19
+ return self:getNumberLevelField("exh1")
20
+ end,
21
+ set = function(self, maximumCorpseCount)
22
+ self:setNumberLevelField("exh1", maximumCorpseCount)
23
+ end
24
+ },
25
+ true
26
+ )
27
+ __TS__SetDescriptor(
28
+ ExhumeCorpsesAbilityType.prototype,
29
+ "corpseUnitTypeId",
30
+ {
31
+ get = function(self)
32
+ return self:getObjectDataEntryNumericIdLevelField("exhu")
33
+ end,
34
+ set = function(self, corpseUnitTypeId)
35
+ self:setObjectDataEntryNumericIdLevelField("exhu", corpseUnitTypeId)
36
+ end
37
+ },
38
+ true
39
+ )
40
+ return ____exports
@@ -32,10 +32,16 @@ export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId>
32
32
  set casterCastingEffectPresets(casterCastingEffectPresets: EffectPresetWithParametersInput[]);
33
33
  get casterChannelingEffectPresets(): EffectPresetWithParameters[];
34
34
  set casterChannelingEffectPresets(casterChannelingEffectPresets: EffectPresetWithParametersInput[]);
35
- get casterAttachmentPresets(): TupleOf<EffectPresetWithParameters, 0 | 1 | 2>;
36
- set casterAttachmentPresets(casterAttachmentPresets: TupleOf<AttachmentPresetInput, 0 | 1 | 2>);
35
+ get casterEffectPresets(): TupleOf<EffectPresetWithParameters, 0 | 1 | 2>;
36
+ set casterEffectPresets(casterEffectPresets: TupleOf<AttachmentPresetInput, 0 | 1 | 2>);
37
37
  get effectModelPaths(): string[];
38
38
  set effectModelPaths(effectModelPaths: string[]);
39
+ get effectModelPathsSD(): string[];
40
+ set effectModelPathsSD(effectModelPathsSD: string[]);
41
+ get effectModelPathsHD(): string[];
42
+ set effectModelPathsHD(effectModelPathsHD: string[]);
43
+ get effectModelPathsDE(): string[];
44
+ set effectModelPathsDE(effectModelPathsDE: string[]);
39
45
  get iconPath(): string;
40
46
  set iconPath(iconPath: string);
41
47
  get iconPathSD(): string;
@@ -150,13 +150,13 @@ __TS__SetDescriptor(
150
150
  )
151
151
  __TS__SetDescriptor(
152
152
  AbilityType.prototype,
153
- "casterAttachmentPresets",
153
+ "casterEffectPresets",
154
154
  {
155
155
  get = function(self)
156
156
  return self:getAttachmentPresetListField("acat", {"acap", "aca1"})
157
157
  end,
158
- set = function(self, casterAttachmentPresets)
159
- self:setAttachmentPresetListField("acat", {"acap", "aca1"}, "acac", casterAttachmentPresets)
158
+ set = function(self, casterEffectPresets)
159
+ self:setAttachmentPresetListField("acat", {"acap", "aca1"}, "acac", casterEffectPresets)
160
160
  end
161
161
  },
162
162
  true
@@ -174,6 +174,45 @@ __TS__SetDescriptor(
174
174
  },
175
175
  true
176
176
  )
177
+ __TS__SetDescriptor(
178
+ AbilityType.prototype,
179
+ "effectModelPathsSD",
180
+ {
181
+ get = function(self)
182
+ return self:getStringsField("aeat:sd")
183
+ end,
184
+ set = function(self, effectModelPathsSD)
185
+ self:setStringsField("aeat:sd", effectModelPathsSD)
186
+ end
187
+ },
188
+ true
189
+ )
190
+ __TS__SetDescriptor(
191
+ AbilityType.prototype,
192
+ "effectModelPathsHD",
193
+ {
194
+ get = function(self)
195
+ return self:getStringsField("aeat:hd")
196
+ end,
197
+ set = function(self, effectModelPathsHD)
198
+ self:setStringsField("aeat:hd", effectModelPathsHD)
199
+ end
200
+ },
201
+ true
202
+ )
203
+ __TS__SetDescriptor(
204
+ AbilityType.prototype,
205
+ "effectModelPathsDE",
206
+ {
207
+ get = function(self)
208
+ return self:getStringsField("aeat:de")
209
+ end,
210
+ set = function(self, effectModelPathsDE)
211
+ self:setStringsField("aeat:de", effectModelPathsDE)
212
+ end
213
+ },
214
+ true
215
+ )
177
216
  __TS__SetDescriptor(
178
217
  AbilityType.prototype,
179
218
  "iconPath",
@@ -73,7 +73,7 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
73
73
  abilityType.levelCount = applicableBuffType.levelCount
74
74
  abilityType.buttonPositionX = 0
75
75
  abilityType.buttonPositionY = -11
76
- abilityType.casterAttachmentPresets = {}
76
+ abilityType.casterEffectPresets = {}
77
77
  abilityType.targetEffectPresets = {}
78
78
  abilityType.casterEffectSoundPresetId = nil
79
79
  abilityType.learnLevelMinimum = 6
@@ -305,14 +305,21 @@ preparePhysicalPositiveApplicatorAbility = function(ability, level, duration)
305
305
  setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_NORMAL, level, duration)
306
306
  setAbilityRealLevelField(ability, ABILITY_RLF_DURATION_HERO, level, duration)
307
307
  end
308
- ---
308
+ --- Removes the ability that keeps a hidden buff on the unit. A leftover applicator
309
+ -- makes the next hidden application fail, since the unit already has the ability.
310
+ --
309
311
  -- @internal For use by internal systems only.
310
- ____exports.removeBuff = function(unit, applicableBuffTypeId)
312
+ ____exports.removeBuffApplicator = function(unit, applicableBuffTypeId)
311
313
  local ____opt_3 = applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId[applicableBuffTypeId]
312
314
  local applicatorAbilityTypeId = ____opt_3 and ____opt_3[0]
313
315
  if applicatorAbilityTypeId ~= nil then
314
316
  unitRemoveAbility(unit, applicatorAbilityTypeId)
315
317
  end
318
+ end
319
+ ---
320
+ -- @internal For use by internal systems only.
321
+ ____exports.removeBuff = function(unit, applicableBuffTypeId)
322
+ ____exports.removeBuffApplicator(unit, applicableBuffTypeId)
316
323
  return unitRemoveAbility(unit, applicableBuffTypeId)
317
324
  end
318
325
  return ____exports