warscript 0.0.1-dev.c60b168 → 0.0.1-dev.c677d41
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/core/types/frame.lua +14 -9
- package/core/types/handle.lua +1 -1
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +57 -14
- package/core/types/playerCamera.lua +44 -0
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +8 -2
- package/decl/native.d.ts +2 -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 +9 -5
- package/engine/behaviour/unit/stun-immunity.lua +17 -7
- package/engine/behaviour/unit.d.ts +9 -3
- package/engine/behaviour/unit.lua +106 -24
- package/engine/buff.d.ts +19 -4
- package/engine/buff.lua +122 -41
- package/engine/internal/ability.lua +6 -5
- package/engine/internal/item.d.ts +13 -15
- package/engine/internal/item.lua +59 -48
- 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/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- 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.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -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 +51 -20
- package/engine/internal/unit.d.ts +16 -20
- package/engine/internal/unit.lua +159 -160
- 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 +4 -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 +9 -1
- package/engine/object-field.lua +265 -122
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +11 -3
- package/engine/standard/fields/unit.lua +15 -2
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +3 -2
- package/engine/unit.d.ts +4 -0
- package/engine/unit.lua +4 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +10 -8
- package/package.json +2 -2
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +5 -1
- package/utility/callback-array.lua +16 -1
- package/utility/linked-map.d.ts +26 -0
- package/utility/linked-map.lua +66 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +23 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/records.lua +20 -1
- package/utility/types.d.ts +3 -0
|
@@ -8,12 +8,10 @@ import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
|
8
8
|
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
9
9
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
10
|
declare const enum ItemPropertyKey {
|
|
11
|
-
ABILITIES = 100
|
|
12
|
-
LUA_INDEX_BY_ABILITY_TYPE_ID = 101
|
|
11
|
+
ABILITIES = 100
|
|
13
12
|
}
|
|
14
13
|
export declare class Item extends Handle<jitem> {
|
|
15
14
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
-
private readonly [ItemPropertyKey.LUA_INDEX_BY_ABILITY_TYPE_ID];
|
|
17
15
|
constructor(handle: jitem);
|
|
18
16
|
protected onDestroy(): HandleDestructor;
|
|
19
17
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
@@ -30,22 +28,22 @@ export declare class Item extends Handle<jitem> {
|
|
|
30
28
|
get extendedTooltip(): string;
|
|
31
29
|
set iconPath(v: string);
|
|
32
30
|
get iconPath(): string;
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
41
|
-
set
|
|
42
|
-
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;
|
|
43
41
|
get isAlive(): boolean;
|
|
44
42
|
get isDead(): boolean;
|
|
45
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
46
44
|
get isInvulnerable(): boolean;
|
|
47
|
-
set
|
|
48
|
-
get
|
|
45
|
+
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
+
get isActivelyUsed(): boolean;
|
|
49
47
|
set visible(v: boolean);
|
|
50
48
|
get visible(): boolean;
|
|
51
49
|
set level(v: number);
|
package/engine/internal/item.lua
CHANGED
|
@@ -29,6 +29,7 @@ local ____vec2 = require("math.vec2")
|
|
|
29
29
|
local distance = ____vec2.distance
|
|
30
30
|
local itemChargesChangeEvent = __TS__New(Event)
|
|
31
31
|
local itemAddAbility = BlzItemAddAbility
|
|
32
|
+
local itemRemoveAbility = BlzItemRemoveAbility
|
|
32
33
|
local getItemAbility = BlzGetItemAbility
|
|
33
34
|
local isItemPowerup = IsItemPowerup
|
|
34
35
|
local getItemAbilityByIndex = BlzGetItemAbilityByIndex
|
|
@@ -49,6 +50,13 @@ local unitRemoveItem = UnitRemoveItem
|
|
|
49
50
|
local unitUseItem = UnitUseItem
|
|
50
51
|
local unitUseItemPoint = UnitUseItemPoint
|
|
51
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
|
|
52
60
|
local tableRemove = table.remove
|
|
53
61
|
_G.SetItemCharges = function(whichItem, charges)
|
|
54
62
|
setItemCharges(whichItem, charges)
|
|
@@ -57,9 +65,6 @@ _G.SetItemCharges = function(whichItem, charges)
|
|
|
57
65
|
____exports.Item:of(whichItem)
|
|
58
66
|
)
|
|
59
67
|
end
|
|
60
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
61
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
62
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
63
68
|
invoke = Event.invoke
|
|
64
69
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
65
70
|
---
|
|
@@ -138,13 +143,7 @@ Item.name = "Item"
|
|
|
138
143
|
__TS__ClassExtends(Item, Handle)
|
|
139
144
|
function Item.prototype.____constructor(self, handle)
|
|
140
145
|
Handle.prototype.____constructor(self, handle)
|
|
141
|
-
|
|
142
|
-
self[100] = abilities
|
|
143
|
-
local luaIndexByAbilityTypeId = {}
|
|
144
|
-
for i = 1, #abilities do
|
|
145
|
-
luaIndexByAbilityTypeId[abilities[i].typeId] = i
|
|
146
|
-
end
|
|
147
|
-
self[101] = luaIndexByAbilityTypeId
|
|
146
|
+
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
148
147
|
end
|
|
149
148
|
function Item.prototype.onDestroy(self)
|
|
150
149
|
local owner = self.owner
|
|
@@ -196,31 +195,32 @@ function Item.prototype.addAbility(self, abilityTypeId)
|
|
|
196
195
|
if nativeAbility ~= nil then
|
|
197
196
|
local ability = ItemAbility:of(nativeAbility, abilityTypeId, self)
|
|
198
197
|
local abilities = self[100]
|
|
199
|
-
|
|
200
|
-
abilities[luaIndex] = ability
|
|
201
|
-
self[101][abilityTypeId] = luaIndex
|
|
198
|
+
abilities[#abilities + 1] = ability
|
|
202
199
|
return ability
|
|
203
200
|
end
|
|
204
201
|
return nil
|
|
205
202
|
end
|
|
206
203
|
function Item.prototype.removeAbility(self, abilityTypeId)
|
|
207
|
-
local
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
local abilities = self[100]
|
|
205
|
+
for i = 1, #abilities do
|
|
206
|
+
if abilities[i].typeId == abilityTypeId then
|
|
207
|
+
local ability = abilities[i]
|
|
208
|
+
tableRemove(abilities, i)
|
|
209
|
+
ability:destroy()
|
|
210
|
+
return true
|
|
211
|
+
end
|
|
215
212
|
end
|
|
216
|
-
return
|
|
213
|
+
return doAbilityAction(self.handle, itemRemoveAbility, abilityTypeId)
|
|
217
214
|
end
|
|
218
215
|
function Item.prototype.hasAbility(self, abilityTypeId)
|
|
219
|
-
return self
|
|
216
|
+
return doAbilityAction(self.handle, getItemAbility, abilityTypeId) ~= nil
|
|
220
217
|
end
|
|
221
218
|
function Item.prototype.getAbility(self, abilityTypeId)
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
return ItemAbility:of(
|
|
220
|
+
doAbilityAction(self.handle, getItemAbility, abilityTypeId),
|
|
221
|
+
abilityTypeId,
|
|
222
|
+
self
|
|
223
|
+
)
|
|
224
224
|
end
|
|
225
225
|
function Item.getInRange(self, x, y, range)
|
|
226
226
|
targetCollection = {}
|
|
@@ -332,65 +332,68 @@ __TS__SetDescriptor(
|
|
|
332
332
|
)
|
|
333
333
|
__TS__SetDescriptor(
|
|
334
334
|
Item.prototype,
|
|
335
|
-
"
|
|
335
|
+
"dropsOnDeath",
|
|
336
336
|
{
|
|
337
337
|
get = function(self)
|
|
338
|
-
return
|
|
338
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
339
339
|
end,
|
|
340
|
-
set = function(self,
|
|
341
|
-
|
|
340
|
+
set = function(self, dropsOnDeath)
|
|
341
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
342
342
|
end
|
|
343
343
|
},
|
|
344
344
|
true
|
|
345
345
|
)
|
|
346
346
|
__TS__SetDescriptor(
|
|
347
347
|
Item.prototype,
|
|
348
|
-
"
|
|
348
|
+
"canBeDropped",
|
|
349
349
|
{
|
|
350
350
|
get = function(self)
|
|
351
|
-
return
|
|
351
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
352
352
|
end,
|
|
353
|
-
set = function(self,
|
|
354
|
-
|
|
353
|
+
set = function(self, canBeDropped)
|
|
354
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
355
355
|
end
|
|
356
356
|
},
|
|
357
357
|
true
|
|
358
358
|
)
|
|
359
359
|
__TS__SetDescriptor(
|
|
360
360
|
Item.prototype,
|
|
361
|
-
"
|
|
361
|
+
"canBeSold",
|
|
362
362
|
{
|
|
363
363
|
get = function(self)
|
|
364
|
-
return
|
|
364
|
+
return isItemPawnable(self.handle)
|
|
365
365
|
end,
|
|
366
|
-
set = function(self,
|
|
367
|
-
|
|
366
|
+
set = function(self, canBeSold)
|
|
367
|
+
setItemPawnable(self.handle, canBeSold)
|
|
368
368
|
end
|
|
369
369
|
},
|
|
370
370
|
true
|
|
371
371
|
)
|
|
372
372
|
__TS__SetDescriptor(
|
|
373
373
|
Item.prototype,
|
|
374
|
-
"
|
|
374
|
+
"perishes",
|
|
375
375
|
{
|
|
376
376
|
get = function(self)
|
|
377
377
|
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
378
378
|
end,
|
|
379
|
-
set = function(self,
|
|
380
|
-
|
|
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)
|
|
381
384
|
end
|
|
382
385
|
},
|
|
383
386
|
true
|
|
384
387
|
)
|
|
385
388
|
__TS__SetDescriptor(
|
|
386
389
|
Item.prototype,
|
|
387
|
-
"
|
|
390
|
+
"isPowerUp",
|
|
388
391
|
{
|
|
389
392
|
get = function(self)
|
|
390
393
|
return isItemPowerup(self.handle)
|
|
391
394
|
end,
|
|
392
|
-
set = function(self,
|
|
393
|
-
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)
|
|
394
397
|
end
|
|
395
398
|
},
|
|
396
399
|
true
|
|
@@ -426,16 +429,24 @@ __TS__SetDescriptor(
|
|
|
426
429
|
)
|
|
427
430
|
__TS__SetDescriptor(
|
|
428
431
|
Item.prototype,
|
|
429
|
-
"
|
|
432
|
+
"isActivelyUsed",
|
|
430
433
|
{
|
|
431
434
|
get = function(self)
|
|
432
435
|
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
433
436
|
end,
|
|
434
|
-
set = function(self,
|
|
437
|
+
set = function(self, isActivelyUsed)
|
|
435
438
|
local handle = self.handle
|
|
436
|
-
local
|
|
437
|
-
|
|
438
|
-
|
|
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)
|
|
439
450
|
end
|
|
440
451
|
},
|
|
441
452
|
true
|
|
@@ -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
|
|
@@ -133,55 +133,55 @@ declare module "../unit" {
|
|
|
133
133
|
}
|
|
134
134
|
declare module "../unit" {
|
|
135
135
|
namespace Unit {
|
|
136
|
-
const
|
|
136
|
+
const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
declare module "../unit" {
|
|
140
140
|
namespace Unit {
|
|
141
|
-
const
|
|
141
|
+
const abilityStopEvent: DispatchingEvent<[Unit, Ability]>;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
declare module "../unit" {
|
|
145
145
|
namespace Unit {
|
|
146
|
-
const
|
|
146
|
+
const abilityCommandEvent: {
|
|
147
|
+
readonly [abilityTypeId: number]: {
|
|
148
|
+
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
declare module "../unit" {
|
|
150
154
|
namespace Unit {
|
|
151
|
-
const
|
|
155
|
+
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
declare module "../unit" {
|
|
155
159
|
namespace Unit {
|
|
156
|
-
const
|
|
160
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
declare module "../unit" {
|
|
160
164
|
namespace Unit {
|
|
161
|
-
const
|
|
165
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
declare module "../unit" {
|
|
165
169
|
namespace Unit {
|
|
166
|
-
const
|
|
170
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
declare module "../unit" {
|
|
170
174
|
namespace Unit {
|
|
171
|
-
const
|
|
175
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
declare module "../unit" {
|
|
175
179
|
namespace Unit {
|
|
176
|
-
const
|
|
180
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
declare module "../unit" {
|
|
180
184
|
namespace Unit {
|
|
181
|
-
const
|
|
182
|
-
readonly [abilityTypeId: number]: {
|
|
183
|
-
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
185
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -22,7 +22,12 @@ local checkNotNull = ____preconditions.checkNotNull
|
|
|
22
22
|
local ____lazy = require("utility.lazy")
|
|
23
23
|
local lazyRecord = ____lazy.lazyRecord
|
|
24
24
|
local ____timer = require("core.types.timer")
|
|
25
|
+
local consumeZeroTimerCallback = ____timer.consumeZeroTimerCallback
|
|
25
26
|
local Timer = ____timer.Timer
|
|
27
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
28
|
+
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
29
|
+
local ____attributes = require("attributes")
|
|
30
|
+
local attribute = ____attributes.attribute
|
|
26
31
|
local eventInvoke = Event.invoke
|
|
27
32
|
local condition = Condition
|
|
28
33
|
local createTrigger = CreateTrigger
|
|
@@ -347,10 +352,65 @@ rawset(
|
|
|
347
352
|
extractAbilityTypeId
|
|
348
353
|
)
|
|
349
354
|
)
|
|
355
|
+
local internalAbilityChannelingFinishEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_FINISH, collectUnitAbilityEventParameters)
|
|
356
|
+
rawset(
|
|
357
|
+
Unit,
|
|
358
|
+
"abilityChannelingFinishEvent",
|
|
359
|
+
createDispatchingEvent(internalAbilityChannelingFinishEvent, extractAbilityTypeId)
|
|
360
|
+
)
|
|
361
|
+
local internalAbilityStopEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters)
|
|
362
|
+
rawset(
|
|
363
|
+
Unit,
|
|
364
|
+
"abilityStopEvent",
|
|
365
|
+
createDispatchingEvent(internalAbilityStopEvent, extractAbilityTypeId)
|
|
366
|
+
)
|
|
367
|
+
rawset(
|
|
368
|
+
Unit,
|
|
369
|
+
"abilityCommandEvent",
|
|
370
|
+
lazyRecord(function(abilityTypeId)
|
|
371
|
+
return lazyRecord(function(orderTypeStringId)
|
|
372
|
+
return __TS__New(
|
|
373
|
+
InitializingEvent,
|
|
374
|
+
function(event)
|
|
375
|
+
local trigger = createTrigger()
|
|
376
|
+
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
377
|
+
triggerAddCondition(
|
|
378
|
+
trigger,
|
|
379
|
+
condition(function()
|
|
380
|
+
local unit = Unit:of(getTriggerUnit())
|
|
381
|
+
if unit ~= nil then
|
|
382
|
+
local ability = unit:getAbility(abilityTypeId)
|
|
383
|
+
if ability ~= nil then
|
|
384
|
+
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end)
|
|
388
|
+
)
|
|
389
|
+
end
|
|
390
|
+
)
|
|
391
|
+
end)
|
|
392
|
+
end)
|
|
393
|
+
)
|
|
350
394
|
local internalAbilityImpactEvent = __TS__New(Event)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
395
|
+
local impactCallbackIdAttribute = attribute()
|
|
396
|
+
local function invokeImpactEvent(unit, ability, ...)
|
|
397
|
+
ability[impactCallbackIdAttribute] = nil
|
|
398
|
+
eventInvoke(internalAbilityImpactEvent, unit, ability, ...)
|
|
399
|
+
end
|
|
400
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
401
|
+
999999,
|
|
402
|
+
function(unit, ability, ...)
|
|
403
|
+
ability[impactCallbackIdAttribute] = Timer:run(invokeImpactEvent, unit, ability, ...)
|
|
404
|
+
end
|
|
405
|
+
)
|
|
406
|
+
local function consumeImpactCallback(_, ability)
|
|
407
|
+
local impactCallbackId = ability[impactCallbackIdAttribute]
|
|
408
|
+
if impactCallbackId ~= nil then
|
|
409
|
+
consumeZeroTimerCallback(impactCallbackId)
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
internalAbilityChannelingFinishEvent:addListener(999999, consumeImpactCallback)
|
|
413
|
+
internalAbilityStopEvent:addListener(999999, consumeImpactCallback)
|
|
354
414
|
rawset(
|
|
355
415
|
Unit,
|
|
356
416
|
"abilityImpactEvent",
|
|
@@ -407,47 +467,14 @@ rawset(
|
|
|
407
467
|
extractAbilityTypeId
|
|
408
468
|
)
|
|
409
469
|
)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
Unit,
|
|
420
|
-
"abilityStopEvent",
|
|
421
|
-
createDispatchingEvent(
|
|
422
|
-
__TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters),
|
|
423
|
-
extractAbilityTypeId
|
|
424
|
-
)
|
|
425
|
-
)
|
|
426
|
-
rawset(
|
|
427
|
-
Unit,
|
|
428
|
-
"abilityCommandEvent",
|
|
429
|
-
lazyRecord(function(abilityTypeId)
|
|
430
|
-
return lazyRecord(function(orderTypeStringId)
|
|
431
|
-
return __TS__New(
|
|
432
|
-
InitializingEvent,
|
|
433
|
-
function(event)
|
|
434
|
-
local trigger = createTrigger()
|
|
435
|
-
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
436
|
-
triggerAddCondition(
|
|
437
|
-
trigger,
|
|
438
|
-
condition(function()
|
|
439
|
-
local unit = Unit:of(getTriggerUnit())
|
|
440
|
-
if unit ~= nil then
|
|
441
|
-
local ability = unit:getAbilityById(abilityTypeId)
|
|
442
|
-
if ability ~= nil then
|
|
443
|
-
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
444
|
-
end
|
|
445
|
-
end
|
|
446
|
-
end)
|
|
447
|
-
)
|
|
448
|
-
end
|
|
449
|
-
)
|
|
450
|
-
end)
|
|
451
|
-
end)
|
|
470
|
+
local spellEffectOnlyAbilityTypeIds = luaSetOf(fourCC("AAns"))
|
|
471
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
472
|
+
-999999,
|
|
473
|
+
function(unit, ability)
|
|
474
|
+
if spellEffectOnlyAbilityTypeIds[ability.parentTypeId] ~= nil then
|
|
475
|
+
eventInvoke(internalAbilityChannelingFinishEvent, unit, ability)
|
|
476
|
+
eventInvoke(internalAbilityStopEvent, unit, ability)
|
|
477
|
+
end
|
|
478
|
+
end
|
|
452
479
|
)
|
|
453
480
|
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
|
|
@@ -0,0 +1,20 @@
|
|
|
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 FLY_HEIGHT_UNIT_FIELD = ____unit.FLY_HEIGHT_UNIT_FIELD
|
|
8
|
+
__TS__ObjectDefineProperty(
|
|
9
|
+
Unit.prototype,
|
|
10
|
+
"flyHeight",
|
|
11
|
+
{
|
|
12
|
+
get = function(self)
|
|
13
|
+
return FLY_HEIGHT_UNIT_FIELD:getValue(self)
|
|
14
|
+
end,
|
|
15
|
+
set = function(self, value)
|
|
16
|
+
FLY_HEIGHT_UNIT_FIELD:setValue(self, value)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
return ____exports
|