warscript 0.0.1-dev.c677d41 → 0.0.1-dev.c762beb

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/core/types/handle.lua +1 -1
  2. package/core/types/sound.lua +1 -1
  3. package/engine/behaviour/ability/damage.d.ts +3 -0
  4. package/engine/behaviour/ability/damage.lua +8 -2
  5. package/engine/behaviour/ability.d.ts +9 -5
  6. package/engine/behaviour/ability.lua +29 -0
  7. package/engine/buff.d.ts +49 -17
  8. package/engine/buff.lua +241 -118
  9. package/engine/internal/object-data/attribute-bonus.lua +2 -2
  10. package/engine/internal/object-data/health-bonus.d.ts +2 -0
  11. package/engine/internal/object-data/health-bonus.lua +16 -0
  12. package/engine/internal/object-data/mana-bonus.d.ts +2 -0
  13. package/engine/internal/object-data/mana-bonus.lua +16 -0
  14. package/engine/internal/unit/bonus.d.ts +4 -0
  15. package/engine/internal/unit/bonus.lua +23 -3
  16. package/engine/internal/unit/item.lua +1 -1
  17. package/engine/internal/unit/range-event.d.ts +12 -0
  18. package/engine/internal/unit/range-event.lua +90 -0
  19. package/engine/internal/unit+bonus.lua +3 -3
  20. package/engine/internal/unit.d.ts +1 -1
  21. package/engine/internal/unit.lua +9 -30
  22. package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
  23. package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
  24. package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
  25. package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
  26. package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
  27. package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
  28. package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
  29. package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
  30. package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
  31. package/engine/object-data/entry/ability-type.d.ts +2 -0
  32. package/engine/object-data/entry/ability-type.lua +84 -4
  33. package/engine/object-data/entry/buff-type/applicable.lua +113 -109
  34. package/engine/object-field/ability.lua +2 -2
  35. package/engine/object-field.d.ts +1 -1
  36. package/engine/object-field.lua +9 -7
  37. package/engine/random.d.ts +1 -0
  38. package/engine/random.lua +8 -0
  39. package/engine/unit.d.ts +1 -0
  40. package/engine/unit.lua +1 -0
  41. package/lualib_bundle.lua +118 -47
  42. package/objutil/object.lua +1 -1
  43. package/operation.lua +23 -17
  44. package/package.json +4 -4
  45. package/utility/linked-map.d.ts +9 -1
  46. package/utility/linked-map.lua +35 -0
  47. package/utility/linked-set.d.ts +2 -1
  48. package/utility/linked-set.lua +17 -0
  49. /package/engine/internal/object-data/{armor-increase.d.ts → armor-bonus.d.ts} +0 -0
  50. /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
  51. /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
  52. /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
@@ -5,6 +5,8 @@ export type UnitBonusId<Brand extends string = any> = number & {
5
5
  readonly __unitBonusId: unique symbol;
6
6
  readonly __unitBonusIdBrand: Brand;
7
7
  };
8
+ export type UnitMaxHealthBonusId = UnitBonusId<"maxHealth">;
9
+ export type UnitMaxManaBonusId = UnitBonusId<"maxMana">;
8
10
  export type UnitArmorBonusId = UnitBonusId<"armor">;
9
11
  export type UnitAttackSpeedFactorBonusId = UnitBonusId<"attackSpeedFactor">;
10
12
  export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
@@ -30,6 +32,8 @@ export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
30
32
  readonly __unitBonusTypeId?: Id;
31
33
  };
32
34
  export declare namespace UnitBonusType {
35
+ const HEALTH: UnitBonusType<UnitMaxHealthBonusId>;
36
+ const MANA: UnitBonusType<UnitMaxManaBonusId>;
33
37
  const ARMOR: UnitBonusType<UnitArmorBonusId>;
34
38
  const ATTACK_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
35
39
  const MOVEMENT_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
@@ -1,9 +1,9 @@
1
1
  local ____exports = {}
2
2
  local ____unit = require("engine.internal.unit")
3
3
  local Unit = ____unit.Unit
4
- local ____armor_2Dincrease = require("engine.internal.object-data.armor-increase")
5
- local ARMOR_BONUS_DUMMY_ABILITY_FIELD = ____armor_2Dincrease.ARMOR_BONUS_DUMMY_ABILITY_FIELD
6
- local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID = ____armor_2Dincrease.ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID
4
+ local ____armor_2Dbonus = require("engine.internal.object-data.armor-bonus")
5
+ local ARMOR_BONUS_DUMMY_ABILITY_FIELD = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_FIELD
6
+ local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID
7
7
  local ____utility = require("engine.internal.utility")
8
8
  local addInternalAbility = ____utility.addInternalAbility
9
9
  local ____arrays = require("utility.arrays")
@@ -24,6 +24,12 @@ local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspee
24
24
  local ____evasion_2Dprobability = require("engine.internal.object-data.evasion-probability")
25
25
  local EVASION_PROBABILITY_ABILITY_FIELD = ____evasion_2Dprobability.EVASION_PROBABILITY_ABILITY_FIELD
26
26
  local EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = ____evasion_2Dprobability.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID
27
+ local ____health_2Dbonus = require("engine.internal.object-data.health-bonus")
28
+ local HEALTH_BONUS_DUMMY_ABILITY_FIELD = ____health_2Dbonus.HEALTH_BONUS_DUMMY_ABILITY_FIELD
29
+ local HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID = ____health_2Dbonus.HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID
30
+ local ____mana_2Dbonus = require("engine.internal.object-data.mana-bonus")
31
+ local MANA_BONUS_DUMMY_ABILITY_FIELD = ____mana_2Dbonus.MANA_BONUS_DUMMY_ABILITY_FIELD
32
+ local MANA_BONUS_DUMMY_ABILITY_TYPE_ID = ____mana_2Dbonus.MANA_BONUS_DUMMY_ABILITY_TYPE_ID
27
33
  local ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor = require("engine.internal.object-data.mana-regeneration-rate-increase-factor")
28
34
  local MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD
29
35
  local MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
@@ -39,6 +45,20 @@ end
39
45
  ____exports.UnitBonusType = {}
40
46
  local UnitBonusType = ____exports.UnitBonusType
41
47
  do
48
+ UnitBonusType.HEALTH = {
49
+ abilityTypeId = HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID,
50
+ field = HEALTH_BONUS_DUMMY_ABILITY_FIELD,
51
+ integer = true,
52
+ reduce = sum,
53
+ initialValue = 0
54
+ }
55
+ UnitBonusType.MANA = {
56
+ abilityTypeId = MANA_BONUS_DUMMY_ABILITY_TYPE_ID,
57
+ field = MANA_BONUS_DUMMY_ABILITY_FIELD,
58
+ integer = true,
59
+ reduce = sum,
60
+ initialValue = 0
61
+ }
42
62
  UnitBonusType.ARMOR = {
43
63
  abilityTypeId = ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID,
44
64
  field = ARMOR_BONUS_DUMMY_ABILITY_FIELD,
@@ -21,7 +21,7 @@ local unitRemoveItemFromSlot = UnitRemoveItemFromSlot
21
21
  local handleByUnitItems = setmetatable({}, {__mode = "k"})
22
22
  local function unitItemsNext(handle, index)
23
23
  local slot = index & 7
24
- if index >> 3 == slot then
24
+ if (index & 4294967295) >> 3 == slot then
25
25
  return nil, nil
26
26
  end
27
27
  return index + 1, Item:of(unitItemInSlot(handle, slot))
@@ -0,0 +1,12 @@
1
+ /** @noSelfInFile */
2
+ import { Event } from "../../../event";
3
+ declare module "../unit" {
4
+ interface Unit {
5
+ readonly unitInRangeEvent: Record<number, Event<[unit: Unit, range: number, unitInRange: Unit]>>;
6
+ }
7
+ }
8
+ declare module "../unit" {
9
+ interface Unit {
10
+ readonly unitOutOfRangeEvent: Record<number, Event<[unit: Unit, range: number, unitOutOfRange: Unit]>>;
11
+ }
12
+ }
@@ -0,0 +1,90 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
4
+ local ____exports = {}
5
+ local ____event = require("event")
6
+ local Event = ____event.Event
7
+ local InitializingEvent = ____event.InitializingEvent
8
+ local TriggerEvent = ____event.TriggerEvent
9
+ local ____unit = require("engine.internal.unit")
10
+ local Unit = ____unit.Unit
11
+ local ____timer = require("core.types.timer")
12
+ local Timer = ____timer.Timer
13
+ local ____attributes = require("attributes")
14
+ local attribute = ____attributes.attribute
15
+ local ____linked_2Dmap = require("utility.linked-map")
16
+ local mutableLinkedMap = ____linked_2Dmap.mutableLinkedMap
17
+ local ____linked_2Dset = require("utility.linked-set")
18
+ local LinkedSet = ____linked_2Dset.LinkedSet
19
+ local mutableLinkedSet = ____linked_2Dset.mutableLinkedSet
20
+ local getTriggerUnit = GetTriggerUnit
21
+ local triggerRegisterUnitInRange = TriggerRegisterUnitInRange
22
+ local eventInvoke = Event.invoke
23
+ __TS__ObjectDefineProperty(
24
+ Unit.prototype,
25
+ "unitInRangeEvent",
26
+ {get = function(self)
27
+ local unit = self
28
+ local handle = self.handle
29
+ local unitInRangeEvent = setmetatable(
30
+ {},
31
+ {__index = function(self, value)
32
+ local event = __TS__New(
33
+ TriggerEvent,
34
+ function(trigger)
35
+ triggerRegisterUnitInRange(trigger, handle, value, nil)
36
+ end,
37
+ function() return unit, value, Unit:of(getTriggerUnit()) end
38
+ )
39
+ rawset(self, value, event)
40
+ return event
41
+ end}
42
+ )
43
+ rawset(self, "unitInRangeEvent", unitInRangeEvent)
44
+ return unitInRangeEvent
45
+ end}
46
+ )
47
+ local units = __TS__New(LinkedSet)
48
+ local unitsInRangeByRangeAttribute = attribute()
49
+ local function registerUnitOfRangeEvent(unit, range, unitInRange)
50
+ units:add(unit)
51
+ unit:getOrPut(unitsInRangeByRangeAttribute, mutableLinkedMap):getOrPut(range, mutableLinkedSet):add(unitInRange)
52
+ end
53
+ __TS__ObjectDefineProperty(
54
+ Unit.prototype,
55
+ "unitOutOfRangeEvent",
56
+ {get = function(self)
57
+ local unit = self
58
+ local unitOutOfRangeEvent = setmetatable(
59
+ {},
60
+ {__index = function(self, value)
61
+ local event = __TS__New(
62
+ InitializingEvent,
63
+ function()
64
+ unit.unitInRangeEvent[value]:addListener(999999, registerUnitOfRangeEvent)
65
+ end
66
+ )
67
+ rawset(self, value, event)
68
+ return event
69
+ end}
70
+ )
71
+ rawset(self, "unitOutOfRangeEvent", unitOutOfRangeEvent)
72
+ return unitOutOfRangeEvent
73
+ end}
74
+ )
75
+ Timer.onPeriod[1]:addListener(function()
76
+ for unit in pairs(units) do
77
+ local unitsInRangeByRange = unit[unitsInRangeByRangeAttribute]
78
+ if unitsInRangeByRange ~= nil then
79
+ for range, unitsInRange in pairs(unitsInRangeByRange) do
80
+ for unitInRange in pairs(unitsInRange) do
81
+ if unit:getDistanceTo(unitInRange) > range then
82
+ unitsInRange:remove(unitInRange)
83
+ eventInvoke(unit.unitOutOfRangeEvent[range], unit, range, unitInRange)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end)
90
+ return ____exports
@@ -3,9 +3,9 @@ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
3
3
  local ____exports = {}
4
4
  local ____unit = require("engine.internal.unit")
5
5
  local Unit = ____unit.Unit
6
- local ____armor_2Dincrease = require("engine.internal.object-data.armor-increase")
7
- local ARMOR_BONUS_DUMMY_ABILITY_FIELD = ____armor_2Dincrease.ARMOR_BONUS_DUMMY_ABILITY_FIELD
8
- local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID = ____armor_2Dincrease.ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID
6
+ local ____armor_2Dbonus = require("engine.internal.object-data.armor-bonus")
7
+ local ARMOR_BONUS_DUMMY_ABILITY_FIELD = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_FIELD
8
+ local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID
9
9
  local getUnitAbility = BlzGetUnitAbility
10
10
  local setAbilityRealLevelField = BlzSetAbilityRealLevelField
11
11
  local unitAddAbility = UnitAddAbility
@@ -139,6 +139,7 @@ export declare class Unit extends Handle<junit> {
139
139
  private _fields?;
140
140
  private getEvent;
141
141
  constructor(handle: junit);
142
+ private saveData;
142
143
  protected onDestroy(): HandleDestructor;
143
144
  addAttackHandler(condition: AttackHandlerCondition, action: AttackHandlerAction): AttackHandler;
144
145
  removeAttackHandler(handler: AttackHandler): boolean;
@@ -291,7 +292,6 @@ export declare class Unit extends Handle<junit> {
291
292
  set waygateDestination(v: Vec2);
292
293
  get waygateDestination(): Vec2;
293
294
  get abilities(): ReadonlyArray<UnitAbility>;
294
- get onUnitInRange(): Record<number, Event<[Unit]>>;
295
295
  get onManaEqual(): Record<number, Event<[Unit, number]>>;
296
296
  get manaEvent(): Record<Operator, Record<number, Event<[Unit]>>>;
297
297
  get targetAcquiredEvent(): Event;
@@ -752,13 +752,15 @@ function Unit.prototype.getEvent(self, jevent, collector)
752
752
  end
753
753
  return event
754
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))
760
+ end
755
761
  function Unit.prototype.onDestroy(self)
756
762
  local handle = self.handle
757
- self[108] = getUnitX(handle)
758
- self[109] = getUnitY(handle)
759
- if not self._owner then
760
- self._owner = Player:of(getOwningPlayer(handle))
761
- end
763
+ self:saveData()
762
764
  local abilities = self.abilities
763
765
  for ____, ability in ipairs(abilities) do
764
766
  ability:destroy()
@@ -1987,30 +1989,6 @@ __TS__SetDescriptor(
1987
1989
  end},
1988
1990
  true
1989
1991
  )
1990
- __TS__SetDescriptor(
1991
- Unit.prototype,
1992
- "onUnitInRange",
1993
- {get = function(self)
1994
- local handle = self.handle
1995
- local onUnitInRange = setmetatable(
1996
- {},
1997
- {__index = function(self, value)
1998
- local event = __TS__New(
1999
- TriggerEvent,
2000
- function(trigger)
2001
- TriggerRegisterUnitInRangeSimple(trigger, value, handle)
2002
- end,
2003
- function() return ____exports.Unit:of(handle) end
2004
- )
2005
- rawset(self, value, event)
2006
- return event
2007
- end}
2008
- )
2009
- rawset(self, "onUnitInRange", onUnitInRange)
2010
- return onUnitInRange
2011
- end},
2012
- true
2013
- )
2014
1992
  __TS__SetDescriptor(
2015
1993
  Unit.prototype,
2016
1994
  "onManaEqual",
@@ -2809,7 +2787,8 @@ Unit.synchronize = synchronizer(
2809
2787
  return
2810
2788
  end
2811
2789
  end
2812
- unit:destroy()
2790
+ unit:saveData()
2791
+ Timer:run(unit, "destroy")
2813
2792
  end)
2814
2793
  end
2815
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
@@ -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