warscript 0.0.1-dev.702d52d → 0.0.1-dev.70c1215
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.
- package/engine/behaviour/ability.d.ts +4 -0
- package/engine/behaviour/ability.lua +29 -0
- package/engine/buff.d.ts +8 -4
- package/engine/buff.lua +20 -3
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit.d.ts +1 -1
- package/engine/internal/unit.lua +9 -30
- package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type.d.ts +2 -0
- package/engine/object-data/entry/ability-type.lua +84 -4
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +8 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +1 -1
- package/utility/linked-map.d.ts +9 -1
- package/utility/linked-map.lua +35 -0
- package/utility/linked-set.d.ts +2 -1
- package/utility/linked-set.lua +17 -0
|
@@ -36,6 +36,10 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
36
36
|
]): void;
|
|
37
37
|
private static MissileLaunchConfig;
|
|
38
38
|
private get missileLaunchConfig();
|
|
39
|
+
protected launchMissile(source: Unit, ...args: [
|
|
40
|
+
...pointOrWidget: [x: number, y: number] | [widget: Unit /** TODO: support Widget */],
|
|
41
|
+
...parameters: NonNullable<Parameters["missileParameters"]>
|
|
42
|
+
]): void;
|
|
39
43
|
protected onCreate(): void;
|
|
40
44
|
onValueChange(_value: ReadonlySubscribableAbilityDependentValue<string | number | boolean>): void;
|
|
41
45
|
onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
@@ -30,7 +30,14 @@ local ____ability = require("engine.object-field.ability")
|
|
|
30
30
|
local AbilityField = ____ability.AbilityField
|
|
31
31
|
local AbilityLevelField = ____ability.AbilityLevelField
|
|
32
32
|
local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
|
|
33
|
+
local ____missile = require("core.types.missile")
|
|
34
|
+
local Missile = ____missile.Missile
|
|
33
35
|
local createBehaviorFunctionsByAbilityTypeId = {}
|
|
36
|
+
local function invokeOnMissileArrival(_missile, success, abilityBehavior, ...)
|
|
37
|
+
if success then
|
|
38
|
+
abilityBehavior:onMissileArrival(...)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
34
41
|
local exclusiveOnImpactHandlerAbilityBehaviorByAbility = setmetatable({}, {__mode = "k"})
|
|
35
42
|
local function createUnitEventListener(key)
|
|
36
43
|
return function(unit, ability, ...)
|
|
@@ -160,6 +167,28 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrParame
|
|
|
160
167
|
)
|
|
161
168
|
end
|
|
162
169
|
end
|
|
170
|
+
function AbilityBehavior.prototype.launchMissile(self, source, xOrWidget, yOrParameter, ...)
|
|
171
|
+
if type(xOrWidget) ~= "number" then
|
|
172
|
+
Missile:launch(
|
|
173
|
+
self.missileLaunchConfig,
|
|
174
|
+
source,
|
|
175
|
+
xOrWidget,
|
|
176
|
+
invokeOnMissileArrival,
|
|
177
|
+
self,
|
|
178
|
+
yOrParameter,
|
|
179
|
+
...
|
|
180
|
+
)
|
|
181
|
+
else
|
|
182
|
+
Missile:launch(
|
|
183
|
+
self.missileLaunchConfig,
|
|
184
|
+
source,
|
|
185
|
+
vec2(xOrWidget, yOrParameter),
|
|
186
|
+
invokeOnMissileArrival,
|
|
187
|
+
self,
|
|
188
|
+
...
|
|
189
|
+
)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
163
192
|
function AbilityBehavior.prototype.onCreate(self)
|
|
164
193
|
end
|
|
165
194
|
function AbilityBehavior.prototype.onValueChange(self, _value)
|
package/engine/buff.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export declare const enum BuffTypeIdSelectionPolicy {
|
|
|
137
137
|
LEAST_DURATION = 0
|
|
138
138
|
}
|
|
139
139
|
export type BuffAdditionalParameters = Prohibit<Record<string, any>, keyof BuffParameters>;
|
|
140
|
-
export type BuffConstructorParameters<
|
|
140
|
+
export type BuffConstructorParameters<T extends Buff<BuffAdditionalParameters>> = T extends Buff<infer AdditionalParameters> ? [
|
|
141
141
|
...typeId: [ApplicableBuffTypeId] | [
|
|
142
142
|
typeIds: ReadonlyNonEmptyArray<ApplicableBuffTypeId>,
|
|
143
143
|
typeIdSelectionPolicy: BuffTypeIdSelectionPolicy
|
|
@@ -147,8 +147,10 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
147
147
|
...abilityOrParameters: [
|
|
148
148
|
ability?: Ability | AbilityBehavior,
|
|
149
149
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
150
|
-
] | [
|
|
151
|
-
|
|
150
|
+
] | [
|
|
151
|
+
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
152
|
+
]
|
|
153
|
+
] : never;
|
|
152
154
|
export declare class Buff<AdditionalParameters extends Prohibit<Record<string, any>, keyof BuffParameters> = object> extends UnitBehavior {
|
|
153
155
|
private _unit;
|
|
154
156
|
protected readonly __additionalParametersBrand?: AdditionalParameters;
|
|
@@ -212,7 +214,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
212
214
|
private readonly [BuffPropertyKey.MISS_PROBABILITY]?;
|
|
213
215
|
private readonly _abilityTypeIds?;
|
|
214
216
|
private _behaviors?;
|
|
215
|
-
constructor(target: Unit, ...parameters: BuffConstructorParameters<AdditionalParameters
|
|
217
|
+
constructor(target: Unit, ...parameters: BuffConstructorParameters<Buff<AdditionalParameters>>);
|
|
216
218
|
get level(): number;
|
|
217
219
|
get remainingDamageOverDuration(): number;
|
|
218
220
|
set remainingDamageOverDuration(remainingDamageOverDuration: number);
|
|
@@ -271,6 +273,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
271
273
|
get manaRegenerationRateIncreaseFactor(): number;
|
|
272
274
|
set manaRegenerationRateIncreaseFactor(manaRegenerationRateIncreaseFactor: number);
|
|
273
275
|
get duration(): number;
|
|
276
|
+
set duration(duration: number);
|
|
274
277
|
get remainingDuration(): number;
|
|
275
278
|
set remainingDuration(remainingDuration: number);
|
|
276
279
|
get abilityCooldownFactor(): number;
|
|
@@ -282,6 +285,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
282
285
|
...parametersOrDuration: [] | [EffectParameters] | [number]
|
|
283
286
|
]): void;
|
|
284
287
|
flashSpecialEffect(...parameters: [...widget: [] | [Widget], ...duration: [] | [number]]): void;
|
|
288
|
+
expire(): void;
|
|
285
289
|
protected onCreate(): void;
|
|
286
290
|
protected onDestroy(): Destructor;
|
|
287
291
|
static apply<T extends Buff<any>, Args extends any[]>(this: BuffConstructor<T, Args>, ...args: Args): T | undefined;
|
package/engine/buff.lua
CHANGED
|
@@ -585,6 +585,9 @@ function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
|
585
585
|
__TS__SparseArraySpread(____array_43)
|
|
586
586
|
)
|
|
587
587
|
end
|
|
588
|
+
function Buff.prototype.expire(self)
|
|
589
|
+
expireBuff(self)
|
|
590
|
+
end
|
|
588
591
|
function Buff.prototype.onCreate(self)
|
|
589
592
|
end
|
|
590
593
|
function Buff.prototype.onDestroy(self)
|
|
@@ -1275,9 +1278,23 @@ __TS__SetDescriptor(
|
|
|
1275
1278
|
__TS__SetDescriptor(
|
|
1276
1279
|
Buff.prototype,
|
|
1277
1280
|
"duration",
|
|
1278
|
-
{
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
+
{
|
|
1282
|
+
get = function(self)
|
|
1283
|
+
return self[103]
|
|
1284
|
+
end,
|
|
1285
|
+
set = function(self, duration)
|
|
1286
|
+
if duration <= 0 then
|
|
1287
|
+
local timer = self._timer
|
|
1288
|
+
if timer ~= nil then
|
|
1289
|
+
timer:destroy()
|
|
1290
|
+
self._timer = nil
|
|
1291
|
+
end
|
|
1292
|
+
self[103] = 0
|
|
1293
|
+
else
|
|
1294
|
+
self.remainingDuration = self.remainingDuration + (duration - self[103])
|
|
1295
|
+
end
|
|
1296
|
+
end
|
|
1297
|
+
},
|
|
1281
1298
|
true
|
|
1282
1299
|
)
|
|
1283
1300
|
__TS__SetDescriptor(
|
|
@@ -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
|
|
@@ -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;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -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
|
|
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:
|
|
2790
|
+
unit:saveData()
|
|
2791
|
+
Timer:run(unit, "destroy")
|
|
2813
2792
|
end)
|
|
2814
2793
|
end
|
|
2815
2794
|
end)(Unit)
|
|
@@ -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
|
|
1104
|
-
if
|
|
1105
|
-
for i = 1, #
|
|
1106
|
-
|
|
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
|
package/engine/random.d.ts
CHANGED
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/package.json
CHANGED
package/utility/linked-map.d.ts
CHANGED
|
@@ -8,10 +8,16 @@ type IteratorState<K extends AnyNotNil, V> = {
|
|
|
8
8
|
type OneSidedTypeGuard = {
|
|
9
9
|
readonly __oneSidedTypeGuard: unique symbol;
|
|
10
10
|
};
|
|
11
|
+
export interface ReadonlyLinkedMap<K extends AnyNotNil, V> extends LuaPairsIterable<K, V> {
|
|
12
|
+
readonly keys: ReadonlyLinkedSet<K>;
|
|
13
|
+
get(key: K): V | undefined;
|
|
14
|
+
contains(key: AnyNotNil): key is K & OneSidedTypeGuard;
|
|
15
|
+
readonly size: number;
|
|
16
|
+
}
|
|
11
17
|
export interface LinkedMap<K extends AnyNotNil, V> extends LuaPairsIterable<K, V> {
|
|
12
18
|
readonly __linkedSet: unique symbol;
|
|
13
19
|
}
|
|
14
|
-
export declare class LinkedMap<K extends AnyNotNil, V> {
|
|
20
|
+
export declare class LinkedMap<K extends AnyNotNil, V> implements ReadonlyLinkedMap<K, V> {
|
|
15
21
|
private k;
|
|
16
22
|
private v;
|
|
17
23
|
get keys(): ReadonlyLinkedSet<K>;
|
|
@@ -23,4 +29,6 @@ export declare class LinkedMap<K extends AnyNotNil, V> {
|
|
|
23
29
|
get size(): number;
|
|
24
30
|
protected __pairs(this: LinkedMap<K, V>): LuaIterator<LuaMultiReturn<[K | undefined, V | undefined]>, IteratorState<K, V>>;
|
|
25
31
|
}
|
|
32
|
+
export declare const emptyLinkedMap: <K extends AnyNotNil, V>() => ReadonlyLinkedMap<K, V>;
|
|
33
|
+
export declare const mutableLinkedMap: <K extends AnyNotNil, V>() => LinkedMap<K, V>;
|
|
26
34
|
export {};
|
package/utility/linked-map.lua
CHANGED
|
@@ -2,9 +2,12 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____linked_2Dset = require("utility.linked-set")
|
|
7
8
|
local LinkedSet = ____linked_2Dset.LinkedSet
|
|
9
|
+
local ____exception = require("exception")
|
|
10
|
+
local UnsupportedOperationException = ____exception.UnsupportedOperationException
|
|
8
11
|
local function linkedMapNext(state)
|
|
9
12
|
local n = state.n
|
|
10
13
|
state.n = state.t[n]
|
|
@@ -63,4 +66,36 @@ __TS__SetDescriptor(
|
|
|
63
66
|
end},
|
|
64
67
|
true
|
|
65
68
|
)
|
|
69
|
+
local emptyIteratorState = {t = {}, v = {}}
|
|
70
|
+
local EmptyLinkedMap = __TS__Class()
|
|
71
|
+
EmptyLinkedMap.name = "EmptyLinkedMap"
|
|
72
|
+
__TS__ClassExtends(EmptyLinkedMap, ____exports.LinkedMap)
|
|
73
|
+
function EmptyLinkedMap.prototype.getOrPut(self)
|
|
74
|
+
error(
|
|
75
|
+
__TS__New(UnsupportedOperationException),
|
|
76
|
+
0
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
function EmptyLinkedMap.prototype.put(self)
|
|
80
|
+
error(
|
|
81
|
+
__TS__New(UnsupportedOperationException),
|
|
82
|
+
0
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
function EmptyLinkedMap.prototype.remove(self)
|
|
86
|
+
error(
|
|
87
|
+
__TS__New(UnsupportedOperationException),
|
|
88
|
+
0
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
function EmptyLinkedMap.prototype.__pairs(self)
|
|
92
|
+
return linkedMapNext, emptyIteratorState, nil
|
|
93
|
+
end
|
|
94
|
+
local EMPTY_LINKED_MAP = __TS__New(EmptyLinkedMap)
|
|
95
|
+
____exports.emptyLinkedMap = function()
|
|
96
|
+
return EMPTY_LINKED_MAP
|
|
97
|
+
end
|
|
98
|
+
____exports.mutableLinkedMap = function()
|
|
99
|
+
return __TS__New(____exports.LinkedMap)
|
|
100
|
+
end
|
|
66
101
|
return ____exports
|
package/utility/linked-set.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyItera
|
|
|
14
14
|
next(key: T): T | undefined;
|
|
15
15
|
previous(key: T): T | undefined;
|
|
16
16
|
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
17
|
-
size: number;
|
|
17
|
+
readonly size: number;
|
|
18
18
|
forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
|
|
19
19
|
toArray(): T[];
|
|
20
20
|
sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
|
|
@@ -40,6 +40,7 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
40
40
|
next(key: T): T | undefined;
|
|
41
41
|
previous(key: T): T | undefined;
|
|
42
42
|
add(key: T): boolean;
|
|
43
|
+
protected addBefore(value: T, key: T): boolean;
|
|
43
44
|
remove(key: T): boolean;
|
|
44
45
|
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
45
46
|
clear(): void;
|
package/utility/linked-set.lua
CHANGED
|
@@ -85,6 +85,23 @@ function LinkedSet.prototype.add(self, key)
|
|
|
85
85
|
end
|
|
86
86
|
return true
|
|
87
87
|
end
|
|
88
|
+
function LinkedSet.prototype.addBefore(self, value, key)
|
|
89
|
+
local n = self.n
|
|
90
|
+
local p = self.p
|
|
91
|
+
local previous = p[value]
|
|
92
|
+
if previous ~= nil then
|
|
93
|
+
n[previous] = key
|
|
94
|
+
p[key] = previous
|
|
95
|
+
elseif value == self.f then
|
|
96
|
+
self.f = key
|
|
97
|
+
else
|
|
98
|
+
return false
|
|
99
|
+
end
|
|
100
|
+
n[key] = value
|
|
101
|
+
p[value] = key
|
|
102
|
+
self.s = self.s + 1
|
|
103
|
+
return true
|
|
104
|
+
end
|
|
88
105
|
function LinkedSet.prototype.remove(self, key)
|
|
89
106
|
local n = self.n
|
|
90
107
|
local next = n[key]
|