warscript 0.0.1-dev.87b6c38 → 0.0.1-dev.8895725
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/types/frame.lua +47 -1
- package/core/types/handle.lua +6 -9
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- package/core/types/player.d.ts +1 -1
- package/core/types/player.lua +12 -11
- package/core/types/sound.lua +1 -1
- 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/ability/damage.d.ts +3 -0
- package/engine/behaviour/ability/damage.lua +8 -2
- package/engine/behaviour/ability/emulate-impact.lua +5 -4
- package/engine/behaviour/ability.d.ts +9 -5
- package/engine/behaviour/ability.lua +29 -0
- 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 +56 -19
- package/engine/buff.lua +283 -142
- package/engine/internal/ability.lua +15 -15
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item.d.ts +4 -5
- package/engine/internal/item.lua +37 -40
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/object-data/attribute-bonus.lua +2 -2
- package/engine/internal/object-data/health-bonus.d.ts +2 -0
- package/engine/internal/object-data/health-bonus.lua +16 -0
- package/engine/internal/object-data/mana-bonus.d.ts +2 -0
- package/engine/internal/object-data/mana-bonus.lua +16 -0
- 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 +6 -0
- package/engine/internal/unit/bonus.lua +33 -3
- 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/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.lua +3 -3
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit-missile-launch.lua +12 -5
- package/engine/internal/unit.d.ts +2 -9
- package/engine/internal/unit.lua +79 -121
- package/engine/local-client.d.ts +6 -1
- package/engine/local-client.lua +60 -5
- 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/auxiliary/unit-attribute.lua +1 -1
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
- package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
- package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -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/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type.d.ts +2 -0
- package/engine/object-data/entry/ability-type.lua +84 -4
- package/engine/object-data/entry/buff-type/applicable.lua +113 -109
- 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/ability.lua +2 -2
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +7 -4
- package/engine/object-field/unit.lua +4 -0
- package/engine/object-field.d.ts +3 -1
- package/engine/object-field.lua +177 -119
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +8 -0
- package/engine/standard/fields/item.d.ts +4 -0
- package/engine/standard/fields/item.lua +6 -0
- package/engine/standard/fields/unit.d.ts +11 -5
- package/engine/standard/fields/unit.lua +13 -4
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +3 -0
- package/lualib_bundle.lua +1 -1
- package/math.d.ts +2 -0
- package/math.lua +14 -0
- package/objutil/buff.lua +9 -7
- package/objutil/object.lua +1 -1
- package/operation.lua +1 -4
- package/package.json +5 -5
- package/patch-lua.lua +15 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +3 -1
- package/utility/linked-set.lua +27 -0
- package/utility/records.lua +20 -1
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- /package/engine/internal/object-data/{armor-increase.d.ts → armor-bonus.d.ts} +0 -0
- /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
|
@@ -35,8 +35,6 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
35
35
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
36
36
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
37
37
|
local getHandleId = GetHandleId
|
|
38
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
38
|
local unitHideAbility = BlzUnitHideAbility
|
|
41
39
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
42
40
|
local match = string.match
|
|
@@ -516,11 +514,13 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
516
514
|
)
|
|
517
515
|
end
|
|
518
516
|
function ItemAbility.prototype.interruptCast(self)
|
|
519
|
-
local
|
|
520
|
-
local
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
517
|
+
local item = self.owner
|
|
518
|
+
local itemHandle = item.handle
|
|
519
|
+
local ____opt_1 = item.owner
|
|
520
|
+
local itemOwnerHandle = ____opt_1 and ____opt_1.handle
|
|
521
|
+
local cooldownRemaining = doAbilityActionForceDummy(itemHandle, itemOwnerHandle, getAbilityCooldown, self.typeId)
|
|
522
|
+
if cooldownRemaining == 0 then
|
|
523
|
+
startItemCooldown(itemHandle, itemOwnerHandle, 0.015625)
|
|
524
524
|
end
|
|
525
525
|
end
|
|
526
526
|
function ItemAbility.prototype.onDestroy(self)
|
|
@@ -543,17 +543,17 @@ __TS__SetDescriptor(
|
|
|
543
543
|
{
|
|
544
544
|
get = function(self)
|
|
545
545
|
local item = self.owner
|
|
546
|
-
local
|
|
547
|
-
local
|
|
548
|
-
local
|
|
549
|
-
return
|
|
546
|
+
local ____doAbilityActionForceDummy_6 = doAbilityActionForceDummy
|
|
547
|
+
local ____item_handle_5 = item.handle
|
|
548
|
+
local ____opt_3 = item.owner
|
|
549
|
+
return ____doAbilityActionForceDummy_6(____item_handle_5, ____opt_3 and ____opt_3.handle, getAbilityCooldown, self.typeId)
|
|
550
550
|
end,
|
|
551
551
|
set = function(self, cooldownRemaining)
|
|
552
552
|
local item = self.owner
|
|
553
|
-
local
|
|
554
|
-
local
|
|
555
|
-
local
|
|
556
|
-
|
|
553
|
+
local ____startItemCooldown_10 = startItemCooldown
|
|
554
|
+
local ____item_handle_9 = item.handle
|
|
555
|
+
local ____opt_7 = item.owner
|
|
556
|
+
____startItemCooldown_10(____item_handle_9, ____opt_7 and ____opt_7.handle, cooldownRemaining)
|
|
557
557
|
end
|
|
558
558
|
},
|
|
559
559
|
true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____item = require("engine.internal.item")
|
|
5
|
+
local Item = ____item.Item
|
|
6
|
+
local ____item = require("engine.standard.fields.item")
|
|
7
|
+
local CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD = ____item.CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD
|
|
8
|
+
local IS_ACTIVELY_USED_ITEM_FIELD = ____item.IS_ACTIVELY_USED_ITEM_FIELD
|
|
9
|
+
__TS__ObjectDefineProperty(
|
|
10
|
+
Item.prototype,
|
|
11
|
+
"canBeSold",
|
|
12
|
+
{
|
|
13
|
+
get = function(self)
|
|
14
|
+
return CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:getValue(self)
|
|
15
|
+
end,
|
|
16
|
+
set = function(self, value)
|
|
17
|
+
CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:setValue(self, value)
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
__TS__ObjectDefineProperty(
|
|
22
|
+
Item.prototype,
|
|
23
|
+
"isActivelyUsed",
|
|
24
|
+
{
|
|
25
|
+
get = function(self)
|
|
26
|
+
return IS_ACTIVELY_USED_ITEM_FIELD:getValue(self)
|
|
27
|
+
end,
|
|
28
|
+
set = function(self, value)
|
|
29
|
+
IS_ACTIVELY_USED_ITEM_FIELD:setValue(self, value)
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
return ____exports
|
|
@@ -8,10 +8,12 @@ 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
|
|
11
|
+
ABILITIES = 100,
|
|
12
|
+
DEATH_TRIGGER = 101
|
|
12
13
|
}
|
|
13
14
|
export declare class Item extends Handle<jitem> {
|
|
14
15
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
+
private readonly [ItemPropertyKey.DEATH_TRIGGER];
|
|
15
17
|
constructor(handle: jitem);
|
|
16
18
|
protected onDestroy(): HandleDestructor;
|
|
17
19
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
@@ -32,8 +34,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
32
34
|
get dropsOnDeath(): boolean;
|
|
33
35
|
set canBeDropped(canBeDropped: boolean);
|
|
34
36
|
get canBeDropped(): boolean;
|
|
35
|
-
set canBeSold(canBeSold: boolean);
|
|
36
|
-
get canBeSold(): boolean;
|
|
37
37
|
set perishes(perishes: boolean);
|
|
38
38
|
get perishes(): boolean;
|
|
39
39
|
set isPowerUp(isPowerUp: boolean);
|
|
@@ -42,8 +42,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
42
42
|
get isDead(): boolean;
|
|
43
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
44
44
|
get isInvulnerable(): boolean;
|
|
45
|
-
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
-
get isActivelyUsed(): boolean;
|
|
47
45
|
set visible(v: boolean);
|
|
48
46
|
get visible(): boolean;
|
|
49
47
|
set level(v: number);
|
|
@@ -82,6 +80,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
82
80
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
83
81
|
static get onCreate(): Event<[Item]>;
|
|
84
82
|
static get destroyEvent(): Event<[Item]>;
|
|
83
|
+
static readonly deathEvent: Event<[Item]>;
|
|
85
84
|
static readonly chargesChangedEvent: Event<[Item]>;
|
|
86
85
|
}
|
|
87
86
|
export {};
|
package/engine/internal/item.lua
CHANGED
|
@@ -27,7 +27,13 @@ local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slo
|
|
|
27
27
|
local SLOT_FILLER_ITEM_TYPE_ID = ____add_2Ditem_2Dto_2Dslot.SLOT_FILLER_ITEM_TYPE_ID
|
|
28
28
|
local ____vec2 = require("math.vec2")
|
|
29
29
|
local distance = ____vec2.distance
|
|
30
|
-
local
|
|
30
|
+
local ____timer = require("core.types.timer")
|
|
31
|
+
local Timer = ____timer.Timer
|
|
32
|
+
local createTrigger = CreateTrigger
|
|
33
|
+
local triggerAddCondition = TriggerAddCondition
|
|
34
|
+
local triggerRegisterDeathEvent = TriggerRegisterDeathEvent
|
|
35
|
+
local condition = Condition
|
|
36
|
+
local destroyTrigger = DestroyTrigger
|
|
31
37
|
local itemAddAbility = BlzItemAddAbility
|
|
32
38
|
local itemRemoveAbility = BlzItemRemoveAbility
|
|
33
39
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -52,12 +58,15 @@ local unitUseItemPoint = UnitUseItemPoint
|
|
|
52
58
|
local unitUseItemTarget = UnitUseItemTarget
|
|
53
59
|
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
60
|
local setItemDroppable = SetItemDroppable
|
|
55
|
-
local setItemPawnable = SetItemPawnable
|
|
56
|
-
local isItemPawnable = IsItemPawnable
|
|
57
61
|
local getItemIntegerField = BlzGetItemIntegerField
|
|
58
62
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
59
63
|
local getItemBooleanField = BlzGetItemBooleanField
|
|
64
|
+
local getTriggerWidget = GetTriggerWidget
|
|
65
|
+
local saveWidgetHandle = SaveWidgetHandle
|
|
66
|
+
local loadItemHandle = LoadItemHandle
|
|
60
67
|
local tableRemove = table.remove
|
|
68
|
+
local itemChargesChangeEvent = __TS__New(Event)
|
|
69
|
+
local itemDeathEvent = __TS__New(Event)
|
|
61
70
|
_G.SetItemCharges = function(whichItem, charges)
|
|
62
71
|
setItemCharges(whichItem, charges)
|
|
63
72
|
invoke(
|
|
@@ -137,6 +146,25 @@ local function collectIntoTargetRange()
|
|
|
137
146
|
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
138
147
|
end
|
|
139
148
|
end
|
|
149
|
+
local hashtable = InitHashtable()
|
|
150
|
+
local deathTriggerCondition = condition(function()
|
|
151
|
+
saveWidgetHandle(
|
|
152
|
+
hashtable,
|
|
153
|
+
1,
|
|
154
|
+
1,
|
|
155
|
+
getTriggerWidget()
|
|
156
|
+
)
|
|
157
|
+
local item = ____exports.Item:of(loadItemHandle(hashtable, 1, 1))
|
|
158
|
+
if item ~= nil then
|
|
159
|
+
invoke(itemDeathEvent, item)
|
|
160
|
+
end
|
|
161
|
+
end)
|
|
162
|
+
itemDeathEvent:addListener(
|
|
163
|
+
999999,
|
|
164
|
+
function(item)
|
|
165
|
+
Timer:run(item, "destroy")
|
|
166
|
+
end
|
|
167
|
+
)
|
|
140
168
|
____exports.Item = __TS__Class()
|
|
141
169
|
local Item = ____exports.Item
|
|
142
170
|
Item.name = "Item"
|
|
@@ -144,6 +172,10 @@ __TS__ClassExtends(Item, Handle)
|
|
|
144
172
|
function Item.prototype.____constructor(self, handle)
|
|
145
173
|
Handle.prototype.____constructor(self, handle)
|
|
146
174
|
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
175
|
+
local deathTrigger = createTrigger()
|
|
176
|
+
triggerRegisterDeathEvent(deathTrigger, handle)
|
|
177
|
+
triggerAddCondition(deathTrigger, deathTriggerCondition)
|
|
178
|
+
self[101] = deathTrigger
|
|
147
179
|
end
|
|
148
180
|
function Item.prototype.onDestroy(self)
|
|
149
181
|
local owner = self.owner
|
|
@@ -155,6 +187,7 @@ function Item.prototype.onDestroy(self)
|
|
|
155
187
|
abilities[i]:destroy()
|
|
156
188
|
end
|
|
157
189
|
removeItem(self.handle)
|
|
190
|
+
destroyTrigger(self[101])
|
|
158
191
|
return Handle.prototype.onDestroy(self)
|
|
159
192
|
end
|
|
160
193
|
function Item.create(self, id, x, y, skinId)
|
|
@@ -356,19 +389,6 @@ __TS__SetDescriptor(
|
|
|
356
389
|
},
|
|
357
390
|
true
|
|
358
391
|
)
|
|
359
|
-
__TS__SetDescriptor(
|
|
360
|
-
Item.prototype,
|
|
361
|
-
"canBeSold",
|
|
362
|
-
{
|
|
363
|
-
get = function(self)
|
|
364
|
-
return isItemPawnable(self.handle)
|
|
365
|
-
end,
|
|
366
|
-
set = function(self, canBeSold)
|
|
367
|
-
setItemPawnable(self.handle, canBeSold)
|
|
368
|
-
end
|
|
369
|
-
},
|
|
370
|
-
true
|
|
371
|
-
)
|
|
372
392
|
__TS__SetDescriptor(
|
|
373
393
|
Item.prototype,
|
|
374
394
|
"perishes",
|
|
@@ -427,30 +447,6 @@ __TS__SetDescriptor(
|
|
|
427
447
|
},
|
|
428
448
|
true
|
|
429
449
|
)
|
|
430
|
-
__TS__SetDescriptor(
|
|
431
|
-
Item.prototype,
|
|
432
|
-
"isActivelyUsed",
|
|
433
|
-
{
|
|
434
|
-
get = function(self)
|
|
435
|
-
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
436
|
-
end,
|
|
437
|
-
set = function(self, isActivelyUsed)
|
|
438
|
-
local handle = self.handle
|
|
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)
|
|
450
|
-
end
|
|
451
|
-
},
|
|
452
|
-
true
|
|
453
|
-
)
|
|
454
450
|
__TS__SetDescriptor(
|
|
455
451
|
Item.prototype,
|
|
456
452
|
"visible",
|
|
@@ -672,6 +668,7 @@ __TS__ObjectDefineProperty(
|
|
|
672
668
|
return self.onDestroyEvent
|
|
673
669
|
end}
|
|
674
670
|
)
|
|
671
|
+
Item.deathEvent = itemDeathEvent
|
|
675
672
|
Item.chargesChangedEvent = itemChargesChangeEvent
|
|
676
673
|
local getManipulatedItem = GetManipulatedItem
|
|
677
674
|
local trigger = CreateTrigger()
|
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
-
local
|
|
3
|
-
local AttributeBonusAbilityType =
|
|
2
|
+
local ____attribute_2Dbonus = require("engine.object-data.entry.ability-type.attribute-bonus")
|
|
3
|
+
local AttributeBonusAbilityType = ____attribute_2Dbonus.AttributeBonusAbilityType
|
|
4
4
|
---
|
|
5
5
|
-- @internal For use by internal systems.
|
|
6
6
|
____exports.ATTRIBUTE_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____health_2Dbonus = require("engine.object-data.entry.ability-type.health-bonus")
|
|
3
|
+
local HealthBonusAbilityType = ____health_2Dbonus.HealthBonusAbilityType
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems only.
|
|
6
|
+
____exports.HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
|
|
7
|
+
local abilityType = HealthBonusAbilityType:create()
|
|
8
|
+
abilityType.isInternal = true
|
|
9
|
+
abilityType.isButtonVisible = false
|
|
10
|
+
abilityType.healthBonus = 0
|
|
11
|
+
return abilityType.id
|
|
12
|
+
end)
|
|
13
|
+
---
|
|
14
|
+
-- @internal For use by internal systems only.
|
|
15
|
+
____exports.HEALTH_BONUS_DUMMY_ABILITY_FIELD = ABILITY_ILF_MAX_LIFE_GAINED
|
|
16
|
+
return ____exports
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____mana_2Dbonus = require("engine.object-data.entry.ability-type.mana-bonus")
|
|
3
|
+
local ManaBonusAbilityType = ____mana_2Dbonus.ManaBonusAbilityType
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems only.
|
|
6
|
+
____exports.MANA_BONUS_DUMMY_ABILITY_TYPE_ID = compiletime(function()
|
|
7
|
+
local abilityType = ManaBonusAbilityType:create()
|
|
8
|
+
abilityType.isInternal = true
|
|
9
|
+
abilityType.isButtonVisible = false
|
|
10
|
+
abilityType.manaBonus = 0
|
|
11
|
+
return abilityType.id
|
|
12
|
+
end)
|
|
13
|
+
---
|
|
14
|
+
-- @internal For use by internal systems only.
|
|
15
|
+
____exports.MANA_BONUS_DUMMY_ABILITY_FIELD = ABILITY_ILF_MAX_MANA_GAINED
|
|
16
|
+
return ____exports
|
|
@@ -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
|
|
@@ -5,6 +5,8 @@ export type UnitBonusId<Brand extends string = any> = number & {
|
|
|
5
5
|
readonly __unitBonusId: unique symbol;
|
|
6
6
|
readonly __unitBonusIdBrand: Brand;
|
|
7
7
|
};
|
|
8
|
+
export type UnitMaxHealthBonusId = UnitBonusId<"maxHealth">;
|
|
9
|
+
export type UnitMaxManaBonusId = UnitBonusId<"maxMana">;
|
|
8
10
|
export type UnitArmorBonusId = UnitBonusId<"armor">;
|
|
9
11
|
export type UnitAttackSpeedFactorBonusId = UnitBonusId<"attackSpeedFactor">;
|
|
10
12
|
export type UnitMovementSpeedFactorBonusId = UnitBonusId<"movementSpeedFactor">;
|
|
@@ -12,6 +14,7 @@ export type UnitAutoAttackDamageBonusId = UnitBonusId<"autoAttackDamage">;
|
|
|
12
14
|
export type UnitDamageFactorBonusId = UnitBonusId<"damageFactor">;
|
|
13
15
|
export type UnitReceivedDamageFactorBonusId = UnitBonusId<"receivedDamageFactor">;
|
|
14
16
|
export type UnitEvasionProbabilityBonusId = UnitBonusId<"evasionProbability">;
|
|
17
|
+
export type UnitManaRegenerationRateFactorBonusId = UnitBonusId<"manaRegenerationRateFactor">;
|
|
15
18
|
export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
16
19
|
abilityTypeId: AbilityTypeId;
|
|
17
20
|
field: jabilityintegerlevelfield;
|
|
@@ -29,6 +32,8 @@ export type UnitBonusType<Id extends UnitBonusId = UnitBonusId> = ({
|
|
|
29
32
|
readonly __unitBonusTypeId?: Id;
|
|
30
33
|
};
|
|
31
34
|
export declare namespace UnitBonusType {
|
|
35
|
+
const HEALTH: UnitBonusType<UnitMaxHealthBonusId>;
|
|
36
|
+
const MANA: UnitBonusType<UnitMaxManaBonusId>;
|
|
32
37
|
const ARMOR: UnitBonusType<UnitArmorBonusId>;
|
|
33
38
|
const ATTACK_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
34
39
|
const MOVEMENT_SPEED_FACTOR: UnitBonusType<UnitAttackSpeedFactorBonusId>;
|
|
@@ -36,6 +41,7 @@ export declare namespace UnitBonusType {
|
|
|
36
41
|
const DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
37
42
|
const RECEIVED_DAMAGE_FACTOR: UnitBonusType<UnitReceivedDamageFactorBonusId>;
|
|
38
43
|
const EVASION_PROBABILITY: UnitBonusType<UnitEvasionProbabilityBonusId>;
|
|
44
|
+
const MANA_REGENERATION_RATE_FACTOR: UnitBonusType<UnitManaRegenerationRateFactorBonusId>;
|
|
39
45
|
}
|
|
40
46
|
export declare const addUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, value: number) => Id;
|
|
41
47
|
export declare const removeUnitBonus: <Id extends UnitBonusId>(unit: Unit, bonusType: UnitBonusType<Id>, id: Id) => boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____unit = require("engine.internal.unit")
|
|
3
3
|
local Unit = ____unit.Unit
|
|
4
|
-
local
|
|
5
|
-
local ARMOR_BONUS_DUMMY_ABILITY_FIELD =
|
|
6
|
-
local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID =
|
|
4
|
+
local ____armor_2Dbonus = require("engine.internal.object-data.armor-bonus")
|
|
5
|
+
local ARMOR_BONUS_DUMMY_ABILITY_FIELD = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_FIELD
|
|
6
|
+
local ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID = ____armor_2Dbonus.ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID
|
|
7
7
|
local ____utility = require("engine.internal.utility")
|
|
8
8
|
local addInternalAbility = ____utility.addInternalAbility
|
|
9
9
|
local ____arrays = require("utility.arrays")
|
|
@@ -24,6 +24,15 @@ 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 ____health_2Dbonus = require("engine.internal.object-data.health-bonus")
|
|
28
|
+
local HEALTH_BONUS_DUMMY_ABILITY_FIELD = ____health_2Dbonus.HEALTH_BONUS_DUMMY_ABILITY_FIELD
|
|
29
|
+
local HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID = ____health_2Dbonus.HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID
|
|
30
|
+
local ____mana_2Dbonus = require("engine.internal.object-data.mana-bonus")
|
|
31
|
+
local MANA_BONUS_DUMMY_ABILITY_FIELD = ____mana_2Dbonus.MANA_BONUS_DUMMY_ABILITY_FIELD
|
|
32
|
+
local MANA_BONUS_DUMMY_ABILITY_TYPE_ID = ____mana_2Dbonus.MANA_BONUS_DUMMY_ABILITY_TYPE_ID
|
|
33
|
+
local ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor = require("engine.internal.object-data.mana-regeneration-rate-increase-factor")
|
|
34
|
+
local MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD = ____mana_2Dregeneration_2Drate_2Dincrease_2Dfactor.MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD
|
|
35
|
+
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
36
|
local damageFactorByUnit = {}
|
|
28
37
|
local receivedDamageFactorByUnit = {}
|
|
29
38
|
local function atLeastOnceProbability(array)
|
|
@@ -36,6 +45,20 @@ end
|
|
|
36
45
|
____exports.UnitBonusType = {}
|
|
37
46
|
local UnitBonusType = ____exports.UnitBonusType
|
|
38
47
|
do
|
|
48
|
+
UnitBonusType.HEALTH = {
|
|
49
|
+
abilityTypeId = HEALTH_BONUS_DUMMY_ABILITY_TYPE_ID,
|
|
50
|
+
field = HEALTH_BONUS_DUMMY_ABILITY_FIELD,
|
|
51
|
+
integer = true,
|
|
52
|
+
reduce = sum,
|
|
53
|
+
initialValue = 0
|
|
54
|
+
}
|
|
55
|
+
UnitBonusType.MANA = {
|
|
56
|
+
abilityTypeId = MANA_BONUS_DUMMY_ABILITY_TYPE_ID,
|
|
57
|
+
field = MANA_BONUS_DUMMY_ABILITY_FIELD,
|
|
58
|
+
integer = true,
|
|
59
|
+
reduce = sum,
|
|
60
|
+
initialValue = 0
|
|
61
|
+
}
|
|
39
62
|
UnitBonusType.ARMOR = {
|
|
40
63
|
abilityTypeId = ARMOR_BONUS_DUMMY_ABILITY_TYPE_ID,
|
|
41
64
|
field = ARMOR_BONUS_DUMMY_ABILITY_FIELD,
|
|
@@ -73,6 +96,13 @@ do
|
|
|
73
96
|
reduce = atLeastOnceProbability,
|
|
74
97
|
initialValue = 0
|
|
75
98
|
}
|
|
99
|
+
UnitBonusType.MANA_REGENERATION_RATE_FACTOR = {
|
|
100
|
+
abilityTypeId = MANA_REGENERATION_RATE_INCREASE_FACTOR_DUMMY_ABILITY_TYPE_ID,
|
|
101
|
+
field = MANA_REGENERATION_RATE_INCREASE_FACTOR_ABILITY_FIELD,
|
|
102
|
+
integer = false,
|
|
103
|
+
reduce = sum,
|
|
104
|
+
initialValue = 0
|
|
105
|
+
}
|
|
76
106
|
end
|
|
77
107
|
local bonusesByUnitByBonusType = {}
|
|
78
108
|
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
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Event } from "../../../event";
|
|
3
|
+
declare module "../unit" {
|
|
4
|
+
interface Unit {
|
|
5
|
+
readonly unitInRangeEvent: Record<number, Event<[unit: Unit, range: number, unitInRange: Unit]>>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare module "../unit" {
|
|
9
|
+
interface Unit {
|
|
10
|
+
readonly unitOutOfRangeEvent: Record<number, Event<[unit: Unit, range: number, unitOutOfRange: Unit]>>;
|
|
11
|
+
}
|
|
12
|
+
}
|