warscript 0.0.1-dev.f1df135 → 0.0.1-dev.f4350ae

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 (52) hide show
  1. package/attributes.d.ts +5 -0
  2. package/attributes.lua +8 -1
  3. package/core/types/sound.lua +5 -0
  4. package/decl/native.d.ts +840 -786
  5. package/engine/behaviour/ability/damage.d.ts +6 -3
  6. package/engine/behaviour/ability/damage.lua +24 -36
  7. package/engine/behaviour/ability/emulate-impact.lua +7 -0
  8. package/engine/internal/ability.d.ts +2 -0
  9. package/engine/internal/ability.lua +7 -0
  10. package/engine/internal/item.d.ts +2 -1
  11. package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
  12. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  13. package/engine/internal/unit+damage.d.ts +2 -11
  14. package/engine/internal/unit+damage.lua +10 -14
  15. package/engine/internal/unit+spellSteal.lua +1 -2
  16. package/engine/internal/unit.d.ts +16 -3
  17. package/engine/internal/unit.lua +126 -37
  18. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  19. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  20. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  21. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  22. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  23. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  24. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  25. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  26. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  27. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  28. package/engine/object-data/entry/ability-type.lua +7 -0
  29. package/engine/object-data/entry/buff-type/applicable.lua +5 -0
  30. package/engine/object-data/entry/buff-type.d.ts +5 -11
  31. package/engine/object-data/entry/buff-type.lua +11 -27
  32. package/engine/object-data/entry/unit-type.d.ts +2 -2
  33. package/engine/object-data/entry/unit-type.lua +94 -84
  34. package/engine/object-field/ability.d.ts +1 -1
  35. package/engine/object-field/unit.d.ts +46 -3
  36. package/engine/object-field/unit.lua +173 -7
  37. package/engine/object-field.d.ts +9 -1
  38. package/engine/object-field.lua +158 -76
  39. package/engine/standard/entries/buff-type.d.ts +3 -0
  40. package/engine/standard/entries/buff-type.lua +3 -0
  41. package/objutil/buff.lua +1 -2
  42. package/package.json +2 -2
  43. package/utility/arrays.d.ts +1 -0
  44. package/utility/arrays.lua +3 -0
  45. package/utility/functions.d.ts +1 -0
  46. package/utility/functions.lua +1 -0
  47. package/utility/linked-set.d.ts +1 -0
  48. package/utility/linked-set.lua +3 -0
  49. package/utility/lua-maps.d.ts +3 -0
  50. package/utility/lua-maps.lua +16 -0
  51. package/utility/lua-sets.d.ts +1 -0
  52. package/utility/lua-sets.lua +3 -0
@@ -53,13 +53,17 @@ local ____math = require("math")
53
53
  local min = ____math.min
54
54
  local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
55
55
  local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
56
+ local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
57
+ local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
58
+ local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
59
+ local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
60
+ local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
61
+ local ____attributes = require("attributes")
62
+ local isAttribute = ____attributes.isAttribute
56
63
  local match = string.match
57
64
  local ____tostring = _G.tostring
58
65
  local setUnitAnimation = SetUnitAnimation
59
- local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
60
66
  local setUnitAnimationByIndex = SetUnitAnimationByIndex
61
- local resetUnitAnimation = ResetUnitAnimation
62
- local queueUnitAnimation = QueueUnitAnimation
63
67
  local getUnitIntegerField = BlzGetUnitIntegerField
64
68
  local getUnitRealField = BlzGetUnitRealField
65
69
  local getHeroStr = GetHeroStr
@@ -81,7 +85,6 @@ local getHandleId = GetHandleId
81
85
  local getUnitCurrentOrder = GetUnitCurrentOrder
82
86
  local createUnit = CreateUnit
83
87
  local killUnit = KillUnit
84
- local setUnitExploded = SetUnitExploded
85
88
  local removeUnit = RemoveUnit
86
89
  local getUnitTypeId = GetUnitTypeId
87
90
  local isHeroUnitId = IsHeroUnitId
@@ -97,8 +100,6 @@ local getSpellTargetItem = GetSpellTargetItem
97
100
  local getSpellTargetDestructable = GetSpellTargetDestructable
98
101
  local isUnitInRangeXY = IsUnitInRangeXY
99
102
  local isUnitInRange = IsUnitInRange
100
- local setResourceAmount = SetResourceAmount
101
- local getResourceAmount = GetResourceAmount
102
103
  local getUnitWeaponRealField = BlzGetUnitWeaponRealField
103
104
  local setUnitWeaponRealField = BlzSetUnitWeaponRealField
104
105
  local getUnitWeaponStringField = BlzGetUnitWeaponStringField
@@ -129,8 +130,6 @@ local isUnitType = IsUnitType
129
130
  local isUnitAlly = IsUnitAlly
130
131
  local isUnitEnemy = IsUnitEnemy
131
132
  local getOwningPlayer = GetOwningPlayer
132
- local setUnitColor = SetUnitColor
133
- local showUnitTeamGlow = BlzShowUnitTeamGlow
134
133
  ____exports.UnitClassification = {}
135
134
  local UnitClassification = ____exports.UnitClassification
136
135
  do
@@ -140,6 +139,7 @@ do
140
139
  UnitClassification.GROUND = UNIT_TYPE_GROUND
141
140
  UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
142
141
  UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
142
+ UnitClassification.WORKER = UNIT_TYPE_PEON
143
143
  UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
144
144
  UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
145
145
  UnitClassification.TAUREN = UNIT_TYPE_TAUREN
@@ -347,6 +347,9 @@ local function dispatchAbility(event)
347
347
  }
348
348
  )
349
349
  end
350
+ local function damagingEventPreventRetaliation(self)
351
+ self[0] = true
352
+ end
350
353
  local function damageEventPreventDeath(self, callback, ...)
351
354
  if self[0] ~= nil then
352
355
  return
@@ -358,7 +361,14 @@ local function damageEventPreventDeath(self, callback, ...)
358
361
  rawset(self, 1 + i, (select(i, ...)))
359
362
  end
360
363
  end
361
- local damageSetters = {amount = BlzSetEventDamage, attackType = BlzSetEventAttackType, damageType = BlzSetEventDamageType, weaponType = BlzSetEventWeaponType}
364
+ local damageSetters = {
365
+ amount = BlzSetEventDamage,
366
+ attackType = function(attackType)
367
+ return BlzSetEventAttackType(attackTypeToNative(attackType))
368
+ end,
369
+ damageType = BlzSetEventDamageType,
370
+ weaponType = BlzSetEventWeaponType
371
+ }
362
372
  local jlimitopByOperator = {
363
373
  [0] = LESS_THAN_OR_EQUAL,
364
374
  [1] = LESS_THAN_OR_EQUAL,
@@ -640,7 +650,8 @@ local function delayHealthChecksCallback(unit)
640
650
  end
641
651
  end
642
652
  local nextSyncId = 1
643
- local unitBySyncId = setmetatable({}, {__mode = "k"})
653
+ local unitBySyncId = setmetatable({}, {__mode = "v"})
654
+ local damagingEventByTarget = setmetatable({}, {__mode = "k"})
644
655
  ____exports.Unit = __TS__Class()
645
656
  local Unit = ____exports.Unit
646
657
  Unit.name = "Unit"
@@ -793,16 +804,16 @@ function Unit.prototype.playAnimation(self, animation, rarity)
793
804
  if type(animation) == "number" then
794
805
  setUnitAnimationByIndex(self.handle, animation)
795
806
  elseif rarity then
796
- setUnitAnimationWithRarity(self.handle, animation, rarity)
807
+ SetUnitAnimationWithRarity(self.handle, animation, rarity)
797
808
  else
798
809
  setUnitAnimation(self.handle, animation)
799
810
  end
800
811
  end
801
812
  function Unit.prototype.resetAnimation(self)
802
- resetUnitAnimation(self.handle)
813
+ ResetUnitAnimation(self.handle)
803
814
  end
804
815
  function Unit.prototype.queueAnimation(self, animation)
805
- queueUnitAnimation(self.handle, animation)
816
+ QueueUnitAnimation(self.handle, animation)
806
817
  end
807
818
  function Unit.prototype.delayHealthChecks(self)
808
819
  self[103] = (self[103] or 0) + 1
@@ -815,7 +826,7 @@ function Unit.prototype.isSelected(self, player)
815
826
  return IsUnitSelected(self.handle, player.handle)
816
827
  end
817
828
  function Unit.prototype.explode(self)
818
- setUnitExploded(self.handle, true)
829
+ SetUnitExploded(self.handle, true)
819
830
  killUnit(self.handle)
820
831
  end
821
832
  function Unit.prototype.kill(self)
@@ -1292,6 +1303,19 @@ __TS__SetDescriptor(
1292
1303
  },
1293
1304
  true
1294
1305
  )
1306
+ __TS__SetDescriptor(
1307
+ Unit.prototype,
1308
+ "primaryAttribute",
1309
+ {
1310
+ get = function(self)
1311
+ return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
1312
+ end,
1313
+ set = function(self, primaryAttribute)
1314
+ setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
1315
+ end
1316
+ },
1317
+ true
1318
+ )
1295
1319
  __TS__SetDescriptor(
1296
1320
  Unit.prototype,
1297
1321
  "strengthBase",
@@ -1416,7 +1440,7 @@ __TS__SetDescriptor(
1416
1440
  return not self[106]
1417
1441
  end,
1418
1442
  set = function(self, isTeamGlowVisible)
1419
- showUnitTeamGlow(self.handle, isTeamGlowVisible)
1443
+ BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
1420
1444
  local ____temp_6
1421
1445
  if not isTeamGlowVisible then
1422
1446
  ____temp_6 = true
@@ -1432,9 +1456,9 @@ __TS__SetDescriptor(
1432
1456
  Unit.prototype,
1433
1457
  "color",
1434
1458
  {set = function(self, color)
1435
- setUnitColor(self.handle, color.handle)
1459
+ SetUnitColor(self.handle, color.handle)
1436
1460
  if self[106] then
1437
- showUnitTeamGlow(self.handle, false)
1461
+ BlzShowUnitTeamGlow(self.handle, false)
1438
1462
  end
1439
1463
  end},
1440
1464
  true
@@ -1702,10 +1726,10 @@ __TS__SetDescriptor(
1702
1726
  "gold",
1703
1727
  {
1704
1728
  get = function(self)
1705
- return getResourceAmount(self.handle)
1729
+ return GetResourceAmount(self.handle)
1706
1730
  end,
1707
1731
  set = function(self, gold)
1708
- setResourceAmount(self.handle, gold)
1732
+ SetResourceAmount(self.handle, gold)
1709
1733
  end
1710
1734
  },
1711
1735
  true
@@ -1833,6 +1857,19 @@ __TS__SetDescriptor(
1833
1857
  end},
1834
1858
  true
1835
1859
  )
1860
+ __TS__SetDescriptor(
1861
+ Unit.prototype,
1862
+ "movementType",
1863
+ {
1864
+ get = function(self)
1865
+ return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
1866
+ end,
1867
+ set = function(self, movementType)
1868
+ setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
1869
+ end
1870
+ },
1871
+ true
1872
+ )
1836
1873
  __TS__SetDescriptor(
1837
1874
  Unit.prototype,
1838
1875
  "pathing",
@@ -2014,6 +2051,14 @@ __TS__SetDescriptor(
2014
2051
  end},
2015
2052
  true
2016
2053
  )
2054
+ __TS__SetDescriptor(
2055
+ Unit.prototype,
2056
+ "targetAcquiredEvent",
2057
+ {get = function(self)
2058
+ return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
2059
+ end},
2060
+ true
2061
+ )
2017
2062
  __TS__SetDescriptor(
2018
2063
  Unit.prototype,
2019
2064
  "onSelect",
@@ -2375,13 +2420,19 @@ Unit.onDamaging = (function()
2375
2420
  if source and source.typeId == dummyUnitId then
2376
2421
  source = nil
2377
2422
  end
2378
- local target = BlzGetEventDamageTarget()
2423
+ local target = ____exports.Unit:of(BlzGetEventDamageTarget())
2424
+ local metadata = damageMetadataByTarget[target]
2425
+ damageMetadataByTarget[target] = nil
2379
2426
  local data = {
2380
2427
  amount = GetEventDamage(),
2381
- attackType = BlzGetEventAttackType(),
2428
+ attackType = nativeToAttackType(BlzGetEventAttackType()),
2382
2429
  damageType = BlzGetEventDamageType(),
2383
2430
  weaponType = BlzGetEventWeaponType(),
2384
- isAttack = BlzGetEventIsAttack()
2431
+ metadata = metadata,
2432
+ isAttack = BlzGetEventIsAttack(),
2433
+ originalAmount = GetEventDamage(),
2434
+ originalMetadata = metadata,
2435
+ preventRetaliation = damagingEventPreventRetaliation
2385
2436
  }
2386
2437
  if data.isAttack and source then
2387
2438
  local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
@@ -2395,18 +2446,36 @@ Unit.onDamaging = (function()
2395
2446
  invoke(
2396
2447
  event,
2397
2448
  source,
2398
- ____exports.Unit:of(target),
2449
+ target,
2399
2450
  setmetatable(
2400
2451
  {},
2401
2452
  {
2402
2453
  __index = data,
2403
2454
  __newindex = function(self, key, value)
2404
- damageSetters[key](value)
2455
+ local damageSetter = damageSetters[key]
2456
+ if damageSetter ~= nil then
2457
+ damageSetter(value)
2458
+ end
2405
2459
  data[key] = value
2406
2460
  end
2407
2461
  }
2408
2462
  )
2409
2463
  )
2464
+ if data[0] and source then
2465
+ local sourceOwner = source.owner.handle
2466
+ data[1] = sourceOwner
2467
+ local targetOwner = target.owner.handle
2468
+ data[2] = targetOwner
2469
+ if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
2470
+ SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
2471
+ data[3] = true
2472
+ end
2473
+ if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
2474
+ SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
2475
+ data[4] = true
2476
+ end
2477
+ end
2478
+ damagingEventByTarget[target] = data
2410
2479
  return
2411
2480
  end
2412
2481
  BlzSetEventDamage(0)
@@ -2414,7 +2483,7 @@ Unit.onDamaging = (function()
2414
2483
  BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
2415
2484
  BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
2416
2485
  local sourceOwner = source.owner.handle
2417
- local targetOwner = GetOwningPlayer(target)
2486
+ local targetOwner = target.owner.handle
2418
2487
  if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
2419
2488
  SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
2420
2489
  Timer:run(function()
@@ -2430,23 +2499,19 @@ Unit.onDamaging = (function()
2430
2499
  for ____, ____value in ipairs(source._attackHandlers) do
2431
2500
  local condition = ____value[1]
2432
2501
  local action = ____value[2]
2433
- if condition(
2434
- source,
2435
- ____exports.Unit:of(target),
2436
- data
2437
- ) then
2502
+ if condition(source, target, data) then
2438
2503
  action(
2439
2504
  source,
2440
- ____exports.Unit:of(target),
2505
+ target,
2441
2506
  setmetatable(
2442
2507
  {fire = function()
2443
2508
  UnitDamageTarget(
2444
2509
  source.handle,
2445
- target,
2510
+ target.handle,
2446
2511
  data.amount,
2447
2512
  true,
2448
2513
  true,
2449
- data.attackType,
2514
+ attackTypeToNative(data.attackType),
2450
2515
  data.damageType,
2451
2516
  data.weaponType
2452
2517
  )
@@ -2473,26 +2538,50 @@ Unit.onDamage = __TS__New(
2473
2538
  if source and source.typeId == dummyUnitId then
2474
2539
  source = nil
2475
2540
  end
2541
+ local target = ____exports.Unit:of(BlzGetEventDamageTarget())
2542
+ local damagingEvent = damagingEventByTarget[target]
2543
+ damagingEventByTarget[target] = nil
2476
2544
  local data = {
2477
2545
  amount = GetEventDamage(),
2478
- attackType = BlzGetEventAttackType(),
2546
+ attackType = nativeToAttackType(BlzGetEventAttackType()),
2479
2547
  damageType = BlzGetEventDamageType(),
2480
2548
  weaponType = BlzGetEventWeaponType(),
2549
+ metadata = damagingEvent and damagingEvent.metadata,
2481
2550
  isAttack = BlzGetEventIsAttack(),
2482
- originalAmount = GetEventDamage(),
2551
+ originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
2552
+ originalMetadata = damagingEvent and damagingEvent.originalMetadata,
2483
2553
  preventDeath = damageEventPreventDeath
2484
2554
  }
2555
+ if damagingEvent then
2556
+ for key, value in pairs(damagingEvent) do
2557
+ if isAttribute(key) then
2558
+ data[key] = value
2559
+ end
2560
+ end
2561
+ local sourceOwner = damagingEvent[1]
2562
+ if sourceOwner then
2563
+ local targetOwner = damagingEvent[2]
2564
+ if damagingEvent[3] then
2565
+ SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
2566
+ end
2567
+ if damagingEvent[4] then
2568
+ SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
2569
+ end
2570
+ end
2571
+ end
2485
2572
  local evData = setmetatable(
2486
2573
  {},
2487
2574
  {
2488
2575
  __index = data,
2489
2576
  __newindex = function(self, key, value)
2490
- damageSetters[key](value)
2577
+ local damageSetter = damageSetters[key]
2578
+ if damageSetter ~= nil then
2579
+ damageSetter(value)
2580
+ end
2491
2581
  data[key] = value
2492
2582
  end
2493
2583
  }
2494
2584
  )
2495
- local target = ____exports.Unit:of(BlzGetEventDamageTarget())
2496
2585
  invoke(event, source, target, evData)
2497
2586
  if evData[0] ~= nil and target.health - evData.amount < 0.405 then
2498
2587
  local bonusHealth = math.ceil(evData.amount)
@@ -1,11 +1,10 @@
1
1
  /** @noSelfInFile */
2
2
  export declare const enum AttackType {
3
- NONE = "unknown",
4
- NORMAL = "normal",
5
- PIERCE = "pierce",
6
- SIEGE = "siege",
7
- SPELL = "spells",
8
- CHAOS = "chaos",
9
- MAGIC = "magic",
10
- HERO = "hero"
3
+ SPELL = 0,
4
+ NORMAL = 1,
5
+ PIERCE = 2,
6
+ SIEGE = 3,
7
+ MAGIC = 4,
8
+ CHAOS = 5,
9
+ HERO = 6
11
10
  }
@@ -1,2 +1,44 @@
1
1
  local ____exports = {}
2
+ local ____records = require("utility.records")
3
+ local invertRecord = ____records.invertRecord
4
+ local stringByAttackType = {
5
+ [1] = "normal",
6
+ [2] = "pierce",
7
+ [3] = "siege",
8
+ [0] = "spells",
9
+ [5] = "chaos",
10
+ [4] = "magic",
11
+ [6] = "hero"
12
+ }
13
+ local attackTypeByString = invertRecord(stringByAttackType)
14
+ local nativeByAttackType = {
15
+ [1] = ATTACK_TYPE_MELEE,
16
+ [2] = ATTACK_TYPE_PIERCE,
17
+ [3] = ATTACK_TYPE_SIEGE,
18
+ [0] = ATTACK_TYPE_NORMAL,
19
+ [5] = ATTACK_TYPE_CHAOS,
20
+ [4] = ATTACK_TYPE_MAGIC,
21
+ [6] = ATTACK_TYPE_HERO
22
+ }
23
+ local attackTypeByNative = invertRecord(nativeByAttackType)
24
+ ---
25
+ -- @internal For use by internal systems only.
26
+ ____exports.attackTypeToString = function(attackType)
27
+ return attackType ~= nil and stringByAttackType[attackType] or "unknown"
28
+ end
29
+ ---
30
+ -- @internal For use by internal systems only.
31
+ ____exports.stringToAttackType = function(____string)
32
+ return attackTypeByString[____string]
33
+ end
34
+ ---
35
+ -- @internal For use by internal systems only.
36
+ ____exports.attackTypeToNative = function(attackType)
37
+ return nativeByAttackType[attackType]
38
+ end
39
+ ---
40
+ -- @internal For use by internal systems only.
41
+ ____exports.nativeToAttackType = function(attackType)
42
+ return attackTypeByNative[attackType]
43
+ end
2
44
  return ____exports
@@ -1,10 +1,10 @@
1
1
  /** @noSelfInFile */
2
2
  export declare const enum MovementType {
3
- NONE = "",
4
- FLOAT = "float",
5
- FLY = "fly",
6
- FOOT = "foot",
7
- HORSE = "horse",
8
- HOVER = "hover",
9
- AMPHIBIOUS = "amph"
3
+ NONE = 0,
4
+ FOOT = 1,
5
+ FLY = 2,
6
+ HORSE = 4,
7
+ HOVER = 8,
8
+ FLOAT = 16,
9
+ AMPHIBIOUS = 32
10
10
  }
@@ -1,2 +1,24 @@
1
1
  local ____exports = {}
2
+ local ____records = require("utility.records")
3
+ local invertRecord = ____records.invertRecord
4
+ local stringByMovementType = {
5
+ [0] = "",
6
+ [16] = "float",
7
+ [2] = "fly",
8
+ [1] = "foot",
9
+ [4] = "horse",
10
+ [8] = "hover",
11
+ [32] = "amph"
12
+ }
13
+ local movementTypeByString = invertRecord(stringByMovementType)
14
+ ---
15
+ -- @internal For use by internal systems only.
16
+ ____exports.movementTypeToString = function(movementType)
17
+ return stringByMovementType[movementType]
18
+ end
19
+ ---
20
+ -- @internal For use by internal systems only.
21
+ ____exports.stringToMovementType = function(____string)
22
+ return movementTypeByString[____string] or 0
23
+ end
2
24
  return ____exports
@@ -0,0 +1,6 @@
1
+ /** @noSelfInFile */
2
+ export declare enum UnitAttribute {
3
+ STRENGTH = 1,
4
+ INTELLIGENCE = 2,
5
+ AGILITY = 3
6
+ }
@@ -0,0 +1,9 @@
1
+ local ____exports = {}
2
+ ____exports.UnitAttribute = UnitAttribute or ({})
3
+ ____exports.UnitAttribute.STRENGTH = 1
4
+ ____exports.UnitAttribute[____exports.UnitAttribute.STRENGTH] = "STRENGTH"
5
+ ____exports.UnitAttribute.INTELLIGENCE = 2
6
+ ____exports.UnitAttribute[____exports.UnitAttribute.INTELLIGENCE] = "INTELLIGENCE"
7
+ ____exports.UnitAttribute.AGILITY = 3
8
+ ____exports.UnitAttribute[____exports.UnitAttribute.AGILITY] = "AGILITY"
9
+ return ____exports
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class PermanentInvisibilityAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get shouldAutoAcquireAttackTargets(): boolean[];
7
+ set shouldAutoAcquireAttackTargets(shouldAutoAcquireAttackTargets: ObjectDataEntryLevelFieldValueSupplier<boolean>);
8
+ }
@@ -0,0 +1,26 @@
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.PermanentInvisibilityAbilityType = __TS__Class()
9
+ local PermanentInvisibilityAbilityType = ____exports.PermanentInvisibilityAbilityType
10
+ PermanentInvisibilityAbilityType.name = "PermanentInvisibilityAbilityType"
11
+ __TS__ClassExtends(PermanentInvisibilityAbilityType, AbilityType)
12
+ PermanentInvisibilityAbilityType.BASE_ID = fourCC("Apiv")
13
+ __TS__SetDescriptor(
14
+ PermanentInvisibilityAbilityType.prototype,
15
+ "shouldAutoAcquireAttackTargets",
16
+ {
17
+ get = function(self)
18
+ return self:getBooleanLevelField("Gho1")
19
+ end,
20
+ set = function(self, shouldAutoAcquireAttackTargets)
21
+ self:setBooleanLevelField("Gho1", shouldAutoAcquireAttackTargets)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ return ____exports
@@ -9,4 +9,14 @@ export declare class SlowPoisonAbilityType extends AbilityType {
9
9
  set movementSpeedDecreaseFactor(movementSpeedDecreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
10
10
  get attackSpeedDecreaseFactor(): number[];
11
11
  set attackSpeedDecreaseFactor(attackSpeedDecreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
12
+ get isDamageStacking(): boolean[];
13
+ set isDamageStacking(isDamageStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
14
+ get isMovementSpeedFactorStacking(): boolean[];
15
+ set isMovementSpeedFactorStacking(isMovementSpeedFactorStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
16
+ get isAttackSpeedFactorStacking(): boolean[];
17
+ set isAttackSpeedFactorStacking(isAttackSpeedFactorStacking: ObjectDataEntryLevelFieldValueSupplier<boolean>);
18
+ get isAbleToKill(): boolean[];
19
+ set isAbleToKill(isAbleToKill: ObjectDataEntryLevelFieldValueSupplier<boolean>);
20
+ private setOption;
21
+ private getOption;
12
22
  }
@@ -9,6 +9,12 @@ ____exports.SlowPoisonAbilityType = __TS__Class()
9
9
  local SlowPoisonAbilityType = ____exports.SlowPoisonAbilityType
10
10
  SlowPoisonAbilityType.name = "SlowPoisonAbilityType"
11
11
  __TS__ClassExtends(SlowPoisonAbilityType, AbilityType)
12
+ function SlowPoisonAbilityType.prototype.setOption(self, option, supplier)
13
+ self:setFlagLevelFieldValue("Spo4", option, supplier)
14
+ end
15
+ function SlowPoisonAbilityType.prototype.getOption(self, option)
16
+ return self:getFlagLevelFieldValue("Spo4", option)
17
+ end
12
18
  SlowPoisonAbilityType.BASE_ID = fourCC("Aspo")
13
19
  __TS__SetDescriptor(
14
20
  SlowPoisonAbilityType.prototype,
@@ -49,4 +55,56 @@ __TS__SetDescriptor(
49
55
  },
50
56
  true
51
57
  )
58
+ __TS__SetDescriptor(
59
+ SlowPoisonAbilityType.prototype,
60
+ "isDamageStacking",
61
+ {
62
+ get = function(self)
63
+ return self:getOption(1)
64
+ end,
65
+ set = function(self, isDamageStacking)
66
+ self:setOption(1, isDamageStacking)
67
+ end
68
+ },
69
+ true
70
+ )
71
+ __TS__SetDescriptor(
72
+ SlowPoisonAbilityType.prototype,
73
+ "isMovementSpeedFactorStacking",
74
+ {
75
+ get = function(self)
76
+ return self:getOption(2)
77
+ end,
78
+ set = function(self, isMovementSpeedFactorStacking)
79
+ self:setOption(2, isMovementSpeedFactorStacking)
80
+ end
81
+ },
82
+ true
83
+ )
84
+ __TS__SetDescriptor(
85
+ SlowPoisonAbilityType.prototype,
86
+ "isAttackSpeedFactorStacking",
87
+ {
88
+ get = function(self)
89
+ return self:getOption(4)
90
+ end,
91
+ set = function(self, isAttackSpeedFactorStacking)
92
+ self:setOption(4, isAttackSpeedFactorStacking)
93
+ end
94
+ },
95
+ true
96
+ )
97
+ __TS__SetDescriptor(
98
+ SlowPoisonAbilityType.prototype,
99
+ "isAbleToKill",
100
+ {
101
+ get = function(self)
102
+ return self:getOption(8)
103
+ end,
104
+ set = function(self, isAbleToKill)
105
+ self:setOption(8, isAbleToKill)
106
+ end
107
+ },
108
+ true
109
+ )
52
110
  return ____exports
@@ -35,6 +35,7 @@ local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilit
35
35
  local ____upgrade = require("engine.object-data.entry.upgrade")
36
36
  local Upgrade = ____upgrade.Upgrade
37
37
  local ____sound = require("core.types.sound")
38
+ local isSoundLabelCustom = ____sound.isSoundLabelCustom
38
39
  local Sound3D = ____sound.Sound3D
39
40
  local SoundSettings = ____sound.SoundSettings
40
41
  local castAnimationFQNByAbilityTypeId = {}
@@ -1005,6 +1006,12 @@ for abilityTypeId, soundPresetId in pairs(postcompile(function() return targetEf
1005
1006
  )
1006
1007
  end
1007
1008
  end
1009
+ Unit.abilityChannelingStartEvent:addListener(function(caster, ability)
1010
+ local soundPresetId = ability:getField(ABILITY_SF_EFFECT_SOUND)
1011
+ if isSoundLabelCustom(soundPresetId) then
1012
+ Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
1013
+ end
1014
+ end)
1008
1015
  local casterCastingEffectModelPathsByAbilityTypeId = postcompile(function()
1009
1016
  return mapValues(
1010
1017
  casterCastingEffectPresetsByAbilityTypeId,
@@ -121,6 +121,10 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
121
121
  applicatorAbilityType.damagePerSecond = 0
122
122
  applicatorAbilityType.movementSpeedDecreaseFactor = 0
123
123
  applicatorAbilityType.attackSpeedDecreaseFactor = 0
124
+ applicatorAbilityType.isDamageStacking = false
125
+ applicatorAbilityType.isMovementSpeedFactorStacking = false
126
+ applicatorAbilityType.isAttackSpeedFactorStacking = false
127
+ applicatorAbilityType.isAbleToKill = false
124
128
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id, applicableBuffType.id}
125
129
  applicatorAbilityTypeIdByApplicatorType[852173] = applicatorAbilityType.id
126
130
  end
@@ -128,6 +132,7 @@ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorU
128
132
  local applicatorAbilityType = prepareAbilityType(BerserkAbilityType, applicableBuffType)
129
133
  applicatorAbilityType.attackSpeedIncreaseFactor = 0
130
134
  applicatorAbilityType.movementSpeedIncreaseFactor = 0
135
+ applicatorAbilityType.receivedDamageIncreaseFactor = 0
131
136
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
132
137
  if applicatorAbilityType.levelCount > 1 then
133
138
  multilevelPhysicalPositiveApplicatorAbilityTypes[#multilevelPhysicalPositiveApplicatorAbilityTypes + 1] = applicatorAbilityType