warscript 0.0.1-dev.e196516 → 0.0.1-dev.e49ec00
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/timer.d.ts +1 -1
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability.lua +7 -16
- package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
- package/engine/behaviour/unit/stun-immunity.lua +43 -27
- package/engine/behaviour/unit.d.ts +12 -1
- package/engine/behaviour/unit.lua +56 -7
- package/engine/buff.d.ts +2 -1
- package/engine/buff.lua +9 -3
- package/engine/internal/ability.lua +8 -2
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/unit/ability.d.ts +30 -0
- package/engine/internal/unit/ability.lua +48 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit.d.ts +2 -1
- package/engine/internal/unit.lua +70 -57
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.lua +5 -5
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +26 -3
- package/engine/text-tag.lua +136 -5
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +1 -1
- package/utility/functions.d.ts +3 -0
- package/utility/functions.lua +3 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
package/core/types/timer.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class Timer extends AbstractDestroyable {
|
|
|
22
22
|
pause(): void;
|
|
23
23
|
resume(): void;
|
|
24
24
|
static create(): Timer;
|
|
25
|
-
static run<Args extends any[]>(callback: (...args: Args) => void, ...args: Args): void;
|
|
25
|
+
static run<Args extends any[]>(callback: (this: void, ...args: Args) => void, ...args: Args): void;
|
|
26
26
|
static simple<Args extends any[]>(timeout: number, callback: (...args: Args) => void, ...args: Args): Timer;
|
|
27
27
|
static periodic<Args extends any[]>(period: number, callback: (this: void, timer: Timer, ...args: Args) => void, ...args: Args): Timer;
|
|
28
28
|
static counted(period: number, count: number, callback: (this: void, timer: Timer) => void): Timer;
|
|
@@ -148,7 +148,7 @@ function ApplyBuffChannelingTargetAbilityBehavior.prototype.onStop(self)
|
|
|
148
148
|
self.buff = nil
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
|
-
Buff.
|
|
151
|
+
Buff.beingDestroyedEvent:addListener(function(buff)
|
|
152
152
|
local behavior = behaviorByBuff[buff]
|
|
153
153
|
if behavior ~= nil then
|
|
154
154
|
behaviorByBuff[buff] = nil
|
|
@@ -5,7 +5,6 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
|
5
5
|
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local createUnitEventListener
|
|
9
8
|
local ____behavior = require("engine.behavior")
|
|
10
9
|
local Behavior = ____behavior.Behavior
|
|
11
10
|
local ____unit = require("engine.unit")
|
|
@@ -30,17 +29,9 @@ local ____ability = require("engine.object-field.ability")
|
|
|
30
29
|
local AbilityField = ____ability.AbilityField
|
|
31
30
|
local AbilityLevelField = ____ability.AbilityLevelField
|
|
32
31
|
local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
|
|
33
|
-
local ____timer = require("core.types.timer")
|
|
34
|
-
local Timer = ____timer.Timer
|
|
35
32
|
local createBehaviorFunctionsByAbilityTypeId = {}
|
|
36
33
|
local exclusiveOnImpactHandlerAbilityBehaviorByAbility = setmetatable({}, {__mode = "k"})
|
|
37
|
-
local function
|
|
38
|
-
local unitEventListener = createUnitEventListener(key)
|
|
39
|
-
return function(unit, ability, ...)
|
|
40
|
-
Timer:run(unitEventListener, unit, ability, ...)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
createUnitEventListener = function(key)
|
|
34
|
+
local function createUnitEventListener(key)
|
|
44
35
|
return function(unit, ability, ...)
|
|
45
36
|
____exports.AbilityBehavior:forAll(ability, key, unit, ...)
|
|
46
37
|
end
|
|
@@ -275,12 +266,12 @@ __TS__SetDescriptor(
|
|
|
275
266
|
Unit.abilityPointTargetChannelingStartEvent:addListener(createUnitEventListener("onPointTargetChannelingStart"))
|
|
276
267
|
Unit.abilityNoTargetChannelingStartEvent:addListener(createUnitEventListener("onNoTargetChannelingStart"))
|
|
277
268
|
Unit.abilityImpactEvent:addListener(createUnitEventListener("onImpact"))
|
|
278
|
-
Unit.
|
|
279
|
-
Unit.
|
|
280
|
-
Unit.
|
|
281
|
-
Unit.
|
|
282
|
-
Unit.
|
|
283
|
-
Unit.
|
|
269
|
+
Unit.abilityWidgetTargetImpactEvent:addListener(createUnitEventListener("onWidgetTargetImpact"))
|
|
270
|
+
Unit.abilityUnitTargetImpactEvent:addListener(createUnitEventListener("onUnitTargetImpact"))
|
|
271
|
+
Unit.abilityItemTargetImpactEvent:addListener(createUnitEventListener("onItemTargetImpact"))
|
|
272
|
+
Unit.abilityDestructibleTargetImpactEvent:addListener(createUnitEventListener("onDestructibleTargetImpact"))
|
|
273
|
+
Unit.abilityPointTargetImpactEvent:addListener(createUnitEventListener("onPointTargetImpact"))
|
|
274
|
+
Unit.abilityNoTargetImpactEvent:addListener(createUnitEventListener("onNoTargetImpact"))
|
|
284
275
|
Unit.abilityChannelingFinishEvent:addListener(createUnitEventListener("onChannelingFinish"))
|
|
285
276
|
Unit.abilityStopEvent:addListener(createUnitEventListener("onStop"))
|
|
286
277
|
end)(AbilityBehavior)
|
|
@@ -10,9 +10,11 @@ export type StunImmunityUnitBehaviourParameters = {
|
|
|
10
10
|
textTagText?: string;
|
|
11
11
|
};
|
|
12
12
|
export declare class StunImmunityUnitBehavior extends UnitBehavior {
|
|
13
|
-
|
|
13
|
+
readonly parameters: Readonly<StunImmunityUnitBehaviourParameters>;
|
|
14
14
|
static defaultParameters: StunImmunityUnitBehaviourParameters;
|
|
15
|
-
constructor(unit: Unit, parameters?: StunImmunityUnitBehaviourParameters);
|
|
15
|
+
constructor(unit: Unit, parameters?: Readonly<StunImmunityUnitBehaviourParameters>);
|
|
16
16
|
protected onDestroy(): Destructor;
|
|
17
|
-
|
|
17
|
+
onDamageReceived(): void;
|
|
18
|
+
onTargetingAbilityChannelingStart(): void;
|
|
19
|
+
onTargetingAbilityImpact(): void;
|
|
18
20
|
}
|
|
@@ -12,31 +12,46 @@ local flatMapToLuaSet = ____arrays.flatMapToLuaSet
|
|
|
12
12
|
local map = ____arrays.map
|
|
13
13
|
local ____text_2Dtag = require("engine.text-tag")
|
|
14
14
|
local TextTag = ____text_2Dtag.TextTag
|
|
15
|
+
local ____timer = require("core.types.timer")
|
|
16
|
+
local Timer = ____timer.Timer
|
|
15
17
|
local DEFAULT_BUFF_TYPE_IDS = postcompile(function()
|
|
16
18
|
return flatMapToLuaSet(
|
|
17
19
|
AbilityType:getAllByBaseIds(map({
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
20
|
+
"AHtb",
|
|
21
|
+
"AHbh",
|
|
22
|
+
"AOws",
|
|
23
|
+
"AOw2",
|
|
24
|
+
"AUim",
|
|
25
|
+
"Acyc",
|
|
26
|
+
"ANfb",
|
|
27
|
+
"ANsb",
|
|
28
|
+
"ANcs",
|
|
29
|
+
"ANc1",
|
|
30
|
+
"ANc2",
|
|
31
|
+
"ANc3",
|
|
32
|
+
"ACbh",
|
|
33
|
+
"ANbh",
|
|
34
|
+
"SCc1",
|
|
35
|
+
"ACcy",
|
|
36
|
+
"ANb2",
|
|
37
|
+
"Awrs",
|
|
38
|
+
"Awrh",
|
|
39
|
+
"Awrg",
|
|
40
|
+
"ACtb",
|
|
41
|
+
"ACcb"
|
|
36
42
|
}, fourCC)),
|
|
37
43
|
function(abilityType) return __TS__ArrayFlat(abilityType.buffTypeIds) end
|
|
38
44
|
)
|
|
39
45
|
end)
|
|
46
|
+
local function process(behavior)
|
|
47
|
+
local hasRemovedBuffs = false
|
|
48
|
+
for buffTypeId in pairs(behavior.parameters.buffTypeIds or DEFAULT_BUFF_TYPE_IDS) do
|
|
49
|
+
hasRemovedBuffs = hasRemovedBuffs or behavior.unit:removeBuff(buffTypeId)
|
|
50
|
+
end
|
|
51
|
+
if hasRemovedBuffs and behavior.parameters.textTagText ~= nil then
|
|
52
|
+
TextTag:flash(TextTag.MISS, behavior.parameters.textTagText, behavior.unit.x, behavior.unit.y)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
40
55
|
____exports.StunImmunityUnitBehavior = __TS__Class()
|
|
41
56
|
local StunImmunityUnitBehavior = ____exports.StunImmunityUnitBehavior
|
|
42
57
|
StunImmunityUnitBehavior.name = "StunImmunityUnitBehavior"
|
|
@@ -48,20 +63,21 @@ function StunImmunityUnitBehavior.prototype.____constructor(self, unit, paramete
|
|
|
48
63
|
UnitBehavior.prototype.____constructor(self, unit)
|
|
49
64
|
self.parameters = parameters
|
|
50
65
|
unit:decrementStunCounter()
|
|
51
|
-
self
|
|
66
|
+
process(self)
|
|
52
67
|
end
|
|
53
68
|
function StunImmunityUnitBehavior.prototype.onDestroy(self)
|
|
54
69
|
self.unit:incrementStunCounter()
|
|
55
70
|
return UnitBehavior.prototype.onDestroy(self)
|
|
56
71
|
end
|
|
57
|
-
function StunImmunityUnitBehavior.prototype.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
function StunImmunityUnitBehavior.prototype.onDamageReceived(self)
|
|
73
|
+
process(self)
|
|
74
|
+
Timer:run(process, self)
|
|
75
|
+
end
|
|
76
|
+
function StunImmunityUnitBehavior.prototype.onTargetingAbilityChannelingStart(self)
|
|
77
|
+
process(self)
|
|
78
|
+
end
|
|
79
|
+
function StunImmunityUnitBehavior.prototype.onTargetingAbilityImpact(self)
|
|
80
|
+
process(self)
|
|
65
81
|
end
|
|
66
82
|
StunImmunityUnitBehavior.defaultParameters = {buffTypeIds = DEFAULT_BUFF_TYPE_IDS, textTagPreset = TextTag.MISS, textTagText = nil}
|
|
67
83
|
return ____exports
|
|
@@ -9,13 +9,15 @@ import type { AbilityBehavior } from "./ability";
|
|
|
9
9
|
import { Event } from "../../event";
|
|
10
10
|
import { Destructor } from "../../destroyable";
|
|
11
11
|
import type { Widget } from "../../core/types/widget";
|
|
12
|
+
import { Destructable } from "../../core/types/destructable";
|
|
13
|
+
import type { Buff } from "../buff";
|
|
12
14
|
export type UnitBehaviorConstructor<Args extends any[]> = new (unit: Unit, ...args: Args) => UnitBehavior;
|
|
13
15
|
export declare abstract class UnitBehavior<PeriodicActionParameters extends any[] = any[]> extends Behavior<Unit, PeriodicActionParameters> {
|
|
14
16
|
constructor(unit: Unit);
|
|
15
17
|
protected onDestroy(): Destructor;
|
|
16
18
|
readonly sourceAbilityBehavior?: AbilityBehavior;
|
|
17
19
|
get unit(): Unit;
|
|
18
|
-
registerInRangeUnitEvent<T extends string, Args extends any[]>(this: UnitBehavior<PeriodicActionParameters> & Record<T, (this: this,
|
|
20
|
+
registerInRangeUnitEvent<T extends string, Args extends any[]>(this: UnitBehavior<PeriodicActionParameters> & Record<T, (this: this, ...args: Args) => unknown>, event: Event<[...Args]>, extractUnit: (...args: Args) => Unit | undefined, range: number, listener: T): void;
|
|
19
21
|
onImmediateOrder(orderId: number): void;
|
|
20
22
|
onTargetOrder(orderId: number, target: Widget): void;
|
|
21
23
|
onPointOrder(orderId: number, x: number, y: number): void;
|
|
@@ -31,8 +33,17 @@ export declare abstract class UnitBehavior<PeriodicActionParameters extends any[
|
|
|
31
33
|
onAbilityLost(ability: Ability): void;
|
|
32
34
|
onAbilityChannelingStart(ability: Ability): void;
|
|
33
35
|
onAbilityImpact(ability: Ability): void;
|
|
36
|
+
onAbilityWidgetTargetImpact(ability: Ability, target: Widget): void;
|
|
37
|
+
onAbilityUnitTargetImpact(ability: Ability, target: Unit): void;
|
|
38
|
+
onAbilityItemTargetImpact(ability: Ability, target: Item): void;
|
|
39
|
+
onAbilityDestructibleTargetImpact(ability: Ability, target: Destructable): void;
|
|
40
|
+
onAbilityPointTargetImpact(ability: Ability, x: number, y: number): void;
|
|
41
|
+
onAbilityNoTargetImpact(ability: Ability): void;
|
|
34
42
|
onAbilityChannelingFinish(ability: Ability): void;
|
|
35
43
|
onAbilityStop(ability: Ability): void;
|
|
44
|
+
onTargetingAbilityChannelingStart(ability: Ability, source: Unit): void;
|
|
45
|
+
onTargetingAbilityImpact(ability: Ability, source: Unit): void;
|
|
46
|
+
onBuffGained(buff: Buff): void;
|
|
36
47
|
onItemDropped(item: Item): void;
|
|
37
48
|
onItemPickedUp(item: Item): void;
|
|
38
49
|
onItemUsed(item: Item): void;
|
|
@@ -49,7 +49,7 @@ function UnitBehavior.prototype.onDestroy(self)
|
|
|
49
49
|
end
|
|
50
50
|
return Behavior.prototype.onDestroy(self)
|
|
51
51
|
end
|
|
52
|
-
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, range, listener)
|
|
52
|
+
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUnit, range, listener)
|
|
53
53
|
local rangeByBehavior = getOrPut(rangeByBehaviorByEvent, event, mutableLuaMap)
|
|
54
54
|
rangeByBehavior[self] = range
|
|
55
55
|
local listenerByBehavior = getOrPut(listenerByBehaviorByEvent, event, mutableLuaMap)
|
|
@@ -57,14 +57,17 @@ function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, range, lis
|
|
|
57
57
|
getOrPut(eventsByBehavior, self, mutableLuaSet)[event] = true
|
|
58
58
|
local behaviors = behaviorsByEvent[event]
|
|
59
59
|
if behaviors == nil then
|
|
60
|
-
event:addListener(function(
|
|
60
|
+
event:addListener(function(...)
|
|
61
61
|
local behaviors = behaviorsByEvent[event]
|
|
62
62
|
if behaviors ~= nil then
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
local
|
|
67
|
-
|
|
63
|
+
local unit = extractUnit(...)
|
|
64
|
+
if unit ~= nil then
|
|
65
|
+
for behavior in pairs(behaviors) do
|
|
66
|
+
local range = rangeByBehavior[behavior]
|
|
67
|
+
if range ~= nil and unit:getCollisionDistanceTo(behavior.unit) <= range then
|
|
68
|
+
local ____self_6 = behavior
|
|
69
|
+
____self_6[listenerByBehavior[behavior]](____self_6, ...)
|
|
70
|
+
end
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
end
|
|
@@ -104,10 +107,28 @@ function UnitBehavior.prototype.onAbilityChannelingStart(self, ability)
|
|
|
104
107
|
end
|
|
105
108
|
function UnitBehavior.prototype.onAbilityImpact(self, ability)
|
|
106
109
|
end
|
|
110
|
+
function UnitBehavior.prototype.onAbilityWidgetTargetImpact(self, ability, target)
|
|
111
|
+
end
|
|
112
|
+
function UnitBehavior.prototype.onAbilityUnitTargetImpact(self, ability, target)
|
|
113
|
+
end
|
|
114
|
+
function UnitBehavior.prototype.onAbilityItemTargetImpact(self, ability, target)
|
|
115
|
+
end
|
|
116
|
+
function UnitBehavior.prototype.onAbilityDestructibleTargetImpact(self, ability, target)
|
|
117
|
+
end
|
|
118
|
+
function UnitBehavior.prototype.onAbilityPointTargetImpact(self, ability, x, y)
|
|
119
|
+
end
|
|
120
|
+
function UnitBehavior.prototype.onAbilityNoTargetImpact(self, ability)
|
|
121
|
+
end
|
|
107
122
|
function UnitBehavior.prototype.onAbilityChannelingFinish(self, ability)
|
|
108
123
|
end
|
|
109
124
|
function UnitBehavior.prototype.onAbilityStop(self, ability)
|
|
110
125
|
end
|
|
126
|
+
function UnitBehavior.prototype.onTargetingAbilityChannelingStart(self, ability, source)
|
|
127
|
+
end
|
|
128
|
+
function UnitBehavior.prototype.onTargetingAbilityImpact(self, ability, source)
|
|
129
|
+
end
|
|
130
|
+
function UnitBehavior.prototype.onBuffGained(self, buff)
|
|
131
|
+
end
|
|
111
132
|
function UnitBehavior.prototype.onItemDropped(self, item)
|
|
112
133
|
end
|
|
113
134
|
function UnitBehavior.prototype.onItemPickedUp(self, item)
|
|
@@ -175,9 +196,37 @@ __TS__SetDescriptor(
|
|
|
175
196
|
Unit.abilityChannelingStartEvent:addListener(function(source, ability)
|
|
176
197
|
____exports.UnitBehavior:forAll(source, "onAbilityChannelingStart", ability)
|
|
177
198
|
end)
|
|
199
|
+
Unit.abilityUnitTargetChannelingStartEvent:addListener(function(source, ability, target)
|
|
200
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAbilityChannelingStart", ability, source)
|
|
201
|
+
end)
|
|
178
202
|
Unit.abilityImpactEvent:addListener(function(source, ability)
|
|
179
203
|
____exports.UnitBehavior:forAll(source, "onAbilityImpact", ability)
|
|
180
204
|
end)
|
|
205
|
+
Unit.abilityWidgetTargetImpactEvent:addListener(function(source, ability, target)
|
|
206
|
+
____exports.UnitBehavior:forAll(source, "onAbilityWidgetTargetImpact", ability, target)
|
|
207
|
+
end)
|
|
208
|
+
Unit.abilityUnitTargetImpactEvent:addListener(function(source, ability, target)
|
|
209
|
+
____exports.UnitBehavior:forAll(source, "onAbilityUnitTargetImpact", ability, target)
|
|
210
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAbilityImpact", ability, source)
|
|
211
|
+
end)
|
|
212
|
+
Unit.abilityItemTargetImpactEvent:addListener(function(source, ability, target)
|
|
213
|
+
____exports.UnitBehavior:forAll(source, "onAbilityItemTargetImpact", ability, target)
|
|
214
|
+
end)
|
|
215
|
+
Unit.abilityDestructibleTargetImpactEvent:addListener(function(source, ability, target)
|
|
216
|
+
____exports.UnitBehavior:forAll(source, "onAbilityDestructibleTargetImpact", ability, target)
|
|
217
|
+
end)
|
|
218
|
+
Unit.abilityPointTargetImpactEvent:addListener(function(source, ability, x, y)
|
|
219
|
+
____exports.UnitBehavior:forAll(
|
|
220
|
+
source,
|
|
221
|
+
"onAbilityPointTargetImpact",
|
|
222
|
+
ability,
|
|
223
|
+
x,
|
|
224
|
+
y
|
|
225
|
+
)
|
|
226
|
+
end)
|
|
227
|
+
Unit.abilityNoTargetImpactEvent:addListener(function(source, ability)
|
|
228
|
+
____exports.UnitBehavior:forAll(source, "onAbilityNoTargetImpact", ability)
|
|
229
|
+
end)
|
|
181
230
|
Unit.abilityChannelingFinishEvent:addListener(function(source, ability)
|
|
182
231
|
____exports.UnitBehavior:forAll(source, "onAbilityChannelingFinish", ability)
|
|
183
232
|
end)
|
package/engine/buff.d.ts
CHANGED
|
@@ -278,6 +278,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
278
278
|
onDeath(source: Unit | undefined): void;
|
|
279
279
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
280
280
|
onDamageReceived(source: Unit | undefined, event: DamageEvent): void;
|
|
281
|
-
static readonly
|
|
281
|
+
static readonly createdEvent: Event<[Buff<object>]>;
|
|
282
|
+
static readonly beingDestroyedEvent: Event<[Buff<object>]>;
|
|
282
283
|
}
|
|
283
284
|
export {};
|
package/engine/buff.lua
CHANGED
|
@@ -304,7 +304,8 @@ buffHealingIntervalTimerCallback = function(buff)
|
|
|
304
304
|
source:healTarget(buff[101], healingPerInterval)
|
|
305
305
|
end
|
|
306
306
|
end
|
|
307
|
-
local
|
|
307
|
+
local buffCreatedEvent = __TS__New(Event)
|
|
308
|
+
local buffBeingDestroyedEvent = __TS__New(Event)
|
|
308
309
|
____exports.Buff = __TS__Class()
|
|
309
310
|
local Buff = ____exports.Buff
|
|
310
311
|
Buff.name = "Buff"
|
|
@@ -506,6 +507,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
507
|
end
|
|
507
508
|
self:onCreate()
|
|
508
509
|
self[100] = 1
|
|
510
|
+
Event.invoke(buffCreatedEvent, self)
|
|
509
511
|
end
|
|
510
512
|
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
511
513
|
local ____opt_38 = self._bonusIdByBonusType
|
|
@@ -619,7 +621,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
619
621
|
removeUnitBonus(unit, bonusType, bonusId)
|
|
620
622
|
end
|
|
621
623
|
end
|
|
622
|
-
Event.invoke(
|
|
624
|
+
Event.invoke(buffBeingDestroyedEvent, self)
|
|
623
625
|
self[100] = 3
|
|
624
626
|
return UnitBehavior.prototype.onDestroy(self)
|
|
625
627
|
end
|
|
@@ -1288,7 +1290,8 @@ __TS__SetDescriptor(
|
|
|
1288
1290
|
},
|
|
1289
1291
|
true
|
|
1290
1292
|
)
|
|
1291
|
-
Buff.
|
|
1293
|
+
Buff.createdEvent = buffCreatedEvent
|
|
1294
|
+
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1292
1295
|
(function(self)
|
|
1293
1296
|
local function destroyBuffIfNeeded(buff)
|
|
1294
1297
|
if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
|
|
@@ -1342,5 +1345,8 @@ Buff.destroyEvent = buffDestroyEvent;
|
|
|
1342
1345
|
____exports.checkBuffs(target)
|
|
1343
1346
|
end
|
|
1344
1347
|
)
|
|
1348
|
+
buffCreatedEvent:addListener(function(buff)
|
|
1349
|
+
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1350
|
+
end)
|
|
1345
1351
|
end)(Buff)
|
|
1346
1352
|
return ____exports
|
|
@@ -404,11 +404,17 @@ function UnitAbility.prototype.decrementHideCounter(self)
|
|
|
404
404
|
unitHideAbility(self.u, self.typeId, false)
|
|
405
405
|
end
|
|
406
406
|
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
407
|
-
|
|
407
|
+
local unit = self.u
|
|
408
|
+
local typeId = self.typeId
|
|
409
|
+
unitHideAbility(unit, typeId, true)
|
|
410
|
+
unitDisableAbility(unit, typeId, true, false)
|
|
408
411
|
self.d = (self.d or 0) + 1
|
|
409
412
|
end
|
|
410
413
|
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
411
|
-
|
|
414
|
+
local unit = self.u
|
|
415
|
+
local typeId = self.typeId
|
|
416
|
+
unitDisableAbility(unit, typeId, false, false)
|
|
417
|
+
unitHideAbility(unit, typeId, true)
|
|
412
418
|
self.d = (self.d or 0) - 1
|
|
413
419
|
end
|
|
414
420
|
function UnitAbility.prototype.interruptCast(self)
|
|
@@ -20,6 +20,7 @@ local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slo
|
|
|
20
20
|
local unitAddItemToSlot = ____add_2Ditem_2Dto_2Dslot.unitAddItemToSlot
|
|
21
21
|
local isItemOwned = IsItemOwned
|
|
22
22
|
local isItemPowerup = IsItemPowerup
|
|
23
|
+
local getItemAbility = BlzGetItemAbility
|
|
23
24
|
local getItemX = GetItemX
|
|
24
25
|
local getItemY = GetItemY
|
|
25
26
|
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
@@ -31,6 +32,8 @@ local unitAddItem = UnitAddItem
|
|
|
31
32
|
local unitRemoveItem = UnitRemoveItem
|
|
32
33
|
local unitUseItem = UnitUseItem
|
|
33
34
|
local unitResetCooldown = UnitResetCooldown
|
|
35
|
+
local unitInventorySize = UnitInventorySize
|
|
36
|
+
local unitItemInSlot = UnitItemInSlot
|
|
34
37
|
local COOLDOWN_STARTER_ABILITY_TYPE_ID = compiletime(function()
|
|
35
38
|
if not currentMap then
|
|
36
39
|
return 0
|
|
@@ -65,7 +68,7 @@ ____exports.itemAbilityDummy = assert(CreateUnit(
|
|
|
65
68
|
270
|
|
66
69
|
))
|
|
67
70
|
local cooldownStarterItem = UnitAddItemById(____exports.itemAbilityDummy, COOLDOWN_STARTER_ITEM_TYPE_ID)
|
|
68
|
-
local cooldownStarterAbility =
|
|
71
|
+
local cooldownStarterAbility = getItemAbility(cooldownStarterItem, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
69
72
|
ShowUnit(____exports.itemAbilityDummy, false)
|
|
70
73
|
local function startItemCooldownInternal(handle, cooldown)
|
|
71
74
|
local cooldownGroup = getItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP)
|
|
@@ -153,4 +156,51 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
153
156
|
end
|
|
154
157
|
return result
|
|
155
158
|
end
|
|
159
|
+
local depth = 0
|
|
160
|
+
local itemBySlot = {}
|
|
161
|
+
---
|
|
162
|
+
-- @internal For use by internal systems only.
|
|
163
|
+
____exports.doUnitAbilityAction = function(unit, abilityTypeId, action, ...)
|
|
164
|
+
local ____depth_0 = depth
|
|
165
|
+
depth = ____depth_0 + 1
|
|
166
|
+
local offset = 6 * ____depth_0
|
|
167
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
168
|
+
local item = unitItemInSlot(unit, slot)
|
|
169
|
+
if getItemAbility(item, abilityTypeId) ~= nil then
|
|
170
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[item] ~= nil
|
|
171
|
+
if not isAlreadyIgnoredInEvents then
|
|
172
|
+
ignoreEventsItems[item] = true
|
|
173
|
+
end
|
|
174
|
+
unitRemoveItem(unit, item)
|
|
175
|
+
if not isAlreadyIgnoredInEvents then
|
|
176
|
+
ignoreEventsItems[item] = nil
|
|
177
|
+
end
|
|
178
|
+
itemBySlot[offset + slot] = item
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
local result = action(unit, ...)
|
|
182
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
183
|
+
local item = itemBySlot[offset + slot]
|
|
184
|
+
if item ~= nil then
|
|
185
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[item] ~= nil
|
|
186
|
+
if not isAlreadyIgnoredInEvents then
|
|
187
|
+
ignoreEventsItems[item] = true
|
|
188
|
+
end
|
|
189
|
+
local isPowerup = isItemPowerup(item)
|
|
190
|
+
if isPowerup then
|
|
191
|
+
setItemBooleanField(item, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
192
|
+
end
|
|
193
|
+
unitAddItemToSlot(unit, item, slot)
|
|
194
|
+
if isPowerup then
|
|
195
|
+
setItemBooleanField(item, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
196
|
+
end
|
|
197
|
+
if not isAlreadyIgnoredInEvents then
|
|
198
|
+
ignoreEventsItems[item] = nil
|
|
199
|
+
end
|
|
200
|
+
itemBySlot[offset + slot] = nil
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
depth = depth - 1
|
|
204
|
+
return result
|
|
205
|
+
end
|
|
156
206
|
return ____exports
|
|
@@ -136,6 +136,36 @@ declare module "../unit" {
|
|
|
136
136
|
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
declare module "../unit" {
|
|
140
|
+
namespace Unit {
|
|
141
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
declare module "../unit" {
|
|
145
|
+
namespace Unit {
|
|
146
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
declare module "../unit" {
|
|
150
|
+
namespace Unit {
|
|
151
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
declare module "../unit" {
|
|
155
|
+
namespace Unit {
|
|
156
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
declare module "../unit" {
|
|
160
|
+
namespace Unit {
|
|
161
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
declare module "../unit" {
|
|
165
|
+
namespace Unit {
|
|
166
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
139
169
|
declare module "../unit" {
|
|
140
170
|
namespace Unit {
|
|
141
171
|
const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
|
|
@@ -359,6 +359,54 @@ rawset(
|
|
|
359
359
|
extractAbilityTypeId
|
|
360
360
|
)
|
|
361
361
|
)
|
|
362
|
+
rawset(
|
|
363
|
+
Unit,
|
|
364
|
+
"abilityWidgetTargetImpactEvent",
|
|
365
|
+
createDispatchingEvent(
|
|
366
|
+
createWidgetTargetEvent(internalAbilityImpactEvent),
|
|
367
|
+
extractAbilityTypeId
|
|
368
|
+
)
|
|
369
|
+
)
|
|
370
|
+
rawset(
|
|
371
|
+
Unit,
|
|
372
|
+
"abilityUnitTargetImpactEvent",
|
|
373
|
+
createDispatchingEvent(
|
|
374
|
+
createUnitTargetEvent(internalAbilityImpactEvent),
|
|
375
|
+
extractAbilityTypeId
|
|
376
|
+
)
|
|
377
|
+
)
|
|
378
|
+
rawset(
|
|
379
|
+
Unit,
|
|
380
|
+
"abilityItemTargetImpactEvent",
|
|
381
|
+
createDispatchingEvent(
|
|
382
|
+
createItemTargetEvent(internalAbilityImpactEvent),
|
|
383
|
+
extractAbilityTypeId
|
|
384
|
+
)
|
|
385
|
+
)
|
|
386
|
+
rawset(
|
|
387
|
+
Unit,
|
|
388
|
+
"abilityDestructibleTargetImpactEvent",
|
|
389
|
+
createDispatchingEvent(
|
|
390
|
+
createDestructibleTargetEvent(internalAbilityImpactEvent),
|
|
391
|
+
extractAbilityTypeId
|
|
392
|
+
)
|
|
393
|
+
)
|
|
394
|
+
rawset(
|
|
395
|
+
Unit,
|
|
396
|
+
"abilityPointTargetImpactEvent",
|
|
397
|
+
createDispatchingEvent(
|
|
398
|
+
createPointTargetEvent(internalAbilityImpactEvent),
|
|
399
|
+
extractAbilityTypeId
|
|
400
|
+
)
|
|
401
|
+
)
|
|
402
|
+
rawset(
|
|
403
|
+
Unit,
|
|
404
|
+
"abilityNoTargetImpactEvent",
|
|
405
|
+
createDispatchingEvent(
|
|
406
|
+
createNoTargetEvent(internalAbilityImpactEvent),
|
|
407
|
+
extractAbilityTypeId
|
|
408
|
+
)
|
|
409
|
+
)
|
|
362
410
|
rawset(
|
|
363
411
|
Unit,
|
|
364
412
|
"abilityChannelingFinishEvent",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Widget } from "../../../core/types/widget";
|
|
3
|
+
export declare const enum OrderType {
|
|
4
|
+
IMMEDIATE = 0,
|
|
5
|
+
POINT = 1,
|
|
6
|
+
TARGET = 2
|
|
7
|
+
}
|
|
8
|
+
declare module "../unit" {
|
|
9
|
+
interface Unit {
|
|
10
|
+
readonly currentOrderType: OrderType;
|
|
11
|
+
readonly currentOrderId: number;
|
|
12
|
+
readonly currentOrderStartTime: number;
|
|
13
|
+
readonly currentOrderStartX: number;
|
|
14
|
+
readonly currentOrderStartY: number;
|
|
15
|
+
readonly currentOrderTargetX: number;
|
|
16
|
+
readonly currentOrderTargetY: number;
|
|
17
|
+
readonly currentOrderTarget?: Widget;
|
|
18
|
+
issueOrder(...order: [orderType: OrderType.IMMEDIATE, orderId: number] | [orderType: OrderType.POINT, orderId: number, x: number, y: number] | [orderType: OrderType.TARGET, orderId: number, target: Widget]): boolean;
|
|
19
|
+
}
|
|
20
|
+
}
|