warscript 0.0.1-dev.448dcfb → 0.0.1-dev.459629d
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.d.ts +1 -0
- package/core/types/frame.lua +126 -46
- 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 +17 -1
- package/core/types/player.lua +67 -23
- package/core/types/playerCamera.lua +44 -0
- package/core/types/sound.lua +1 -1
- 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 +22 -2
- package/decl/native.d.ts +2 -2
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +12 -1
- package/engine/behavior.lua +199 -65
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- 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/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability.d.ts +11 -6
- package/engine/behaviour/ability.lua +31 -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 +15 -5
- package/engine/behaviour/unit.lua +126 -22
- package/engine/buff.d.ts +65 -21
- package/engine/buff.lua +362 -179
- package/engine/internal/ability.lua +21 -20
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item.d.ts +11 -14
- package/engine/internal/item.lua +77 -69
- 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/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 +6 -0
- package/engine/internal/unit/bonus.lua +33 -3
- 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/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit-missile-launch.lua +51 -20
- package/engine/internal/unit.d.ts +17 -21
- package/engine/internal/unit.lua +166 -188
- package/engine/local-client.d.ts +7 -0
- package/engine/local-client.lua +86 -1
- 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 +88 -5
- package/engine/object-data/entry/buff-type/applicable.lua +113 -109
- 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/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 +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +10 -2
- package/engine/object-field.lua +268 -123
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +21 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- 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 -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 +5 -0
- package/engine/unit.lua +5 -0
- package/lualib_bundle.lua +1 -1
- package/math.d.ts +2 -0
- package/math.lua +14 -0
- package/net/socket.lua +1 -1
- package/network.lua +25 -1
- package/objutil/buff.lua +10 -8
- package/objutil/object.lua +1 -1
- package/operation.d.ts +8 -1
- package/operation.lua +38 -18
- package/package.json +5 -5
- 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 +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +4 -1
- package/utility/linked-set.lua +46 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- package/utility/types.d.ts +3 -0
- 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
|
@@ -13,7 +13,6 @@ local ____ability = require("engine.internal.item.ability")
|
|
|
13
13
|
local abilityActionDummy = ____ability.abilityActionDummy
|
|
14
14
|
local doAbilityAction = ____ability.doAbilityAction
|
|
15
15
|
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
16
|
-
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
17
16
|
local startItemCooldown = ____ability.startItemCooldown
|
|
18
17
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
19
18
|
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
@@ -36,12 +35,8 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
36
35
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
37
36
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
38
37
|
local getHandleId = GetHandleId
|
|
39
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
40
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
41
38
|
local unitHideAbility = BlzUnitHideAbility
|
|
42
39
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
43
|
-
local unitRemoveAbility = UnitRemoveAbility
|
|
44
|
-
local itemRemoveAbility = BlzItemRemoveAbility
|
|
45
40
|
local match = string.match
|
|
46
41
|
local ____type = _G.type
|
|
47
42
|
local ____tostring = _G.tostring
|
|
@@ -429,7 +424,9 @@ function UnitAbility.prototype.interruptCast(self)
|
|
|
429
424
|
self.owner:interruptCast(self.typeId)
|
|
430
425
|
end
|
|
431
426
|
function UnitAbility.prototype.onDestroy(self)
|
|
432
|
-
|
|
427
|
+
if self.owner.state ~= 2 then
|
|
428
|
+
self.owner:removeAbility(self.typeId)
|
|
429
|
+
end
|
|
433
430
|
return UnitAbility.____super.prototype.onDestroy(self)
|
|
434
431
|
end
|
|
435
432
|
__TS__SetDescriptor(
|
|
@@ -517,15 +514,19 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
517
514
|
)
|
|
518
515
|
end
|
|
519
516
|
function ItemAbility.prototype.interruptCast(self)
|
|
520
|
-
local
|
|
521
|
-
local
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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)
|
|
525
524
|
end
|
|
526
525
|
end
|
|
527
526
|
function ItemAbility.prototype.onDestroy(self)
|
|
528
|
-
|
|
527
|
+
if self.owner.state ~= 2 then
|
|
528
|
+
self.owner:removeAbility(self.typeId)
|
|
529
|
+
end
|
|
529
530
|
return ItemAbility.____super.prototype.onDestroy(self)
|
|
530
531
|
end
|
|
531
532
|
__TS__SetDescriptor(
|
|
@@ -542,17 +543,17 @@ __TS__SetDescriptor(
|
|
|
542
543
|
{
|
|
543
544
|
get = function(self)
|
|
544
545
|
local item = self.owner
|
|
545
|
-
local
|
|
546
|
-
local
|
|
547
|
-
local
|
|
548
|
-
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)
|
|
549
550
|
end,
|
|
550
551
|
set = function(self, cooldownRemaining)
|
|
551
552
|
local item = self.owner
|
|
552
|
-
local
|
|
553
|
-
local
|
|
554
|
-
local
|
|
555
|
-
|
|
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)
|
|
556
557
|
end
|
|
557
558
|
},
|
|
558
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
|
|
@@ -9,11 +9,11 @@ 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
11
|
ABILITIES = 100,
|
|
12
|
-
|
|
12
|
+
DEATH_TRIGGER = 101
|
|
13
13
|
}
|
|
14
14
|
export declare class Item extends Handle<jitem> {
|
|
15
15
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
-
private readonly [ItemPropertyKey.
|
|
16
|
+
private readonly [ItemPropertyKey.DEATH_TRIGGER];
|
|
17
17
|
constructor(handle: jitem);
|
|
18
18
|
protected onDestroy(): HandleDestructor;
|
|
19
19
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
@@ -30,22 +30,18 @@ export declare class Item extends Handle<jitem> {
|
|
|
30
30
|
get extendedTooltip(): string;
|
|
31
31
|
set iconPath(v: string);
|
|
32
32
|
get iconPath(): string;
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
41
|
-
set powerup(v: boolean);
|
|
42
|
-
get powerup(): boolean;
|
|
33
|
+
set dropsOnDeath(dropsOnDeath: boolean);
|
|
34
|
+
get dropsOnDeath(): boolean;
|
|
35
|
+
set canBeDropped(canBeDropped: boolean);
|
|
36
|
+
get canBeDropped(): 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 usable(v: boolean);
|
|
48
|
-
get usable(): boolean;
|
|
49
45
|
set visible(v: boolean);
|
|
50
46
|
get visible(): boolean;
|
|
51
47
|
set level(v: number);
|
|
@@ -84,6 +80,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
84
80
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
85
81
|
static get onCreate(): Event<[Item]>;
|
|
86
82
|
static get destroyEvent(): Event<[Item]>;
|
|
83
|
+
static readonly deathEvent: Event<[Item]>;
|
|
87
84
|
static readonly chargesChangedEvent: Event<[Item]>;
|
|
88
85
|
}
|
|
89
86
|
export {};
|
package/engine/internal/item.lua
CHANGED
|
@@ -27,8 +27,15 @@ 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
|
|
38
|
+
local itemRemoveAbility = BlzItemRemoveAbility
|
|
32
39
|
local getItemAbility = BlzGetItemAbility
|
|
33
40
|
local isItemPowerup = IsItemPowerup
|
|
34
41
|
local getItemAbilityByIndex = BlzGetItemAbilityByIndex
|
|
@@ -49,7 +56,17 @@ local unitRemoveItem = UnitRemoveItem
|
|
|
49
56
|
local unitUseItem = UnitUseItem
|
|
50
57
|
local unitUseItemPoint = UnitUseItemPoint
|
|
51
58
|
local unitUseItemTarget = UnitUseItemTarget
|
|
59
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
60
|
+
local setItemDroppable = SetItemDroppable
|
|
61
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
62
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
63
|
+
local getItemBooleanField = BlzGetItemBooleanField
|
|
64
|
+
local getTriggerWidget = GetTriggerWidget
|
|
65
|
+
local saveWidgetHandle = SaveWidgetHandle
|
|
66
|
+
local loadItemHandle = LoadItemHandle
|
|
52
67
|
local tableRemove = table.remove
|
|
68
|
+
local itemChargesChangeEvent = __TS__New(Event)
|
|
69
|
+
local itemDeathEvent = __TS__New(Event)
|
|
53
70
|
_G.SetItemCharges = function(whichItem, charges)
|
|
54
71
|
setItemCharges(whichItem, charges)
|
|
55
72
|
invoke(
|
|
@@ -57,9 +74,6 @@ _G.SetItemCharges = function(whichItem, charges)
|
|
|
57
74
|
____exports.Item:of(whichItem)
|
|
58
75
|
)
|
|
59
76
|
end
|
|
60
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
61
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
62
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
63
77
|
invoke = Event.invoke
|
|
64
78
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
65
79
|
---
|
|
@@ -132,19 +146,36 @@ local function collectIntoTargetRange()
|
|
|
132
146
|
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
133
147
|
end
|
|
134
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
|
+
)
|
|
135
168
|
____exports.Item = __TS__Class()
|
|
136
169
|
local Item = ____exports.Item
|
|
137
170
|
Item.name = "Item"
|
|
138
171
|
__TS__ClassExtends(Item, Handle)
|
|
139
172
|
function Item.prototype.____constructor(self, handle)
|
|
140
173
|
Handle.prototype.____constructor(self, handle)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
end
|
|
147
|
-
self[101] = luaIndexByAbilityTypeId
|
|
174
|
+
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
175
|
+
local deathTrigger = createTrigger()
|
|
176
|
+
triggerRegisterDeathEvent(deathTrigger, handle)
|
|
177
|
+
triggerAddCondition(deathTrigger, deathTriggerCondition)
|
|
178
|
+
self[101] = deathTrigger
|
|
148
179
|
end
|
|
149
180
|
function Item.prototype.onDestroy(self)
|
|
150
181
|
local owner = self.owner
|
|
@@ -156,6 +187,7 @@ function Item.prototype.onDestroy(self)
|
|
|
156
187
|
abilities[i]:destroy()
|
|
157
188
|
end
|
|
158
189
|
removeItem(self.handle)
|
|
190
|
+
destroyTrigger(self[101])
|
|
159
191
|
return Handle.prototype.onDestroy(self)
|
|
160
192
|
end
|
|
161
193
|
function Item.create(self, id, x, y, skinId)
|
|
@@ -196,31 +228,32 @@ function Item.prototype.addAbility(self, abilityTypeId)
|
|
|
196
228
|
if nativeAbility ~= nil then
|
|
197
229
|
local ability = ItemAbility:of(nativeAbility, abilityTypeId, self)
|
|
198
230
|
local abilities = self[100]
|
|
199
|
-
|
|
200
|
-
abilities[luaIndex] = ability
|
|
201
|
-
self[101][abilityTypeId] = luaIndex
|
|
231
|
+
abilities[#abilities + 1] = ability
|
|
202
232
|
return ability
|
|
203
233
|
end
|
|
204
234
|
return nil
|
|
205
235
|
end
|
|
206
236
|
function Item.prototype.removeAbility(self, abilityTypeId)
|
|
207
|
-
local
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
local abilities = self[100]
|
|
238
|
+
for i = 1, #abilities do
|
|
239
|
+
if abilities[i].typeId == abilityTypeId then
|
|
240
|
+
local ability = abilities[i]
|
|
241
|
+
tableRemove(abilities, i)
|
|
242
|
+
ability:destroy()
|
|
243
|
+
return true
|
|
244
|
+
end
|
|
215
245
|
end
|
|
216
|
-
return
|
|
246
|
+
return doAbilityAction(self.handle, itemRemoveAbility, abilityTypeId)
|
|
217
247
|
end
|
|
218
248
|
function Item.prototype.hasAbility(self, abilityTypeId)
|
|
219
|
-
return self
|
|
249
|
+
return doAbilityAction(self.handle, getItemAbility, abilityTypeId) ~= nil
|
|
220
250
|
end
|
|
221
251
|
function Item.prototype.getAbility(self, abilityTypeId)
|
|
222
|
-
|
|
223
|
-
|
|
252
|
+
return ItemAbility:of(
|
|
253
|
+
doAbilityAction(self.handle, getItemAbility, abilityTypeId),
|
|
254
|
+
abilityTypeId,
|
|
255
|
+
self
|
|
256
|
+
)
|
|
224
257
|
end
|
|
225
258
|
function Item.getInRange(self, x, y, range)
|
|
226
259
|
targetCollection = {}
|
|
@@ -332,65 +365,55 @@ __TS__SetDescriptor(
|
|
|
332
365
|
)
|
|
333
366
|
__TS__SetDescriptor(
|
|
334
367
|
Item.prototype,
|
|
335
|
-
"
|
|
336
|
-
{
|
|
337
|
-
get = function(self)
|
|
338
|
-
return BlzGetItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
339
|
-
end,
|
|
340
|
-
set = function(self, v)
|
|
341
|
-
SetItemDropOnDeath(self.handle, v)
|
|
342
|
-
end
|
|
343
|
-
},
|
|
344
|
-
true
|
|
345
|
-
)
|
|
346
|
-
__TS__SetDescriptor(
|
|
347
|
-
Item.prototype,
|
|
348
|
-
"droppable",
|
|
368
|
+
"dropsOnDeath",
|
|
349
369
|
{
|
|
350
370
|
get = function(self)
|
|
351
|
-
return
|
|
371
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
352
372
|
end,
|
|
353
|
-
set = function(self,
|
|
354
|
-
|
|
373
|
+
set = function(self, dropsOnDeath)
|
|
374
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
355
375
|
end
|
|
356
376
|
},
|
|
357
377
|
true
|
|
358
378
|
)
|
|
359
379
|
__TS__SetDescriptor(
|
|
360
380
|
Item.prototype,
|
|
361
|
-
"
|
|
381
|
+
"canBeDropped",
|
|
362
382
|
{
|
|
363
383
|
get = function(self)
|
|
364
|
-
return
|
|
384
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
365
385
|
end,
|
|
366
|
-
set = function(self,
|
|
367
|
-
|
|
386
|
+
set = function(self, canBeDropped)
|
|
387
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
368
388
|
end
|
|
369
389
|
},
|
|
370
390
|
true
|
|
371
391
|
)
|
|
372
392
|
__TS__SetDescriptor(
|
|
373
393
|
Item.prototype,
|
|
374
|
-
"
|
|
394
|
+
"perishes",
|
|
375
395
|
{
|
|
376
396
|
get = function(self)
|
|
377
397
|
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
378
398
|
end,
|
|
379
|
-
set = function(self,
|
|
380
|
-
|
|
399
|
+
set = function(self, perishes)
|
|
400
|
+
local handle = self.handle
|
|
401
|
+
local powerUp = isItemPowerup(handle)
|
|
402
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
403
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
381
404
|
end
|
|
382
405
|
},
|
|
383
406
|
true
|
|
384
407
|
)
|
|
385
408
|
__TS__SetDescriptor(
|
|
386
409
|
Item.prototype,
|
|
387
|
-
"
|
|
410
|
+
"isPowerUp",
|
|
388
411
|
{
|
|
389
412
|
get = function(self)
|
|
390
413
|
return isItemPowerup(self.handle)
|
|
391
414
|
end,
|
|
392
|
-
set = function(self,
|
|
393
|
-
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED,
|
|
415
|
+
set = function(self, isPowerUp)
|
|
416
|
+
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, isPowerUp)
|
|
394
417
|
end
|
|
395
418
|
},
|
|
396
419
|
true
|
|
@@ -424,22 +447,6 @@ __TS__SetDescriptor(
|
|
|
424
447
|
},
|
|
425
448
|
true
|
|
426
449
|
)
|
|
427
|
-
__TS__SetDescriptor(
|
|
428
|
-
Item.prototype,
|
|
429
|
-
"usable",
|
|
430
|
-
{
|
|
431
|
-
get = function(self)
|
|
432
|
-
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
433
|
-
end,
|
|
434
|
-
set = function(self, v)
|
|
435
|
-
local handle = self.handle
|
|
436
|
-
local powerup = isItemPowerup(handle)
|
|
437
|
-
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, v)
|
|
438
|
-
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerup)
|
|
439
|
-
end
|
|
440
|
-
},
|
|
441
|
-
true
|
|
442
|
-
)
|
|
443
450
|
__TS__SetDescriptor(
|
|
444
451
|
Item.prototype,
|
|
445
452
|
"visible",
|
|
@@ -661,6 +668,7 @@ __TS__ObjectDefineProperty(
|
|
|
661
668
|
return self.onDestroyEvent
|
|
662
669
|
end}
|
|
663
670
|
)
|
|
671
|
+
Item.deathEvent = itemDeathEvent
|
|
664
672
|
Item.chargesChangedEvent = itemChargesChangeEvent
|
|
665
673
|
local getManipulatedItem = GetManipulatedItem
|
|
666
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
|
|
@@ -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
|
}
|