warscript 0.0.1-dev.87b6c38 → 0.0.1-dev.8895ff6
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/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +4 -2
- package/engine/behavior.lua +69 -11
- package/engine/behaviour/unit/stun-immunity.d.ts +1 -1
- package/engine/behaviour/unit/stun-immunity.lua +5 -4
- package/engine/behaviour/unit.lua +13 -3
- package/engine/buff.d.ts +7 -2
- package/engine/buff.lua +42 -24
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- 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/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.lua +3 -3
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/scale.lua +3 -3
- package/engine/internal/unit-missile-launch.lua +12 -5
- package/engine/internal/unit.d.ts +1 -8
- package/engine/internal/unit.lua +16 -69
- package/engine/local-client.d.ts +1 -1
- package/engine/local-client.lua +4 -4
- 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/destructible-type.d.ts +12 -0
- package/engine/object-data/entry/destructible-type.lua +78 -0
- package/engine/object-field/unit.d.ts +7 -4
- package/engine/object-field/unit.lua +4 -0
- package/engine/object-field.d.ts +2 -0
- package/engine/object-field.lua +171 -115
- package/engine/standard/fields/unit.d.ts +11 -5
- package/engine/standard/fields/unit.lua +13 -4
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/objutil/buff.lua +9 -7
- package/package.json +1 -1
- package/utility/linked-map.d.ts +26 -0
- package/utility/linked-map.lua +66 -0
- package/utility/linked-set.lua +4 -0
- package/utility/records.lua +20 -1
package/destroyable.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface Destroyable {
|
|
|
10
10
|
destroy(): void;
|
|
11
11
|
}
|
|
12
12
|
export declare abstract class AbstractDestroyable implements Destroyable {
|
|
13
|
+
get isDestroyed(): boolean;
|
|
13
14
|
/**
|
|
14
15
|
* An overriding function should always call the super one at the end of it,
|
|
15
16
|
* in the following manner: `return super.onDestroy()`.
|
package/destroyable.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local ____exception = require("exception")
|
|
6
7
|
local IllegalStateException = ____exception.IllegalStateException
|
|
@@ -28,4 +29,12 @@ function AbstractDestroyable.prototype.destroy(self)
|
|
|
28
29
|
end
|
|
29
30
|
return true
|
|
30
31
|
end
|
|
32
|
+
__TS__SetDescriptor(
|
|
33
|
+
AbstractDestroyable.prototype,
|
|
34
|
+
"isDestroyed",
|
|
35
|
+
{get = function(self)
|
|
36
|
+
return stateByDestroyable[self] ~= nil
|
|
37
|
+
end},
|
|
38
|
+
true
|
|
39
|
+
)
|
|
31
40
|
return ____exports
|
package/engine/behavior.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ export declare abstract class Behavior<T extends AnyNotNil, PeriodicActionParame
|
|
|
18
18
|
private [BehaviorPropertyKey.PREVIOUS_BEHAVIOR]?;
|
|
19
19
|
private [BehaviorPropertyKey.NEXT_BEHAVIOR]?;
|
|
20
20
|
private [BehaviorPropertyKey.TIMER]?;
|
|
21
|
-
|
|
21
|
+
constructor(object: T, priority?: BehaviorPriority);
|
|
22
22
|
protected onDestroy(): Destructor;
|
|
23
|
-
protected
|
|
23
|
+
protected registerGlobalEvent<K extends string, Args extends any[]>(this: Behavior<any, PeriodicActionParameters> & Record<K, (this: this, ...args: Args) => unknown>, event: Event<[...Args]>, listener: K): void;
|
|
24
|
+
protected deregisterGlobalEvent(event: Event<any>): boolean;
|
|
25
|
+
protected registerEvent<K extends string, Args extends any[]>(this: Behavior<any, PeriodicActionParameters> & Record<K, (this: this, ...args: Args) => unknown>, event: Event<[...Args]>, extractObject: (...args: Args) => T | undefined, listener: K): void;
|
|
24
26
|
protected deregisterEvent(event: Event<any>): boolean;
|
|
25
27
|
protected onPeriod(...parameters: PeriodicActionParameters): void;
|
|
26
28
|
protected startPeriodicAction(interval: number, ...parameters: PeriodicActionParameters): void;
|
package/engine/behavior.lua
CHANGED
|
@@ -57,9 +57,17 @@ local function reduceBehaviors(behaviorConstructor, object, operation, initial,
|
|
|
57
57
|
end
|
|
58
58
|
return accumulator
|
|
59
59
|
end
|
|
60
|
+
local behaviorsByGlobalEvent = {}
|
|
61
|
+
local listenerByBehaviorByGlobalEvent = {}
|
|
62
|
+
local globalEventsByBehavior = {}
|
|
60
63
|
local behaviorsByEvent = {}
|
|
61
64
|
local listenerByBehaviorByEvent = {}
|
|
62
65
|
local eventsByBehavior = {}
|
|
66
|
+
local function safeCallBehaviorListener(behavior, behaviors, listenerByBehavior, ...)
|
|
67
|
+
if behaviors[behavior] ~= nil then
|
|
68
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
63
71
|
____exports.Behavior = __TS__Class()
|
|
64
72
|
local Behavior = ____exports.Behavior
|
|
65
73
|
Behavior.name = "Behavior"
|
|
@@ -87,18 +95,32 @@ function Behavior.prototype.onDestroy(self)
|
|
|
87
95
|
if ____opt_0 ~= nil then
|
|
88
96
|
____opt_0:destroy()
|
|
89
97
|
end
|
|
90
|
-
local
|
|
91
|
-
if
|
|
92
|
-
for event in pairs(
|
|
93
|
-
local ____opt_2 =
|
|
98
|
+
local globalEvents = globalEventsByBehavior[self]
|
|
99
|
+
if globalEvents ~= nil then
|
|
100
|
+
for event in pairs(globalEvents) do
|
|
101
|
+
local ____opt_2 = behaviorsByGlobalEvent[event]
|
|
94
102
|
if ____opt_2 ~= nil then
|
|
95
103
|
____opt_2:remove(self)
|
|
96
104
|
end
|
|
97
|
-
local ____opt_4 =
|
|
105
|
+
local ____opt_4 = listenerByBehaviorByGlobalEvent[event]
|
|
98
106
|
if ____opt_4 ~= nil then
|
|
99
107
|
____opt_4[self] = nil
|
|
100
108
|
end
|
|
101
109
|
end
|
|
110
|
+
globalEventsByBehavior[self] = nil
|
|
111
|
+
end
|
|
112
|
+
local events = eventsByBehavior[self]
|
|
113
|
+
if events ~= nil then
|
|
114
|
+
for event in pairs(events) do
|
|
115
|
+
local ____opt_6 = behaviorsByEvent[event]
|
|
116
|
+
if ____opt_6 ~= nil then
|
|
117
|
+
____opt_6[self] = nil
|
|
118
|
+
end
|
|
119
|
+
local ____opt_8 = listenerByBehaviorByEvent[event]
|
|
120
|
+
if ____opt_8 ~= nil then
|
|
121
|
+
____opt_8[self] = nil
|
|
122
|
+
end
|
|
123
|
+
end
|
|
102
124
|
eventsByBehavior[self] = nil
|
|
103
125
|
end
|
|
104
126
|
local previousBehavior = self[0]
|
|
@@ -115,7 +137,35 @@ function Behavior.prototype.onDestroy(self)
|
|
|
115
137
|
end
|
|
116
138
|
return AbstractDestroyable.prototype.onDestroy(self)
|
|
117
139
|
end
|
|
118
|
-
function Behavior.prototype.
|
|
140
|
+
function Behavior.prototype.registerGlobalEvent(self, event, listener)
|
|
141
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByGlobalEvent, event, mutableLuaMap)
|
|
142
|
+
listenerByBehavior[self] = listener
|
|
143
|
+
getOrPut(globalEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
144
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
145
|
+
if behaviors == nil then
|
|
146
|
+
event:addListener(function(...)
|
|
147
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
148
|
+
if behaviors ~= nil then
|
|
149
|
+
for behavior in pairs(behaviors) do
|
|
150
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end)
|
|
154
|
+
behaviors = __TS__New(LinkedSet)
|
|
155
|
+
behaviorsByGlobalEvent[event] = behaviors
|
|
156
|
+
end
|
|
157
|
+
behaviors:add(self)
|
|
158
|
+
end
|
|
159
|
+
function Behavior.prototype.deregisterGlobalEvent(self, event)
|
|
160
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
161
|
+
if behaviors ~= nil and behaviors:remove(self) then
|
|
162
|
+
globalEventsByBehavior[self][event] = nil
|
|
163
|
+
listenerByBehaviorByGlobalEvent[event][self] = nil
|
|
164
|
+
return true
|
|
165
|
+
end
|
|
166
|
+
return false
|
|
167
|
+
end
|
|
168
|
+
function Behavior.prototype.registerEvent(self, event, extractObject, listener)
|
|
119
169
|
local listenerByBehavior = getOrPut(listenerByBehaviorByEvent, event, mutableLuaMap)
|
|
120
170
|
listenerByBehavior[self] = listener
|
|
121
171
|
getOrPut(eventsByBehavior, self, mutableLuaSet)[event] = true
|
|
@@ -124,19 +174,27 @@ function Behavior.prototype.registerEvent(self, event, listener)
|
|
|
124
174
|
event:addListener(function(...)
|
|
125
175
|
local behaviors = behaviorsByEvent[event]
|
|
126
176
|
if behaviors ~= nil then
|
|
127
|
-
|
|
128
|
-
|
|
177
|
+
local object = extractObject(...)
|
|
178
|
+
if object ~= nil then
|
|
179
|
+
____exports.Behavior:forAll(
|
|
180
|
+
object,
|
|
181
|
+
safeCallBehaviorListener,
|
|
182
|
+
behaviors,
|
|
183
|
+
listenerByBehavior,
|
|
184
|
+
...
|
|
185
|
+
)
|
|
129
186
|
end
|
|
130
187
|
end
|
|
131
188
|
end)
|
|
132
|
-
behaviors =
|
|
189
|
+
behaviors = {}
|
|
133
190
|
behaviorsByEvent[event] = behaviors
|
|
134
191
|
end
|
|
135
|
-
behaviors
|
|
192
|
+
behaviors[self] = true
|
|
136
193
|
end
|
|
137
194
|
function Behavior.prototype.deregisterEvent(self, event)
|
|
138
195
|
local behaviors = behaviorsByEvent[event]
|
|
139
|
-
if behaviors ~= nil and behaviors
|
|
196
|
+
if behaviors ~= nil and behaviors[self] ~= nil then
|
|
197
|
+
behaviors[self] = nil
|
|
140
198
|
eventsByBehavior[self][event] = nil
|
|
141
199
|
listenerByBehaviorByEvent[event][self] = nil
|
|
142
200
|
return true
|
|
@@ -7,7 +7,7 @@ import { Destructor } from "../../../destroyable";
|
|
|
7
7
|
import { BehaviorPriority } from "../../behavior";
|
|
8
8
|
export type StunImmunityUnitBehaviorParameters = {
|
|
9
9
|
readonly priority?: BehaviorPriority;
|
|
10
|
-
buffTypeIds?:
|
|
10
|
+
buffTypeIds?: readonly BuffTypeId[];
|
|
11
11
|
textTagPreset?: TextTagPreset;
|
|
12
12
|
textTagText?: string;
|
|
13
13
|
additionalAction?: (this: void, unit: Unit) => void;
|
|
@@ -8,14 +8,15 @@ local UnitBehavior = ____unit.UnitBehavior
|
|
|
8
8
|
local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
|
|
9
9
|
local AbilityType = ____ability_2Dtype.AbilityType
|
|
10
10
|
local ____arrays = require("utility.arrays")
|
|
11
|
-
local
|
|
11
|
+
local distinct = ____arrays.distinct
|
|
12
|
+
local flatMap = ____arrays.flatMap
|
|
12
13
|
local map = ____arrays.map
|
|
13
14
|
local ____text_2Dtag = require("engine.text-tag")
|
|
14
15
|
local TextTag = ____text_2Dtag.TextTag
|
|
15
16
|
local ____timer = require("core.types.timer")
|
|
16
17
|
local Timer = ____timer.Timer
|
|
17
18
|
local DEFAULT_BUFF_TYPE_IDS = postcompile(function()
|
|
18
|
-
return
|
|
19
|
+
return distinct(flatMap(
|
|
19
20
|
AbilityType:getAllByBaseIds(map({
|
|
20
21
|
"AHtb",
|
|
21
22
|
"AHbh",
|
|
@@ -41,11 +42,11 @@ local DEFAULT_BUFF_TYPE_IDS = postcompile(function()
|
|
|
41
42
|
"ACcb"
|
|
42
43
|
}, fourCC)),
|
|
43
44
|
function(abilityType) return __TS__ArrayFlat(abilityType.buffTypeIds) end
|
|
44
|
-
)
|
|
45
|
+
))
|
|
45
46
|
end)
|
|
46
47
|
local function process(behavior)
|
|
47
48
|
local hasRemovedBuffs = false
|
|
48
|
-
for buffTypeId in
|
|
49
|
+
for ____, buffTypeId in ipairs(behavior.parameters.buffTypeIds or DEFAULT_BUFF_TYPE_IDS) do
|
|
49
50
|
hasRemovedBuffs = hasRemovedBuffs or behavior.unit:removeBuff(buffTypeId)
|
|
50
51
|
end
|
|
51
52
|
if hasRemovedBuffs then
|
|
@@ -21,6 +21,8 @@ local ____bonus = require("engine.internal.unit.bonus")
|
|
|
21
21
|
local addOrUpdateOrRemoveUnitBonus = ____bonus.addOrUpdateOrRemoveUnitBonus
|
|
22
22
|
local getUnitBonus = ____bonus.getUnitBonus
|
|
23
23
|
local removeUnitBonus = ____bonus.removeUnitBonus
|
|
24
|
+
local ____linked_2Dmap = require("utility.linked-map")
|
|
25
|
+
local LinkedMap = ____linked_2Dmap.LinkedMap
|
|
24
26
|
local safeCall = warpack.safeCall
|
|
25
27
|
local createBehaviorFunctionsByUnitTypeId = {}
|
|
26
28
|
local behaviorsByOwningPlayerEvent = {}
|
|
@@ -79,16 +81,24 @@ function UnitBehavior.prototype.onDestroy(self)
|
|
|
79
81
|
end
|
|
80
82
|
function UnitBehavior.prototype.getUnitBonus(self, bonusType)
|
|
81
83
|
local ____opt_10 = self._bonusIdByBonusType
|
|
82
|
-
local bonusId = ____opt_10 and ____opt_10
|
|
84
|
+
local bonusId = ____opt_10 and ____opt_10:get(bonusType)
|
|
83
85
|
return bonusId == nil and 0 or getUnitBonus(self.object, bonusType, bonusId)
|
|
84
86
|
end
|
|
85
87
|
function UnitBehavior.prototype.addOrUpdateOrRemoveUnitBonus(self, bonusType, value)
|
|
86
88
|
local bonusIdByBonusType = self._bonusIdByBonusType
|
|
87
89
|
if bonusIdByBonusType == nil then
|
|
88
|
-
bonusIdByBonusType =
|
|
90
|
+
bonusIdByBonusType = __TS__New(LinkedMap)
|
|
89
91
|
self._bonusIdByBonusType = bonusIdByBonusType
|
|
90
92
|
end
|
|
91
|
-
bonusIdByBonusType
|
|
93
|
+
bonusIdByBonusType:put(
|
|
94
|
+
bonusType,
|
|
95
|
+
addOrUpdateOrRemoveUnitBonus(
|
|
96
|
+
self.object,
|
|
97
|
+
bonusType,
|
|
98
|
+
bonusIdByBonusType:get(bonusType),
|
|
99
|
+
value
|
|
100
|
+
)
|
|
101
|
+
)
|
|
92
102
|
end
|
|
93
103
|
function UnitBehavior.prototype.registerOwningPlayerEvent(self, event, extractPlayer, listener)
|
|
94
104
|
local listenerByBehavior = getOrPut(listenerByBehaviorByOwningPlayerEvent, event, mutableLuaMap)
|
package/engine/buff.d.ts
CHANGED
|
@@ -31,8 +31,10 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
31
31
|
source?: Unit;
|
|
32
32
|
behaviorConstructors?: (new (unit: Unit) => UnitBehavior)[];
|
|
33
33
|
abilityTypeIds?: Record<AbilityTypeId, {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
readonly fields?: [
|
|
35
|
+
AbilityNumberField | AbilityNumberLevelField,
|
|
36
|
+
NumberParameterValueType
|
|
37
|
+
][];
|
|
36
38
|
/** Default `true`. */
|
|
37
39
|
readonly isButtonVisible?: boolean;
|
|
38
40
|
/** Default is the level of the source ability or 0 if it is absent. */
|
|
@@ -57,6 +59,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
57
59
|
armorIncreaseFactor?: NumberParameterValueType;
|
|
58
60
|
attackSpeedIncreaseFactor?: NumberParameterValueType;
|
|
59
61
|
movementSpeedIncreaseFactor?: NumberParameterValueType;
|
|
62
|
+
manaRegenerationRateIncreaseFactor?: NumberParameterValueType;
|
|
60
63
|
evasionProbability?: NumberParameterValueType;
|
|
61
64
|
missProbability?: NumberParameterValueType;
|
|
62
65
|
damageFactor?: NumberParameterValueType;
|
|
@@ -265,6 +268,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
265
268
|
set movementSpeedIncreaseFactor(movementSpeedIncreaseFactor: number);
|
|
266
269
|
get evasionProbability(): number;
|
|
267
270
|
set evasionProbability(evasionProbability: number);
|
|
271
|
+
get manaRegenerationRateIncreaseFactor(): number;
|
|
272
|
+
set manaRegenerationRateIncreaseFactor(manaRegenerationRateIncreaseFactor: number);
|
|
268
273
|
get duration(): number;
|
|
269
274
|
get remainingDuration(): number;
|
|
270
275
|
set remainingDuration(remainingDuration: number);
|
package/engine/buff.lua
CHANGED
|
@@ -42,6 +42,7 @@ local BuffType = ____buff_2Dtype.BuffType
|
|
|
42
42
|
local ____unit = require("engine.behaviour.unit")
|
|
43
43
|
local UnitBehavior = ____unit.UnitBehavior
|
|
44
44
|
local ____arrays = require("utility.arrays")
|
|
45
|
+
local emptyArray = ____arrays.emptyArray
|
|
45
46
|
local forEach = ____arrays.forEach
|
|
46
47
|
local ____event = require("event")
|
|
47
48
|
local Event = ____event.Event
|
|
@@ -55,6 +56,8 @@ local ____ability = require("engine.standard.fields.ability")
|
|
|
55
56
|
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
56
57
|
local ____ability = require("engine.behaviour.ability")
|
|
57
58
|
local AbilityBehavior = ____ability.AbilityBehavior
|
|
59
|
+
local ____records = require("utility.records")
|
|
60
|
+
local sortedKeysUnnested = ____records.sortedKeysUnnested
|
|
58
61
|
local getUnitAbility = BlzGetUnitAbility
|
|
59
62
|
local stringValueByBuffTypeIdByFieldId = postcompile(function()
|
|
60
63
|
local stringValueByBuffTypeIdByFieldId = {}
|
|
@@ -103,6 +106,7 @@ local buffParametersKeys = {
|
|
|
103
106
|
armorIncreaseFactor = true,
|
|
104
107
|
attackSpeedIncreaseFactor = true,
|
|
105
108
|
movementSpeedIncreaseFactor = true,
|
|
109
|
+
manaRegenerationRateIncreaseFactor = true,
|
|
106
110
|
evasionProbability = true,
|
|
107
111
|
missProbability = true,
|
|
108
112
|
damageFactor = true,
|
|
@@ -190,6 +194,7 @@ local buffNumberParameters = {
|
|
|
190
194
|
"durationIncreaseOnAutoAttack",
|
|
191
195
|
"attackSpeedIncreaseFactor",
|
|
192
196
|
"movementSpeedIncreaseFactor",
|
|
197
|
+
"manaRegenerationRateIncreaseFactor",
|
|
193
198
|
"evasionProbability",
|
|
194
199
|
"armorIncrease",
|
|
195
200
|
"damageFactor",
|
|
@@ -466,24 +471,22 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
466
471
|
abilityTypeIds = {}
|
|
467
472
|
self._abilityTypeIds = abilityTypeIds
|
|
468
473
|
end
|
|
469
|
-
for
|
|
474
|
+
for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
|
|
475
|
+
local abilityParameters = parametersAbilityTypeIds[abilityTypeId]
|
|
470
476
|
local addedAbility = _unit:addAbility(abilityTypeId)
|
|
471
477
|
if addedAbility ~= nil then
|
|
472
478
|
_unit:makeAbilityPermanent(abilityTypeId, true)
|
|
473
479
|
_unit:setAbilityLevel(abilityTypeId, 1 + (abilityParameters.level or ability and ability.level or 0))
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
resolveNumberValue(ability, level, abilityParameterValue)
|
|
483
|
-
)
|
|
484
|
-
end
|
|
480
|
+
if abilityParameters.isButtonVisible == false then
|
|
481
|
+
_unit:hideAbility(abilityTypeId, true)
|
|
482
|
+
end
|
|
483
|
+
for ____, field in ipairs(abilityParameters.fields or emptyArray()) do
|
|
484
|
+
field[1]:setValue(
|
|
485
|
+
addedAbility,
|
|
486
|
+
resolveNumberValue(ability, level, field[2])
|
|
487
|
+
)
|
|
485
488
|
end
|
|
486
|
-
abilityTypeIds[
|
|
489
|
+
abilityTypeIds[#abilityTypeIds + 1] = abilityTypeId
|
|
487
490
|
end
|
|
488
491
|
end
|
|
489
492
|
local behaviorConstructors = parameters and parameters.behaviorConstructors or defaultParameters.behaviorConstructors
|
|
@@ -495,18 +498,20 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
495
498
|
self._behaviors = behaviors
|
|
496
499
|
end
|
|
497
500
|
end
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
if parameters ~= nil then
|
|
502
|
+
local additionalParameters = {}
|
|
503
|
+
for ____, key in ipairs(sortedKeysUnnested(parameters)) do
|
|
504
|
+
if not buffParametersKeys[key] then
|
|
505
|
+
if ability then
|
|
506
|
+
additionalParameters[key] = resolveCurrentAbilityDependentValue(ability, parameters[key])
|
|
507
|
+
else
|
|
508
|
+
additionalParameters[key] = parameters[key]
|
|
509
|
+
end
|
|
505
510
|
end
|
|
506
511
|
end
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
512
|
+
if (next(additionalParameters)) ~= nil then
|
|
513
|
+
self.parameters = additionalParameters
|
|
514
|
+
end
|
|
510
515
|
end
|
|
511
516
|
end
|
|
512
517
|
if duration ~= nil and duration > 0 then
|
|
@@ -630,7 +635,7 @@ function Buff.prototype.onDestroy(self)
|
|
|
630
635
|
unit:decrementGhostCounter()
|
|
631
636
|
end
|
|
632
637
|
if self._abilityTypeIds ~= nil then
|
|
633
|
-
for abilityTypeId in
|
|
638
|
+
for ____, abilityTypeId in ipairs(self._abilityTypeIds) do
|
|
634
639
|
unit:removeAbility(abilityTypeId)
|
|
635
640
|
end
|
|
636
641
|
end
|
|
@@ -1254,6 +1259,19 @@ __TS__SetDescriptor(
|
|
|
1254
1259
|
},
|
|
1255
1260
|
true
|
|
1256
1261
|
)
|
|
1262
|
+
__TS__SetDescriptor(
|
|
1263
|
+
Buff.prototype,
|
|
1264
|
+
"manaRegenerationRateIncreaseFactor",
|
|
1265
|
+
{
|
|
1266
|
+
get = function(self)
|
|
1267
|
+
return self:getUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR)
|
|
1268
|
+
end,
|
|
1269
|
+
set = function(self, manaRegenerationRateIncreaseFactor)
|
|
1270
|
+
self:addOrUpdateOrRemoveUnitBonus(UnitBonusType.MANA_REGENERATION_RATE_FACTOR, manaRegenerationRateIncreaseFactor)
|
|
1271
|
+
end
|
|
1272
|
+
},
|
|
1273
|
+
true
|
|
1274
|
+
)
|
|
1257
1275
|
__TS__SetDescriptor(
|
|
1258
1276
|
Buff.prototype,
|
|
1259
1277
|
"duration",
|
|
@@ -74,9 +74,12 @@ ____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ..
|
|
|
74
74
|
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
75
75
|
if latestInventoryAbilityTypeId ~= 0 then
|
|
76
76
|
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
77
|
-
for slot,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
for slot = 0, inventorySize - 1 do
|
|
78
|
+
local nativeItem = nativeItemBySlot[slot]
|
|
79
|
+
if nativeItem ~= nil then
|
|
80
|
+
unitAddItem(nativeUnit, nativeItem)
|
|
81
|
+
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
82
|
+
end
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
end
|
|
@@ -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 = 4
|
|
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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare module "../unit" {
|
|
3
|
+
interface Unit {
|
|
4
|
+
strengthBase: number;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare module "../unit" {
|
|
8
|
+
interface Unit {
|
|
9
|
+
agilityBase: number;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare module "../unit" {
|
|
13
|
+
interface Unit {
|
|
14
|
+
intelligenceBase: number;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____unit = require("engine.internal.unit")
|
|
5
|
+
local Unit = ____unit.Unit
|
|
6
|
+
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
+
local AGILITY_UNIT_FIELD = ____unit.AGILITY_UNIT_FIELD
|
|
8
|
+
local INTELLIGENCE_UNIT_FIELD = ____unit.INTELLIGENCE_UNIT_FIELD
|
|
9
|
+
local STRENGTH_UNIT_FIELD = ____unit.STRENGTH_UNIT_FIELD
|
|
10
|
+
__TS__ObjectDefineProperty(
|
|
11
|
+
Unit.prototype,
|
|
12
|
+
"strengthBase",
|
|
13
|
+
{
|
|
14
|
+
get = function(self)
|
|
15
|
+
return STRENGTH_UNIT_FIELD:getValue(self)
|
|
16
|
+
end,
|
|
17
|
+
set = function(self, value)
|
|
18
|
+
STRENGTH_UNIT_FIELD:setValue(self, value)
|
|
19
|
+
end
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
__TS__ObjectDefineProperty(
|
|
23
|
+
Unit.prototype,
|
|
24
|
+
"agilityBase",
|
|
25
|
+
{
|
|
26
|
+
get = function(self)
|
|
27
|
+
return AGILITY_UNIT_FIELD:getValue(self)
|
|
28
|
+
end,
|
|
29
|
+
set = function(self, value)
|
|
30
|
+
AGILITY_UNIT_FIELD:setValue(self, value)
|
|
31
|
+
end
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
__TS__ObjectDefineProperty(
|
|
35
|
+
Unit.prototype,
|
|
36
|
+
"intelligenceBase",
|
|
37
|
+
{
|
|
38
|
+
get = function(self)
|
|
39
|
+
return INTELLIGENCE_UNIT_FIELD:getValue(self)
|
|
40
|
+
end,
|
|
41
|
+
set = function(self, value)
|
|
42
|
+
INTELLIGENCE_UNIT_FIELD:setValue(self, value)
|
|
43
|
+
end
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
return ____exports
|
|
@@ -12,6 +12,7 @@ export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
|
|
|
12
12
|
export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
|
|
13
13
|
export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
|
|
14
14
|
export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
|
|
15
|
+
export type UnitManaRegenerationRateFactorBonusId = UnitBonusId<"manaRegenerationRateFactor">;
|
|
15
16
|
export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
16
17
|
abilityTypeId: AbilityTypeId;
|
|
17
18
|
field: jabilityintegerlevelfield;
|
|
@@ -36,6 +37,7 @@ export declare namespace UnitBonusType {
|
|
|
36
37
|
const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
37
38
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
38
39
|
const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
|
|
40
|
+
const MANA_REGENERATION_RATE_FACTOR: UnitBonusType<UnitManaRegenerationRateFactorBonusId>;
|
|
39
41
|
}
|
|
40
42
|
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
41
43
|
export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
|
|
@@ -24,6 +24,9 @@ local MOVEMENT_SPEED_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____movement_2Dspee
|
|
|
24
24
|
local ____evasion_2Dprobability = require("engine.internal.object-data.evasion-probability")
|
|
25
25
|
local EVASION_PROBABILITY_ABILITY_FIELD = ____evasion_2Dprobability.EVASION_PROBABILITY_ABILITY_FIELD
|
|
26
26
|
local EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID = ____evasion_2Dprobability.EVASION_PROBABILITY_DUMMY_ABILITY_TYPE_ID
|
|
27
|
+
local ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor = require("engine.internal.object-data.mana-regeneration-rate-increase-factor")
|
|
28
|
+
local MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD
|
|
29
|
+
local MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID
|
|
27
30
|
local damageFactorByUnit = {}
|
|
28
31
|
local receivedDamageFactorByUnit = {}
|
|
29
32
|
local function atLeastOnceProbability(array)
|
|
@@ -73,6 +76,13 @@ do
|
|
|
73
76
|
reduce = atLeastOnceProbability,
|
|
74
77
|
initialValue = 0
|
|
75
78
|
}
|
|
79
|
+
UnitBonusType.MANA_REGENERATION_RATE_FACTOR = {
|
|
80
|
+
abilityTypeId = MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID,
|
|
81
|
+
field = MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD,
|
|
82
|
+
integer = false,
|
|
83
|
+
reduce = sum,
|
|
84
|
+
initialValue = 0
|
|
85
|
+
}
|
|
76
86
|
end
|
|
77
87
|
local bonusesByUnitByBonusType = {}
|
|
78
88
|
local nextId = 1
|
|
@@ -4,16 +4,16 @@ local ____exports = {}
|
|
|
4
4
|
local ____unit = require("engine.internal.unit")
|
|
5
5
|
local Unit = ____unit.Unit
|
|
6
6
|
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
-
local
|
|
7
|
+
local FLY_HEIGHT_UNIT_FIELD = ____unit.FLY_HEIGHT_UNIT_FIELD
|
|
8
8
|
__TS__ObjectDefineProperty(
|
|
9
9
|
Unit.prototype,
|
|
10
10
|
"flyHeight",
|
|
11
11
|
{
|
|
12
12
|
get = function(self)
|
|
13
|
-
return
|
|
13
|
+
return FLY_HEIGHT_UNIT_FIELD:getValue(self)
|
|
14
14
|
end,
|
|
15
15
|
set = function(self, value)
|
|
16
|
-
|
|
16
|
+
FLY_HEIGHT_UNIT_FIELD:setValue(self, value)
|
|
17
17
|
end
|
|
18
18
|
}
|
|
19
19
|
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.internal.unit")
|
|
3
|
+
local Unit = ____unit.Unit
|
|
4
|
+
local ____unit_2Dmissile_2Dlaunch = require("engine.internal.unit-missile-launch")
|
|
5
|
+
local resetAutoAttackTimer = ____unit_2Dmissile_2Dlaunch.resetAutoAttackTimer
|
|
6
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
7
|
+
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
8
|
+
Unit.prototype.interruptAttack = function(self)
|
|
9
|
+
unitInterruptAttack(self.handle)
|
|
10
|
+
resetAutoAttackTimer(self)
|
|
11
|
+
end
|
|
12
|
+
Unit.prototype.interruptMovement = function(self)
|
|
13
|
+
local handle = self.handle
|
|
14
|
+
unitDisableAbility(
|
|
15
|
+
handle,
|
|
16
|
+
fourCC("Amov"),
|
|
17
|
+
true,
|
|
18
|
+
false
|
|
19
|
+
)
|
|
20
|
+
unitDisableAbility(
|
|
21
|
+
handle,
|
|
22
|
+
fourCC("Amov"),
|
|
23
|
+
false,
|
|
24
|
+
false
|
|
25
|
+
)
|
|
26
|
+
resetAutoAttackTimer(self)
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -4,16 +4,16 @@ local ____exports = {}
|
|
|
4
4
|
local ____unit = require("engine.internal.unit")
|
|
5
5
|
local Unit = ____unit.Unit
|
|
6
6
|
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
-
local
|
|
7
|
+
local SCALING_VALUE_UNIT_FIELD = ____unit.SCALING_VALUE_UNIT_FIELD
|
|
8
8
|
__TS__ObjectDefineProperty(
|
|
9
9
|
Unit.prototype,
|
|
10
10
|
"scale",
|
|
11
11
|
{
|
|
12
12
|
get = function(self)
|
|
13
|
-
return
|
|
13
|
+
return SCALING_VALUE_UNIT_FIELD:getValue(self)
|
|
14
14
|
end,
|
|
15
15
|
set = function(self, value)
|
|
16
|
-
|
|
16
|
+
SCALING_VALUE_UNIT_FIELD:setValue(self, value)
|
|
17
17
|
end
|
|
18
18
|
}
|
|
19
19
|
)
|