warscript 0.0.1-dev.d18f377 → 0.0.1-dev.d5f6f38
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/core/types/effect.lua +2 -2
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +19 -4
- package/engine/behaviour/ability.d.ts +3 -7
- package/engine/behaviour/ability.lua +34 -35
- package/engine/buff.lua +1 -1
- package/engine/internal/ability.d.ts +1 -2
- package/engine/internal/ability.lua +2 -10
- package/engine/internal/unit/ability.d.ts +1 -10
- package/engine/internal/unit/ability.lua +0 -36
- package/engine/object-field/ability.d.ts +2 -2
- package/package.json +1 -1
- package/engine/behaviour/ability/emulate-impact.d.ts +0 -6
- package/engine/behaviour/ability/emulate-impact.lua +0 -29
- package/engine/behaviour/ability/on-command-impact.d.ts +0 -8
- package/engine/behaviour/ability/on-command-impact.lua +0 -18
- package/engine/behaviour/ability/remove-buffs.d.ts +0 -16
- package/engine/behaviour/ability/remove-buffs.lua +0 -28
- package/utility/lazy.d.ts +0 -2
- package/utility/lazy.lua +0 -14
package/core/types/effect.lua
CHANGED
|
@@ -41,10 +41,10 @@ local function setSpecialEffectPitchDegrees(effect, pitch)
|
|
|
41
41
|
-mathRad(pitch)
|
|
42
42
|
)
|
|
43
43
|
end
|
|
44
|
-
local function setSpecialEffectRollDegrees(effect,
|
|
44
|
+
local function setSpecialEffectRollDegrees(effect, pitch)
|
|
45
45
|
setSpecialEffectRoll(
|
|
46
46
|
effect,
|
|
47
|
-
-mathRad(
|
|
47
|
+
-mathRad(pitch)
|
|
48
48
|
)
|
|
49
49
|
end
|
|
50
50
|
local animTypeByAnimationName = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import { AbilityBehavior } from "../ability";
|
|
2
3
|
import { Unit } from "../../internal/unit";
|
|
3
|
-
|
|
4
|
-
export declare class InstantImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
4
|
+
export declare class InstantImpactAbilityBehavior extends AbilityBehavior {
|
|
5
5
|
onCastingStart(caster: Unit): void;
|
|
6
6
|
}
|
|
@@ -2,13 +2,28 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
4
|
local ____exports = {}
|
|
5
|
-
local
|
|
6
|
-
local
|
|
5
|
+
local ____ability = require("engine.behaviour.ability")
|
|
6
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
7
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
8
|
+
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
9
|
+
local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTEGER_LEVEL_FIELD
|
|
7
10
|
____exports.InstantImpactAbilityBehavior = __TS__Class()
|
|
8
11
|
local InstantImpactAbilityBehavior = ____exports.InstantImpactAbilityBehavior
|
|
9
12
|
InstantImpactAbilityBehavior.name = "InstantImpactAbilityBehavior"
|
|
10
|
-
__TS__ClassExtends(InstantImpactAbilityBehavior,
|
|
13
|
+
__TS__ClassExtends(InstantImpactAbilityBehavior, AbilityBehavior)
|
|
11
14
|
function InstantImpactAbilityBehavior.prototype.onCastingStart(self, caster)
|
|
12
|
-
self
|
|
15
|
+
local abilityTypeId = self.ability.typeId
|
|
16
|
+
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
17
|
+
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
18
|
+
if caster:getAbilityRemainingCooldown(abilityTypeId) ~= 0 or caster.mana < manaCost then
|
|
19
|
+
return
|
|
20
|
+
end
|
|
21
|
+
caster.mana = caster.mana - manaCost
|
|
22
|
+
if cooldown == 0 then
|
|
23
|
+
caster:interruptCast(self.ability.typeId)
|
|
24
|
+
else
|
|
25
|
+
caster:startAbilityCooldown(self.ability.typeId, cooldown)
|
|
26
|
+
end
|
|
27
|
+
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
13
28
|
end
|
|
14
29
|
return ____exports
|
|
@@ -9,26 +9,22 @@ 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 type AbilityBehaviorParameters = {
|
|
13
|
-
isExclusiveOnImpactHandler?: boolean;
|
|
14
|
-
};
|
|
15
12
|
export declare abstract class AbilityBehavior<Parameters extends {
|
|
16
13
|
periodicActionParameters?: any[];
|
|
17
14
|
missileParameters?: any[];
|
|
18
15
|
} = {}> extends Behavior<Ability, NonNullable<Parameters["periodicActionParameters"]>> {
|
|
19
|
-
constructor(ability: Ability
|
|
20
|
-
protected registerCommandEvent(orderTypeStringId?: string): void;
|
|
16
|
+
constructor(ability: Ability);
|
|
21
17
|
get ability(): Ability;
|
|
22
|
-
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string
|
|
18
|
+
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
23
19
|
protected flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
24
20
|
protected flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
25
21
|
protected flashSpecialEffect(...args: [...pointOrWidget: [x: number, y: number] | [widget: Widget], duration?: number]): void;
|
|
26
22
|
private static MissileLaunchConfig;
|
|
27
23
|
private get missileLaunchConfig();
|
|
24
|
+
protected launchMissile(source: Unit, target: Unit, ...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
28
25
|
onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
29
26
|
onUnitGainAbility(_unit: Unit): void;
|
|
30
27
|
onUnitLoseAbility(_unit: Unit): void;
|
|
31
|
-
onCommand(caster: Unit, orderTypeStringId: string): void;
|
|
32
28
|
onCastingStart(caster: Unit): void;
|
|
33
29
|
onCastingFinish(caster: Unit): void;
|
|
34
30
|
onChannelingStart(caster: Unit): void;
|
|
@@ -4,7 +4,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local createUnitEventListener
|
|
8
7
|
local ____behavior = require("engine.behavior")
|
|
9
8
|
local Behavior = ____behavior.Behavior
|
|
10
9
|
local ____unit = require("engine.unit")
|
|
@@ -25,27 +24,21 @@ local ____ability = require("engine.object-field.ability")
|
|
|
25
24
|
local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
|
|
26
25
|
local ____timer = require("core.types.timer")
|
|
27
26
|
local Timer = ____timer.Timer
|
|
27
|
+
local ____missile = require("core.types.missile")
|
|
28
|
+
local Missile = ____missile.Missile
|
|
28
29
|
local createBehaviorFunctionsByAbilityTypeId = {}
|
|
29
|
-
local
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return function(unit, ability, ...)
|
|
33
|
-
Timer:run(unitEventListener, unit, ability, ...)
|
|
30
|
+
local function invokeOnMissileArrival(_missile, success, abilityBehavior, ...)
|
|
31
|
+
if success then
|
|
32
|
+
abilityBehavior:onMissileArrival(...)
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
local registeredCommandEventIds = {}
|
|
42
|
-
local ____class_2 = __TS__Class()
|
|
43
|
-
____class_2.name = ""
|
|
44
|
-
function ____class_2.prototype.____constructor(self, abilityBehavior)
|
|
35
|
+
local ____class_0 = __TS__Class()
|
|
36
|
+
____class_0.name = ""
|
|
37
|
+
function ____class_0.prototype.____constructor(self, abilityBehavior)
|
|
45
38
|
self.abilityBehavior = abilityBehavior
|
|
46
39
|
end
|
|
47
40
|
__TS__SetDescriptor(
|
|
48
|
-
|
|
41
|
+
____class_0.prototype,
|
|
49
42
|
"art",
|
|
50
43
|
{get = function(self)
|
|
51
44
|
return MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.abilityBehavior.ability, 0)
|
|
@@ -53,7 +46,7 @@ __TS__SetDescriptor(
|
|
|
53
46
|
true
|
|
54
47
|
)
|
|
55
48
|
__TS__SetDescriptor(
|
|
56
|
-
|
|
49
|
+
____class_0.prototype,
|
|
57
50
|
"arc",
|
|
58
51
|
{get = function(self)
|
|
59
52
|
return MISSILE_ARC_ABILITY_FLOAT_FIELD:getValue(self.abilityBehavior.ability)
|
|
@@ -61,7 +54,7 @@ __TS__SetDescriptor(
|
|
|
61
54
|
true
|
|
62
55
|
)
|
|
63
56
|
__TS__SetDescriptor(
|
|
64
|
-
|
|
57
|
+
____class_0.prototype,
|
|
65
58
|
"speed",
|
|
66
59
|
{get = function(self)
|
|
67
60
|
return MISSILE_SPEED_ABILITY_INTEGER_FIELD:getValue(self.abilityBehavior.ability)
|
|
@@ -72,21 +65,8 @@ ____exports.AbilityBehavior = __TS__Class()
|
|
|
72
65
|
local AbilityBehavior = ____exports.AbilityBehavior
|
|
73
66
|
AbilityBehavior.name = "AbilityBehavior"
|
|
74
67
|
__TS__ClassExtends(AbilityBehavior, Behavior)
|
|
75
|
-
function AbilityBehavior.prototype.____constructor(self, ability
|
|
68
|
+
function AbilityBehavior.prototype.____constructor(self, ability)
|
|
76
69
|
Behavior.prototype.____constructor(self, ability)
|
|
77
|
-
if parameters and parameters.isExclusiveOnImpactHandler then
|
|
78
|
-
exclusiveOnImpactHandlerAbilityBehaviorByAbility[ability] = self
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
function AbilityBehavior.prototype.registerCommandEvent(self, orderTypeStringId)
|
|
82
|
-
if orderTypeStringId == nil then
|
|
83
|
-
orderTypeStringId = self.ability.orderTypeStringId
|
|
84
|
-
end
|
|
85
|
-
local commandEventId = (tostring(self.ability.typeId) .. "#") .. orderTypeStringId
|
|
86
|
-
if not (registeredCommandEventIds[commandEventId] ~= nil) then
|
|
87
|
-
registeredCommandEventIds[commandEventId] = true
|
|
88
|
-
Unit.abilityCommandEvent[self.ability.typeId][orderTypeStringId]:addListener(createUnitEventListener("onCommand"))
|
|
89
|
-
end
|
|
90
70
|
end
|
|
91
71
|
function AbilityBehavior.prototype.resolveCurrentAbilityDependentValue(self, value)
|
|
92
72
|
return resolveCurrentAbilityDependentValue(self.ability, value)
|
|
@@ -124,14 +104,22 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrDurati
|
|
|
124
104
|
)
|
|
125
105
|
end
|
|
126
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
|
|
127
117
|
function AbilityBehavior.prototype.onMissileArrival(self, ...)
|
|
128
118
|
end
|
|
129
119
|
function AbilityBehavior.prototype.onUnitGainAbility(self, _unit)
|
|
130
120
|
end
|
|
131
121
|
function AbilityBehavior.prototype.onUnitLoseAbility(self, _unit)
|
|
132
122
|
end
|
|
133
|
-
function AbilityBehavior.prototype.onCommand(self, caster, orderTypeStringId)
|
|
134
|
-
end
|
|
135
123
|
function AbilityBehavior.prototype.onCastingStart(self, caster)
|
|
136
124
|
end
|
|
137
125
|
function AbilityBehavior.prototype.onCastingFinish(self, caster)
|
|
@@ -191,7 +179,7 @@ __TS__SetDescriptor(
|
|
|
191
179
|
end},
|
|
192
180
|
true
|
|
193
181
|
)
|
|
194
|
-
AbilityBehavior.MissileLaunchConfig =
|
|
182
|
+
AbilityBehavior.MissileLaunchConfig = ____class_0
|
|
195
183
|
__TS__SetDescriptor(
|
|
196
184
|
AbilityBehavior.prototype,
|
|
197
185
|
"missileLaunchConfig",
|
|
@@ -203,6 +191,17 @@ __TS__SetDescriptor(
|
|
|
203
191
|
true
|
|
204
192
|
);
|
|
205
193
|
(function(self)
|
|
194
|
+
local function createUnitEventListener(key)
|
|
195
|
+
return function(unit, ability, ...)
|
|
196
|
+
____exports.AbilityBehavior:forAll(ability, key, unit, ...)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
local function createZeroTimerUnitEventListener(key)
|
|
200
|
+
local unitEventListener = createUnitEventListener(key)
|
|
201
|
+
return function(unit, ability, ...)
|
|
202
|
+
Timer:run(unitEventListener, unit, ability, ...)
|
|
203
|
+
end
|
|
204
|
+
end
|
|
206
205
|
Unit.abilityGainedEvent:addListener(createUnitEventListener("onUnitGainAbility"))
|
|
207
206
|
Unit.abilityLostEvent:addListener(createUnitEventListener("onUnitLoseAbility"))
|
|
208
207
|
Unit.abilityCastingStartEvent:addListener(createUnitEventListener("onCastingStart"))
|
package/engine/buff.lua
CHANGED
|
@@ -515,7 +515,7 @@ function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrPa
|
|
|
515
515
|
)
|
|
516
516
|
local ____isWidgetProvided_38
|
|
517
517
|
if isWidgetProvided then
|
|
518
|
-
____isWidgetProvided_38 =
|
|
518
|
+
____isWidgetProvided_38 = parametersOrDuration
|
|
519
519
|
else
|
|
520
520
|
____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
|
|
521
521
|
end
|
|
@@ -12,8 +12,7 @@ export declare abstract class Ability extends Handle<jability> {
|
|
|
12
12
|
protected constructor(handle: jability, typeId: number);
|
|
13
13
|
toString(): string;
|
|
14
14
|
get parentTypeId(): number;
|
|
15
|
-
get
|
|
16
|
-
get orderTypeId(): number;
|
|
15
|
+
get orderId(): number;
|
|
17
16
|
abstract readonly owner: Unit | Item;
|
|
18
17
|
getSnapshot(): AbilitySnapshot;
|
|
19
18
|
hasField(field: jabilityfield | number): boolean;
|
|
@@ -296,18 +296,10 @@ __TS__SetDescriptor(
|
|
|
296
296
|
)
|
|
297
297
|
__TS__SetDescriptor(
|
|
298
298
|
Ability.prototype,
|
|
299
|
-
"
|
|
299
|
+
"orderId",
|
|
300
300
|
{get = function(self)
|
|
301
301
|
local field = orderIdFieldByParentTypeId[self.parentTypeId]
|
|
302
|
-
return field ~= nil and getAbilityStringLevelField(self.handle,
|
|
303
|
-
end},
|
|
304
|
-
true
|
|
305
|
-
)
|
|
306
|
-
__TS__SetDescriptor(
|
|
307
|
-
Ability.prototype,
|
|
308
|
-
"orderTypeId",
|
|
309
|
-
{get = function(self)
|
|
310
|
-
return order2orderId(self.orderTypeStringId)
|
|
302
|
+
return order2orderId(field ~= nil and getAbilityStringLevelField(self.handle, ABILITY_SLF_BASE_ORDER_ID_NCL6, self.level) or (orders[self.parentTypeId] or ""))
|
|
311
303
|
end},
|
|
312
304
|
true
|
|
313
305
|
)
|
|
@@ -3,7 +3,7 @@ import { Ability } from "../ability";
|
|
|
3
3
|
import { Destructable } from "../../../core/types/destructable";
|
|
4
4
|
import { Item } from "../item";
|
|
5
5
|
import { Widget } from "../../../core/types/widget";
|
|
6
|
-
import { DispatchingEvent
|
|
6
|
+
import { DispatchingEvent } from "../../../event";
|
|
7
7
|
declare module "../unit" {
|
|
8
8
|
namespace Unit {
|
|
9
9
|
const abilityCastingStartEvent: DispatchingEvent<[Unit, Ability]>;
|
|
@@ -141,12 +141,3 @@ declare module "../unit" {
|
|
|
141
141
|
const abilityStopEvent: DispatchingEvent<[Unit, Ability]>;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
declare module "../unit" {
|
|
145
|
-
namespace Unit {
|
|
146
|
-
const abilityCommandEvent: {
|
|
147
|
-
readonly [abilityTypeId: number]: {
|
|
148
|
-
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
@@ -15,15 +15,8 @@ local UnitTriggerEvent = ____unit.UnitTriggerEvent
|
|
|
15
15
|
local ____event = require("event")
|
|
16
16
|
local createDispatchingEvent = ____event.createDispatchingEvent
|
|
17
17
|
local DependentInitializingEvent = ____event.DependentInitializingEvent
|
|
18
|
-
local Event = ____event.Event
|
|
19
|
-
local InitializingEvent = ____event.InitializingEvent
|
|
20
18
|
local ____preconditions = require("utility.preconditions")
|
|
21
19
|
local checkNotNull = ____preconditions.checkNotNull
|
|
22
|
-
local ____lazy = require("utility.lazy")
|
|
23
|
-
local lazyRecord = ____lazy.lazyRecord
|
|
24
|
-
local eventInvoke = Event.invoke
|
|
25
|
-
local condition = Condition
|
|
26
|
-
local createTrigger = CreateTrigger
|
|
27
20
|
local getItemAbility = BlzGetItemAbility
|
|
28
21
|
local getSpellAbility = GetSpellAbility
|
|
29
22
|
local getSpellAbilityId = GetSpellAbilityId
|
|
@@ -33,8 +26,6 @@ local getSpellTargetUnit = GetSpellTargetUnit
|
|
|
33
26
|
local getSpellTargetX = GetSpellTargetX
|
|
34
27
|
local getSpellTargetY = GetSpellTargetY
|
|
35
28
|
local getTriggerUnit = GetTriggerUnit
|
|
36
|
-
local triggerAddCondition = TriggerAddCondition
|
|
37
|
-
local triggerRegisterCommandEvent = TriggerRegisterCommandEvent
|
|
38
29
|
local unitInventorySize = UnitInventorySize
|
|
39
30
|
local unitItemInSlot = UnitItemInSlot
|
|
40
31
|
local function retrieveAbility(unit, ability, abilityId)
|
|
@@ -361,31 +352,4 @@ rawset(
|
|
|
361
352
|
extractAbilityTypeId
|
|
362
353
|
)
|
|
363
354
|
)
|
|
364
|
-
rawset(
|
|
365
|
-
Unit,
|
|
366
|
-
"abilityCommandEvent",
|
|
367
|
-
lazyRecord(function(abilityTypeId)
|
|
368
|
-
return lazyRecord(function(orderTypeStringId)
|
|
369
|
-
return __TS__New(
|
|
370
|
-
InitializingEvent,
|
|
371
|
-
function(event)
|
|
372
|
-
local trigger = createTrigger()
|
|
373
|
-
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
374
|
-
triggerAddCondition(
|
|
375
|
-
trigger,
|
|
376
|
-
condition(function()
|
|
377
|
-
local unit = Unit:of(getTriggerUnit())
|
|
378
|
-
if unit ~= nil then
|
|
379
|
-
local ability = unit:getAbilityById(abilityTypeId)
|
|
380
|
-
if ability ~= nil then
|
|
381
|
-
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
382
|
-
end
|
|
383
|
-
end
|
|
384
|
-
end)
|
|
385
|
-
)
|
|
386
|
-
end
|
|
387
|
-
)
|
|
388
|
-
end)
|
|
389
|
-
end)
|
|
390
|
-
)
|
|
391
355
|
return ____exports
|
|
@@ -130,5 +130,5 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
|
|
|
130
130
|
protected getNativeFieldValue(instance: Ability, level: number): CombatClassifications;
|
|
131
131
|
protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
|
|
132
132
|
}
|
|
133
|
-
export type AbilityDependentValue<ValueType extends boolean | number | string
|
|
134
|
-
export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string
|
|
133
|
+
export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
|
|
134
|
+
export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local ____exports = {}
|
|
5
|
-
local ____ability = require("engine.behaviour.ability")
|
|
6
|
-
local AbilityBehavior = ____ability.AbilityBehavior
|
|
7
|
-
local ____ability = require("engine.standard.fields.ability")
|
|
8
|
-
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
9
|
-
local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTEGER_LEVEL_FIELD
|
|
10
|
-
____exports.EmulateImpactAbilityBehavior = __TS__Class()
|
|
11
|
-
local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
|
|
12
|
-
EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
|
|
13
|
-
__TS__ClassExtends(EmulateImpactAbilityBehavior, AbilityBehavior)
|
|
14
|
-
function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
15
|
-
local abilityTypeId = self.ability.typeId
|
|
16
|
-
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
17
|
-
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
18
|
-
if caster:getAbilityRemainingCooldown(abilityTypeId) ~= 0 or caster.mana < manaCost then
|
|
19
|
-
return
|
|
20
|
-
end
|
|
21
|
-
caster.mana = caster.mana - manaCost
|
|
22
|
-
if cooldown == 0 then
|
|
23
|
-
caster:interruptCast(self.ability.typeId)
|
|
24
|
-
else
|
|
25
|
-
caster:startAbilityCooldown(self.ability.typeId, cooldown)
|
|
26
|
-
end
|
|
27
|
-
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
28
|
-
end
|
|
29
|
-
return ____exports
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import { Unit } from "../../internal/unit";
|
|
3
|
-
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
4
|
-
import { Ability } from "../../internal/ability";
|
|
5
|
-
export declare class OnCommandImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
6
|
-
constructor(ability: Ability);
|
|
7
|
-
onCommand(caster: Unit): void;
|
|
8
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local ____exports = {}
|
|
5
|
-
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
6
|
-
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
7
|
-
____exports.OnCommandImpactAbilityBehavior = __TS__Class()
|
|
8
|
-
local OnCommandImpactAbilityBehavior = ____exports.OnCommandImpactAbilityBehavior
|
|
9
|
-
OnCommandImpactAbilityBehavior.name = "OnCommandImpactAbilityBehavior"
|
|
10
|
-
__TS__ClassExtends(OnCommandImpactAbilityBehavior, EmulateImpactAbilityBehavior)
|
|
11
|
-
function OnCommandImpactAbilityBehavior.prototype.____constructor(self, ability)
|
|
12
|
-
EmulateImpactAbilityBehavior.prototype.____constructor(self, ability)
|
|
13
|
-
self:registerCommandEvent()
|
|
14
|
-
end
|
|
15
|
-
function OnCommandImpactAbilityBehavior.prototype.onCommand(self, caster)
|
|
16
|
-
self:emulateImpact(caster)
|
|
17
|
-
end
|
|
18
|
-
return ____exports
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import { AbilityBehavior } from "../ability";
|
|
3
|
-
import { Unit } from "../../internal/unit";
|
|
4
|
-
import { Ability } from "../../internal/ability";
|
|
5
|
-
import { AbilityDependentValue } from "../../object-field/ability";
|
|
6
|
-
import { BuffPolarity } from "../../object-data/auxiliary/buff-polarity";
|
|
7
|
-
import { BuffResistanceType } from "../../object-data/auxiliary/buff-resistance-type";
|
|
8
|
-
export declare class RemoveBuffsSelfAbilityBehavior extends AbilityBehavior {
|
|
9
|
-
private readonly polarity?;
|
|
10
|
-
private readonly resistanceType?;
|
|
11
|
-
private readonly includeExpirationTimers?;
|
|
12
|
-
private readonly includeAuras?;
|
|
13
|
-
private readonly autoDispel?;
|
|
14
|
-
constructor(ability: Ability, polarity?: AbilityDependentValue<BuffPolarity> | undefined, resistanceType?: AbilityDependentValue<BuffResistanceType> | undefined, includeExpirationTimers?: AbilityDependentValue<boolean> | undefined, includeAuras?: AbilityDependentValue<boolean> | undefined, autoDispel?: AbilityDependentValue<boolean> | undefined);
|
|
15
|
-
onImpact(caster: Unit): void;
|
|
16
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local ____exports = {}
|
|
5
|
-
local ____ability = require("engine.behaviour.ability")
|
|
6
|
-
local AbilityBehavior = ____ability.AbilityBehavior
|
|
7
|
-
____exports.RemoveBuffsSelfAbilityBehavior = __TS__Class()
|
|
8
|
-
local RemoveBuffsSelfAbilityBehavior = ____exports.RemoveBuffsSelfAbilityBehavior
|
|
9
|
-
RemoveBuffsSelfAbilityBehavior.name = "RemoveBuffsSelfAbilityBehavior"
|
|
10
|
-
__TS__ClassExtends(RemoveBuffsSelfAbilityBehavior, AbilityBehavior)
|
|
11
|
-
function RemoveBuffsSelfAbilityBehavior.prototype.____constructor(self, ability, polarity, resistanceType, includeExpirationTimers, includeAuras, autoDispel)
|
|
12
|
-
AbilityBehavior.prototype.____constructor(self, ability)
|
|
13
|
-
self.polarity = polarity
|
|
14
|
-
self.resistanceType = resistanceType
|
|
15
|
-
self.includeExpirationTimers = includeExpirationTimers
|
|
16
|
-
self.includeAuras = includeAuras
|
|
17
|
-
self.autoDispel = autoDispel
|
|
18
|
-
end
|
|
19
|
-
function RemoveBuffsSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
20
|
-
caster:removeBuffs(
|
|
21
|
-
self:resolveCurrentAbilityDependentValue(self.polarity),
|
|
22
|
-
self:resolveCurrentAbilityDependentValue(self.resistanceType),
|
|
23
|
-
self:resolveCurrentAbilityDependentValue(self.includeExpirationTimers),
|
|
24
|
-
self:resolveCurrentAbilityDependentValue(self.includeAuras),
|
|
25
|
-
self:resolveCurrentAbilityDependentValue(self.autoDispel)
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
return ____exports
|
package/utility/lazy.d.ts
DELETED
package/utility/lazy.lua
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
local rawset = _G.rawset
|
|
3
|
-
local setmetatable = _G.setmetatable
|
|
4
|
-
____exports.lazyRecord = function(initializer)
|
|
5
|
-
return setmetatable(
|
|
6
|
-
{},
|
|
7
|
-
{__index = function(self, key)
|
|
8
|
-
local value = initializer(key)
|
|
9
|
-
rawset(self, key, value)
|
|
10
|
-
return value
|
|
11
|
-
end}
|
|
12
|
-
)
|
|
13
|
-
end
|
|
14
|
-
return ____exports
|