warscript 0.0.1-dev.66ce6c9 → 0.0.1-dev.6912057
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 +5 -0
- package/attributes.lua +8 -1
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/sound.d.ts +17 -25
- package/core/types/sound.lua +85 -44
- package/core/types/timer.d.ts +8 -8
- package/core/types/timer.lua +25 -23
- package/decl/native.d.ts +840 -786
- package/engine/behavior.d.ts +2 -0
- package/engine/behavior.lua +53 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +18 -3
- package/engine/behaviour/ability.d.ts +4 -1
- package/engine/behaviour/ability.lua +14 -21
- 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 +28 -0
- package/engine/behaviour/unit.lua +163 -4
- package/engine/buff.d.ts +15 -9
- package/engine/buff.lua +90 -53
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +23 -0
- package/engine/internal/item/ability.lua +63 -11
- package/engine/internal/item.d.ts +5 -2
- package/engine/internal/item.lua +75 -3
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +62 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +29 -7
- package/engine/internal/unit.lua +239 -94
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +11 -11
- package/engine/object-data/entry/ability-type.lua +32 -13
- package/engine/object-data/entry/buff-type/applicable.lua +5 -0
- package/engine/object-data/entry/buff-type.d.ts +5 -11
- package/engine/object-data/entry/buff-type.lua +11 -27
- package/engine/object-data/entry/sound-preset.d.ts +17 -0
- package/engine/object-data/entry/sound-preset.lua +104 -0
- package/engine/object-data/entry/unit-type.d.ts +2 -2
- package/engine/object-data/entry/unit-type.lua +94 -84
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field/unit.d.ts +57 -3
- package/engine/object-field/unit.lua +207 -7
- package/engine/object-field.d.ts +15 -4
- package/engine/object-field.lua +184 -90
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- 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 +175 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/objutil/buff.lua +1 -2
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +6 -0
- package/utility/functions.lua +6 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +4 -0
- package/utility/lua-maps.lua +20 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____behavior = require("engine.behavior")
|
|
@@ -9,6 +10,17 @@ local ____unit = require("engine.internal.unit")
|
|
|
9
10
|
local Unit = ____unit.Unit
|
|
10
11
|
require("engine.internal.unit+ability")
|
|
11
12
|
require("engine.internal.unit-missile-launch")
|
|
13
|
+
local ____linked_2Dset = require("utility.linked-set")
|
|
14
|
+
local LinkedSet = ____linked_2Dset.LinkedSet
|
|
15
|
+
local ____lua_2Dmaps = require("utility.lua-maps")
|
|
16
|
+
local getOrPut = ____lua_2Dmaps.getOrPut
|
|
17
|
+
local mutableLuaMap = ____lua_2Dmaps.mutableLuaMap
|
|
18
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
19
|
+
local mutableLuaSet = ____lua_2Dsets.mutableLuaSet
|
|
20
|
+
local behaviorsByEvent = {}
|
|
21
|
+
local rangeByBehaviorByEvent = {}
|
|
22
|
+
local listenerByBehaviorByEvent = {}
|
|
23
|
+
local eventsByBehavior = {}
|
|
12
24
|
____exports.UnitBehavior = __TS__Class()
|
|
13
25
|
local UnitBehavior = ____exports.UnitBehavior
|
|
14
26
|
UnitBehavior.name = "UnitBehavior"
|
|
@@ -16,10 +28,69 @@ __TS__ClassExtends(UnitBehavior, Behavior)
|
|
|
16
28
|
function UnitBehavior.prototype.____constructor(self, unit)
|
|
17
29
|
Behavior.prototype.____constructor(self, unit)
|
|
18
30
|
end
|
|
31
|
+
function UnitBehavior.prototype.onDestroy(self)
|
|
32
|
+
local events = eventsByBehavior[self]
|
|
33
|
+
if events ~= nil then
|
|
34
|
+
for event in pairs(events) do
|
|
35
|
+
local ____opt_0 = behaviorsByEvent[event]
|
|
36
|
+
if ____opt_0 ~= nil then
|
|
37
|
+
____opt_0:remove(self)
|
|
38
|
+
end
|
|
39
|
+
local ____opt_2 = rangeByBehaviorByEvent[event]
|
|
40
|
+
if ____opt_2 ~= nil then
|
|
41
|
+
____opt_2[self] = nil
|
|
42
|
+
end
|
|
43
|
+
local ____opt_4 = listenerByBehaviorByEvent[event]
|
|
44
|
+
if ____opt_4 ~= nil then
|
|
45
|
+
____opt_4[self] = nil
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
eventsByBehavior[self] = nil
|
|
49
|
+
end
|
|
50
|
+
return Behavior.prototype.onDestroy(self)
|
|
51
|
+
end
|
|
52
|
+
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUnit, range, listener)
|
|
53
|
+
local rangeByBehavior = getOrPut(rangeByBehaviorByEvent, event, mutableLuaMap)
|
|
54
|
+
rangeByBehavior[self] = range
|
|
55
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByEvent, event, mutableLuaMap)
|
|
56
|
+
listenerByBehavior[self] = listener
|
|
57
|
+
getOrPut(eventsByBehavior, self, mutableLuaSet)[event] = true
|
|
58
|
+
local behaviors = behaviorsByEvent[event]
|
|
59
|
+
if behaviors == nil then
|
|
60
|
+
event:addListener(function(...)
|
|
61
|
+
local behaviors = behaviorsByEvent[event]
|
|
62
|
+
if behaviors ~= nil then
|
|
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
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end)
|
|
75
|
+
behaviors = __TS__New(LinkedSet)
|
|
76
|
+
behaviorsByEvent[event] = behaviors
|
|
77
|
+
end
|
|
78
|
+
behaviors:add(self)
|
|
79
|
+
end
|
|
80
|
+
function UnitBehavior.prototype.onImmediateOrder(self, orderId)
|
|
81
|
+
end
|
|
82
|
+
function UnitBehavior.prototype.onTargetOrder(self, orderId, target)
|
|
83
|
+
end
|
|
84
|
+
function UnitBehavior.prototype.onPointOrder(self, orderId, x, y)
|
|
85
|
+
end
|
|
19
86
|
function UnitBehavior.prototype.onAutoAttackStart(self, target)
|
|
20
87
|
end
|
|
21
88
|
function UnitBehavior.prototype.onAutoAttackFinish(self, target)
|
|
22
89
|
end
|
|
90
|
+
function UnitBehavior.prototype.onTargetingAutoAttackStart(self, source)
|
|
91
|
+
end
|
|
92
|
+
function UnitBehavior.prototype.onTargetingAutoAttackFinish(self, source)
|
|
93
|
+
end
|
|
23
94
|
function UnitBehavior.prototype.onDamageDealing(self, target, event)
|
|
24
95
|
end
|
|
25
96
|
function UnitBehavior.prototype.onDamageDealt(self, target, event)
|
|
@@ -32,6 +103,32 @@ function UnitBehavior.prototype.onAbilityGained(self, ability)
|
|
|
32
103
|
end
|
|
33
104
|
function UnitBehavior.prototype.onAbilityLost(self, ability)
|
|
34
105
|
end
|
|
106
|
+
function UnitBehavior.prototype.onAbilityChannelingStart(self, ability)
|
|
107
|
+
end
|
|
108
|
+
function UnitBehavior.prototype.onAbilityImpact(self, ability)
|
|
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
|
|
122
|
+
function UnitBehavior.prototype.onAbilityChannelingFinish(self, ability)
|
|
123
|
+
end
|
|
124
|
+
function UnitBehavior.prototype.onAbilityStop(self, ability)
|
|
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
|
|
35
132
|
function UnitBehavior.prototype.onItemDropped(self, item)
|
|
36
133
|
end
|
|
37
134
|
function UnitBehavior.prototype.onItemPickedUp(self, item)
|
|
@@ -40,6 +137,8 @@ function UnitBehavior.prototype.onItemUsed(self, item)
|
|
|
40
137
|
end
|
|
41
138
|
function UnitBehavior.prototype.onItemStacked(self, item)
|
|
42
139
|
end
|
|
140
|
+
function UnitBehavior.prototype.onItemChargesChanged(self, item)
|
|
141
|
+
end
|
|
43
142
|
function UnitBehavior.prototype.onKill(self, target)
|
|
44
143
|
end
|
|
45
144
|
function UnitBehavior.prototype.onDeath(self, source)
|
|
@@ -53,11 +152,28 @@ __TS__SetDescriptor(
|
|
|
53
152
|
true
|
|
54
153
|
);
|
|
55
154
|
(function(self)
|
|
155
|
+
Unit.onImmediateOrder:addListener(function(source, orderId)
|
|
156
|
+
____exports.UnitBehavior:forAll(source, "onImmediateOrder", orderId)
|
|
157
|
+
end)
|
|
158
|
+
Unit.onTargetOrder:addListener(function(source, orderId, target)
|
|
159
|
+
____exports.UnitBehavior:forAll(source, "onTargetOrder", orderId, target)
|
|
160
|
+
end)
|
|
161
|
+
Unit.onPointOrder:addListener(function(source, orderId, x, y)
|
|
162
|
+
____exports.UnitBehavior:forAll(
|
|
163
|
+
source,
|
|
164
|
+
"onPointOrder",
|
|
165
|
+
orderId,
|
|
166
|
+
x,
|
|
167
|
+
y
|
|
168
|
+
)
|
|
169
|
+
end)
|
|
56
170
|
Unit.autoAttackStartEvent:addListener(function(source, target)
|
|
57
171
|
____exports.UnitBehavior:forAll(source, "onAutoAttackStart", target)
|
|
172
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAutoAttackStart", source)
|
|
58
173
|
end)
|
|
59
174
|
Unit.autoAttackFinishEvent:addListener(function(source, target)
|
|
60
175
|
____exports.UnitBehavior:forAll(source, "onAutoAttackFinish", target)
|
|
176
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAutoAttackFinish", source)
|
|
61
177
|
end)
|
|
62
178
|
Unit.onDamaging:addListener(function(source, target, event)
|
|
63
179
|
if source ~= nil then
|
|
@@ -71,11 +187,51 @@ __TS__SetDescriptor(
|
|
|
71
187
|
end
|
|
72
188
|
____exports.UnitBehavior:forAll(target, "onDamageReceived", source, event)
|
|
73
189
|
end)
|
|
74
|
-
Unit.abilityGainedEvent:addListener(function(source,
|
|
75
|
-
____exports.UnitBehavior:forAll(source, "onAbilityGained",
|
|
190
|
+
Unit.abilityGainedEvent:addListener(function(source, ability)
|
|
191
|
+
____exports.UnitBehavior:forAll(source, "onAbilityGained", ability)
|
|
192
|
+
end)
|
|
193
|
+
Unit.abilityLostEvent:addListener(function(source, ability)
|
|
194
|
+
____exports.UnitBehavior:forAll(source, "onAbilityLost", ability)
|
|
195
|
+
end)
|
|
196
|
+
Unit.abilityChannelingStartEvent:addListener(function(source, ability)
|
|
197
|
+
____exports.UnitBehavior:forAll(source, "onAbilityChannelingStart", ability)
|
|
198
|
+
end)
|
|
199
|
+
Unit.abilityUnitTargetChannelingStartEvent:addListener(function(source, ability, target)
|
|
200
|
+
____exports.UnitBehavior:forAll(target, "onTargetingAbilityChannelingStart", ability, source)
|
|
76
201
|
end)
|
|
77
|
-
Unit.
|
|
78
|
-
____exports.UnitBehavior:forAll(source, "
|
|
202
|
+
Unit.abilityImpactEvent:addListener(function(source, ability)
|
|
203
|
+
____exports.UnitBehavior:forAll(source, "onAbilityImpact", ability)
|
|
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)
|
|
230
|
+
Unit.abilityChannelingFinishEvent:addListener(function(source, ability)
|
|
231
|
+
____exports.UnitBehavior:forAll(source, "onAbilityChannelingFinish", ability)
|
|
232
|
+
end)
|
|
233
|
+
Unit.abilityStopEvent:addListener(function(source, ability)
|
|
234
|
+
____exports.UnitBehavior:forAll(source, "onAbilityStop", ability)
|
|
79
235
|
end)
|
|
80
236
|
Unit.deathEvent:addListener(function(target, source)
|
|
81
237
|
if source ~= nil then
|
|
@@ -95,6 +251,9 @@ __TS__SetDescriptor(
|
|
|
95
251
|
Unit.itemStackedEvent:addListener(function(unit, item)
|
|
96
252
|
____exports.UnitBehavior:forAll(unit, "onItemStacked", item)
|
|
97
253
|
end)
|
|
254
|
+
Unit.itemChargesChangedEvent:addListener(function(unit, item)
|
|
255
|
+
____exports.UnitBehavior:forAll(unit, "onItemChargesChanged", item)
|
|
256
|
+
end)
|
|
98
257
|
end)(UnitBehavior)
|
|
99
258
|
Unit.destroyEvent:addListener(function(unit)
|
|
100
259
|
____exports.UnitBehavior:forAll(unit, "destroy")
|
package/engine/buff.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
64
64
|
durationIncreaseOnAutoAttack?: NumberParameterValueType;
|
|
65
65
|
maximumRemainingDuration?: NumberParameterValueType;
|
|
66
66
|
maximumDuration?: NumberParameterValueType;
|
|
67
|
+
turnsIntoGhost?: BooleanParameterValueType;
|
|
67
68
|
stuns?: BooleanParameterValueType;
|
|
68
69
|
ignoresStunImmunity?: BooleanParameterValueType;
|
|
69
70
|
providesStunImmunity?: BooleanParameterValueType;
|
|
@@ -116,13 +117,14 @@ declare const enum BuffPropertyKey {
|
|
|
116
117
|
MAXIMUM_DAMAGE_DEALT_EVENT_COUNT = 132,
|
|
117
118
|
DAMAGE_RECEIVED_EVENT_COUNT = 133,
|
|
118
119
|
MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT = 134,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
TURNS_INTO_GHOST = 135,
|
|
121
|
+
STUNS = 136,
|
|
122
|
+
IGNORES_STUN_IMMUNITY = 137,
|
|
123
|
+
DISABLES_AUTO_ATTACK = 138,
|
|
124
|
+
PROVIDES_INVULNERABILITY = 139,
|
|
125
|
+
KILLS_ON_EXPIRATION = 140,
|
|
126
|
+
EXPLODES_ON_EXPIRATION = 141,
|
|
127
|
+
MISS_PROBABILITY = 142
|
|
126
128
|
}
|
|
127
129
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
128
130
|
LEAST_DURATION = 0
|
|
@@ -136,7 +138,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
136
138
|
polarity: BuffPolarityParameterType,
|
|
137
139
|
resistanceType: BuffResistanceTypeParameterType,
|
|
138
140
|
...abilityOrParameters: [
|
|
139
|
-
ability
|
|
141
|
+
ability?: Ability,
|
|
140
142
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
141
143
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
142
144
|
];
|
|
@@ -178,6 +180,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
178
180
|
private [BuffPropertyKey.DAMAGE_DEALT_EVENT_COUNT]?;
|
|
179
181
|
private [BuffPropertyKey.MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
180
182
|
private [BuffPropertyKey.DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
183
|
+
private [BuffPropertyKey.TURNS_INTO_GHOST]?;
|
|
181
184
|
private [BuffPropertyKey.STUNS]?;
|
|
182
185
|
private [BuffPropertyKey.IGNORES_STUN_IMMUNITY]?;
|
|
183
186
|
private [BuffPropertyKey.DISABLES_AUTO_ATTACK]?;
|
|
@@ -231,6 +234,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
231
234
|
set receivedDamageFactor(receivedDamageFactor: number);
|
|
232
235
|
get armorIncrease(): number;
|
|
233
236
|
set armorIncrease(armorIncrease: number);
|
|
237
|
+
get turnsIntoGhost(): boolean;
|
|
238
|
+
set turnsIntoGhost(turnsIntoGhost: boolean);
|
|
234
239
|
get stuns(): boolean;
|
|
235
240
|
set stuns(stuns: boolean);
|
|
236
241
|
get ignoresStunImmunity(): boolean;
|
|
@@ -273,6 +278,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
273
278
|
onDeath(source: Unit | undefined): void;
|
|
274
279
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
|
275
280
|
onDamageReceived(source: Unit | undefined, event: DamageEvent): void;
|
|
276
|
-
static readonly
|
|
281
|
+
static readonly createdEvent: Event<[Buff<object>]>;
|
|
282
|
+
static readonly beingDestroyedEvent: Event<[Buff<object>]>;
|
|
277
283
|
}
|
|
278
284
|
export {};
|
package/engine/buff.lua
CHANGED
|
@@ -109,6 +109,7 @@ local buffParametersKeys = {
|
|
|
109
109
|
durationIncreaseOnAutoAttack = true,
|
|
110
110
|
maximumDuration = true,
|
|
111
111
|
maximumRemainingDuration = true,
|
|
112
|
+
turnsIntoGhost = true,
|
|
112
113
|
stuns = true,
|
|
113
114
|
ignoresStunImmunity = true,
|
|
114
115
|
providesStunImmunity = true,
|
|
@@ -174,6 +175,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
174
175
|
end
|
|
175
176
|
end
|
|
176
177
|
local buffBooleanParameters = {
|
|
178
|
+
"turnsIntoGhost",
|
|
177
179
|
"stuns",
|
|
178
180
|
"ignoresStunImmunity",
|
|
179
181
|
"disablesAutoAttack",
|
|
@@ -302,7 +304,8 @@ buffHealingIntervalTimerCallback = function(buff)
|
|
|
302
304
|
source:healTarget(buff[101], healingPerInterval)
|
|
303
305
|
end
|
|
304
306
|
end
|
|
305
|
-
local
|
|
307
|
+
local buffCreatedEvent = __TS__New(Event)
|
|
308
|
+
local buffBeingDestroyedEvent = __TS__New(Event)
|
|
306
309
|
____exports.Buff = __TS__Class()
|
|
307
310
|
local Buff = ____exports.Buff
|
|
308
311
|
Buff.name = "Buff"
|
|
@@ -321,7 +324,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
321
324
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
322
325
|
polarity = resistanceTypeOrPolarity
|
|
323
326
|
resistanceType = abilityOrParametersOrResistanceType
|
|
324
|
-
if __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
327
|
+
if __TS__InstanceOf(parametersOrAbility, Ability) or parametersOrAbility == nil then
|
|
325
328
|
ability = parametersOrAbility
|
|
326
329
|
else
|
|
327
330
|
ability = nil
|
|
@@ -331,7 +334,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
331
334
|
typeId = typeIdOrTypeIds
|
|
332
335
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
333
336
|
resistanceType = resistanceTypeOrPolarity
|
|
334
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
337
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) or abilityOrParametersOrResistanceType == nil then
|
|
335
338
|
ability = abilityOrParametersOrResistanceType
|
|
336
339
|
parameters = parametersOrAbility
|
|
337
340
|
else
|
|
@@ -340,7 +343,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
340
343
|
end
|
|
341
344
|
end
|
|
342
345
|
self.typeId = typeId
|
|
343
|
-
if not __TS__InstanceOf(ability, Ability) then
|
|
346
|
+
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
344
347
|
parameters = ability
|
|
345
348
|
ability = nil
|
|
346
349
|
end
|
|
@@ -371,7 +374,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
371
374
|
local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
|
|
372
375
|
if missProbability ~= nil then
|
|
373
376
|
missProbability = resolveNumberValue(ability, level, missProbability)
|
|
374
|
-
self[
|
|
377
|
+
self[142] = missProbability
|
|
375
378
|
end
|
|
376
379
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
377
380
|
if buffByTypeId == nil then
|
|
@@ -504,6 +507,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
504
507
|
end
|
|
505
508
|
self:onCreate()
|
|
506
509
|
self[100] = 1
|
|
510
|
+
Event.invoke(buffCreatedEvent, self)
|
|
507
511
|
end
|
|
508
512
|
function Buff.prototype.getUnitBonus(self, bonusType)
|
|
509
513
|
local ____opt_38 = self._bonusIdByBonusType
|
|
@@ -592,15 +596,21 @@ function Buff.prototype.onDestroy(self)
|
|
|
592
596
|
behavior:destroy()
|
|
593
597
|
end
|
|
594
598
|
end
|
|
595
|
-
if self[
|
|
599
|
+
if self[139] then
|
|
600
|
+
unit:decrementInvulnerabilityCounter()
|
|
601
|
+
end
|
|
602
|
+
if self[138] then
|
|
596
603
|
unit:decrementDisableAutoAttackCounter()
|
|
597
604
|
end
|
|
598
|
-
if self[
|
|
599
|
-
if self[
|
|
605
|
+
if self[136] then
|
|
606
|
+
if self[137] then
|
|
600
607
|
unit:decrementStunCounter()
|
|
601
608
|
end
|
|
602
609
|
unit:decrementStunCounter()
|
|
603
610
|
end
|
|
611
|
+
if self[135] then
|
|
612
|
+
unit:decrementGhostCounter()
|
|
613
|
+
end
|
|
604
614
|
if self._abilityTypeIds ~= nil then
|
|
605
615
|
for abilityTypeId in pairs(self._abilityTypeIds) do
|
|
606
616
|
unit:removeAbility(abilityTypeId)
|
|
@@ -611,7 +621,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
611
621
|
removeUnitBonus(unit, bonusType, bonusId)
|
|
612
622
|
end
|
|
613
623
|
end
|
|
614
|
-
Event.invoke(
|
|
624
|
+
Event.invoke(buffBeingDestroyedEvent, self)
|
|
615
625
|
self[100] = 3
|
|
616
626
|
return UnitBehavior.prototype.onDestroy(self)
|
|
617
627
|
end
|
|
@@ -655,9 +665,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
655
665
|
if self[121] ~= nil then
|
|
656
666
|
(self[102] or unit):healTarget(unit, self[120] or 0)
|
|
657
667
|
end
|
|
658
|
-
if self[
|
|
668
|
+
if self[141] then
|
|
659
669
|
unit:explode()
|
|
660
|
-
elseif self[
|
|
670
|
+
elseif self[140] then
|
|
661
671
|
unit:kill()
|
|
662
672
|
end
|
|
663
673
|
end
|
|
@@ -963,7 +973,7 @@ __TS__SetDescriptor(
|
|
|
963
973
|
)
|
|
964
974
|
__TS__SetDescriptor(
|
|
965
975
|
Buff.prototype,
|
|
966
|
-
"
|
|
976
|
+
"turnsIntoGhost",
|
|
967
977
|
{
|
|
968
978
|
get = function(self)
|
|
969
979
|
local ____self__135_54 = self[135]
|
|
@@ -972,18 +982,12 @@ __TS__SetDescriptor(
|
|
|
972
982
|
end
|
|
973
983
|
return ____self__135_54
|
|
974
984
|
end,
|
|
975
|
-
set = function(self,
|
|
976
|
-
if not
|
|
977
|
-
|
|
978
|
-
self.object:decrementStunCounter()
|
|
979
|
-
end
|
|
980
|
-
self.object:decrementStunCounter()
|
|
985
|
+
set = function(self, turnsIntoGhost)
|
|
986
|
+
if not turnsIntoGhost and self[135] then
|
|
987
|
+
self.object:decrementGhostCounter()
|
|
981
988
|
self[135] = nil
|
|
982
|
-
elseif
|
|
983
|
-
|
|
984
|
-
self.object:incrementStunCounter()
|
|
985
|
-
end
|
|
986
|
-
self.object:incrementStunCounter()
|
|
989
|
+
elseif turnsIntoGhost and not self[135] then
|
|
990
|
+
self.object:incrementGhostCounter()
|
|
987
991
|
self[135] = true
|
|
988
992
|
end
|
|
989
993
|
end
|
|
@@ -992,7 +996,7 @@ __TS__SetDescriptor(
|
|
|
992
996
|
)
|
|
993
997
|
__TS__SetDescriptor(
|
|
994
998
|
Buff.prototype,
|
|
995
|
-
"
|
|
999
|
+
"stuns",
|
|
996
1000
|
{
|
|
997
1001
|
get = function(self)
|
|
998
1002
|
local ____self__136_55 = self[136]
|
|
@@ -1001,16 +1005,18 @@ __TS__SetDescriptor(
|
|
|
1001
1005
|
end
|
|
1002
1006
|
return ____self__136_55
|
|
1003
1007
|
end,
|
|
1004
|
-
set = function(self,
|
|
1005
|
-
if not
|
|
1006
|
-
if self[
|
|
1008
|
+
set = function(self, stuns)
|
|
1009
|
+
if not stuns and self[136] then
|
|
1010
|
+
if self[137] then
|
|
1007
1011
|
self.object:decrementStunCounter()
|
|
1008
1012
|
end
|
|
1013
|
+
self.object:decrementStunCounter()
|
|
1009
1014
|
self[136] = nil
|
|
1010
|
-
elseif
|
|
1011
|
-
if self[
|
|
1015
|
+
elseif stuns and not self[136] then
|
|
1016
|
+
if self[137] then
|
|
1012
1017
|
self.object:incrementStunCounter()
|
|
1013
1018
|
end
|
|
1019
|
+
self.object:incrementStunCounter()
|
|
1014
1020
|
self[136] = true
|
|
1015
1021
|
end
|
|
1016
1022
|
end
|
|
@@ -1019,7 +1025,7 @@ __TS__SetDescriptor(
|
|
|
1019
1025
|
)
|
|
1020
1026
|
__TS__SetDescriptor(
|
|
1021
1027
|
Buff.prototype,
|
|
1022
|
-
"
|
|
1028
|
+
"ignoresStunImmunity",
|
|
1023
1029
|
{
|
|
1024
1030
|
get = function(self)
|
|
1025
1031
|
local ____self__137_56 = self[137]
|
|
@@ -1028,12 +1034,16 @@ __TS__SetDescriptor(
|
|
|
1028
1034
|
end
|
|
1029
1035
|
return ____self__137_56
|
|
1030
1036
|
end,
|
|
1031
|
-
set = function(self,
|
|
1032
|
-
if not
|
|
1033
|
-
self
|
|
1037
|
+
set = function(self, ignoresStunImmunity)
|
|
1038
|
+
if not ignoresStunImmunity and self[137] then
|
|
1039
|
+
if self[136] then
|
|
1040
|
+
self.object:decrementStunCounter()
|
|
1041
|
+
end
|
|
1034
1042
|
self[137] = nil
|
|
1035
|
-
elseif
|
|
1036
|
-
self
|
|
1043
|
+
elseif ignoresStunImmunity and not self[137] then
|
|
1044
|
+
if self[136] then
|
|
1045
|
+
self.object:incrementStunCounter()
|
|
1046
|
+
end
|
|
1037
1047
|
self[137] = true
|
|
1038
1048
|
end
|
|
1039
1049
|
end
|
|
@@ -1042,7 +1052,7 @@ __TS__SetDescriptor(
|
|
|
1042
1052
|
)
|
|
1043
1053
|
__TS__SetDescriptor(
|
|
1044
1054
|
Buff.prototype,
|
|
1045
|
-
"
|
|
1055
|
+
"disablesAutoAttack",
|
|
1046
1056
|
{
|
|
1047
1057
|
get = function(self)
|
|
1048
1058
|
local ____self__138_57 = self[138]
|
|
@@ -1051,12 +1061,12 @@ __TS__SetDescriptor(
|
|
|
1051
1061
|
end
|
|
1052
1062
|
return ____self__138_57
|
|
1053
1063
|
end,
|
|
1054
|
-
set = function(self,
|
|
1055
|
-
if not
|
|
1056
|
-
self.object:
|
|
1064
|
+
set = function(self, disablesAutoAttack)
|
|
1065
|
+
if not disablesAutoAttack and self[138] then
|
|
1066
|
+
self.object:decrementDisableAutoAttackCounter()
|
|
1057
1067
|
self[138] = nil
|
|
1058
|
-
elseif
|
|
1059
|
-
self.object:
|
|
1068
|
+
elseif disablesAutoAttack and not self[138] then
|
|
1069
|
+
self.object:incrementDisableAutoAttackCounter()
|
|
1060
1070
|
self[138] = true
|
|
1061
1071
|
end
|
|
1062
1072
|
end
|
|
@@ -1065,7 +1075,7 @@ __TS__SetDescriptor(
|
|
|
1065
1075
|
)
|
|
1066
1076
|
__TS__SetDescriptor(
|
|
1067
1077
|
Buff.prototype,
|
|
1068
|
-
"
|
|
1078
|
+
"providesInvulnerability",
|
|
1069
1079
|
{
|
|
1070
1080
|
get = function(self)
|
|
1071
1081
|
local ____self__139_58 = self[139]
|
|
@@ -1074,10 +1084,12 @@ __TS__SetDescriptor(
|
|
|
1074
1084
|
end
|
|
1075
1085
|
return ____self__139_58
|
|
1076
1086
|
end,
|
|
1077
|
-
set = function(self,
|
|
1078
|
-
if not
|
|
1087
|
+
set = function(self, providesInvulnerability)
|
|
1088
|
+
if not providesInvulnerability and self[139] then
|
|
1089
|
+
self.object:decrementInvulnerabilityCounter()
|
|
1079
1090
|
self[139] = nil
|
|
1080
|
-
elseif
|
|
1091
|
+
elseif providesInvulnerability and not self[139] then
|
|
1092
|
+
self.object:incrementInvulnerabilityCounter()
|
|
1081
1093
|
self[139] = true
|
|
1082
1094
|
end
|
|
1083
1095
|
end
|
|
@@ -1086,7 +1098,7 @@ __TS__SetDescriptor(
|
|
|
1086
1098
|
)
|
|
1087
1099
|
__TS__SetDescriptor(
|
|
1088
1100
|
Buff.prototype,
|
|
1089
|
-
"
|
|
1101
|
+
"killsOnExpiration",
|
|
1090
1102
|
{
|
|
1091
1103
|
get = function(self)
|
|
1092
1104
|
local ____self__140_59 = self[140]
|
|
@@ -1105,6 +1117,27 @@ __TS__SetDescriptor(
|
|
|
1105
1117
|
},
|
|
1106
1118
|
true
|
|
1107
1119
|
)
|
|
1120
|
+
__TS__SetDescriptor(
|
|
1121
|
+
Buff.prototype,
|
|
1122
|
+
"explodesOnExpiration",
|
|
1123
|
+
{
|
|
1124
|
+
get = function(self)
|
|
1125
|
+
local ____self__141_60 = self[141]
|
|
1126
|
+
if ____self__141_60 == nil then
|
|
1127
|
+
____self__141_60 = false
|
|
1128
|
+
end
|
|
1129
|
+
return ____self__141_60
|
|
1130
|
+
end,
|
|
1131
|
+
set = function(self, killsOnExpiration)
|
|
1132
|
+
if not killsOnExpiration and self[141] then
|
|
1133
|
+
self[141] = nil
|
|
1134
|
+
elseif killsOnExpiration and not self[141] then
|
|
1135
|
+
self[141] = true
|
|
1136
|
+
end
|
|
1137
|
+
end
|
|
1138
|
+
},
|
|
1139
|
+
true
|
|
1140
|
+
)
|
|
1108
1141
|
__TS__SetDescriptor(
|
|
1109
1142
|
Buff.prototype,
|
|
1110
1143
|
"maximumDamageDealtEventCount",
|
|
@@ -1221,13 +1254,13 @@ __TS__SetDescriptor(
|
|
|
1221
1254
|
"remainingDuration",
|
|
1222
1255
|
{
|
|
1223
1256
|
get = function(self)
|
|
1224
|
-
local
|
|
1225
|
-
return
|
|
1257
|
+
local ____opt_61 = self._timer
|
|
1258
|
+
return ____opt_61 and ____opt_61.remaining or 0
|
|
1226
1259
|
end,
|
|
1227
1260
|
set = function(self, remainingDuration)
|
|
1228
|
-
local
|
|
1229
|
-
local
|
|
1230
|
-
local remainingDurationDelta =
|
|
1261
|
+
local ____remainingDuration_65 = remainingDuration
|
|
1262
|
+
local ____opt_63 = self._timer
|
|
1263
|
+
local remainingDurationDelta = ____remainingDuration_65 - (____opt_63 and ____opt_63.remaining or 0)
|
|
1231
1264
|
if remainingDurationDelta ~= 0 then
|
|
1232
1265
|
self[103] = self[103] + remainingDurationDelta
|
|
1233
1266
|
if remainingDuration <= 0 then
|
|
@@ -1242,7 +1275,7 @@ __TS__SetDescriptor(
|
|
|
1242
1275
|
remainingDuration,
|
|
1243
1276
|
self._spellStealPriority,
|
|
1244
1277
|
self._learnLevelMinimum,
|
|
1245
|
-
self[
|
|
1278
|
+
self[142]
|
|
1246
1279
|
) then
|
|
1247
1280
|
local timer = self._timer
|
|
1248
1281
|
if timer == nil then
|
|
@@ -1257,7 +1290,8 @@ __TS__SetDescriptor(
|
|
|
1257
1290
|
},
|
|
1258
1291
|
true
|
|
1259
1292
|
)
|
|
1260
|
-
Buff.
|
|
1293
|
+
Buff.createdEvent = buffCreatedEvent
|
|
1294
|
+
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1261
1295
|
(function(self)
|
|
1262
1296
|
local function destroyBuffIfNeeded(buff)
|
|
1263
1297
|
if getUnitAbility(buff[101].handle, buff.typeId) ~= buff.handle and buff[100] == 1 then
|
|
@@ -1311,5 +1345,8 @@ Buff.destroyEvent = buffDestroyEvent;
|
|
|
1311
1345
|
____exports.checkBuffs(target)
|
|
1312
1346
|
end
|
|
1313
1347
|
)
|
|
1348
|
+
buffCreatedEvent:addListener(function(buff)
|
|
1349
|
+
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1350
|
+
end)
|
|
1314
1351
|
end)(Buff)
|
|
1315
1352
|
return ____exports
|
|
@@ -55,9 +55,13 @@ 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;
|
|
62
|
+
incrementDisableCounter(): void;
|
|
63
|
+
decrementDisableCounter(): void;
|
|
64
|
+
get isDisabled(): boolean;
|
|
61
65
|
get level(): number;
|
|
62
66
|
set level(v: number);
|
|
63
67
|
get cooldownRemaining(): number;
|
|
@@ -38,6 +38,7 @@ local getHandleId = GetHandleId
|
|
|
38
38
|
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
39
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
40
|
local unitHideAbility = BlzUnitHideAbility
|
|
41
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
41
42
|
local match = string.match
|
|
42
43
|
local ____type = _G.type
|
|
43
44
|
local ____tostring = _G.tostring
|
|
@@ -402,9 +403,31 @@ end
|
|
|
402
403
|
function UnitAbility.prototype.decrementHideCounter(self)
|
|
403
404
|
unitHideAbility(self.u, self.typeId, false)
|
|
404
405
|
end
|
|
406
|
+
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
407
|
+
local unit = self.u
|
|
408
|
+
local typeId = self.typeId
|
|
409
|
+
unitHideAbility(unit, typeId, true)
|
|
410
|
+
unitDisableAbility(unit, typeId, true, false)
|
|
411
|
+
self.d = (self.d or 0) + 1
|
|
412
|
+
end
|
|
413
|
+
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
414
|
+
local unit = self.u
|
|
415
|
+
local typeId = self.typeId
|
|
416
|
+
unitDisableAbility(unit, typeId, false, false)
|
|
417
|
+
unitHideAbility(unit, typeId, true)
|
|
418
|
+
self.d = (self.d or 0) - 1
|
|
419
|
+
end
|
|
405
420
|
function UnitAbility.prototype.interruptCast(self)
|
|
406
421
|
self.owner:interruptCast(self.typeId)
|
|
407
422
|
end
|
|
423
|
+
__TS__SetDescriptor(
|
|
424
|
+
UnitAbility.prototype,
|
|
425
|
+
"isDisabled",
|
|
426
|
+
{get = function(self)
|
|
427
|
+
return self.d ~= nil and self.d > 0
|
|
428
|
+
end},
|
|
429
|
+
true
|
|
430
|
+
)
|
|
408
431
|
__TS__SetDescriptor(
|
|
409
432
|
UnitAbility.prototype,
|
|
410
433
|
"level",
|