warscript 0.0.1-dev.d7e0522 → 0.0.1-dev.da5fb2e
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/frame.lua +10 -12
- package/core/types/player.lua +3 -1
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +79 -5
- package/core/types/timer.d.ts +2 -1
- package/core/types/timer.lua +21 -2
- package/decl/native.d.ts +4 -2
- package/engine/behavior.d.ts +5 -0
- package/engine/behavior.lua +106 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +11 -3
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.lua +8 -17
- 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 +19 -2
- package/engine/behaviour/unit.lua +88 -7
- package/engine/buff.d.ts +2 -4
- package/engine/buff.lua +68 -83
- package/engine/internal/ability.d.ts +5 -1
- package/engine/internal/ability.lua +43 -11
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +1 -0
- package/engine/internal/item.lua +20 -11
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +62 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +8 -1
- package/engine/internal/unit.d.ts +4 -4
- package/engine/internal/unit.lua +84 -70
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/entry/ability-type.lua +1 -3
- package/engine/object-data/entry/unit-type.d.ts +11 -2
- package/engine/object-data/entry/unit-type.lua +59 -1
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.d.ts +8 -5
- package/engine/object-field.lua +90 -76
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +249 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/callback-array.d.ts +13 -0
- package/utility/callback-array.lua +46 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/lua-maps.d.ts +1 -0
- package/utility/lua-maps.lua +4 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
|
@@ -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,19 @@ 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";
|
|
14
|
+
import { UnitBonusType } from "../internal/unit/bonus";
|
|
12
15
|
export type UnitBehaviorConstructor<Args extends any[]> = new (unit: Unit, ...args: Args) => UnitBehavior;
|
|
13
16
|
export declare abstract class UnitBehavior<PeriodicActionParameters extends any[] = any[]> extends Behavior<Unit, PeriodicActionParameters> {
|
|
17
|
+
readonly sourceAbilityBehavior?: AbilityBehavior;
|
|
18
|
+
private _bonusIdByBonusType?;
|
|
14
19
|
constructor(unit: Unit);
|
|
15
20
|
protected onDestroy(): Destructor;
|
|
16
|
-
readonly sourceAbilityBehavior?: AbilityBehavior;
|
|
17
21
|
get unit(): Unit;
|
|
18
|
-
|
|
22
|
+
protected getUnitBonus(bonusType: UnitBonusType): number;
|
|
23
|
+
protected addOrUpdateOrRemoveUnitBonus(bonusType: UnitBonusType, value: number): void;
|
|
24
|
+
protected 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
25
|
onImmediateOrder(orderId: number): void;
|
|
20
26
|
onTargetOrder(orderId: number, target: Widget): void;
|
|
21
27
|
onPointOrder(orderId: number, x: number, y: number): void;
|
|
@@ -30,7 +36,18 @@ export declare abstract class UnitBehavior<PeriodicActionParameters extends any[
|
|
|
30
36
|
onAbilityGained(ability: Ability): void;
|
|
31
37
|
onAbilityLost(ability: Ability): void;
|
|
32
38
|
onAbilityChannelingStart(ability: Ability): void;
|
|
39
|
+
onAbilityImpact(ability: Ability): void;
|
|
40
|
+
onAbilityWidgetTargetImpact(ability: Ability, target: Widget): void;
|
|
41
|
+
onAbilityUnitTargetImpact(ability: Ability, target: Unit): void;
|
|
42
|
+
onAbilityItemTargetImpact(ability: Ability, target: Item): void;
|
|
43
|
+
onAbilityDestructibleTargetImpact(ability: Ability, target: Destructable): void;
|
|
44
|
+
onAbilityPointTargetImpact(ability: Ability, x: number, y: number): void;
|
|
45
|
+
onAbilityNoTargetImpact(ability: Ability): void;
|
|
33
46
|
onAbilityChannelingFinish(ability: Ability): void;
|
|
47
|
+
onAbilityStop(ability: Ability): void;
|
|
48
|
+
onTargetingAbilityChannelingStart(ability: Ability, source: Unit): void;
|
|
49
|
+
onTargetingAbilityImpact(ability: Ability, source: Unit): void;
|
|
50
|
+
onBuffGained(buff: Buff): void;
|
|
34
51
|
onItemDropped(item: Item): void;
|
|
35
52
|
onItemPickedUp(item: Item): void;
|
|
36
53
|
onItemUsed(item: Item): void;
|
|
@@ -17,6 +17,11 @@ local getOrPut = ____lua_2Dmaps.getOrPut
|
|
|
17
17
|
local mutableLuaMap = ____lua_2Dmaps.mutableLuaMap
|
|
18
18
|
local ____lua_2Dsets = require("utility.lua-sets")
|
|
19
19
|
local mutableLuaSet = ____lua_2Dsets.mutableLuaSet
|
|
20
|
+
local ____bonus = require("engine.internal.unit.bonus")
|
|
21
|
+
local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
22
|
+
local getUnitBonus = ____bonus.getUnitBonus
|
|
23
|
+
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
24
|
+
local safeCall = warpack.safeCall
|
|
20
25
|
local behaviorsByEvent = {}
|
|
21
26
|
local rangeByBehaviorByEvent = {}
|
|
22
27
|
local listenerByBehaviorByEvent = {}
|
|
@@ -47,9 +52,27 @@ function UnitBehavior.prototype.onDestroy(self)
|
|
|
47
52
|
end
|
|
48
53
|
eventsByBehavior[self] = nil
|
|
49
54
|
end
|
|
55
|
+
if self._bonusIdByBonusType ~= nil then
|
|
56
|
+
for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
|
|
57
|
+
removeUnitBonus(self.object, bonusType, bonusId)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
50
60
|
return Behavior.prototype.onDestroy(self)
|
|
51
61
|
end
|
|
52
|
-
function UnitBehavior.prototype.
|
|
62
|
+
function UnitBehavior.prototype.getUnitBonus(self, bonusType)
|
|
63
|
+
local ____opt_6 = self._bonusIdByBonusType
|
|
64
|
+
local bonusId = ____opt_6 and ____opt_6[bonusType]
|
|
65
|
+
return bonusId == nil and 0 or getUnitBonus(self.object, bonusType, bonusId)
|
|
66
|
+
end
|
|
67
|
+
function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
68
|
+
local bonusIdByBonusType = self._bonusIdByBonusType
|
|
69
|
+
if bonusIdByBonusType == nil then
|
|
70
|
+
bonusIdByBonusType = {}
|
|
71
|
+
self._bonusIdByBonusType = bonusIdByBonusType
|
|
72
|
+
end
|
|
73
|
+
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self.object, bonusType, bonusIdByBonusType[bonusType], value)
|
|
74
|
+
end
|
|
75
|
+
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUnit, range, listener)
|
|
53
76
|
local rangeByBehavior = getOrPut(rangeByBehaviorByEvent, event, mutableLuaMap)
|
|
54
77
|
rangeByBehavior[self] = range
|
|
55
78
|
local listenerByBehavior = getOrPut(listenerByBehaviorByEvent, event, mutableLuaMap)
|
|
@@ -57,14 +80,16 @@ function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, range, lis
|
|
|
57
80
|
getOrPut(eventsByBehavior, self, mutableLuaSet)[event] = true
|
|
58
81
|
local behaviors = behaviorsByEvent[event]
|
|
59
82
|
if behaviors == nil then
|
|
60
|
-
event:addListener(function(
|
|
83
|
+
event:addListener(function(...)
|
|
61
84
|
local behaviors = behaviorsByEvent[event]
|
|
62
85
|
if behaviors ~= nil then
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
local
|
|
67
|
-
|
|
86
|
+
local unit = extractUnit(...)
|
|
87
|
+
if unit ~= nil then
|
|
88
|
+
for behavior in pairs(behaviors) do
|
|
89
|
+
local range = rangeByBehavior[behavior]
|
|
90
|
+
if range ~= nil and unit:getCollisionDistanceTo(behavior.unit) <= range then
|
|
91
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
92
|
+
end
|
|
68
93
|
end
|
|
69
94
|
end
|
|
70
95
|
end
|
|
@@ -102,8 +127,30 @@ function UnitBehavior.prototype.onAbilityLost(self, ability)
|
|
|
102
127
|
end
|
|
103
128
|
function UnitBehavior.prototype.onAbilityChannelingStart(self, ability)
|
|
104
129
|
end
|
|
130
|
+
function UnitBehavior.prototype.onAbilityImpact(self, ability)
|
|
131
|
+
end
|
|
132
|
+
function UnitBehavior.prototype.onAbilityWidgetTargetImpact(self, ability, target)
|
|
133
|
+
end
|
|
134
|
+
function UnitBehavior.prototype.onAbilityUnitTargetImpact(self, ability, target)
|
|
135
|
+
end
|
|
136
|
+
function UnitBehavior.prototype.onAbilityItemTargetImpact(self, ability, target)
|
|
137
|
+
end
|
|
138
|
+
function UnitBehavior.prototype.onAbilityDestructibleTargetImpact(self, ability, target)
|
|
139
|
+
end
|
|
140
|
+
function UnitBehavior.prototype.onAbilityPointTargetImpact(self, ability, x, y)
|
|
141
|
+
end
|
|
142
|
+
function UnitBehavior.prototype.onAbilityNoTargetImpact(self, ability)
|
|
143
|
+
end
|
|
105
144
|
function UnitBehavior.prototype.onAbilityChannelingFinish(self, ability)
|
|
106
145
|
end
|
|
146
|
+
function UnitBehavior.prototype.onAbilityStop(self, ability)
|
|
147
|
+
end
|
|
148
|
+
function UnitBehavior.prototype.onTargetingAbilityChannelingStart(self, ability, source)
|
|
149
|
+
end
|
|
150
|
+
function UnitBehavior.prototype.onTargetingAbilityImpact(self, ability, source)
|
|
151
|
+
end
|
|
152
|
+
function UnitBehavior.prototype.onBuffGained(self, buff)
|
|
153
|
+
end
|
|
107
154
|
function UnitBehavior.prototype.onItemDropped(self, item)
|
|
108
155
|
end
|
|
109
156
|
function UnitBehavior.prototype.onItemPickedUp(self, item)
|
|
@@ -171,9 +218,43 @@ __TS__SetDescriptor(
|
|
|
171
218
|
Unit.abilityChannelingStartEvent:addListener(function(source, ability)
|
|
172
219
|
____exports.UnitBehavior:forAll(source, "onAbilityChannelingStart", ability)
|
|
173
220
|
end)
|
|
221
|
+
Unit.abilityUnitTargetChannelingStartEvent:addListener(function(source, ability, target)
|
|
222
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAbilityChannelingStart", ability, source)
|
|
223
|
+
end)
|
|
224
|
+
Unit.abilityImpactEvent:addListener(function(source, ability)
|
|
225
|
+
____exports.UnitBehavior:forAll(source, "onAbilityImpact", ability)
|
|
226
|
+
end)
|
|
227
|
+
Unit.abilityWidgetTargetImpactEvent:addListener(function(source, ability, target)
|
|
228
|
+
____exports.UnitBehavior:forAll(source, "onAbilityWidgetTargetImpact", ability, target)
|
|
229
|
+
end)
|
|
230
|
+
Unit.abilityUnitTargetImpactEvent:addListener(function(source, ability, target)
|
|
231
|
+
____exports.UnitBehavior:forAll(source, "onAbilityUnitTargetImpact", ability, target)
|
|
232
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAbilityImpact", ability, source)
|
|
233
|
+
end)
|
|
234
|
+
Unit.abilityItemTargetImpactEvent:addListener(function(source, ability, target)
|
|
235
|
+
____exports.UnitBehavior:forAll(source, "onAbilityItemTargetImpact", ability, target)
|
|
236
|
+
end)
|
|
237
|
+
Unit.abilityDestructibleTargetImpactEvent:addListener(function(source, ability, target)
|
|
238
|
+
____exports.UnitBehavior:forAll(source, "onAbilityDestructibleTargetImpact", ability, target)
|
|
239
|
+
end)
|
|
240
|
+
Unit.abilityPointTargetImpactEvent:addListener(function(source, ability, x, y)
|
|
241
|
+
____exports.UnitBehavior:forAll(
|
|
242
|
+
source,
|
|
243
|
+
"onAbilityPointTargetImpact",
|
|
244
|
+
ability,
|
|
245
|
+
x,
|
|
246
|
+
y
|
|
247
|
+
)
|
|
248
|
+
end)
|
|
249
|
+
Unit.abilityNoTargetImpactEvent:addListener(function(source, ability)
|
|
250
|
+
____exports.UnitBehavior:forAll(source, "onAbilityNoTargetImpact", ability)
|
|
251
|
+
end)
|
|
174
252
|
Unit.abilityChannelingFinishEvent:addListener(function(source, ability)
|
|
175
253
|
____exports.UnitBehavior:forAll(source, "onAbilityChannelingFinish", ability)
|
|
176
254
|
end)
|
|
255
|
+
Unit.abilityStopEvent:addListener(function(source, ability)
|
|
256
|
+
____exports.UnitBehavior:forAll(source, "onAbilityStop", ability)
|
|
257
|
+
end)
|
|
177
258
|
Unit.deathEvent:addListener(function(target, source)
|
|
178
259
|
if source ~= nil then
|
|
179
260
|
____exports.UnitBehavior:forAll(source, "onKill", target)
|
package/engine/buff.d.ts
CHANGED
|
@@ -201,11 +201,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
201
201
|
private readonly _spellStealPriority?;
|
|
202
202
|
private readonly _learnLevelMinimum?;
|
|
203
203
|
private readonly [BuffPropertyKey.MISS_PROBABILITY]?;
|
|
204
|
-
private _bonusIdByBonusType?;
|
|
205
204
|
private readonly _abilityTypeIds?;
|
|
206
205
|
private _behaviors?;
|
|
207
|
-
private getUnitBonus;
|
|
208
|
-
private addOrUpdateOrRemoveUnitBonus;
|
|
209
206
|
constructor(target: Unit, ...parameters: BuffConstructorParameters<AdditionalParameters>);
|
|
210
207
|
get level(): number;
|
|
211
208
|
get remainingDamageOverDuration(): number;
|
|
@@ -278,6 +275,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
278
275
|
onDeath(source: Unit | undefined): void;
|
|
279
276
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
280
277
|
onDamageReceived(source: Unit | undefined, event: DamageEvent): void;
|
|
281
|
-
static readonly
|
|
278
|
+
static readonly createdEvent: Event<[Buff<object>]>;
|
|
279
|
+
static readonly beingDestroyedEvent: Event<[Buff<object>]>;
|
|
282
280
|
}
|
|
283
281
|
export {};
|
package/engine/buff.lua
CHANGED
|
@@ -28,9 +28,6 @@ local ____math = require("math")
|
|
|
28
28
|
local max = ____math.max
|
|
29
29
|
local min = ____math.min
|
|
30
30
|
local ____bonus = require("engine.internal.unit.bonus")
|
|
31
|
-
local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
32
|
-
local getUnitBonus = ____bonus.getUnitBonus
|
|
33
|
-
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
34
31
|
local UnitBonusType = ____bonus.UnitBonusType
|
|
35
32
|
local ____area_2Ddamage = require("engine.internal.mechanics.area-damage")
|
|
36
33
|
local damageArea = ____area_2Ddamage.damageArea
|
|
@@ -304,7 +301,8 @@ buffHealingIntervalTimerCallback = function(buff)
|
|
|
304
301
|
source:healTarget(buff[101], healingPerInterval)
|
|
305
302
|
end
|
|
306
303
|
end
|
|
307
|
-
local
|
|
304
|
+
local buffCreatedEvent = __TS__New(Event)
|
|
305
|
+
local buffBeingDestroyedEvent = __TS__New(Event)
|
|
308
306
|
____exports.Buff = __TS__Class()
|
|
309
307
|
local Buff = ____exports.Buff
|
|
310
308
|
Buff.name = "Buff"
|
|
@@ -506,64 +504,52 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
504
|
end
|
|
507
505
|
self:onCreate()
|
|
508
506
|
self[100] = 1
|
|
509
|
-
|
|
510
|
-
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
511
|
-
local ____opt_38 = self._bonusIdByBonusType
|
|
512
|
-
local bonusId = ____opt_38 and ____opt_38[bonusType]
|
|
513
|
-
return bonusId == nil and 0 or getUnitBonus(self._unit, bonusType, bonusId)
|
|
514
|
-
end
|
|
515
|
-
function Buff.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
516
|
-
local bonusIdByBonusType = self._bonusIdByBonusType
|
|
517
|
-
if bonusIdByBonusType == nil then
|
|
518
|
-
bonusIdByBonusType = {}
|
|
519
|
-
self._bonusIdByBonusType = bonusIdByBonusType
|
|
520
|
-
end
|
|
521
|
-
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self._unit, bonusType, bonusIdByBonusType[bonusType], value)
|
|
507
|
+
Event.invoke(buffCreatedEvent, self)
|
|
522
508
|
end
|
|
523
509
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
524
510
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
525
511
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
526
512
|
else
|
|
527
513
|
local isWidgetProvided = __TS__InstanceOf(widgetOrXOrParametersOrDuration, Unit) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Item) or __TS__InstanceOf(widgetOrXOrParametersOrDuration, Destructable)
|
|
528
|
-
local
|
|
529
|
-
local
|
|
530
|
-
local
|
|
514
|
+
local ____Effect_40 = Effect
|
|
515
|
+
local ____Effect_flash_41 = Effect.flash
|
|
516
|
+
local ____array_39 = __TS__SparseArrayNew(
|
|
531
517
|
self[105],
|
|
532
518
|
isWidgetProvided and widgetOrXOrParametersOrDuration or self._unit,
|
|
533
519
|
stringValueByBuffTypeIdByFieldId[fourCC("feft")][self.typeId] or "origin"
|
|
534
520
|
)
|
|
535
|
-
local
|
|
521
|
+
local ____isWidgetProvided_38
|
|
536
522
|
if isWidgetProvided then
|
|
537
|
-
|
|
523
|
+
____isWidgetProvided_38 = yOrParametersOrDuration
|
|
538
524
|
else
|
|
539
|
-
|
|
525
|
+
____isWidgetProvided_38 = widgetOrXOrParametersOrDuration
|
|
540
526
|
end
|
|
541
|
-
__TS__SparseArrayPush(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
__TS__SparseArraySpread(
|
|
527
|
+
__TS__SparseArrayPush(____array_39, ____isWidgetProvided_38)
|
|
528
|
+
____Effect_flash_41(
|
|
529
|
+
____Effect_40,
|
|
530
|
+
__TS__SparseArraySpread(____array_39)
|
|
545
531
|
)
|
|
546
532
|
end
|
|
547
533
|
end
|
|
548
534
|
function Buff.prototype.flashSpecialEffect(self, widgetOrDuration, duration)
|
|
549
535
|
local isWidgetProvided = type(widgetOrDuration) == "table"
|
|
550
|
-
local
|
|
551
|
-
local
|
|
552
|
-
local
|
|
536
|
+
local ____Effect_44 = Effect
|
|
537
|
+
local ____Effect_flash_45 = Effect.flash
|
|
538
|
+
local ____array_43 = __TS__SparseArrayNew(
|
|
553
539
|
self[106],
|
|
554
540
|
isWidgetProvided and widgetOrDuration or self._unit,
|
|
555
541
|
stringValueByBuffTypeIdByFieldId[fourCC("fspt")][self.typeId] or "origin"
|
|
556
542
|
)
|
|
557
|
-
local
|
|
543
|
+
local ____isWidgetProvided_42
|
|
558
544
|
if isWidgetProvided then
|
|
559
|
-
|
|
545
|
+
____isWidgetProvided_42 = duration
|
|
560
546
|
else
|
|
561
|
-
|
|
547
|
+
____isWidgetProvided_42 = widgetOrDuration
|
|
562
548
|
end
|
|
563
|
-
__TS__SparseArrayPush(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
__TS__SparseArraySpread(
|
|
549
|
+
__TS__SparseArrayPush(____array_43, ____isWidgetProvided_42)
|
|
550
|
+
____Effect_flash_45(
|
|
551
|
+
____Effect_44,
|
|
552
|
+
__TS__SparseArraySpread(____array_43)
|
|
567
553
|
)
|
|
568
554
|
end
|
|
569
555
|
function Buff.prototype.onCreate(self)
|
|
@@ -614,12 +600,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
614
600
|
unit:removeAbility(abilityTypeId)
|
|
615
601
|
end
|
|
616
602
|
end
|
|
617
|
-
|
|
618
|
-
for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
|
|
619
|
-
removeUnitBonus(unit, bonusType, bonusId)
|
|
620
|
-
end
|
|
621
|
-
end
|
|
622
|
-
Event.invoke(buffDestroyEvent, self)
|
|
603
|
+
Event.invoke(buffBeingDestroyedEvent, self)
|
|
623
604
|
self[100] = 3
|
|
624
605
|
return UnitBehavior.prototype.onDestroy(self)
|
|
625
606
|
end
|
|
@@ -648,8 +629,8 @@ function Buff.apply(self, ...)
|
|
|
648
629
|
end
|
|
649
630
|
end
|
|
650
631
|
function Buff.getByTypeId(self, unit, typeId)
|
|
651
|
-
local
|
|
652
|
-
local buff =
|
|
632
|
+
local ____opt_46 = buffByTypeIdByUnit[unit]
|
|
633
|
+
local buff = ____opt_46 and ____opt_46[typeId]
|
|
653
634
|
if __TS__InstanceOf(buff, self) then
|
|
654
635
|
return buff
|
|
655
636
|
end
|
|
@@ -807,8 +788,8 @@ __TS__SetDescriptor(
|
|
|
807
788
|
return
|
|
808
789
|
end
|
|
809
790
|
self[112] = damageInterval
|
|
810
|
-
local
|
|
811
|
-
local elapsed =
|
|
791
|
+
local ____opt_48 = self._timer
|
|
792
|
+
local elapsed = ____opt_48 and ____opt_48.elapsed or 0
|
|
812
793
|
local timer = self[114]
|
|
813
794
|
if timer == nil then
|
|
814
795
|
timer = Timer:create()
|
|
@@ -887,8 +868,8 @@ __TS__SetDescriptor(
|
|
|
887
868
|
return
|
|
888
869
|
end
|
|
889
870
|
self[117] = healingInterval
|
|
890
|
-
local
|
|
891
|
-
local elapsed =
|
|
871
|
+
local ____opt_50 = self._timer
|
|
872
|
+
local elapsed = ____opt_50 and ____opt_50.elapsed or 0
|
|
892
873
|
local timer = self[119]
|
|
893
874
|
if timer == nil then
|
|
894
875
|
timer = Timer:create()
|
|
@@ -974,11 +955,11 @@ __TS__SetDescriptor(
|
|
|
974
955
|
"turnsIntoGhost",
|
|
975
956
|
{
|
|
976
957
|
get = function(self)
|
|
977
|
-
local
|
|
978
|
-
if
|
|
979
|
-
|
|
958
|
+
local ____self__135_52 = self[135]
|
|
959
|
+
if ____self__135_52 == nil then
|
|
960
|
+
____self__135_52 = false
|
|
980
961
|
end
|
|
981
|
-
return
|
|
962
|
+
return ____self__135_52
|
|
982
963
|
end,
|
|
983
964
|
set = function(self, turnsIntoGhost)
|
|
984
965
|
if not turnsIntoGhost and self[135] then
|
|
@@ -997,11 +978,11 @@ __TS__SetDescriptor(
|
|
|
997
978
|
"stuns",
|
|
998
979
|
{
|
|
999
980
|
get = function(self)
|
|
1000
|
-
local
|
|
1001
|
-
if
|
|
1002
|
-
|
|
981
|
+
local ____self__136_53 = self[136]
|
|
982
|
+
if ____self__136_53 == nil then
|
|
983
|
+
____self__136_53 = false
|
|
1003
984
|
end
|
|
1004
|
-
return
|
|
985
|
+
return ____self__136_53
|
|
1005
986
|
end,
|
|
1006
987
|
set = function(self, stuns)
|
|
1007
988
|
if not stuns and self[136] then
|
|
@@ -1026,11 +1007,11 @@ __TS__SetDescriptor(
|
|
|
1026
1007
|
"ignoresStunImmunity",
|
|
1027
1008
|
{
|
|
1028
1009
|
get = function(self)
|
|
1029
|
-
local
|
|
1030
|
-
if
|
|
1031
|
-
|
|
1010
|
+
local ____self__137_54 = self[137]
|
|
1011
|
+
if ____self__137_54 == nil then
|
|
1012
|
+
____self__137_54 = false
|
|
1032
1013
|
end
|
|
1033
|
-
return
|
|
1014
|
+
return ____self__137_54
|
|
1034
1015
|
end,
|
|
1035
1016
|
set = function(self, ignoresStunImmunity)
|
|
1036
1017
|
if not ignoresStunImmunity and self[137] then
|
|
@@ -1053,11 +1034,11 @@ __TS__SetDescriptor(
|
|
|
1053
1034
|
"disablesAutoAttack",
|
|
1054
1035
|
{
|
|
1055
1036
|
get = function(self)
|
|
1056
|
-
local
|
|
1057
|
-
if
|
|
1058
|
-
|
|
1037
|
+
local ____self__138_55 = self[138]
|
|
1038
|
+
if ____self__138_55 == nil then
|
|
1039
|
+
____self__138_55 = false
|
|
1059
1040
|
end
|
|
1060
|
-
return
|
|
1041
|
+
return ____self__138_55
|
|
1061
1042
|
end,
|
|
1062
1043
|
set = function(self, disablesAutoAttack)
|
|
1063
1044
|
if not disablesAutoAttack and self[138] then
|
|
@@ -1076,11 +1057,11 @@ __TS__SetDescriptor(
|
|
|
1076
1057
|
"providesInvulnerability",
|
|
1077
1058
|
{
|
|
1078
1059
|
get = function(self)
|
|
1079
|
-
local
|
|
1080
|
-
if
|
|
1081
|
-
|
|
1060
|
+
local ____self__139_56 = self[139]
|
|
1061
|
+
if ____self__139_56 == nil then
|
|
1062
|
+
____self__139_56 = false
|
|
1082
1063
|
end
|
|
1083
|
-
return
|
|
1064
|
+
return ____self__139_56
|
|
1084
1065
|
end,
|
|
1085
1066
|
set = function(self, providesInvulnerability)
|
|
1086
1067
|
if not providesInvulnerability and self[139] then
|
|
@@ -1099,11 +1080,11 @@ __TS__SetDescriptor(
|
|
|
1099
1080
|
"killsOnExpiration",
|
|
1100
1081
|
{
|
|
1101
1082
|
get = function(self)
|
|
1102
|
-
local
|
|
1103
|
-
if
|
|
1104
|
-
|
|
1083
|
+
local ____self__140_57 = self[140]
|
|
1084
|
+
if ____self__140_57 == nil then
|
|
1085
|
+
____self__140_57 = false
|
|
1105
1086
|
end
|
|
1106
|
-
return
|
|
1087
|
+
return ____self__140_57
|
|
1107
1088
|
end,
|
|
1108
1089
|
set = function(self, killsOnExpiration)
|
|
1109
1090
|
if not killsOnExpiration and self[140] then
|
|
@@ -1120,11 +1101,11 @@ __TS__SetDescriptor(
|
|
|
1120
1101
|
"explodesOnExpiration",
|
|
1121
1102
|
{
|
|
1122
1103
|
get = function(self)
|
|
1123
|
-
local
|
|
1124
|
-
if
|
|
1125
|
-
|
|
1104
|
+
local ____self__141_58 = self[141]
|
|
1105
|
+
if ____self__141_58 == nil then
|
|
1106
|
+
____self__141_58 = false
|
|
1126
1107
|
end
|
|
1127
|
-
return
|
|
1108
|
+
return ____self__141_58
|
|
1128
1109
|
end,
|
|
1129
1110
|
set = function(self, killsOnExpiration)
|
|
1130
1111
|
if not killsOnExpiration and self[141] then
|
|
@@ -1252,13 +1233,13 @@ __TS__SetDescriptor(
|
|
|
1252
1233
|
"remainingDuration",
|
|
1253
1234
|
{
|
|
1254
1235
|
get = function(self)
|
|
1255
|
-
local
|
|
1256
|
-
return
|
|
1236
|
+
local ____opt_59 = self._timer
|
|
1237
|
+
return ____opt_59 and ____opt_59.remaining or 0
|
|
1257
1238
|
end,
|
|
1258
1239
|
set = function(self, remainingDuration)
|
|
1259
|
-
local
|
|
1260
|
-
local
|
|
1261
|
-
local remainingDurationDelta =
|
|
1240
|
+
local ____remainingDuration_63 = remainingDuration
|
|
1241
|
+
local ____opt_61 = self._timer
|
|
1242
|
+
local remainingDurationDelta = ____remainingDuration_63 - (____opt_61 and ____opt_61.remaining or 0)
|
|
1262
1243
|
if remainingDurationDelta ~= 0 then
|
|
1263
1244
|
self[103] = self[103] + remainingDurationDelta
|
|
1264
1245
|
if remainingDuration <= 0 then
|
|
@@ -1288,7 +1269,8 @@ __TS__SetDescriptor(
|
|
|
1288
1269
|
},
|
|
1289
1270
|
true
|
|
1290
1271
|
)
|
|
1291
|
-
Buff.
|
|
1272
|
+
Buff.createdEvent = buffCreatedEvent
|
|
1273
|
+
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1292
1274
|
(function(self)
|
|
1293
1275
|
local function destroyBuffIfNeeded(buff)
|
|
1294
1276
|
if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
|
|
@@ -1342,5 +1324,8 @@ Buff.destroyEvent = buffDestroyEvent;
|
|
|
1342
1324
|
____exports.checkBuffs(target)
|
|
1343
1325
|
end
|
|
1344
1326
|
)
|
|
1327
|
+
buffCreatedEvent:addListener(function(buff)
|
|
1328
|
+
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1329
|
+
end)
|
|
1345
1330
|
end)(Buff)
|
|
1346
1331
|
return ____exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import { Handle } from "../../core/types/handle";
|
|
2
|
+
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Event } from "../../event";
|
|
4
4
|
import type { Item } from "../../core/types/item";
|
|
5
5
|
import type { Unit } from "./unit";
|
|
@@ -55,16 +55,19 @@ export declare class UnrecognizedAbility extends Ability {
|
|
|
55
55
|
export declare class UnitAbility extends Ability {
|
|
56
56
|
readonly owner: Unit;
|
|
57
57
|
private readonly u;
|
|
58
|
+
private d?;
|
|
58
59
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
59
60
|
incrementHideCounter(): void;
|
|
60
61
|
decrementHideCounter(): void;
|
|
61
62
|
incrementDisableCounter(): void;
|
|
62
63
|
decrementDisableCounter(): void;
|
|
64
|
+
get isDisabled(): boolean;
|
|
63
65
|
get level(): number;
|
|
64
66
|
set level(v: number);
|
|
65
67
|
get cooldownRemaining(): number;
|
|
66
68
|
set cooldownRemaining(cooldownRemaining: number);
|
|
67
69
|
interruptCast(): void;
|
|
70
|
+
protected onDestroy(): HandleDestructor;
|
|
68
71
|
static get onCreate(): Event<[UnitAbility]>;
|
|
69
72
|
static get onDestroy(): Event<[UnitAbility]>;
|
|
70
73
|
}
|
|
@@ -91,6 +94,7 @@ export declare class ItemAbility extends Ability {
|
|
|
91
94
|
get cooldownRemaining(): number;
|
|
92
95
|
set cooldownRemaining(cooldownRemaining: number);
|
|
93
96
|
interruptCast(): void;
|
|
97
|
+
protected onDestroy(): HandleDestructor;
|
|
94
98
|
static get onCreate(): Event<[ItemAbility]>;
|
|
95
99
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
96
100
|
}
|