warscript 0.0.1-dev.4753736 → 0.0.1-dev.47e7849
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 +1 -0
- package/attributes.lua +9 -0
- package/binarywriter.lua +0 -12
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/tileCell.d.ts +2 -1
- package/core/types/tileCell.lua +5 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +8 -2
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +10 -2
- package/engine/behavior.lua +157 -76
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability.d.ts +2 -1
- package/engine/behaviour/ability.lua +2 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +6 -4
- package/engine/behaviour/unit/stun-immunity.lua +1 -1
- package/engine/behaviour/unit.d.ts +7 -3
- package/engine/behaviour/unit.lua +89 -22
- package/engine/buff.d.ts +15 -2
- package/engine/buff.lua +95 -17
- package/engine/internal/item.d.ts +12 -12
- package/engine/internal/item.lua +41 -26
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit-missile-launch.lua +41 -23
- package/engine/internal/unit.d.ts +13 -10
- package/engine/internal/unit.lua +83 -64
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type.lua +1 -1
- package/engine/object-data/entry/destructible-type.d.ts +27 -1
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/unit-type.d.ts +4 -0
- package/engine/object-data/entry/unit-type.lua +76 -32
- package/engine/object-field/unit.d.ts +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +7 -1
- package/engine/object-field.lua +232 -111
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +4 -1
- package/engine/standard/fields/unit.lua +6 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +2 -1
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/utility/callback-array.d.ts +5 -1
- package/utility/callback-array.lua +16 -1
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- package/utility/types.d.ts +3 -0
|
@@ -22,35 +22,53 @@ local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
|
22
22
|
local getUnitBonus = ____bonus.getUnitBonus
|
|
23
23
|
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
24
24
|
local safeCall = warpack.safeCall
|
|
25
|
-
local
|
|
26
|
-
local
|
|
27
|
-
local
|
|
28
|
-
local
|
|
25
|
+
local createBehaviorFunctionsByUnitTypeId = {}
|
|
26
|
+
local behaviorsByOwningPlayerEvent = {}
|
|
27
|
+
local listenerByBehaviorByOwningPlayerEvent = {}
|
|
28
|
+
local owningPlayerEventsByBehavior = {}
|
|
29
|
+
local behaviorsByInRangeUnitEvent = {}
|
|
30
|
+
local rangeByBehaviorByInRangeUnitEvent = {}
|
|
31
|
+
local listenerByBehaviorByInRangeUnitEvent = {}
|
|
32
|
+
local inRangeUnitEventsByBehavior = {}
|
|
29
33
|
____exports.UnitBehavior = __TS__Class()
|
|
30
34
|
local UnitBehavior = ____exports.UnitBehavior
|
|
31
35
|
UnitBehavior.name = "UnitBehavior"
|
|
32
36
|
__TS__ClassExtends(UnitBehavior, Behavior)
|
|
33
|
-
function UnitBehavior.prototype.____constructor(self, unit)
|
|
34
|
-
Behavior.prototype.____constructor(self, unit)
|
|
37
|
+
function UnitBehavior.prototype.____constructor(self, unit, priority)
|
|
38
|
+
Behavior.prototype.____constructor(self, unit, priority)
|
|
35
39
|
end
|
|
36
40
|
function UnitBehavior.prototype.onDestroy(self)
|
|
37
|
-
local
|
|
38
|
-
if
|
|
39
|
-
for event in pairs(
|
|
40
|
-
local ____opt_0 =
|
|
41
|
+
local owningPlayerEvents = owningPlayerEventsByBehavior[self]
|
|
42
|
+
if owningPlayerEvents ~= nil then
|
|
43
|
+
for event in pairs(owningPlayerEvents) do
|
|
44
|
+
local ____opt_0 = behaviorsByOwningPlayerEvent[event]
|
|
41
45
|
if ____opt_0 ~= nil then
|
|
42
46
|
____opt_0:remove(self)
|
|
43
47
|
end
|
|
44
|
-
local ____opt_2 =
|
|
48
|
+
local ____opt_2 = listenerByBehaviorByOwningPlayerEvent[event]
|
|
45
49
|
if ____opt_2 ~= nil then
|
|
46
50
|
____opt_2[self] = nil
|
|
47
51
|
end
|
|
48
|
-
|
|
52
|
+
end
|
|
53
|
+
owningPlayerEventsByBehavior[self] = nil
|
|
54
|
+
end
|
|
55
|
+
local inRangeUnitEvents = inRangeUnitEventsByBehavior[self]
|
|
56
|
+
if inRangeUnitEvents ~= nil then
|
|
57
|
+
for event in pairs(inRangeUnitEvents) do
|
|
58
|
+
local ____opt_4 = behaviorsByInRangeUnitEvent[event]
|
|
49
59
|
if ____opt_4 ~= nil then
|
|
50
|
-
____opt_4
|
|
60
|
+
____opt_4:remove(self)
|
|
61
|
+
end
|
|
62
|
+
local ____opt_6 = rangeByBehaviorByInRangeUnitEvent[event]
|
|
63
|
+
if ____opt_6 ~= nil then
|
|
64
|
+
____opt_6[self] = nil
|
|
65
|
+
end
|
|
66
|
+
local ____opt_8 = listenerByBehaviorByInRangeUnitEvent[event]
|
|
67
|
+
if ____opt_8 ~= nil then
|
|
68
|
+
____opt_8[self] = nil
|
|
51
69
|
end
|
|
52
70
|
end
|
|
53
|
-
|
|
71
|
+
inRangeUnitEventsByBehavior[self] = nil
|
|
54
72
|
end
|
|
55
73
|
if self._bonusIdByBonusType ~= nil then
|
|
56
74
|
for bonusType, bonusId in pairs(self._bonusIdByBonusType) do
|
|
@@ -60,8 +78,8 @@ function UnitBehavior.prototype.onDestroy(self)
|
|
|
60
78
|
return Behavior.prototype.onDestroy(self)
|
|
61
79
|
end
|
|
62
80
|
function UnitBehavior.prototype.getUnitBonus(self, bonusType)
|
|
63
|
-
local
|
|
64
|
-
local bonusId =
|
|
81
|
+
local ____opt_10 = self._bonusIdByBonusType
|
|
82
|
+
local bonusId = ____opt_10 and ____opt_10[bonusType]
|
|
65
83
|
return bonusId == nil and 0 or getUnitBonus(self.object, bonusType, bonusId)
|
|
66
84
|
end
|
|
67
85
|
function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
@@ -72,16 +90,40 @@ function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, va
|
|
|
72
90
|
end
|
|
73
91
|
bonusIdByBonusType[bonusType] = addOrUpdateOrRemoveUnitBonus(self.object, bonusType, bonusIdByBonusType[bonusType], value)
|
|
74
92
|
end
|
|
93
|
+
function UnitBehavior.prototype.registerOwningPlayerEvent(self, event, extractPlayer, listener)
|
|
94
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByOwningPlayerEvent, event, mutableLuaMap)
|
|
95
|
+
listenerByBehavior[self] = listener
|
|
96
|
+
getOrPut(inRangeUnitEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
97
|
+
local behaviors = behaviorsByOwningPlayerEvent[event]
|
|
98
|
+
if behaviors == nil then
|
|
99
|
+
event:addListener(function(...)
|
|
100
|
+
local behaviors = behaviorsByOwningPlayerEvent[event]
|
|
101
|
+
if behaviors ~= nil then
|
|
102
|
+
local player = extractPlayer(...)
|
|
103
|
+
if player ~= nil then
|
|
104
|
+
for behavior in pairs(behaviors) do
|
|
105
|
+
if behavior.unit.owner == player then
|
|
106
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end)
|
|
112
|
+
behaviors = __TS__New(LinkedSet)
|
|
113
|
+
behaviorsByOwningPlayerEvent[event] = behaviors
|
|
114
|
+
end
|
|
115
|
+
behaviors:add(self)
|
|
116
|
+
end
|
|
75
117
|
function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUnit, range, listener)
|
|
76
|
-
local rangeByBehavior = getOrPut(
|
|
118
|
+
local rangeByBehavior = getOrPut(rangeByBehaviorByInRangeUnitEvent, event, mutableLuaMap)
|
|
77
119
|
rangeByBehavior[self] = range
|
|
78
|
-
local listenerByBehavior = getOrPut(
|
|
120
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByInRangeUnitEvent, event, mutableLuaMap)
|
|
79
121
|
listenerByBehavior[self] = listener
|
|
80
|
-
getOrPut(
|
|
81
|
-
local behaviors =
|
|
122
|
+
getOrPut(inRangeUnitEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
123
|
+
local behaviors = behaviorsByInRangeUnitEvent[event]
|
|
82
124
|
if behaviors == nil then
|
|
83
125
|
event:addListener(function(...)
|
|
84
|
-
local behaviors =
|
|
126
|
+
local behaviors = behaviorsByInRangeUnitEvent[event]
|
|
85
127
|
if behaviors ~= nil then
|
|
86
128
|
local unit = extractUnit(...)
|
|
87
129
|
if unit ~= nil then
|
|
@@ -95,7 +137,7 @@ function UnitBehavior.prototype.registerInRangeUnitEvent(self, event, extractUni
|
|
|
95
137
|
end
|
|
96
138
|
end)
|
|
97
139
|
behaviors = __TS__New(LinkedSet)
|
|
98
|
-
|
|
140
|
+
behaviorsByInRangeUnitEvent[event] = behaviors
|
|
99
141
|
end
|
|
100
142
|
behaviors:add(self)
|
|
101
143
|
end
|
|
@@ -151,6 +193,8 @@ function UnitBehavior.prototype.onTargetingAbilityImpact(self, ability, source)
|
|
|
151
193
|
end
|
|
152
194
|
function UnitBehavior.prototype.onBuffGained(self, buff)
|
|
153
195
|
end
|
|
196
|
+
function UnitBehavior.prototype.onBuffLost(self, buff)
|
|
197
|
+
end
|
|
154
198
|
function UnitBehavior.prototype.onItemDropped(self, item)
|
|
155
199
|
end
|
|
156
200
|
function UnitBehavior.prototype.onItemPickedUp(self, item)
|
|
@@ -167,6 +211,21 @@ function UnitBehavior.prototype.onDeath(self, source)
|
|
|
167
211
|
end
|
|
168
212
|
function UnitBehavior.prototype.onOwnerChange(self, previousOwner)
|
|
169
213
|
end
|
|
214
|
+
function UnitBehavior.bindUnitType(self, unitTypeId, ...)
|
|
215
|
+
local args = {...}
|
|
216
|
+
local createBehaviorFunctions = createBehaviorFunctionsByUnitTypeId[unitTypeId]
|
|
217
|
+
if createBehaviorFunctions == nil then
|
|
218
|
+
createBehaviorFunctions = {}
|
|
219
|
+
createBehaviorFunctionsByUnitTypeId[unitTypeId] = createBehaviorFunctions
|
|
220
|
+
end
|
|
221
|
+
createBehaviorFunctions[#createBehaviorFunctions + 1] = function(unit)
|
|
222
|
+
return __TS__New(
|
|
223
|
+
self,
|
|
224
|
+
unit,
|
|
225
|
+
table.unpack(args)
|
|
226
|
+
)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
170
229
|
__TS__SetDescriptor(
|
|
171
230
|
UnitBehavior.prototype,
|
|
172
231
|
"unit",
|
|
@@ -282,6 +341,14 @@ __TS__SetDescriptor(
|
|
|
282
341
|
____exports.UnitBehavior:forAll(unit, "onOwnerChange", previousOwner)
|
|
283
342
|
end)
|
|
284
343
|
end)(UnitBehavior)
|
|
344
|
+
Unit.onCreate:addListener(function(unit)
|
|
345
|
+
local createBehaviorFunctions = createBehaviorFunctionsByUnitTypeId[unit.typeId]
|
|
346
|
+
if createBehaviorFunctions ~= nil then
|
|
347
|
+
for ____, createBehavior in ipairs(createBehaviorFunctions) do
|
|
348
|
+
createBehavior(unit)
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
end)
|
|
285
352
|
Unit.destroyEvent:addListener(function(unit)
|
|
286
353
|
____exports.UnitBehavior:forAll(unit, "destroy")
|
|
287
354
|
end)
|
package/engine/buff.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { UnitBehavior } from "./behaviour/unit";
|
|
|
13
13
|
import type { Widget } from "../core/types/widget";
|
|
14
14
|
import { Destructor } from "../destroyable";
|
|
15
15
|
import { Event } from "../event";
|
|
16
|
+
import { AbilityBehavior } from "./behaviour/ability";
|
|
16
17
|
export type BuffConstructor<T extends Buff<any> = Buff<any>, Args extends any[] = any> = OmitConstructor<typeof Buff<any>> & (new (...args: Args) => T);
|
|
17
18
|
type EnumParameterValueType<T extends number> = T | AbilityEnumLevelField<T>;
|
|
18
19
|
type NumberParameterValueType = number | AbilityNumberField | AbilityNumberLevelField;
|
|
@@ -56,6 +57,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
56
57
|
armorIncreaseFactor?: NumberParameterValueType;
|
|
57
58
|
attackSpeedIncreaseFactor?: NumberParameterValueType;
|
|
58
59
|
movementSpeedIncreaseFactor?: NumberParameterValueType;
|
|
60
|
+
manaRegenerationRateIncreaseFactor?: NumberParameterValueType;
|
|
59
61
|
evasionProbability?: NumberParameterValueType;
|
|
60
62
|
missProbability?: NumberParameterValueType;
|
|
61
63
|
damageFactor?: NumberParameterValueType;
|
|
@@ -79,6 +81,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
79
81
|
healingOnExpiration?: NumberParameterValueType;
|
|
80
82
|
killsOnExpiration?: BooleanParameterValueType;
|
|
81
83
|
explodesOnExpiration?: BooleanParameterValueType;
|
|
84
|
+
abilityCooldownFactor?: NumberParameterValueType;
|
|
82
85
|
uniqueGroup?: BuffUniqueGroup;
|
|
83
86
|
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
84
87
|
declare const enum BuffPropertyKey {
|
|
@@ -124,7 +127,9 @@ declare const enum BuffPropertyKey {
|
|
|
124
127
|
PROVIDES_INVULNERABILITY = 139,
|
|
125
128
|
KILLS_ON_EXPIRATION = 140,
|
|
126
129
|
EXPLODES_ON_EXPIRATION = 141,
|
|
127
|
-
MISS_PROBABILITY = 142
|
|
130
|
+
MISS_PROBABILITY = 142,
|
|
131
|
+
ABILITY_COOLDOWN_FACTOR = 143,
|
|
132
|
+
ABILITY_COOLDOWN_MODIFIER = 144
|
|
128
133
|
}
|
|
129
134
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
130
135
|
LEAST_DURATION = 0
|
|
@@ -138,7 +143,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
138
143
|
polarity: BuffPolarityParameterType,
|
|
139
144
|
resistanceType: BuffResistanceTypeParameterType,
|
|
140
145
|
...abilityOrParameters: [
|
|
141
|
-
ability?: Ability,
|
|
146
|
+
ability?: Ability | AbilityBehavior,
|
|
142
147
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
143
148
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
144
149
|
];
|
|
@@ -187,6 +192,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
187
192
|
private [BuffPropertyKey.PROVIDES_INVULNERABILITY]?;
|
|
188
193
|
private [BuffPropertyKey.KILLS_ON_EXPIRATION]?;
|
|
189
194
|
private [BuffPropertyKey.EXPLODES_ON_EXPIRATION]?;
|
|
195
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_FACTOR]?;
|
|
196
|
+
private [BuffPropertyKey.ABILITY_COOLDOWN_MODIFIER]?;
|
|
190
197
|
protected static readonly defaultParameters: BuffParameters;
|
|
191
198
|
get source(): Unit;
|
|
192
199
|
readonly typeId: ApplicableBuffTypeId;
|
|
@@ -259,9 +266,15 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
259
266
|
set movementSpeedIncreaseFactor(movementSpeedIncreaseFactor: number);
|
|
260
267
|
get evasionProbability(): number;
|
|
261
268
|
set evasionProbability(evasionProbability: number);
|
|
269
|
+
get manaRegenerationRateIncreaseFactor(): number;
|
|
270
|
+
set manaRegenerationRateIncreaseFactor(manaRegenerationRateIncreaseFactor: number);
|
|
262
271
|
get duration(): number;
|
|
263
272
|
get remainingDuration(): number;
|
|
264
273
|
set remainingDuration(remainingDuration: number);
|
|
274
|
+
get abilityCooldownFactor(): number;
|
|
275
|
+
set abilityCooldownFactor(abilityCooldownFactor: number);
|
|
276
|
+
onAbilityGained(ability: Ability): void;
|
|
277
|
+
onAbilityLost(ability: Ability): void;
|
|
265
278
|
flashEffect(...parameters: [
|
|
266
279
|
...widgetOrXY: [] | [Widget] | [x: number, x: number],
|
|
267
280
|
...parametersOrDuration: [] | [EffectParameters] | [number]
|
package/engine/buff.lua
CHANGED
|
@@ -16,6 +16,7 @@ local internalApplyBuff = ____applicable.internalApplyBuff
|
|
|
16
16
|
local removeBuff = ____applicable.removeBuff
|
|
17
17
|
local ____ability = require("engine.internal.ability")
|
|
18
18
|
local Ability = ____ability.Ability
|
|
19
|
+
local UnitAbility = ____ability.UnitAbility
|
|
19
20
|
local ____ability = require("engine.object-field.ability")
|
|
20
21
|
local AbilityBooleanField = ____ability.AbilityBooleanField
|
|
21
22
|
local AbilityNumberField = ____ability.AbilityNumberField
|
|
@@ -50,6 +51,10 @@ local ____item = require("engine.internal.item")
|
|
|
50
51
|
local Item = ____item.Item
|
|
51
52
|
local ____destructable = require("core.types.destructable")
|
|
52
53
|
local Destructable = ____destructable.Destructable
|
|
54
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
55
|
+
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
56
|
+
local ____ability = require("engine.behaviour.ability")
|
|
57
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
53
58
|
local getUnitAbility = BlzGetUnitAbility
|
|
54
59
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
55
60
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -98,6 +103,7 @@ local buffParametersKeys = {
|
|
|
98
103
|
armorIncreaseFactor = true,
|
|
99
104
|
attackSpeedIncreaseFactor = true,
|
|
100
105
|
movementSpeedIncreaseFactor = true,
|
|
106
|
+
manaRegenerationRateIncreaseFactor = true,
|
|
101
107
|
evasionProbability = true,
|
|
102
108
|
missProbability = true,
|
|
103
109
|
damageFactor = true,
|
|
@@ -121,7 +127,8 @@ local buffParametersKeys = {
|
|
|
121
127
|
damageOnExpiration = true,
|
|
122
128
|
healingOnExpiration = true,
|
|
123
129
|
killsOnExpiration = true,
|
|
124
|
-
explodesOnExpiration = true
|
|
130
|
+
explodesOnExpiration = true,
|
|
131
|
+
abilityCooldownFactor = true
|
|
125
132
|
}
|
|
126
133
|
local function resolveEnumValue(ability, level, value)
|
|
127
134
|
if value == nil or type(value) == "number" then
|
|
@@ -184,6 +191,7 @@ local buffNumberParameters = {
|
|
|
184
191
|
"durationIncreaseOnAutoAttack",
|
|
185
192
|
"attackSpeedIncreaseFactor",
|
|
186
193
|
"movementSpeedIncreaseFactor",
|
|
194
|
+
"manaRegenerationRateIncreaseFactor",
|
|
187
195
|
"evasionProbability",
|
|
188
196
|
"armorIncrease",
|
|
189
197
|
"damageFactor",
|
|
@@ -198,7 +206,8 @@ local buffNumberParameters = {
|
|
|
198
206
|
"healingPerInterval",
|
|
199
207
|
"healingOverDuration",
|
|
200
208
|
"damageOnExpiration",
|
|
201
|
-
"healingOnExpiration"
|
|
209
|
+
"healingOnExpiration",
|
|
210
|
+
"abilityCooldownFactor"
|
|
202
211
|
}
|
|
203
212
|
local unsuccessfulApplicationMarker = {}
|
|
204
213
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -317,33 +326,38 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
317
326
|
local polarity
|
|
318
327
|
local resistanceType
|
|
319
328
|
local ability
|
|
329
|
+
local abilityBehavior
|
|
320
330
|
if type(typeIdOrTypeIds) ~= "number" then
|
|
321
331
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
322
332
|
polarity = resistanceTypeOrPolarity
|
|
323
333
|
resistanceType = abilityOrParametersOrResistanceType
|
|
324
|
-
if __TS__InstanceOf(parametersOrAbility,
|
|
334
|
+
if __TS__InstanceOf(parametersOrAbility, AbilityBehavior) then
|
|
335
|
+
abilityBehavior = parametersOrAbility
|
|
336
|
+
ability = abilityBehavior.ability
|
|
337
|
+
elseif __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
325
338
|
ability = parametersOrAbility
|
|
326
|
-
|
|
327
|
-
ability = nil
|
|
339
|
+
elseif parametersOrAbility ~= nil then
|
|
328
340
|
parameters = parametersOrAbility
|
|
329
341
|
end
|
|
330
342
|
else
|
|
331
343
|
typeId = typeIdOrTypeIds
|
|
332
344
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
333
345
|
resistanceType = resistanceTypeOrPolarity
|
|
334
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType,
|
|
346
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, AbilityBehavior) then
|
|
347
|
+
abilityBehavior = abilityOrParametersOrResistanceType
|
|
348
|
+
ability = abilityBehavior.ability
|
|
349
|
+
parameters = parametersOrAbility
|
|
350
|
+
elseif __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
335
351
|
ability = abilityOrParametersOrResistanceType
|
|
336
352
|
parameters = parametersOrAbility
|
|
337
|
-
|
|
338
|
-
ability = nil
|
|
353
|
+
elseif abilityOrParametersOrResistanceType ~= nil then
|
|
339
354
|
parameters = abilityOrParametersOrResistanceType
|
|
355
|
+
else
|
|
356
|
+
parameters = parametersOrAbility
|
|
340
357
|
end
|
|
341
358
|
end
|
|
359
|
+
self.sourceAbilityBehavior = abilityBehavior
|
|
342
360
|
self.typeId = typeId
|
|
343
|
-
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
344
|
-
parameters = ability
|
|
345
|
-
ability = nil
|
|
346
|
-
end
|
|
347
361
|
local defaultParameters = self.constructor.defaultParameters
|
|
348
362
|
local level = parameters and parameters.level or defaultParameters.level
|
|
349
363
|
local spellStealPriority = parameters and parameters.spellStealPriority or defaultParameters.spellStealPriority
|
|
@@ -506,6 +520,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
506
520
|
self[100] = 1
|
|
507
521
|
Event.invoke(buffCreatedEvent, self)
|
|
508
522
|
end
|
|
523
|
+
function Buff.prototype.onAbilityGained(self, ability)
|
|
524
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
525
|
+
local abilityCooldownModifier = self[144]
|
|
526
|
+
if abilityCooldownModifier then
|
|
527
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, abilityCooldownModifier)
|
|
528
|
+
end
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
function Buff.prototype.onAbilityLost(self, ability)
|
|
532
|
+
if __TS__InstanceOf(ability, UnitAbility) then
|
|
533
|
+
local abilityCooldownModifier = self[144]
|
|
534
|
+
if abilityCooldownModifier then
|
|
535
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, abilityCooldownModifier)
|
|
536
|
+
end
|
|
537
|
+
end
|
|
538
|
+
end
|
|
509
539
|
function Buff.prototype.flashEffect(self, widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
510
540
|
if type(widgetOrXOrParametersOrDuration) == "number" and type(yOrParametersOrDuration) == "number" then
|
|
511
541
|
Effect:flash(self[105], widgetOrXOrParametersOrDuration, yOrParametersOrDuration, parametersOrDuration)
|
|
@@ -580,6 +610,12 @@ function Buff.prototype.onDestroy(self)
|
|
|
580
610
|
behavior:destroy()
|
|
581
611
|
end
|
|
582
612
|
end
|
|
613
|
+
local previousAbilityCooldownModifier = self[144]
|
|
614
|
+
if previousAbilityCooldownModifier then
|
|
615
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
616
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
617
|
+
end
|
|
618
|
+
end
|
|
583
619
|
if self[139] then
|
|
584
620
|
unit:decrementInvulnerabilityCounter()
|
|
585
621
|
end
|
|
@@ -588,7 +624,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
588
624
|
end
|
|
589
625
|
if self[136] then
|
|
590
626
|
if self[137] then
|
|
591
|
-
unit:
|
|
627
|
+
unit:decrementForceStunCounter()
|
|
592
628
|
end
|
|
593
629
|
unit:decrementStunCounter()
|
|
594
630
|
end
|
|
@@ -987,13 +1023,13 @@ __TS__SetDescriptor(
|
|
|
987
1023
|
set = function(self, stuns)
|
|
988
1024
|
if not stuns and self[136] then
|
|
989
1025
|
if self[137] then
|
|
990
|
-
self.object:
|
|
1026
|
+
self.object:decrementForceStunCounter()
|
|
991
1027
|
end
|
|
992
1028
|
self.object:decrementStunCounter()
|
|
993
1029
|
self[136] = nil
|
|
994
1030
|
elseif stuns and not self[136] then
|
|
995
1031
|
if self[137] then
|
|
996
|
-
self.object:
|
|
1032
|
+
self.object:incrementForceStunCounter()
|
|
997
1033
|
end
|
|
998
1034
|
self.object:incrementStunCounter()
|
|
999
1035
|
self[136] = true
|
|
@@ -1016,12 +1052,12 @@ __TS__SetDescriptor(
|
|
|
1016
1052
|
set = function(self, ignoresStunImmunity)
|
|
1017
1053
|
if not ignoresStunImmunity and self[137] then
|
|
1018
1054
|
if self[136] then
|
|
1019
|
-
self.object:
|
|
1055
|
+
self.object:decrementForceStunCounter()
|
|
1020
1056
|
end
|
|
1021
1057
|
self[137] = nil
|
|
1022
1058
|
elseif ignoresStunImmunity and not self[137] then
|
|
1023
1059
|
if self[136] then
|
|
1024
|
-
self.object:
|
|
1060
|
+
self.object:incrementForceStunCounter()
|
|
1025
1061
|
end
|
|
1026
1062
|
self[137] = true
|
|
1027
1063
|
end
|
|
@@ -1220,6 +1256,19 @@ __TS__SetDescriptor(
|
|
|
1220
1256
|
},
|
|
1221
1257
|
true
|
|
1222
1258
|
)
|
|
1259
|
+
__TS__SetDescriptor(
|
|
1260
|
+
Buff.prototype,
|
|
1261
|
+
"manaRegenerationRateIncreaseFactor",
|
|
1262
|
+
{
|
|
1263
|
+
get = function(self)
|
|
1264
|
+
return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
|
|
1265
|
+
end,
|
|
1266
|
+
set = function(self, manaRegenerationRateIncreaseFactor)
|
|
1267
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
|
|
1268
|
+
end
|
|
1269
|
+
},
|
|
1270
|
+
true
|
|
1271
|
+
)
|
|
1223
1272
|
__TS__SetDescriptor(
|
|
1224
1273
|
Buff.prototype,
|
|
1225
1274
|
"duration",
|
|
@@ -1269,6 +1318,32 @@ __TS__SetDescriptor(
|
|
|
1269
1318
|
},
|
|
1270
1319
|
true
|
|
1271
1320
|
)
|
|
1321
|
+
__TS__SetDescriptor(
|
|
1322
|
+
Buff.prototype,
|
|
1323
|
+
"abilityCooldownFactor",
|
|
1324
|
+
{
|
|
1325
|
+
get = function(self)
|
|
1326
|
+
return self[143] or 1
|
|
1327
|
+
end,
|
|
1328
|
+
set = function(self, abilityCooldownFactor)
|
|
1329
|
+
local previousAbilityCooldownModifier = self[144]
|
|
1330
|
+
if previousAbilityCooldownModifier then
|
|
1331
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1332
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:removeModifier(ability, previousAbilityCooldownModifier)
|
|
1333
|
+
end
|
|
1334
|
+
end
|
|
1335
|
+
local function modifier(ability, level, cooldown)
|
|
1336
|
+
return cooldown * abilityCooldownFactor
|
|
1337
|
+
end
|
|
1338
|
+
for ____, ability in ipairs(self._unit.abilities) do
|
|
1339
|
+
COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD:applyModifier(ability, modifier)
|
|
1340
|
+
end
|
|
1341
|
+
self[144] = modifier
|
|
1342
|
+
self[143] = abilityCooldownFactor
|
|
1343
|
+
end
|
|
1344
|
+
},
|
|
1345
|
+
true
|
|
1346
|
+
)
|
|
1272
1347
|
Buff.createdEvent = buffCreatedEvent
|
|
1273
1348
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1274
1349
|
(function(self)
|
|
@@ -1327,5 +1402,8 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1327
1402
|
buffCreatedEvent:addListener(function(buff)
|
|
1328
1403
|
UnitBehavior:forAll(buff.unit, "onBuffGained", buff)
|
|
1329
1404
|
end)
|
|
1405
|
+
buffBeingDestroyedEvent:addListener(function(buff)
|
|
1406
|
+
UnitBehavior:forAll(buff.unit, "onBuffLost", buff)
|
|
1407
|
+
end)
|
|
1330
1408
|
end)(Buff)
|
|
1331
1409
|
return ____exports
|
|
@@ -28,22 +28,22 @@ export declare class Item extends Handle<jitem> {
|
|
|
28
28
|
get extendedTooltip(): string;
|
|
29
29
|
set iconPath(v: string);
|
|
30
30
|
get iconPath(): string;
|
|
31
|
-
set
|
|
32
|
-
get
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
31
|
+
set dropsOnDeath(dropsOnDeath: boolean);
|
|
32
|
+
get dropsOnDeath(): boolean;
|
|
33
|
+
set canBeDropped(canBeDropped: boolean);
|
|
34
|
+
get canBeDropped(): boolean;
|
|
35
|
+
set canBeSold(canBeSold: boolean);
|
|
36
|
+
get canBeSold(): boolean;
|
|
37
|
+
set perishes(perishes: boolean);
|
|
38
|
+
get perishes(): boolean;
|
|
39
|
+
set isPowerUp(isPowerUp: boolean);
|
|
40
|
+
get isPowerUp(): boolean;
|
|
41
41
|
get isAlive(): boolean;
|
|
42
42
|
get isDead(): boolean;
|
|
43
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
44
44
|
get isInvulnerable(): boolean;
|
|
45
|
-
set
|
|
46
|
-
get
|
|
45
|
+
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
+
get isActivelyUsed(): boolean;
|
|
47
47
|
set visible(v: boolean);
|
|
48
48
|
get visible(): boolean;
|
|
49
49
|
set level(v: number);
|
package/engine/internal/item.lua
CHANGED
|
@@ -50,6 +50,13 @@ local unitRemoveItem = UnitRemoveItem
|
|
|
50
50
|
local unitUseItem = UnitUseItem
|
|
51
51
|
local unitUseItemPoint = UnitUseItemPoint
|
|
52
52
|
local unitUseItemTarget = UnitUseItemTarget
|
|
53
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
|
+
local setItemDroppable = SetItemDroppable
|
|
55
|
+
local setItemPawnable = SetItemPawnable
|
|
56
|
+
local isItemPawnable = IsItemPawnable
|
|
57
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
58
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
59
|
+
local getItemBooleanField = BlzGetItemBooleanField
|
|
53
60
|
local tableRemove = table.remove
|
|
54
61
|
_G.SetItemCharges = function(whichItem, charges)
|
|
55
62
|
setItemCharges(whichItem, charges)
|
|
@@ -58,9 +65,6 @@ _G.SetItemCharges = function(whichItem, charges)
|
|
|
58
65
|
____exports.Item:of(whichItem)
|
|
59
66
|
)
|
|
60
67
|
end
|
|
61
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
62
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
63
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
64
68
|
invoke = Event.invoke
|
|
65
69
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
66
70
|
---
|
|
@@ -328,65 +332,68 @@ __TS__SetDescriptor(
|
|
|
328
332
|
)
|
|
329
333
|
__TS__SetDescriptor(
|
|
330
334
|
Item.prototype,
|
|
331
|
-
"
|
|
335
|
+
"dropsOnDeath",
|
|
332
336
|
{
|
|
333
337
|
get = function(self)
|
|
334
|
-
return
|
|
338
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
335
339
|
end,
|
|
336
|
-
set = function(self,
|
|
337
|
-
|
|
340
|
+
set = function(self, dropsOnDeath)
|
|
341
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
338
342
|
end
|
|
339
343
|
},
|
|
340
344
|
true
|
|
341
345
|
)
|
|
342
346
|
__TS__SetDescriptor(
|
|
343
347
|
Item.prototype,
|
|
344
|
-
"
|
|
348
|
+
"canBeDropped",
|
|
345
349
|
{
|
|
346
350
|
get = function(self)
|
|
347
|
-
return
|
|
351
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
348
352
|
end,
|
|
349
|
-
set = function(self,
|
|
350
|
-
|
|
353
|
+
set = function(self, canBeDropped)
|
|
354
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
351
355
|
end
|
|
352
356
|
},
|
|
353
357
|
true
|
|
354
358
|
)
|
|
355
359
|
__TS__SetDescriptor(
|
|
356
360
|
Item.prototype,
|
|
357
|
-
"
|
|
361
|
+
"canBeSold",
|
|
358
362
|
{
|
|
359
363
|
get = function(self)
|
|
360
|
-
return
|
|
364
|
+
return isItemPawnable(self.handle)
|
|
361
365
|
end,
|
|
362
|
-
set = function(self,
|
|
363
|
-
|
|
366
|
+
set = function(self, canBeSold)
|
|
367
|
+
setItemPawnable(self.handle, canBeSold)
|
|
364
368
|
end
|
|
365
369
|
},
|
|
366
370
|
true
|
|
367
371
|
)
|
|
368
372
|
__TS__SetDescriptor(
|
|
369
373
|
Item.prototype,
|
|
370
|
-
"
|
|
374
|
+
"perishes",
|
|
371
375
|
{
|
|
372
376
|
get = function(self)
|
|
373
377
|
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
374
378
|
end,
|
|
375
|
-
set = function(self,
|
|
376
|
-
|
|
379
|
+
set = function(self, perishes)
|
|
380
|
+
local handle = self.handle
|
|
381
|
+
local powerUp = isItemPowerup(handle)
|
|
382
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
383
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
377
384
|
end
|
|
378
385
|
},
|
|
379
386
|
true
|
|
380
387
|
)
|
|
381
388
|
__TS__SetDescriptor(
|
|
382
389
|
Item.prototype,
|
|
383
|
-
"
|
|
390
|
+
"isPowerUp",
|
|
384
391
|
{
|
|
385
392
|
get = function(self)
|
|
386
393
|
return isItemPowerup(self.handle)
|
|
387
394
|
end,
|
|
388
|
-
set = function(self,
|
|
389
|
-
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED,
|
|
395
|
+
set = function(self, isPowerUp)
|
|
396
|
+
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, isPowerUp)
|
|
390
397
|
end
|
|
391
398
|
},
|
|
392
399
|
true
|
|
@@ -422,16 +429,24 @@ __TS__SetDescriptor(
|
|
|
422
429
|
)
|
|
423
430
|
__TS__SetDescriptor(
|
|
424
431
|
Item.prototype,
|
|
425
|
-
"
|
|
432
|
+
"isActivelyUsed",
|
|
426
433
|
{
|
|
427
434
|
get = function(self)
|
|
428
435
|
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
429
436
|
end,
|
|
430
|
-
set = function(self,
|
|
437
|
+
set = function(self, isActivelyUsed)
|
|
431
438
|
local handle = self.handle
|
|
432
|
-
local
|
|
433
|
-
|
|
434
|
-
|
|
439
|
+
local powerUp = isItemPowerup(handle)
|
|
440
|
+
local perishes = getItemBooleanField(handle, ITEM_BF_PERISHABLE)
|
|
441
|
+
local dropsOnDeath = getItemBooleanField(handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
442
|
+
local canBeDropped = getItemBooleanField(handle, ITEM_BF_CAN_BE_DROPPED)
|
|
443
|
+
local canBeSold = isItemPawnable(handle)
|
|
444
|
+
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, isActivelyUsed)
|
|
445
|
+
setItemPawnable(handle, canBeSold)
|
|
446
|
+
setItemDroppable(handle, canBeDropped)
|
|
447
|
+
setItemDropOnDeath(handle, dropsOnDeath)
|
|
448
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
449
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
435
450
|
end
|
|
436
451
|
},
|
|
437
452
|
true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____mana_2Dregeneration = require("engine.object-data.entry.ability-type.mana-regeneration")
|
|
3
|
+
local ManaRegenerationAbilityType = ____mana_2Dregeneration.ManaRegenerationAbilityType
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems.
|
|
6
|
+
____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = compiletime(function()
|
|
7
|
+
local abilityType = ManaRegenerationAbilityType:create()
|
|
8
|
+
abilityType.isInternal = true
|
|
9
|
+
abilityType.isButtonVisible = false
|
|
10
|
+
abilityType.manaRegenerationRateIncreaseFactor = 0
|
|
11
|
+
return abilityType.id
|
|
12
|
+
end)
|
|
13
|
+
---
|
|
14
|
+
-- @internal For use by internal systems.
|
|
15
|
+
____exports.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ABILITY_RLF_MANA_REGENERATION_BONUS_AS_FRACTION_OF_NORMAL
|
|
16
|
+
return ____exports
|