warscript 0.0.1-dev.8a238c4 → 0.0.1-dev.8c7ee30
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/attributes.d.ts +0 -1
- package/core/types/frame.d.ts +0 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/handle.lua +0 -2
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/decl/index.d.ts +1 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability.d.ts +8 -1
- package/engine/behaviour/ability.lua +62 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +3 -2
- package/engine/behaviour/unit.lua +7 -0
- package/engine/buff.d.ts +2 -2
- package/engine/buff.lua +8 -10
- package/engine/internal/unit/bonus.d.ts +5 -6
- package/engine/internal/unit.d.ts +1 -2
- package/engine/internal/unit.lua +27 -37
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +0 -1
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +0 -1
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- package/engine/unit.lua +9 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/lualib_bundle.lua +139 -40
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -13
- package/string.d.ts +16 -0
- package/string.lua +5 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +3 -4
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +1 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
package/attributes.d.ts
CHANGED
package/core/types/frame.d.ts
CHANGED
package/core/types/group.d.ts
CHANGED
package/core/types/handle.lua
CHANGED
|
@@ -2,7 +2,6 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
-
local __TS__Delete = ____lualib.__TS__Delete
|
|
6
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
7
6
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
8
7
|
local ____exports = {}
|
|
@@ -89,7 +88,6 @@ function Handle.prototype.destroy(self, ...)
|
|
|
89
88
|
0
|
|
90
89
|
)
|
|
91
90
|
end
|
|
92
|
-
__TS__Delete(clazz.memoized, id)
|
|
93
91
|
return nil
|
|
94
92
|
end
|
|
95
93
|
function Handle.invokeOnDestroyEvent(self, clazz, handle)
|
package/core/types/image.d.ts
CHANGED
package/core/types/missile.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class Missile implements Destroyable {
|
|
|
5
5
|
readonly retarget: (this: void, target: Unit | Vec2) => void;
|
|
6
6
|
private readonly update;
|
|
7
7
|
protected constructor(effect: jeffect, retarget: (this: void, target: Unit | Vec2) => void, update: (this: Missile) => boolean);
|
|
8
|
-
static launch(config: Readonly<{
|
|
8
|
+
static launch<T extends any[]>(config: Readonly<{
|
|
9
9
|
art: string;
|
|
10
10
|
scale?: number;
|
|
11
11
|
acceleration?: number;
|
|
@@ -15,7 +15,7 @@ export declare class Missile implements Destroyable {
|
|
|
15
15
|
maxSpeed?: number;
|
|
16
16
|
sourceOffset?: Vec2;
|
|
17
17
|
targetOffset?: Vec2;
|
|
18
|
-
}>, source: Unit | Vec2, target: Unit | Vec2, onArrival: (missile: Missile, success: boolean) => void): Missile;
|
|
18
|
+
}>, source: Unit | Vec2, target: Unit | Vec2, onArrival: (missile: Missile, success: boolean, ...parameters: T) => void, ...parameters: T): Missile;
|
|
19
19
|
destroy(): void;
|
|
20
20
|
}
|
|
21
21
|
export declare namespace Missile {
|
package/core/types/missile.lua
CHANGED
|
@@ -41,7 +41,8 @@ function Missile.prototype.____constructor(self, effect, retarget, update)
|
|
|
41
41
|
end
|
|
42
42
|
head = self
|
|
43
43
|
end
|
|
44
|
-
function Missile.launch(self, config, source, target, onArrival)
|
|
44
|
+
function Missile.launch(self, config, source, target, onArrival, ...)
|
|
45
|
+
local parameters = {...}
|
|
45
46
|
local ____opt_0 = config.sourceOffset
|
|
46
47
|
local offsetX = ____opt_0 and ____opt_0.x or 0
|
|
47
48
|
local ____opt_2 = config.sourceOffset
|
|
@@ -142,7 +143,12 @@ function Missile.launch(self, config, source, target, onArrival)
|
|
|
142
143
|
visualPositionArcY = currentVisualTargetY
|
|
143
144
|
visualPositionArcZ = currentVisualTargetZ
|
|
144
145
|
retarget = false
|
|
145
|
-
safeCall(
|
|
146
|
+
safeCall(
|
|
147
|
+
onArrival,
|
|
148
|
+
self,
|
|
149
|
+
true,
|
|
150
|
+
table.unpack(parameters)
|
|
151
|
+
)
|
|
146
152
|
return not retarget
|
|
147
153
|
end
|
|
148
154
|
if arcVSpeed ~= 0 and (currentTargetX ~= initialTargetX or currentTargetY ~= initialTargetY) then
|
package/core/types/unit.lua
CHANGED
|
@@ -21,4 +21,12 @@ do
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
|
+
do
|
|
25
|
+
local ____export = require("engine.internal.unit+rally")
|
|
26
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
27
|
+
if ____exportKey ~= "default" then
|
|
28
|
+
____exports[____exportKey] = ____exportValue
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
24
32
|
return ____exports
|
package/decl/index.d.ts
CHANGED
package/engine/ability.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { AbilityTypeId } from "./object-data/entry/ability-type";
|
|
3
3
|
import { UnitAbility } from "./internal/ability";
|
|
4
4
|
import { Player } from "../core/types/player";
|
|
5
|
-
export declare const castAbility: (owner: Player, abilityTypeId: AbilityTypeId, ...args: [
|
|
5
|
+
export declare const castAbility: (owner: Player, abilityTypeId: AbilityTypeId, ...args: [...levelOrAbilityConsumer: [number] | [(ability: UnitAbility) => void] | [], x: number, y: number]) => void;
|
package/engine/behavior.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { AbstractDestroyable, Destructor } from "../destroyable";
|
|
3
|
-
export type BehaviorConstructor<T extends Behavior<
|
|
3
|
+
export type BehaviorConstructor<T extends Behavior<AnyNotNil>, Parameters extends any[] = any[]> = OmitConstructor<typeof Behavior<any>> & (abstract new (...parameters: Parameters) => T);
|
|
4
4
|
declare const enum BehaviorPropertyKey {
|
|
5
5
|
PREVIOUS_BEHAVIOR = 0,
|
|
6
6
|
NEXT_BEHAVIOR = 1,
|
|
7
7
|
TIMER = 2
|
|
8
8
|
}
|
|
9
|
-
export declare abstract class Behavior<T, PeriodicActionParameters extends any[] = any[]> extends AbstractDestroyable {
|
|
9
|
+
export declare abstract class Behavior<T extends AnyNotNil, PeriodicActionParameters extends any[] = any[]> extends AbstractDestroyable {
|
|
10
10
|
protected readonly object: T;
|
|
11
11
|
private [BehaviorPropertyKey.PREVIOUS_BEHAVIOR]?;
|
|
12
12
|
private [BehaviorPropertyKey.NEXT_BEHAVIOR]?;
|
|
@@ -16,13 +16,13 @@ export declare abstract class Behavior<T, PeriodicActionParameters extends any[]
|
|
|
16
16
|
protected onPeriod(...parameters: PeriodicActionParameters): void;
|
|
17
17
|
protected startPeriodicAction(interval: number, ...parameters: PeriodicActionParameters): void;
|
|
18
18
|
protected stopPeriodicAction(): void;
|
|
19
|
-
static count<T extends Behavior<
|
|
20
|
-
static getFirst<T extends Behavior<
|
|
21
|
-
static getLast<T extends Behavior<
|
|
22
|
-
static getAll<T extends Behavior<
|
|
23
|
-
static forFirst<T extends Behavior<
|
|
24
|
-
static forFirst<T extends Behavior<
|
|
25
|
-
static forAll<T extends Behavior<
|
|
26
|
-
static forAll<T extends Behavior<
|
|
19
|
+
static count<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, limit?: number): number;
|
|
20
|
+
static getFirst<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], Count extends [number] | []>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, ...[count]: Count): Count extends [number] ? T[] : T | undefined;
|
|
21
|
+
static getLast<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never): T | undefined;
|
|
22
|
+
static getAll<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never): T[];
|
|
23
|
+
static forFirst<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], ConsumerParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, count: number, consumer: (this: void, behavior: T, ...parameters: ConsumerParameters) => any, ...parameters: ConsumerParameters): number;
|
|
24
|
+
static forFirst<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], K extends KeysOfType<T, (this: T, ...args: any) => any>>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, count: number, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): number;
|
|
25
|
+
static forAll<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], ConsumerParameters extends any[]>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, consumer: (this: void, behavior: T, ...parameters: ConsumerParameters) => unknown, ...parameters: ConsumerParameters): number;
|
|
26
|
+
static forAll<T extends Behavior<AnyNotNil>, ConstructorParameters extends any[], K extends KeysOfType<T, (this: T, ...args: any) => any>>(this: BehaviorConstructor<T, ConstructorParameters>, object: T extends Behavior<infer Object> ? Object : never, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): number;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
|
@@ -3,14 +3,19 @@ import { AbilityBehavior } from "../ability";
|
|
|
3
3
|
import { Ability } from "../../internal/ability";
|
|
4
4
|
import { UnitBehavior } from "../unit";
|
|
5
5
|
import { Unit } from "../../internal/unit";
|
|
6
|
+
import { MutableKeys } from "../../../utility/types";
|
|
6
7
|
import { AbilityDependentValue } from "../../object-field/ability";
|
|
8
|
+
type UnitBehaviorParameters<T extends UnitBehavior> = Partial<{
|
|
9
|
+
[K in MutableKeys<T> & KeysOfType<T, boolean | number | string>]: T[K] extends boolean | number | string ? AbilityDependentValue<T[K]> : never;
|
|
10
|
+
}>;
|
|
7
11
|
export declare class ApplyUnitBehaviorAbilityBehavior<T extends UnitBehavior> extends AbilityBehavior {
|
|
8
12
|
private readonly unitBehaviorConstructor;
|
|
9
13
|
private readonly parameters?;
|
|
10
14
|
private readonly keys?;
|
|
11
15
|
private unitBehavior?;
|
|
12
|
-
constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?:
|
|
16
|
+
constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?: UnitBehaviorParameters<T> | undefined);
|
|
13
17
|
update(): void;
|
|
14
18
|
onUnitGainAbility(unit: Unit): void;
|
|
15
19
|
onUnitLoseAbility(): void;
|
|
16
20
|
}
|
|
21
|
+
export {};
|
|
@@ -9,13 +9,20 @@ import { Destructable } from "../../core/types/destructable";
|
|
|
9
9
|
import { EffectParameters } from "../../core/types/effect";
|
|
10
10
|
import { AbilityDependentValue } from "../object-field/ability";
|
|
11
11
|
export type AbilityBehaviorConstructor<Args extends any[]> = new (ability: Ability, ...args: Args) => AbilityBehavior;
|
|
12
|
-
export declare abstract class AbilityBehavior<
|
|
12
|
+
export declare abstract class AbilityBehavior<Parameters extends {
|
|
13
|
+
periodicActionParameters?: any[];
|
|
14
|
+
missileParameters?: any[];
|
|
15
|
+
} = {}> extends Behavior<Ability, NonNullable<Parameters["periodicActionParameters"]>> {
|
|
13
16
|
constructor(ability: Ability);
|
|
14
17
|
get ability(): Ability;
|
|
15
18
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
16
19
|
protected flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
17
20
|
protected flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
18
21
|
protected flashSpecialEffect(...args: [...pointOrWidget: [x: number, y: number] | [widget: Widget], duration?: number]): void;
|
|
22
|
+
private static MissileLaunchConfig;
|
|
23
|
+
private get missileLaunchConfig();
|
|
24
|
+
protected launchMissile(source: Unit, target: Unit, ...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
25
|
+
onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
19
26
|
onUnitGainAbility(_unit: Unit): void;
|
|
20
27
|
onUnitLoseAbility(_unit: Unit): void;
|
|
21
28
|
onCastingStart(caster: Unit): void;
|
|
@@ -15,13 +15,52 @@ local Effect = ____effect.Effect
|
|
|
15
15
|
local ____ability = require("engine.standard.fields.ability")
|
|
16
16
|
local AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
17
17
|
local EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
18
|
+
local MISSILE_ARC_ABILITY_FLOAT_FIELD = ____ability.MISSILE_ARC_ABILITY_FLOAT_FIELD
|
|
19
|
+
local MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
20
|
+
local MISSILE_SPEED_ABILITY_INTEGER_FIELD = ____ability.MISSILE_SPEED_ABILITY_INTEGER_FIELD
|
|
18
21
|
local SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD = ____ability.SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD
|
|
19
22
|
local SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
20
23
|
local ____ability = require("engine.object-field.ability")
|
|
21
24
|
local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
|
|
22
25
|
local ____timer = require("core.types.timer")
|
|
23
26
|
local Timer = ____timer.Timer
|
|
27
|
+
local ____missile = require("core.types.missile")
|
|
28
|
+
local Missile = ____missile.Missile
|
|
24
29
|
local createBehaviorFunctionsByAbilityTypeId = {}
|
|
30
|
+
local function invokeOnMissileArrival(_missile, success, abilityBehavior, ...)
|
|
31
|
+
if success then
|
|
32
|
+
abilityBehavior:onMissileArrival(...)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
local ____class_0 = __TS__Class()
|
|
36
|
+
____class_0.name = ""
|
|
37
|
+
function ____class_0.prototype.____constructor(self, abilityBehavior)
|
|
38
|
+
self.abilityBehavior = abilityBehavior
|
|
39
|
+
end
|
|
40
|
+
__TS__SetDescriptor(
|
|
41
|
+
____class_0.prototype,
|
|
42
|
+
"art",
|
|
43
|
+
{get = function(self)
|
|
44
|
+
return MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.abilityBehavior.ability, 0)
|
|
45
|
+
end},
|
|
46
|
+
true
|
|
47
|
+
)
|
|
48
|
+
__TS__SetDescriptor(
|
|
49
|
+
____class_0.prototype,
|
|
50
|
+
"arc",
|
|
51
|
+
{get = function(self)
|
|
52
|
+
return MISSILE_ARC_ABILITY_FLOAT_FIELD:getValue(self.abilityBehavior.ability)
|
|
53
|
+
end},
|
|
54
|
+
true
|
|
55
|
+
)
|
|
56
|
+
__TS__SetDescriptor(
|
|
57
|
+
____class_0.prototype,
|
|
58
|
+
"speed",
|
|
59
|
+
{get = function(self)
|
|
60
|
+
return MISSILE_SPEED_ABILITY_INTEGER_FIELD:getValue(self.abilityBehavior.ability)
|
|
61
|
+
end},
|
|
62
|
+
true
|
|
63
|
+
)
|
|
25
64
|
____exports.AbilityBehavior = __TS__Class()
|
|
26
65
|
local AbilityBehavior = ____exports.AbilityBehavior
|
|
27
66
|
AbilityBehavior.name = "AbilityBehavior"
|
|
@@ -65,6 +104,18 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrDurati
|
|
|
65
104
|
)
|
|
66
105
|
end
|
|
67
106
|
end
|
|
107
|
+
function AbilityBehavior.prototype.launchMissile(self, source, target, ...)
|
|
108
|
+
Missile:launch(
|
|
109
|
+
self.missileLaunchConfig,
|
|
110
|
+
source,
|
|
111
|
+
target,
|
|
112
|
+
invokeOnMissileArrival,
|
|
113
|
+
self,
|
|
114
|
+
...
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
function AbilityBehavior.prototype.onMissileArrival(self, ...)
|
|
118
|
+
end
|
|
68
119
|
function AbilityBehavior.prototype.onUnitGainAbility(self, _unit)
|
|
69
120
|
end
|
|
70
121
|
function AbilityBehavior.prototype.onUnitLoseAbility(self, _unit)
|
|
@@ -127,6 +178,17 @@ __TS__SetDescriptor(
|
|
|
127
178
|
return self.object
|
|
128
179
|
end},
|
|
129
180
|
true
|
|
181
|
+
)
|
|
182
|
+
AbilityBehavior.MissileLaunchConfig = ____class_0
|
|
183
|
+
__TS__SetDescriptor(
|
|
184
|
+
AbilityBehavior.prototype,
|
|
185
|
+
"missileLaunchConfig",
|
|
186
|
+
{get = function(self)
|
|
187
|
+
local missileLaunchConfig = __TS__New(____exports.AbilityBehavior.MissileLaunchConfig, self)
|
|
188
|
+
rawset(self, "missileLaunchConfig", missileLaunchConfig)
|
|
189
|
+
return missileLaunchConfig
|
|
190
|
+
end},
|
|
191
|
+
true
|
|
130
192
|
);
|
|
131
193
|
(function(self)
|
|
132
194
|
local function createUnitEventListener(key)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Behavior } from "../behavior";
|
|
3
3
|
import { Ability } from "../internal/ability";
|
|
4
4
|
import { DamageEvent, DamagingEvent, Unit } from "../internal/unit";
|
|
5
|
+
import "../internal/unit+ability";
|
|
5
6
|
import "../internal/unit-missile-launch";
|
|
6
7
|
export type UnitBehaviorConstructor<Args extends any[]> = new (unit: Unit, ...args: Args) => UnitBehavior;
|
|
7
8
|
export declare abstract class UnitBehavior<PeriodicActionParameters extends any[] = any[]> extends Behavior<Unit, PeriodicActionParameters> {
|
|
@@ -13,8 +14,8 @@ export declare abstract class UnitBehavior<PeriodicActionParameters extends any[
|
|
|
13
14
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
14
15
|
onDamageReceiving(source: Unit | undefined, event: DamagingEvent): void;
|
|
15
16
|
onDamageReceived(source: Unit | undefined, event: DamageEvent): void;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
onAbilityGained(ability: Ability): void;
|
|
18
|
+
onAbilityLost(ability: Ability): void;
|
|
18
19
|
onKill(target: Unit): void;
|
|
19
20
|
onDeath(source: Unit | undefined): void;
|
|
20
21
|
}
|
|
@@ -7,6 +7,7 @@ local ____behavior = require("engine.behavior")
|
|
|
7
7
|
local Behavior = ____behavior.Behavior
|
|
8
8
|
local ____unit = require("engine.internal.unit")
|
|
9
9
|
local Unit = ____unit.Unit
|
|
10
|
+
require("engine.internal.unit+ability")
|
|
10
11
|
require("engine.internal.unit-missile-launch")
|
|
11
12
|
____exports.UnitBehavior = __TS__Class()
|
|
12
13
|
local UnitBehavior = ____exports.UnitBehavior
|
|
@@ -62,6 +63,12 @@ __TS__SetDescriptor(
|
|
|
62
63
|
end
|
|
63
64
|
____exports.UnitBehavior:forAll(target, "onDamageReceived", source, event)
|
|
64
65
|
end)
|
|
66
|
+
Unit.abilityGainedEvent:addListener(function(source, target)
|
|
67
|
+
____exports.UnitBehavior:forAll(source, "onAbilityGained", target)
|
|
68
|
+
end)
|
|
69
|
+
Unit.abilityLostEvent:addListener(function(source, target)
|
|
70
|
+
____exports.UnitBehavior:forAll(source, "onAbilityLost", target)
|
|
71
|
+
end)
|
|
65
72
|
Unit.deathEvent:addListener(function(target, source)
|
|
66
73
|
if source ~= nil then
|
|
67
74
|
____exports.UnitBehavior:forAll(source, "onKill", target)
|
package/engine/buff.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
65
65
|
destroysOnDamage?: BooleanParameterValueType;
|
|
66
66
|
maximumAutoAttackCount?: IntegerParameterValueType;
|
|
67
67
|
uniqueGroup?: BuffUniqueGroup;
|
|
68
|
-
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters :
|
|
68
|
+
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
69
69
|
declare const enum BuffPropertyKey {
|
|
70
70
|
UNIT = 100,
|
|
71
71
|
SOURCE = 101,
|
|
@@ -116,7 +116,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
116
116
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
117
117
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
118
118
|
];
|
|
119
|
-
export declare class Buff<AdditionalParameters extends Prohibit<Record<string, any>, keyof BuffParameters> =
|
|
119
|
+
export declare class Buff<AdditionalParameters extends Prohibit<Record<string, any>, keyof BuffParameters> = object> extends UnitBehavior {
|
|
120
120
|
private _unit;
|
|
121
121
|
protected readonly __additionalParametersBrand?: AdditionalParameters;
|
|
122
122
|
private [BuffPropertyKey.UNIT];
|
package/engine/buff.lua
CHANGED
|
@@ -1035,24 +1035,22 @@ __TS__SetDescriptor(
|
|
|
1035
1035
|
true
|
|
1036
1036
|
);
|
|
1037
1037
|
(function(self)
|
|
1038
|
+
local function destroyBuffIfNeeded(buff)
|
|
1039
|
+
if getUnitAbility(buff[100].handle, buff.typeId) ~= buff.handle then
|
|
1040
|
+
buff:destroy()
|
|
1041
|
+
end
|
|
1042
|
+
end
|
|
1038
1043
|
____exports.checkBuff = function(unit, buffTypeId)
|
|
1039
1044
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1040
1045
|
if buffByTypeId ~= nil then
|
|
1041
1046
|
local buff = buffByTypeId[buffTypeId]
|
|
1042
|
-
if buff ~= nil
|
|
1043
|
-
buff
|
|
1047
|
+
if buff ~= nil then
|
|
1048
|
+
destroyBuffIfNeeded(buff)
|
|
1044
1049
|
end
|
|
1045
1050
|
end
|
|
1046
1051
|
end
|
|
1047
1052
|
____exports.checkBuffs = function(unit)
|
|
1048
|
-
|
|
1049
|
-
if buffByTypeId ~= nil then
|
|
1050
|
-
for ____, buff in pairs(buffByTypeId) do
|
|
1051
|
-
if getUnitAbility(unit.handle, buff.typeId) ~= buff.handle then
|
|
1052
|
-
buff:destroy()
|
|
1053
|
-
end
|
|
1054
|
-
end
|
|
1055
|
-
end
|
|
1053
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1056
1054
|
end
|
|
1057
1055
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1058
1056
|
0,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Unit } from "../unit";
|
|
4
3
|
import { AbilityTypeId } from "../../object-data/entry/ability-type";
|
|
@@ -34,8 +33,8 @@ export declare namespace UnitBonusType {
|
|
|
34
33
|
const DAMAGE: UnitBonusType<UnitDamageBonusId>;
|
|
35
34
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
36
35
|
}
|
|
37
|
-
export declare const addUnitBonus: <Id extends UnitBonusId
|
|
38
|
-
export declare const removeUnitBonus: <Id extends UnitBonusId
|
|
39
|
-
export declare const updateUnitBonus: <Id extends UnitBonusId
|
|
40
|
-
export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId
|
|
41
|
-
export declare const getUnitBonus: <Id extends UnitBonusId
|
|
36
|
+
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
37
|
+
export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
|
|
38
|
+
export declare const updateUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id, value: number) => boolean;
|
|
39
|
+
export declare const addOrUpdateOrRemoveUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id | undefined, value: number) => Id | undefined;
|
|
40
|
+
export declare const getUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
4
3
|
import { Player } from "../../core/types/player";
|
|
@@ -228,7 +227,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
228
227
|
isSelected(player: Player): boolean;
|
|
229
228
|
explode(): void;
|
|
230
229
|
kill(): void;
|
|
231
|
-
revive(
|
|
230
|
+
revive(x: number, y: number, doEffect?: boolean): void;
|
|
232
231
|
healTarget(target: Widget, amount: number): void;
|
|
233
232
|
useItem(item: Item): boolean;
|
|
234
233
|
issueImmediateOrder(order: number): boolean;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -6,7 +6,9 @@ local __TS__New = ____lualib.__TS__New
|
|
|
6
6
|
local __TS__Class = ____lualib.__TS__Class
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
8
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
9
|
-
local
|
|
9
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
10
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
11
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
10
12
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
11
13
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
12
14
|
local Set = ____lualib.Set
|
|
@@ -279,9 +281,8 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
|
|
|
279
281
|
end
|
|
280
282
|
local function dispatch(event, idGetter, argsGetter)
|
|
281
283
|
local initialized = false
|
|
282
|
-
local x = {}
|
|
283
284
|
return setmetatable(
|
|
284
|
-
|
|
285
|
+
{},
|
|
285
286
|
{
|
|
286
287
|
__index = function(self, id)
|
|
287
288
|
if type(id) ~= "number" then
|
|
@@ -685,11 +686,6 @@ function Unit.prototype.onDestroy(self)
|
|
|
685
686
|
if not self._owner then
|
|
686
687
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
687
688
|
end
|
|
688
|
-
local abilities = self.abilities
|
|
689
|
-
for ____, ability in ipairs(abilities) do
|
|
690
|
-
ability:destroy()
|
|
691
|
-
end
|
|
692
|
-
__TS__ArraySetLength(abilities, 0)
|
|
693
689
|
for ____, player in ipairs(Player.all) do
|
|
694
690
|
if self:isSelected(player) then
|
|
695
691
|
Event.invoke(____exports.Unit.onDeselect, self, player)
|
|
@@ -704,10 +700,6 @@ function Unit.prototype.onDestroy(self)
|
|
|
704
700
|
if eventsToDestroy ~= nil then
|
|
705
701
|
forEach(eventsToDestroy, "destroy")
|
|
706
702
|
end
|
|
707
|
-
if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
|
|
708
|
-
unitRemoveAbility(handle, leaveDetectAbilityId)
|
|
709
|
-
removeUnit(handle)
|
|
710
|
-
end
|
|
711
703
|
return Handle.prototype.onDestroy(self)
|
|
712
704
|
end
|
|
713
705
|
function Unit.prototype.addAttackHandler(self, condition, action)
|
|
@@ -817,8 +809,15 @@ end
|
|
|
817
809
|
function Unit.prototype.kill(self)
|
|
818
810
|
killUnit(self.handle)
|
|
819
811
|
end
|
|
820
|
-
function Unit.prototype.revive(self,
|
|
821
|
-
|
|
812
|
+
function Unit.prototype.revive(self, x, y, doEffect)
|
|
813
|
+
local ____ReviveHero_4 = ReviveHero
|
|
814
|
+
local ____array_3 = __TS__SparseArrayNew(self.handle, x, y)
|
|
815
|
+
local ____doEffect_2 = doEffect
|
|
816
|
+
if ____doEffect_2 == nil then
|
|
817
|
+
____doEffect_2 = false
|
|
818
|
+
end
|
|
819
|
+
__TS__SparseArrayPush(____array_3, ____doEffect_2)
|
|
820
|
+
____ReviveHero_4(__TS__SparseArraySpread(____array_3))
|
|
822
821
|
end
|
|
823
822
|
function Unit.prototype.healTarget(self, target, amount)
|
|
824
823
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -1385,13 +1384,13 @@ __TS__SetDescriptor(
|
|
|
1385
1384
|
end,
|
|
1386
1385
|
set = function(self, isTeamGlowVisible)
|
|
1387
1386
|
showUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1388
|
-
local
|
|
1387
|
+
local ____temp_5
|
|
1389
1388
|
if not isTeamGlowVisible then
|
|
1390
|
-
|
|
1389
|
+
____temp_5 = true
|
|
1391
1390
|
else
|
|
1392
|
-
|
|
1391
|
+
____temp_5 = nil
|
|
1393
1392
|
end
|
|
1394
|
-
self[105] =
|
|
1393
|
+
self[105] = ____temp_5
|
|
1395
1394
|
end
|
|
1396
1395
|
},
|
|
1397
1396
|
true
|
|
@@ -2114,25 +2113,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2114
2113
|
function(event)
|
|
2115
2114
|
local invoke = Event.invoke
|
|
2116
2115
|
local function listener(unit, id)
|
|
2117
|
-
local
|
|
2116
|
+
local ____GetSpellTargetUnit_result_8
|
|
2118
2117
|
if GetSpellTargetUnit() then
|
|
2119
|
-
|
|
2118
|
+
____GetSpellTargetUnit_result_8 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2120
2119
|
else
|
|
2121
|
-
local
|
|
2120
|
+
local ____GetSpellTargetItem_result_7
|
|
2122
2121
|
if GetSpellTargetItem() then
|
|
2123
|
-
|
|
2122
|
+
____GetSpellTargetItem_result_7 = Item:of(GetSpellTargetItem())
|
|
2124
2123
|
else
|
|
2125
|
-
local
|
|
2124
|
+
local ____GetSpellTargetDestructable_result_6
|
|
2126
2125
|
if GetSpellTargetDestructable() then
|
|
2127
|
-
|
|
2126
|
+
____GetSpellTargetDestructable_result_6 = Destructable:of(GetSpellTargetDestructable())
|
|
2128
2127
|
else
|
|
2129
|
-
|
|
2128
|
+
____GetSpellTargetDestructable_result_6 = nil
|
|
2130
2129
|
end
|
|
2131
|
-
|
|
2130
|
+
____GetSpellTargetItem_result_7 = ____GetSpellTargetDestructable_result_6
|
|
2132
2131
|
end
|
|
2133
|
-
|
|
2132
|
+
____GetSpellTargetUnit_result_8 = ____GetSpellTargetItem_result_7
|
|
2134
2133
|
end
|
|
2135
|
-
local target =
|
|
2134
|
+
local target = ____GetSpellTargetUnit_result_8
|
|
2136
2135
|
if target then
|
|
2137
2136
|
invoke(event, unit, id, target)
|
|
2138
2137
|
end
|
|
@@ -2568,15 +2567,6 @@ __TS__ObjectDefineProperty(
|
|
|
2568
2567
|
orderId("magicundefense"),
|
|
2569
2568
|
orderId("unimmolation")
|
|
2570
2569
|
}) do
|
|
2571
|
-
____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
|
|
2572
|
-
local handle = unit.handle
|
|
2573
|
-
for i = 1, #leaveAbilityIds do
|
|
2574
|
-
if getUnitAbilityLevel(handle, leaveAbilityIds[i]) ~= 0 then
|
|
2575
|
-
return
|
|
2576
|
-
end
|
|
2577
|
-
end
|
|
2578
|
-
unit:destroy()
|
|
2579
|
-
end)
|
|
2580
2570
|
end
|
|
2581
2571
|
end)(Unit)
|
|
2582
2572
|
return ____exports
|