warscript 0.0.1-dev.f074376 → 0.0.1-dev.f0daa48

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 (67) hide show
  1. package/core/types/sound.lua +1 -1
  2. package/engine/behaviour/ability.d.ts +9 -5
  3. package/engine/behaviour/ability.lua +29 -0
  4. package/engine/behaviour/unit/stun-immunity.d.ts +1 -1
  5. package/engine/behaviour/unit/stun-immunity.lua +5 -4
  6. package/engine/behaviour/unit.lua +13 -3
  7. package/engine/buff.d.ts +52 -19
  8. package/engine/buff.lua +266 -141
  9. package/engine/internal/mechanics/cast-ability.lua +6 -3
  10. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  11. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  12. package/engine/internal/object-data/health-bonus.lua +16 -0
  13. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  14. package/engine/internal/object-data/mana-bonus.lua +16 -0
  15. package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +1 -1
  16. package/engine/internal/unit/attributes.d.ts +17 -0
  17. package/engine/internal/unit/attributes.lua +46 -0
  18. package/engine/internal/unit/bonus.d.ts +4 -0
  19. package/engine/internal/unit/bonus.lua +23 -3
  20. package/engine/internal/unit/fly-height.lua +3 -3
  21. package/engine/internal/unit/interrupts.d.ts +12 -0
  22. package/engine/internal/unit/interrupts.lua +28 -0
  23. package/engine/internal/unit/item.lua +1 -1
  24. package/engine/internal/unit/range-event.d.ts +12 -0
  25. package/engine/internal/unit/range-event.lua +90 -0
  26. package/engine/internal/unit/scale.lua +3 -3
  27. package/engine/internal/unit+bonus.lua +3 -3
  28. package/engine/internal/unit-missile-launch.lua +12 -5
  29. package/engine/internal/unit.d.ts +2 -9
  30. package/engine/internal/unit.lua +79 -121
  31. package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
  32. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
  33. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  34. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  35. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  36. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  37. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  38. package/engine/object-data/entry/ability-type/mana-regeneration.lua +1 -1
  39. package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
  40. package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
  41. package/engine/object-data/entry/ability-type.d.ts +2 -0
  42. package/engine/object-data/entry/ability-type.lua +84 -4
  43. package/engine/object-data/entry/buff-type/applicable.lua +113 -109
  44. package/engine/object-field/ability.lua +2 -2
  45. package/engine/object-field.d.ts +3 -1
  46. package/engine/object-field.lua +42 -18
  47. package/engine/random.d.ts +1 -0
  48. package/engine/random.lua +8 -0
  49. package/engine/standard/fields/unit.d.ts +11 -6
  50. package/engine/standard/fields/unit.lua +12 -5
  51. package/engine/unit.d.ts +3 -0
  52. package/engine/unit.lua +3 -0
  53. package/lualib_bundle.lua +118 -47
  54. package/objutil/buff.lua +9 -7
  55. package/objutil/object.lua +1 -1
  56. package/operation.lua +23 -17
  57. package/package.json +5 -5
  58. package/patch-lua.lua +15 -0
  59. package/utility/linked-map.d.ts +34 -0
  60. package/utility/linked-map.lua +101 -0
  61. package/utility/linked-set.d.ts +2 -1
  62. package/utility/linked-set.lua +21 -0
  63. package/utility/records.lua +20 -1
  64. /package/engine/internal/object-data/{armor-increase.d.ts → armor-bonus.d.ts} +0 -0
  65. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  66. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  67. /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
@@ -64,6 +64,8 @@ local ____ability = require("engine.internal.item.ability")
64
64
  local doUnitAbilityAction = ____ability.doUnitAbilityAction
65
65
  local ____synchronization = require("engine.synchronization")
66
66
  local synchronizer = ____synchronization.synchronizer
67
+ local ____linked_2Dmap = require("utility.linked-map")
68
+ local LinkedMap = ____linked_2Dmap.LinkedMap
67
69
  local match = string.match
68
70
  local ____tostring = _G.tostring
69
71
  local setUnitAnimation = SetUnitAnimation
@@ -73,16 +75,12 @@ local getUnitRealField = BlzGetUnitRealField
73
75
  local getHeroStr = GetHeroStr
74
76
  local getHeroAgi = GetHeroAgi
75
77
  local getHeroInt = GetHeroInt
76
- local setHeroStr = SetHeroStr
77
- local setHeroAgi = SetHeroAgi
78
- local setHeroInt = SetHeroInt
79
78
  local getUnitBooleanField = BlzGetUnitBooleanField
80
79
  local getUnitStringField = BlzGetUnitStringField
81
80
  local setUnitIntegerField = BlzSetUnitIntegerField
82
81
  local setUnitRealField = BlzSetUnitRealField
83
82
  local setUnitBooleanField = BlzSetUnitBooleanField
84
83
  local setUnitStringField = BlzSetUnitStringField
85
- local setUnitScale = SetUnitScale
86
84
  local setUnitPosition = SetUnitPosition
87
85
  local setUnitTimeScale = SetUnitTimeScale
88
86
  local getHandleId = GetHandleId
@@ -110,7 +108,6 @@ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
110
108
  local setUnitWeaponStringField = BlzSetUnitWeaponStringField
111
109
  local getUnitAbilityLevel = GetUnitAbilityLevel
112
110
  local unitDisableAbility = BlzUnitDisableAbility
113
- local unitInterruptAttack = BlzUnitInterruptAttack
114
111
  local isUnitInvisible = IsUnitInvisible
115
112
  local isUnitVisible = IsUnitVisible
116
113
  local getUnitX = GetUnitX
@@ -386,15 +383,27 @@ local modifiers = {
386
383
  end,
387
384
  armor = function(unit, value)
388
385
  if UnitAddAbility(unit, armorBonusAbilityId) then
389
- assert(UnitMakeAbilityPermanent(unit, true, armorBonusAbilityId))
386
+ assert(
387
+ UnitMakeAbilityPermanent(unit, true, armorBonusAbilityId),
388
+ "armor bonus ability must be made permanent",
389
+ unit
390
+ )
390
391
  end
391
- local ability = assert(BlzGetUnitAbility(unit, armorBonusAbilityId))
392
- assert(BlzSetAbilityRealLevelField(
393
- ability,
394
- armorBonusField,
395
- 0,
396
- BlzGetAbilityRealLevelField(ability, armorBonusField, 0) + value
397
- ))
392
+ local ability = assert(
393
+ BlzGetUnitAbility(unit, armorBonusAbilityId),
394
+ "armor bonus ability must be existing",
395
+ unit
396
+ )
397
+ assert(
398
+ BlzSetAbilityRealLevelField(
399
+ ability,
400
+ armorBonusField,
401
+ 0,
402
+ BlzGetAbilityRealLevelField(ability, armorBonusField, 0) + value
403
+ ),
404
+ "armor bonus ability field must be set",
405
+ unit
406
+ )
398
407
  end
399
408
  }
400
409
  local getters = {
@@ -648,13 +657,17 @@ local fieldSetters = {
648
657
  }
649
658
  local dummies = {}
650
659
  for ____, player in ipairs(Player.all) do
651
- local dummy = assert(createUnit(
652
- player.handle,
653
- dummyUnitId,
654
- 0,
655
- 0,
656
- 270
657
- ))
660
+ local dummy = assert(
661
+ createUnit(
662
+ player.handle,
663
+ dummyUnitId,
664
+ 0,
665
+ 0,
666
+ 270
667
+ ),
668
+ "dummy must be created",
669
+ player
670
+ )
658
671
  ShowUnit(dummy, false)
659
672
  dummies[player] = dummy
660
673
  end
@@ -697,41 +710,57 @@ function Unit.prototype.____constructor(self, handle)
697
710
  nextSyncId = ____nextSyncId_1 + 1
698
711
  self.syncId = ____nextSyncId_1
699
712
  self._owner = Player:of(getOwningPlayer(handle))
700
- assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
701
- assert(unitAddAbility(handle, morphDetectAbilityId))
713
+ assert(
714
+ unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId),
715
+ "leave detection ability must be added",
716
+ self
717
+ )
718
+ assert(
719
+ unitAddAbility(handle, morphDetectAbilityId),
720
+ "morph detection ability must be added",
721
+ self
722
+ )
702
723
  if unitAddAbility(
703
724
  handle,
704
725
  fourCC("Amrf")
705
726
  ) then
706
- assert(unitRemoveAbility(
707
- handle,
708
- fourCC("Amrf")
709
- ))
727
+ assert(
728
+ unitRemoveAbility(
729
+ handle,
730
+ fourCC("Amrf")
731
+ ),
732
+ "fly ability must be removed after addition",
733
+ self
734
+ )
710
735
  end
711
736
  unitBySyncId[self.syncId] = self
712
737
  local ____ = self.abilities
713
738
  end
714
- function Unit.prototype.getEvent(self, event, collector)
715
- self.events = self.events or ({})
716
- local eventId = GetHandleId(event)
717
- if not self.events[eventId] then
718
- self.events[eventId] = __TS__New(
739
+ function Unit.prototype.getEvent(self, jevent, collector)
740
+ self.events = self.events or __TS__New(LinkedMap)
741
+ local eventId = GetHandleId(jevent)
742
+ local event = self.events:get(eventId)
743
+ if event == nil then
744
+ event = __TS__New(
719
745
  TriggerEvent,
720
746
  function(trigger)
721
- TriggerRegisterUnitEvent(trigger, self.handle, event)
747
+ TriggerRegisterUnitEvent(trigger, self.handle, jevent)
722
748
  end,
723
749
  collector or (function() return {} end)
724
750
  )
751
+ self.events:put(eventId, event)
725
752
  end
726
- return self.events[eventId]
753
+ return event
754
+ end
755
+ function Unit.prototype.saveData(self)
756
+ local handle = self.handle
757
+ self[108] = self[108] or getUnitX(handle)
758
+ self[109] = self[109] or getUnitY(handle)
759
+ self._owner = self._owner or Player:of(getOwningPlayer(handle))
727
760
  end
728
761
  function Unit.prototype.onDestroy(self)
729
762
  local handle = self.handle
730
- self[108] = getUnitX(handle)
731
- self[109] = getUnitY(handle)
732
- if not self._owner then
733
- self._owner = Player:of(getOwningPlayer(handle))
734
- end
763
+ self:saveData()
735
764
  local abilities = self.abilities
736
765
  for ____, ability in ipairs(abilities) do
737
766
  ability:destroy()
@@ -767,7 +796,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
767
796
  self._attackHandlers = handlers
768
797
  if #handlers == 1 then
769
798
  local handle = self.handle
770
- assert(unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId))
799
+ assert(
800
+ unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
801
+ "attack handler ability must be added",
802
+ self
803
+ )
771
804
  end
772
805
  return handler
773
806
  end
@@ -980,24 +1013,6 @@ end
980
1013
  function Unit.prototype.endAbilityCooldown(self, abilityId)
981
1014
  BlzEndUnitAbilityCooldown(self.handle, abilityId)
982
1015
  end
983
- function Unit.prototype.interruptMovement(self)
984
- local handle = self.handle
985
- unitDisableAbility(
986
- handle,
987
- fourCC("Amov"),
988
- true,
989
- false
990
- )
991
- unitDisableAbility(
992
- handle,
993
- fourCC("Amov"),
994
- false,
995
- false
996
- )
997
- end
998
- function Unit.prototype.interruptAttack(self)
999
- unitInterruptAttack(self.handle)
1000
- end
1001
1016
  function Unit.prototype.interruptCast(self, abilityId)
1002
1017
  local handle = self.handle
1003
1018
  unitDisableAbility(handle, abilityId, true, false)
@@ -1392,19 +1407,6 @@ __TS__SetDescriptor(
1392
1407
  },
1393
1408
  true
1394
1409
  )
1395
- __TS__SetDescriptor(
1396
- Unit.prototype,
1397
- "strengthBase",
1398
- {
1399
- get = function(self)
1400
- return getHeroStr(self.handle, false)
1401
- end,
1402
- set = function(self, strengthBase)
1403
- setHeroStr(self.handle, strengthBase, true)
1404
- end
1405
- },
1406
- true
1407
- )
1408
1410
  __TS__SetDescriptor(
1409
1411
  Unit.prototype,
1410
1412
  "strengthBonus",
@@ -1422,19 +1424,6 @@ __TS__SetDescriptor(
1422
1424
  end},
1423
1425
  true
1424
1426
  )
1425
- __TS__SetDescriptor(
1426
- Unit.prototype,
1427
- "agilityBase",
1428
- {
1429
- get = function(self)
1430
- return getHeroAgi(self.handle, false)
1431
- end,
1432
- set = function(self, agilityBase)
1433
- setHeroAgi(self.handle, agilityBase, true)
1434
- end
1435
- },
1436
- true
1437
- )
1438
1427
  __TS__SetDescriptor(
1439
1428
  Unit.prototype,
1440
1429
  "agilityBonus",
@@ -1452,19 +1441,6 @@ __TS__SetDescriptor(
1452
1441
  end},
1453
1442
  true
1454
1443
  )
1455
- __TS__SetDescriptor(
1456
- Unit.prototype,
1457
- "intelligenceBase",
1458
- {
1459
- get = function(self)
1460
- return getHeroInt(self.handle, false)
1461
- end,
1462
- set = function(self, intelligenceBase)
1463
- setHeroInt(self.handle, intelligenceBase, true)
1464
- end
1465
- },
1466
- true
1467
- )
1468
1444
  __TS__SetDescriptor(
1469
1445
  Unit.prototype,
1470
1446
  "intelligenceBonus",
@@ -2013,30 +1989,6 @@ __TS__SetDescriptor(
2013
1989
  end},
2014
1990
  true
2015
1991
  )
2016
- __TS__SetDescriptor(
2017
- Unit.prototype,
2018
- "onUnitInRange",
2019
- {get = function(self)
2020
- local handle = self.handle
2021
- local onUnitInRange = setmetatable(
2022
- {},
2023
- {__index = function(self, value)
2024
- local event = __TS__New(
2025
- TriggerEvent,
2026
- function(trigger)
2027
- TriggerRegisterUnitInRangeSimple(trigger, value, handle)
2028
- end,
2029
- function() return ____exports.Unit:of(handle) end
2030
- )
2031
- rawset(self, value, event)
2032
- return event
2033
- end}
2034
- )
2035
- rawset(self, "onUnitInRange", onUnitInRange)
2036
- return onUnitInRange
2037
- end},
2038
- true
2039
- )
2040
1992
  __TS__SetDescriptor(
2041
1993
  Unit.prototype,
2042
1994
  "onManaEqual",
@@ -2172,6 +2124,11 @@ __TS__SetDescriptor(
2172
2124
  end},
2173
2125
  true
2174
2126
  )
2127
+ Unit.levelChangedEvent = __TS__New(
2128
+ ____exports.UnitTriggerEvent,
2129
+ EVENT_PLAYER_HERO_LEVEL,
2130
+ function() return ____exports.Unit:of(getTriggerUnit()) end
2131
+ )
2175
2132
  Unit.deathEvent = __TS__New(
2176
2133
  ____exports.UnitTriggerEvent,
2177
2134
  EVENT_PLAYER_UNIT_DEATH,
@@ -2830,7 +2787,8 @@ Unit.synchronize = synchronizer(
2830
2787
  return
2831
2788
  end
2832
2789
  end
2833
- unit:destroy()
2790
+ unit:saveData()
2791
+ Timer:run(unit, "destroy")
2834
2792
  end)
2835
2793
  end
2836
2794
  end)(Unit)
@@ -1,5 +1,5 @@
1
1
  local ____exports = {}
2
- ____exports.UnitAttribute = UnitAttribute or ({})
2
+ ____exports.UnitAttribute = ____exports.UnitAttribute or ({})
3
3
  ____exports.UnitAttribute.STRENGTH = 1
4
4
  ____exports.UnitAttribute[____exports.UnitAttribute.STRENGTH] = "STRENGTH"
5
5
  ____exports.UnitAttribute.INTELLIGENCE = 2
@@ -1,8 +1,8 @@
1
1
  /** @noSelfInFile */
2
2
  import { AbilityType, AbilityTypeId } from "../ability-type";
3
3
  import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
- export declare class ArmorIncreaseAbilityType extends AbilityType {
4
+ export declare class ArmorBonusAbilityType extends AbilityType {
5
5
  static readonly BASE_ID: AbilityTypeId;
6
- get armorIncrease(): number[];
7
- set armorIncrease(armorIncrease: ObjectDataEntryLevelFieldValueSupplier<number>);
6
+ get armorBonus(): number[];
7
+ set armorBonus(armorBonus: ObjectDataEntryLevelFieldValueSupplier<number>);
8
8
  }
@@ -5,20 +5,20 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
5
  local ____exports = {}
6
6
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
7
  local AbilityType = ____ability_2Dtype.AbilityType
8
- ____exports.ArmorIncreaseAbilityType = __TS__Class()
9
- local ArmorIncreaseAbilityType = ____exports.ArmorIncreaseAbilityType
10
- ArmorIncreaseAbilityType.name = "ArmorIncreaseAbilityType"
11
- __TS__ClassExtends(ArmorIncreaseAbilityType, AbilityType)
12
- ArmorIncreaseAbilityType.BASE_ID = fourCC("AId1")
8
+ ____exports.ArmorBonusAbilityType = __TS__Class()
9
+ local ArmorBonusAbilityType = ____exports.ArmorBonusAbilityType
10
+ ArmorBonusAbilityType.name = "ArmorBonusAbilityType"
11
+ __TS__ClassExtends(ArmorBonusAbilityType, AbilityType)
12
+ ArmorBonusAbilityType.BASE_ID = fourCC("AId1")
13
13
  __TS__SetDescriptor(
14
- ArmorIncreaseAbilityType.prototype,
15
- "armorIncrease",
14
+ ArmorBonusAbilityType.prototype,
15
+ "armorBonus",
16
16
  {
17
17
  get = function(self)
18
18
  return self:getNumberLevelField("Idef")
19
19
  end,
20
- set = function(self, armorIncrease)
21
- self:setNumberLevelField("Idef", armorIncrease)
20
+ set = function(self, armorBonus)
21
+ self:setNumberLevelField("Idef", armorBonus)
22
22
  end
23
23
  },
24
24
  true
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class HealthBonusAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get healthBonus(): number[];
7
+ set healthBonus(healthBonus: ObjectDataEntryLevelFieldValueSupplier<number>);
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.HealthBonusAbilityType = __TS__Class()
9
+ local HealthBonusAbilityType = ____exports.HealthBonusAbilityType
10
+ HealthBonusAbilityType.name = "HealthBonusAbilityType"
11
+ __TS__ClassExtends(HealthBonusAbilityType, AbilityType)
12
+ HealthBonusAbilityType.BASE_ID = fourCC("AIlf")
13
+ __TS__SetDescriptor(
14
+ HealthBonusAbilityType.prototype,
15
+ "healthBonus",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Ilif")
19
+ end,
20
+ set = function(self, healthBonus)
21
+ self:setNumberLevelField("Ilif", healthBonus)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ return ____exports
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class ManaBonusAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get manaBonus(): number[];
7
+ set manaBonus(manaBonus: ObjectDataEntryLevelFieldValueSupplier<number>);
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.ManaBonusAbilityType = __TS__Class()
9
+ local ManaBonusAbilityType = ____exports.ManaBonusAbilityType
10
+ ManaBonusAbilityType.name = "ManaBonusAbilityType"
11
+ __TS__ClassExtends(ManaBonusAbilityType, AbilityType)
12
+ ManaBonusAbilityType.BASE_ID = fourCC("AImb")
13
+ __TS__SetDescriptor(
14
+ ManaBonusAbilityType.prototype,
15
+ "manaBonus",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Iman")
19
+ end,
20
+ set = function(self, manaBonus)
21
+ self:setNumberLevelField("Iman", manaBonus)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ return ____exports
@@ -9,7 +9,7 @@ ____exports.ManaRegenerationAbilityType = __TS__Class()
9
9
  local ManaRegenerationAbilityType = ____exports.ManaRegenerationAbilityType
10
10
  ManaRegenerationAbilityType.name = "ManaRegenerationAbilityType"
11
11
  __TS__ClassExtends(ManaRegenerationAbilityType, AbilityType)
12
- ManaRegenerationAbilityType.BASE_ID = fourCC("AIrm")
12
+ ManaRegenerationAbilityType.BASE_ID = fourCC("AIrn")
13
13
  __TS__SetDescriptor(
14
14
  ManaRegenerationAbilityType.prototype,
15
15
  "manaRegenerationRateIncreaseFactor",
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class ReincarnationAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get reincarnationDelay(): number[];
7
+ set reincarnationDelay(reincarnationDelay: ObjectDataEntryLevelFieldValueSupplier<number>);
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.ReincarnationAbilityType = __TS__Class()
9
+ local ReincarnationAbilityType = ____exports.ReincarnationAbilityType
10
+ ReincarnationAbilityType.name = "ReincarnationAbilityType"
11
+ __TS__ClassExtends(ReincarnationAbilityType, AbilityType)
12
+ ReincarnationAbilityType.BASE_ID = fourCC("AOre")
13
+ __TS__SetDescriptor(
14
+ ReincarnationAbilityType.prototype,
15
+ "reincarnationDelay",
16
+ {
17
+ get = function(self)
18
+ return self:getNumberLevelField("Ore1")
19
+ end,
20
+ set = function(self, reincarnationDelay)
21
+ self:setNumberLevelField("Ore1", reincarnationDelay)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ return ____exports
@@ -67,6 +67,8 @@ export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId>
67
67
  set specialAttachmentPreset(specialAttachmentPreset: AttachmentPresetInput | undefined);
68
68
  get targetCastingEffectPresets(): EffectPresetWithParameters[];
69
69
  set targetCastingEffectPresets(targetCastingEffectPresets: AttachmentPresetInput[]);
70
+ get targetChannelingEffectPresets(): EffectPresetWithParameters[];
71
+ set targetChannelingEffectPresets(targetChannelingEffectPresets: EffectPresetWithParametersInput[]);
70
72
  get targetEffectPresets(): TupleOf<EffectPresetWithParameters, 0 | 1 | 2 | 3 | 4 | 5 | 6>;
71
73
  set targetEffectPresets(targetEffectPresets: TupleOf<AttachmentPresetInput, 0 | 1 | 2 | 3 | 4 | 5 | 6>);
72
74
  get targetEffectPresetsSD(): TupleOf<EffectPresetWithParameters, 0 | 1 | 2 | 3 | 4 | 5 | 6>;
@@ -45,6 +45,7 @@ local isButtonVisibleFalseAbilityTypes = {}
45
45
  local casterCastingEffectPresetsByAbilityTypeId = {}
46
46
  local casterChannelingEffectPresetsByAbilityTypeId = {}
47
47
  local targetCastingEffectPresetsByAbilityTypeId = {}
48
+ local targetChannelingEffectPresetsByAbilityTypeId = {}
48
49
  local targetEffectSoundPresetByAbilityTypeId = {}
49
50
  ____exports.AbilityType = __TS__Class()
50
51
  local AbilityType = ____exports.AbilityType
@@ -378,6 +379,19 @@ __TS__SetDescriptor(
378
379
  },
379
380
  true
380
381
  )
382
+ __TS__SetDescriptor(
383
+ AbilityType.prototype,
384
+ "targetChannelingEffectPresets",
385
+ {
386
+ get = function(self)
387
+ return targetChannelingEffectPresetsByAbilityTypeId[self.id] or ({})
388
+ end,
389
+ set = function(self, targetChannelingEffectPresets)
390
+ targetChannelingEffectPresetsByAbilityTypeId[self.id] = map(targetChannelingEffectPresets, toEffectPreset)
391
+ end
392
+ },
393
+ true
394
+ )
381
395
  __TS__SetDescriptor(
382
396
  AbilityType.prototype,
383
397
  "targetEffectPresets",
@@ -1099,18 +1113,84 @@ local function handleAbilityChannelingStartEvent(caster, ability)
1099
1113
  end
1100
1114
  casterChannelingEffectsByCaster[caster] = effects
1101
1115
  end
1116
+ local targetChannelingEffectModelPathsByAbilityTypeId = postcompile(function()
1117
+ return mapValues(
1118
+ targetChannelingEffectPresetsByAbilityTypeId,
1119
+ function(targetChannelingEffectPresets) return map(targetChannelingEffectPresets, extractAttachmentPresetInputModelPath) end
1120
+ )
1121
+ end)
1122
+ local targetChannelingEffectAttachmentPointsByAbilityTypeId = postcompile(function()
1123
+ return mapValues(
1124
+ targetChannelingEffectPresetsByAbilityTypeId,
1125
+ function(targetChannelingEffectPresets) return map(targetChannelingEffectPresets, extractAttachmentPresetInputNodeFQN) end
1126
+ )
1127
+ end)
1128
+ local targetChannelingEffectParametersByAbilityTypeId = postcompile(function()
1129
+ return mapValues(
1130
+ targetChannelingEffectPresetsByAbilityTypeId,
1131
+ function(targetChannelingEffectPresets) return map(targetChannelingEffectPresets, "parameters") end
1132
+ )
1133
+ end)
1134
+ local targetChannelingEffectsByCaster = {}
1135
+ local function handleAbilityWidgetTargetChannelingStartEvent(caster, ability, target)
1136
+ local effectModelPaths = targetChannelingEffectModelPathsByAbilityTypeId[ability.typeId]
1137
+ local attachmentPoints = targetChannelingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
1138
+ local parameters = targetChannelingEffectParametersByAbilityTypeId[ability.typeId]
1139
+ local effects = {}
1140
+ if effectModelPaths ~= nil then
1141
+ for i = 1, #effectModelPaths do
1142
+ local effectModelPath = effectModelPaths[i]
1143
+ local attachmentPoint = attachmentPoints and attachmentPoints[i]
1144
+ if attachmentPoint == nil or attachmentPoint == "" then
1145
+ attachmentPoint = "origin"
1146
+ end
1147
+ effects[i] = Effect:create(effectModelPath, target, attachmentPoint, parameters and parameters[i])
1148
+ end
1149
+ end
1150
+ targetChannelingEffectsByCaster[caster] = effects
1151
+ end
1152
+ local function handleAbilityPointTargetChannelingStartEvent(caster, ability, x, y)
1153
+ local effectModelPaths = targetChannelingEffectModelPathsByAbilityTypeId[ability.typeId]
1154
+ local attachmentPoints = targetChannelingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
1155
+ local parameters = targetChannelingEffectParametersByAbilityTypeId[ability.typeId]
1156
+ local effects = {}
1157
+ if effectModelPaths ~= nil then
1158
+ for i = 1, #effectModelPaths do
1159
+ local effectModelPath = effectModelPaths[i]
1160
+ local attachmentPoint = attachmentPoints and attachmentPoints[i]
1161
+ if attachmentPoint == nil or attachmentPoint == "" then
1162
+ attachmentPoint = "origin"
1163
+ end
1164
+ effects[i] = Effect:create(effectModelPath, x, y, parameters and parameters[i])
1165
+ end
1166
+ end
1167
+ targetChannelingEffectsByCaster[caster] = effects
1168
+ end
1102
1169
  local function handleAbilityStopChannelingEvent(caster)
1103
- local effects = casterChannelingEffectsByCaster[caster]
1104
- if effects ~= nil then
1105
- for i = 1, #effects do
1106
- effects[i]:destroy()
1170
+ local casterEffects = casterChannelingEffectsByCaster[caster]
1171
+ if casterEffects ~= nil then
1172
+ for i = 1, #casterEffects do
1173
+ casterEffects[i]:destroy()
1107
1174
  end
1108
1175
  casterChannelingEffectsByCaster[caster] = nil
1109
1176
  end
1177
+ local targetEffects = targetChannelingEffectsByCaster[caster]
1178
+ if targetEffects ~= nil then
1179
+ for i = 1, #targetEffects do
1180
+ targetEffects[i]:destroy()
1181
+ end
1182
+ targetChannelingEffectsByCaster[caster] = nil
1183
+ end
1110
1184
  end
1111
1185
  for abilityTypeId in pairs(casterChannelingEffectModelPathsByAbilityTypeId) do
1112
1186
  Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityChannelingStartEvent)
1113
1187
  Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1114
1188
  Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1115
1189
  end
1190
+ for abilityTypeId in pairs(targetChannelingEffectModelPathsByAbilityTypeId) do
1191
+ Unit.abilityWidgetTargetChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityWidgetTargetChannelingStartEvent)
1192
+ Unit.abilityPointTargetChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityPointTargetChannelingStartEvent)
1193
+ Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1194
+ Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
1195
+ end
1116
1196
  return ____exports