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
@@ -65,123 +65,127 @@ function ApplicableBuffType.wrap(self, other)
65
65
  return __TS__New(____exports.ApplicableBuffType, other.object)
66
66
  end
67
67
  ApplicableBuffType.BASE_ID = fourCC("BHbz")
68
- local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorUpgradeIdByApplicatorAbilityTypeId = table.unpack(postcompile(function()
69
- local function prepareAbilityType(abilityTypeConstructor, applicableBuffType)
70
- local abilityType = abilityTypeConstructor:create()
71
- abilityType.isInternal = true
72
- abilityType.levelCount = applicableBuffType.levelCount
73
- abilityType.buttonPositionX = 0
74
- abilityType.buttonPositionY = -11
75
- abilityType.casterAttachmentPresets = {}
76
- abilityType.targetEffectPresets = {}
77
- abilityType.casterEffectSoundPresetId = nil
78
- abilityType.learnLevelMinimum = 6
79
- abilityType.race = "other"
80
- abilityType.shouldCheckTechTreeDependencies = false
81
- abilityType.techTreeDependencies = {}
82
- abilityType.allowedTargetCombatClassifications = combatClassificationsOf(
83
- 4,
84
- 2,
85
- 2097152,
86
- 8,
87
- 1048576,
88
- 16
89
- )
90
- abilityType.areaOfEffect = 0
91
- abilityType.castRange = 999999
92
- abilityType.cooldown = 0
93
- abilityType.manaCost = 0
94
- abilityType.buffDuration = 0
95
- abilityType.heroBuffDuration = 0
96
- return abilityType
97
- end
98
- local multilevelPhysicalPositiveApplicatorAbilityTypes = {}
99
- local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId = {}
100
- for applicableBuffType in pairs(compiletimeApplicableBuffTypes) do
101
- local applicatorAbilityTypeIdByApplicatorType = {}
102
- if applicableBuffType.resistanceType == 1 or applicableBuffType.resistanceType == nil then
103
- if applicableBuffType.polarity == 2 or applicableBuffType.polarity == nil then
104
- local applicatorAbilityType = prepareAbilityType(CurseAbilityType, applicableBuffType)
105
- applicatorAbilityType.missProbability = 0
106
- applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
107
- applicatorAbilityTypeIdByApplicatorType[852190] = applicatorAbilityType.id
68
+ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorUpgradeIdByApplicatorAbilityTypeId = table.unpack(
69
+ postcompile(function()
70
+ local function prepareAbilityType(abilityTypeConstructor, applicableBuffType)
71
+ local abilityType = abilityTypeConstructor:create()
72
+ abilityType.isInternal = true
73
+ abilityType.levelCount = applicableBuffType.levelCount
74
+ abilityType.buttonPositionX = 0
75
+ abilityType.buttonPositionY = -11
76
+ abilityType.casterAttachmentPresets = {}
77
+ abilityType.targetEffectPresets = {}
78
+ abilityType.casterEffectSoundPresetId = nil
79
+ abilityType.learnLevelMinimum = 6
80
+ abilityType.race = "other"
81
+ abilityType.shouldCheckTechTreeDependencies = false
82
+ abilityType.techTreeDependencies = {}
83
+ abilityType.allowedTargetCombatClassifications = combatClassificationsOf(
84
+ 4,
85
+ 2,
86
+ 2097152,
87
+ 8,
88
+ 1048576,
89
+ 16
90
+ )
91
+ abilityType.areaOfEffect = 0
92
+ abilityType.castRange = 999999
93
+ abilityType.cooldown = 0
94
+ abilityType.manaCost = 0
95
+ abilityType.buffDuration = 0
96
+ abilityType.heroBuffDuration = 0
97
+ return abilityType
98
+ end
99
+ local multilevelPhysicalPositiveApplicatorAbilityTypes = {}
100
+ local applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId = {}
101
+ for applicableBuffType in pairs(compiletimeApplicableBuffTypes) do
102
+ local applicatorAbilityTypeIdByApplicatorType = {}
103
+ if applicableBuffType.resistanceType == 1 or applicableBuffType.resistanceType == nil then
104
+ if applicableBuffType.polarity == 2 or applicableBuffType.polarity == nil then
105
+ local applicatorAbilityType = prepareAbilityType(CurseAbilityType, applicableBuffType)
106
+ applicatorAbilityType.missProbability = 0
107
+ applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
108
+ applicatorAbilityTypeIdByApplicatorType[852190] = applicatorAbilityType.id
109
+ end
110
+ if applicableBuffType.polarity == 1 or applicableBuffType.polarity == nil then
111
+ local applicatorAbilityType = prepareAbilityType(BloodLustAbilityType, applicableBuffType)
112
+ applicatorAbilityType.attackSpeedIncreaseFactor = 0
113
+ applicatorAbilityType.movementSpeedIncreaseFactor = 0
114
+ applicatorAbilityType.scaleIncrease = 0
115
+ applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
116
+ applicatorAbilityTypeIdByApplicatorType[852101] = applicatorAbilityType.id
117
+ end
108
118
  end
109
- if applicableBuffType.polarity == 1 or applicableBuffType.polarity == nil then
110
- local applicatorAbilityType = prepareAbilityType(BloodLustAbilityType, applicableBuffType)
111
- applicatorAbilityType.attackSpeedIncreaseFactor = 0
112
- applicatorAbilityType.movementSpeedIncreaseFactor = 0
113
- applicatorAbilityType.scaleIncrease = 0
119
+ if applicableBuffType.resistanceType == 2 or applicableBuffType.resistanceType == nil then
120
+ if applicableBuffType.polarity == 2 or applicableBuffType.polarity == nil then
121
+ local applicatorAbilityType = prepareAbilityType(SlowPoisonAbilityType, applicableBuffType)
122
+ applicatorAbilityType.damagePerSecond = 0
123
+ applicatorAbilityType.movementSpeedDecreaseFactor = 0
124
+ applicatorAbilityType.attackSpeedDecreaseFactor = 0
125
+ applicatorAbilityType.isDamageStacking = false
126
+ applicatorAbilityType.isMovementSpeedFactorStacking = false
127
+ applicatorAbilityType.isAttackSpeedFactorStacking = false
128
+ applicatorAbilityType.isAbleToKill = false
129
+ applicatorAbilityType.buffTypeIds = {applicableBuffType.id, applicableBuffType.id}
130
+ applicatorAbilityTypeIdByApplicatorType[852173] = applicatorAbilityType.id
131
+ end
132
+ if applicableBuffType.polarity == 1 or applicableBuffType.polarity == nil then
133
+ local applicatorAbilityType = prepareAbilityType(BerserkAbilityType, applicableBuffType)
134
+ applicatorAbilityType.attackSpeedIncreaseFactor = 0
135
+ applicatorAbilityType.movementSpeedIncreaseFactor = 0
136
+ applicatorAbilityType.receivedDamageIncreaseFactor = 0
137
+ applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
138
+ if applicatorAbilityType.levelCount > 1 then
139
+ multilevelPhysicalPositiveApplicatorAbilityTypes[#multilevelPhysicalPositiveApplicatorAbilityTypes + 1] = applicatorAbilityType
140
+ end
141
+ applicatorAbilityTypeIdByApplicatorType[852100] = applicatorAbilityType.id
142
+ end
143
+ end
144
+ if applicableBuffType.polarity == 0 or applicableBuffType.polarity == nil then
145
+ local applicatorAbilityType = prepareAbilityType(PermanentImmolationAbilityType, applicableBuffType)
146
+ applicatorAbilityType.levelCount = 1
147
+ applicatorAbilityType.damagePerInterval = 0
148
+ applicatorAbilityType.castRange = 0
149
+ applicatorAbilityType.buffDuration = MAXIMUM_INTEGER
150
+ applicatorAbilityType.heroBuffDuration = MAXIMUM_INTEGER
151
+ applicatorAbilityType.allowedTargetCombatClassifications = combatClassificationsOf(1)
114
152
  applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
115
- applicatorAbilityTypeIdByApplicatorType[852101] = applicatorAbilityType.id
153
+ applicatorAbilityTypeIdByApplicatorType[0] = applicatorAbilityType.id
116
154
  end
155
+ applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId[applicableBuffType.id] = applicatorAbilityTypeIdByApplicatorType
117
156
  end
118
- if applicableBuffType.resistanceType == 2 or applicableBuffType.resistanceType == nil then
119
- if applicableBuffType.polarity == 2 or applicableBuffType.polarity == nil then
120
- local applicatorAbilityType = prepareAbilityType(SlowPoisonAbilityType, applicableBuffType)
121
- applicatorAbilityType.damagePerSecond = 0
122
- applicatorAbilityType.movementSpeedDecreaseFactor = 0
123
- applicatorAbilityType.attackSpeedDecreaseFactor = 0
124
- applicatorAbilityType.isDamageStacking = false
125
- applicatorAbilityType.isMovementSpeedFactorStacking = false
126
- applicatorAbilityType.isAttackSpeedFactorStacking = false
127
- applicatorAbilityType.isAbleToKill = false
128
- applicatorAbilityType.buffTypeIds = {applicableBuffType.id, applicableBuffType.id}
129
- applicatorAbilityTypeIdByApplicatorType[852173] = applicatorAbilityType.id
130
- end
131
- if applicableBuffType.polarity == 1 or applicableBuffType.polarity == nil then
132
- local applicatorAbilityType = prepareAbilityType(BerserkAbilityType, applicableBuffType)
133
- applicatorAbilityType.attackSpeedIncreaseFactor = 0
134
- applicatorAbilityType.movementSpeedIncreaseFactor = 0
135
- applicatorAbilityType.receivedDamageIncreaseFactor = 0
136
- applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
137
- if applicatorAbilityType.levelCount > 1 then
138
- multilevelPhysicalPositiveApplicatorAbilityTypes[#multilevelPhysicalPositiveApplicatorAbilityTypes + 1] = applicatorAbilityType
157
+ local applicatorUpgradeIds = {}
158
+ local applicatorUpgradeIdByApplicatorAbilityTypeId = {}
159
+ for ____, multilevelPhysicalPositiveApplicatorAbilityTypesChunk in ipairs(chunked(multilevelPhysicalPositiveApplicatorAbilityTypes, 4)) do
160
+ local maxLevelCount = max(map(multilevelPhysicalPositiveApplicatorAbilityTypesChunk, "levelCount"))
161
+ local applicatorAbilityTypeIds = map(multilevelPhysicalPositiveApplicatorAbilityTypesChunk, "id")
162
+ local applicatorUpgrade = BlankUpgrade:create()
163
+ applicatorUpgrade.isInternal = true
164
+ applicatorUpgrade.levelCount = maxLevelCount - 1
165
+ applicatorUpgrade.effects = map(
166
+ applicatorAbilityTypeIds,
167
+ function(applicatorAbilityTypeId)
168
+ return {type = "rlev", bonusBase = 1, bonusIncrement = 1, abilityTypeId = applicatorAbilityTypeId}
139
169
  end
140
- applicatorAbilityTypeIdByApplicatorType[852100] = applicatorAbilityType.id
170
+ )
171
+ applicatorUpgradeIds[#applicatorUpgradeIds + 1] = applicatorUpgrade.id
172
+ for ____, applicatorAbilityTypeId in ipairs(applicatorAbilityTypeIds) do
173
+ applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId] = applicatorUpgrade.id
141
174
  end
142
175
  end
143
- if applicableBuffType.polarity == 0 or applicableBuffType.polarity == nil then
144
- local applicatorAbilityType = prepareAbilityType(PermanentImmolationAbilityType, applicableBuffType)
145
- applicatorAbilityType.levelCount = 1
146
- applicatorAbilityType.damagePerInterval = 0
147
- applicatorAbilityType.castRange = 0
148
- applicatorAbilityType.buffDuration = MAXIMUM_INTEGER
149
- applicatorAbilityType.heroBuffDuration = MAXIMUM_INTEGER
150
- applicatorAbilityType.allowedTargetCombatClassifications = combatClassificationsOf(1)
151
- applicatorAbilityType.buffTypeIds = {applicableBuffType.id}
152
- applicatorAbilityTypeIdByApplicatorType[0] = applicatorAbilityType.id
153
- end
154
- applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId[applicableBuffType.id] = applicatorAbilityTypeIdByApplicatorType
155
- end
156
- local applicatorUpgradeIds = {}
157
- local applicatorUpgradeIdByApplicatorAbilityTypeId = {}
158
- for ____, multilevelPhysicalPositiveApplicatorAbilityTypesChunk in ipairs(chunked(multilevelPhysicalPositiveApplicatorAbilityTypes, 4)) do
159
- local maxLevelCount = max(map(multilevelPhysicalPositiveApplicatorAbilityTypesChunk, "levelCount"))
160
- local applicatorAbilityTypeIds = map(multilevelPhysicalPositiveApplicatorAbilityTypesChunk, "id")
161
- local applicatorUpgrade = BlankUpgrade:create()
162
- applicatorUpgrade.isInternal = true
163
- applicatorUpgrade.levelCount = maxLevelCount - 1
164
- applicatorUpgrade.effects = map(
165
- applicatorAbilityTypeIds,
166
- function(applicatorAbilityTypeId)
167
- return {type = "rlev", bonusBase = 1, bonusIncrement = 1, abilityTypeId = applicatorAbilityTypeId}
168
- end
169
- )
170
- applicatorUpgradeIds[#applicatorUpgradeIds + 1] = applicatorUpgrade.id
171
- for ____, applicatorAbilityTypeId in ipairs(applicatorAbilityTypeIds) do
172
- applicatorUpgradeIdByApplicatorAbilityTypeId[applicatorAbilityTypeId] = applicatorUpgrade.id
176
+ for ____, unitType in ipairs(UnitType:getAll()) do
177
+ local ____array_0 = __TS__SparseArrayNew(table.unpack(unitType.affectingUpgradeIds))
178
+ __TS__SparseArrayPush(
179
+ ____array_0,
180
+ table.unpack(applicatorUpgradeIds)
181
+ )
182
+ unitType.affectingUpgradeIds = {__TS__SparseArraySpread(____array_0)}
173
183
  end
174
- end
175
- for ____, unitType in ipairs(UnitType:getAll()) do
176
- local ____array_0 = __TS__SparseArrayNew(table.unpack(unitType.affectingUpgradeIds))
177
- __TS__SparseArrayPush(
178
- ____array_0,
179
- table.unpack(applicatorUpgradeIds)
180
- )
181
- unitType.affectingUpgradeIds = {__TS__SparseArraySpread(____array_0)}
182
- end
183
- return {applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorUpgradeIdByApplicatorAbilityTypeId}
184
- end))
184
+ return {applicatorAbilityTypeIdByApplicatorTypeByApplicableBuffTypeId, applicatorUpgradeIdByApplicatorAbilityTypeId}
185
+ end),
186
+ 1,
187
+ 2
188
+ )
185
189
  local EVASION_ABILITY_TYPE_IDS = postcompile(function()
186
190
  return AbilityType:getAllIdsByBaseIds(map({
187
191
  "AEev",
@@ -519,9 +519,9 @@ __TS__SetDescriptor(
519
519
  )
520
520
  ____exports.resolveCurrentAbilityDependentValue = function(ability, value)
521
521
  if __TS__InstanceOf(value, ____exports.AbilityField) then
522
- return value:getValue(ability)
522
+ return value:getValue(ability, true)
523
523
  elseif __TS__InstanceOf(value, ____exports.AbilityLevelField) then
524
- return value:getValue(ability, ability.level)
524
+ return value:getValue(ability, ability.level, true)
525
525
  elseif type(value) == "function" then
526
526
  return value(ability)
527
527
  else
@@ -88,7 +88,7 @@ export declare abstract class ObjectLevelField<ObjectDataEntryType extends Objec
88
88
  protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
89
89
  protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
90
90
  protected abstract getLevelCount(entry: ObjectDataEntryType | InstanceType): number;
91
- getValue<LevelType extends [number] | []>(entry: ObjectDataEntryType | InstanceType, ...[level]: LevelType): LevelType extends [number] ? ValueType : ValueType[];
91
+ getValue<LevelType extends [number, boolean?] | [boolean?]>(entry: ObjectDataEntryType | InstanceType, ...[level, includeModifiers]: LevelType): LevelType extends [number, boolean?] ? ValueType : ValueType[];
92
92
  setValue(entry: ObjectDataEntryType | InstanceType, ...[levelOrValue, value]: [value: ObjectDataEntryLevelFieldValueSupplier<InputValueType, ValueType>] | [level: number, value: InputValueType]): boolean;
93
93
  updateActualValue(instance: InstanceType, level?: number): void;
94
94
  applyModifier(instance: InstanceType, modifier: ObjectLevelFieldModifier<InstanceType, ValueType>): void;
@@ -403,12 +403,12 @@ ____exports.ObjectLevelField = __TS__Class()
403
403
  local ObjectLevelField = ____exports.ObjectLevelField
404
404
  ObjectLevelField.name = "ObjectLevelField"
405
405
  __TS__ClassExtends(ObjectLevelField, ObjectFieldBase)
406
- function ObjectLevelField.prototype.getValue(self, entry, level)
406
+ function ObjectLevelField.prototype.getValue(self, entry, level, includeModifiers)
407
407
  if level == nil then
408
408
  local result = {}
409
409
  local levelCount = self:getLevelCount(entry)
410
410
  for i = 0, levelCount - 1 do
411
- result[i + 1] = self:getValue(entry, i)
411
+ result[i + 1] = self:getValue(entry, i, includeModifiers)
412
412
  end
413
413
  return result
414
414
  end
@@ -426,11 +426,13 @@ function ObjectLevelField.prototype.getValue(self, entry, level)
426
426
  end
427
427
  return self.defaultValue
428
428
  end
429
- local ____opt_22 = self.originalValueByLevelByInstance
430
- local ____opt_20 = ____opt_22 and ____opt_22[entry]
431
- local originalValue = ____opt_20 and ____opt_20[level]
432
- if originalValue ~= nil then
433
- return originalValue
429
+ if not includeModifiers then
430
+ local ____opt_22 = self.originalValueByLevelByInstance
431
+ local ____opt_20 = ____opt_22 and ____opt_22[entry]
432
+ local originalValue = ____opt_20 and ____opt_20[level]
433
+ if originalValue ~= nil then
434
+ return originalValue
435
+ end
434
436
  end
435
437
  return self:getActualValue(entry, level)
436
438
  end
@@ -18,3 +18,4 @@ export declare const random: {
18
18
  <T>(element: T, ...elements: T[]): T;
19
19
  <T>(...elements: T[]): T | undefined;
20
20
  };
21
+ export declare const shuffle: (array: unknown[]) => void;
package/engine/random.lua CHANGED
@@ -28,4 +28,12 @@ ____exports.random = function(...)
28
28
  ...
29
29
  ))
30
30
  end
31
+ ____exports.shuffle = function(array)
32
+ for i = #array - 1, 1 do
33
+ local j = getRandomInt(0, i)
34
+ local value = array[i + 1]
35
+ array[i + 1] = array[j + 1]
36
+ array[j + 1] = value
37
+ end
38
+ end
31
39
  return ____exports
package/engine/unit.d.ts CHANGED
@@ -23,6 +23,7 @@ import "./internal/unit/attributes";
23
23
  import "./internal/unit/fly-height";
24
24
  import "./internal/unit/scale";
25
25
  import "./internal/unit/interrupts";
26
+ import "./internal/unit/range-event";
26
27
  import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
27
28
  export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
28
29
  export * from "./internal/unit+damage";
package/engine/unit.lua CHANGED
@@ -23,6 +23,7 @@ require("engine.internal.unit.attributes")
23
23
  require("engine.internal.unit.fly-height")
24
24
  require("engine.internal.unit.scale")
25
25
  require("engine.internal.unit.interrupts")
26
+ require("engine.internal.unit.range-event")
26
27
  require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
27
28
  do
28
29
  local ____unit = require("engine.internal.unit")
package/lualib_bundle.lua CHANGED
@@ -653,7 +653,6 @@ do
653
653
  self.state = 0
654
654
  self.fulfilledCallbacks = {}
655
655
  self.rejectedCallbacks = {}
656
- self.finallyCallbacks = {}
657
656
  local success, ____error = ____pcall(
658
657
  executor,
659
658
  nil,
@@ -703,14 +702,40 @@ do
703
702
  return self["then"](self, nil, onRejected)
704
703
  end
705
704
  function __TS__Promise.prototype.finally(self, onFinally)
706
- if onFinally then
707
- local ____self_finallyCallbacks_2 = self.finallyCallbacks
708
- ____self_finallyCallbacks_2[#____self_finallyCallbacks_2 + 1] = onFinally
709
- if self.state ~= 0 then
710
- onFinally(nil)
711
- end
705
+ if type(onFinally) ~= "function" then
706
+ return self["then"](self, onFinally, onFinally)
712
707
  end
713
- return self
708
+ return self["then"](
709
+ self,
710
+ function(____, x)
711
+ local ____self_2 = __TS__New(
712
+ __TS__Promise,
713
+ function(____, resolve) return resolve(
714
+ nil,
715
+ onFinally(nil)
716
+ ) end
717
+ )
718
+ return ____self_2["then"](
719
+ ____self_2,
720
+ function() return x end
721
+ )
722
+ end,
723
+ function(____, e)
724
+ local ____self_3 = __TS__New(
725
+ __TS__Promise,
726
+ function(____, resolve) return resolve(
727
+ nil,
728
+ onFinally(nil)
729
+ ) end
730
+ )
731
+ return ____self_3["then"](
732
+ ____self_3,
733
+ function()
734
+ error(e, 0)
735
+ end
736
+ )
737
+ end
738
+ )
714
739
  end
715
740
  function __TS__Promise.prototype.resolve(self, value)
716
741
  if isPromiseLike(value) then
@@ -734,22 +759,11 @@ do
734
759
  end
735
760
  function __TS__Promise.prototype.invokeCallbacks(self, callbacks, value)
736
761
  local callbacksLength = #callbacks
737
- local finallyCallbacks = self.finallyCallbacks
738
- local finallyCallbacksLength = #finallyCallbacks
739
762
  if callbacksLength ~= 0 then
740
763
  for i = 1, callbacksLength - 1 do
741
764
  callbacks[i](callbacks, value)
742
765
  end
743
- if finallyCallbacksLength == 0 then
744
- return callbacks[callbacksLength](callbacks, value)
745
- end
746
- callbacks[callbacksLength](callbacks, value)
747
- end
748
- if finallyCallbacksLength ~= 0 then
749
- for i = 1, finallyCallbacksLength - 1 do
750
- finallyCallbacks[i](finallyCallbacks)
751
- end
752
- return finallyCallbacks[finallyCallbacksLength](finallyCallbacks)
766
+ return callbacks[callbacksLength](callbacks, value)
753
767
  end
754
768
  end
755
769
  function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve, reject)
@@ -904,8 +918,10 @@ local function __TS__ObjectAssign(target, ...)
904
918
  local sources = {...}
905
919
  for i = 1, #sources do
906
920
  local source = sources[i]
907
- for key in pairs(source) do
908
- target[key] = source[key]
921
+ if type(source) == "table" then
922
+ for key in pairs(source) do
923
+ target[key] = source[key]
924
+ end
909
925
  end
910
926
  end
911
927
  return target
@@ -1011,6 +1027,13 @@ do
1011
1027
  metatable = {}
1012
1028
  setmetatable(target, metatable)
1013
1029
  end
1030
+ if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
1031
+ local instanceMetatable = {}
1032
+ instanceMetatable._isOwnDescriptorMetatable = true
1033
+ setmetatable(instanceMetatable, metatable)
1034
+ setmetatable(target, instanceMetatable)
1035
+ metatable = instanceMetatable
1036
+ end
1014
1037
  local value = rawget(target, key)
1015
1038
  if value ~= nil then
1016
1039
  rawset(target, key, nil)
@@ -1383,46 +1406,70 @@ do
1383
1406
  return self:entries()
1384
1407
  end
1385
1408
  function Map.prototype.entries(self)
1409
+ local function getFirstKey()
1410
+ return self.firstKey
1411
+ end
1386
1412
  local items = self.items
1387
1413
  local nextKey = self.nextKey
1388
- local key = self.firstKey
1414
+ local key
1415
+ local started = false
1389
1416
  return {
1390
1417
  [Symbol.iterator] = function(self)
1391
1418
  return self
1392
1419
  end,
1393
1420
  next = function(self)
1394
- local result = {done = not key, value = {key, items[key]}}
1395
- key = nextKey[key]
1396
- return result
1421
+ if not started then
1422
+ started = true
1423
+ key = getFirstKey(nil)
1424
+ else
1425
+ key = nextKey[key]
1426
+ end
1427
+ return {done = not key, value = {key, items[key]}}
1397
1428
  end
1398
1429
  }
1399
1430
  end
1400
1431
  function Map.prototype.keys(self)
1432
+ local function getFirstKey()
1433
+ return self.firstKey
1434
+ end
1401
1435
  local nextKey = self.nextKey
1402
- local key = self.firstKey
1436
+ local key
1437
+ local started = false
1403
1438
  return {
1404
1439
  [Symbol.iterator] = function(self)
1405
1440
  return self
1406
1441
  end,
1407
1442
  next = function(self)
1408
- local result = {done = not key, value = key}
1409
- key = nextKey[key]
1410
- return result
1443
+ if not started then
1444
+ started = true
1445
+ key = getFirstKey(nil)
1446
+ else
1447
+ key = nextKey[key]
1448
+ end
1449
+ return {done = not key, value = key}
1411
1450
  end
1412
1451
  }
1413
1452
  end
1414
1453
  function Map.prototype.values(self)
1454
+ local function getFirstKey()
1455
+ return self.firstKey
1456
+ end
1415
1457
  local items = self.items
1416
1458
  local nextKey = self.nextKey
1417
- local key = self.firstKey
1459
+ local key
1460
+ local started = false
1418
1461
  return {
1419
1462
  [Symbol.iterator] = function(self)
1420
1463
  return self
1421
1464
  end,
1422
1465
  next = function(self)
1423
- local result = {done = not key, value = items[key]}
1424
- key = nextKey[key]
1425
- return result
1466
+ if not started then
1467
+ started = true
1468
+ key = getFirstKey(nil)
1469
+ else
1470
+ key = nextKey[key]
1471
+ end
1472
+ return {done = not key, value = items[key]}
1426
1473
  end
1427
1474
  }
1428
1475
  end
@@ -1999,44 +2046,68 @@ do
1999
2046
  return self:values()
2000
2047
  end
2001
2048
  function Set.prototype.entries(self)
2049
+ local function getFirstKey()
2050
+ return self.firstKey
2051
+ end
2002
2052
  local nextKey = self.nextKey
2003
- local key = self.firstKey
2053
+ local key
2054
+ local started = false
2004
2055
  return {
2005
2056
  [Symbol.iterator] = function(self)
2006
2057
  return self
2007
2058
  end,
2008
2059
  next = function(self)
2009
- local result = {done = not key, value = {key, key}}
2010
- key = nextKey[key]
2011
- return result
2060
+ if not started then
2061
+ started = true
2062
+ key = getFirstKey(nil)
2063
+ else
2064
+ key = nextKey[key]
2065
+ end
2066
+ return {done = not key, value = {key, key}}
2012
2067
  end
2013
2068
  }
2014
2069
  end
2015
2070
  function Set.prototype.keys(self)
2071
+ local function getFirstKey()
2072
+ return self.firstKey
2073
+ end
2016
2074
  local nextKey = self.nextKey
2017
- local key = self.firstKey
2075
+ local key
2076
+ local started = false
2018
2077
  return {
2019
2078
  [Symbol.iterator] = function(self)
2020
2079
  return self
2021
2080
  end,
2022
2081
  next = function(self)
2023
- local result = {done = not key, value = key}
2024
- key = nextKey[key]
2025
- return result
2082
+ if not started then
2083
+ started = true
2084
+ key = getFirstKey(nil)
2085
+ else
2086
+ key = nextKey[key]
2087
+ end
2088
+ return {done = not key, value = key}
2026
2089
  end
2027
2090
  }
2028
2091
  end
2029
2092
  function Set.prototype.values(self)
2093
+ local function getFirstKey()
2094
+ return self.firstKey
2095
+ end
2030
2096
  local nextKey = self.nextKey
2031
- local key = self.firstKey
2097
+ local key
2098
+ local started = false
2032
2099
  return {
2033
2100
  [Symbol.iterator] = function(self)
2034
2101
  return self
2035
2102
  end,
2036
2103
  next = function(self)
2037
- local result = {done = not key, value = key}
2038
- key = nextKey[key]
2039
- return result
2104
+ if not started then
2105
+ started = true
2106
+ key = getFirstKey(nil)
2107
+ else
2108
+ key = nextKey[key]
2109
+ end
2110
+ return {done = not key, value = key}
2040
2111
  end
2041
2112
  }
2042
2113
  end
@@ -2241,7 +2312,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
2241
2312
  end
2242
2313
  local result = string.gsub(
2243
2314
  trace,
2244
- "(%S+)%.lua:(%d+)",
2315
+ "([^%s<]+)%.lua:(%d+)",
2245
2316
  function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
2246
2317
  )
2247
2318
  local function stringReplacer(____, file, line)
@@ -153,7 +153,7 @@ end
153
153
  function ObjectDefinition.getLevelArrayFieldValue(self, level, value, values)
154
154
  return type(values) == "function" and values(level, value) or (__TS__ArrayIsArray(values[1]) and values[1] or values)
155
155
  end
156
- ____exports.ObjectType = ObjectType or ({})
156
+ ____exports.ObjectType = ____exports.ObjectType or ({})
157
157
  ____exports.ObjectType.ABILITY = 0
158
158
  ____exports.ObjectType[____exports.ObjectType.ABILITY] = "ABILITY"
159
159
  ____exports.ObjectType.ITEM = 1