warscript 0.0.1-dev.a5f2d10 → 0.0.1-dev.a856ae3
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 +6 -0
- package/attributes.lua +17 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/frame.lua +71 -22
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +100 -25
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/util.lua +6 -1
- package/decl/native.d.ts +846 -790
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/apply-buff.d.ts +5 -0
- package/engine/behaviour/ability/apply-buff.lua +36 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +12 -3
- package/engine/behaviour/ability/damage.lua +33 -39
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +18 -3
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +15 -6
- package/engine/behaviour/ability.lua +56 -21
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +40 -2
- package/engine/behaviour/unit.lua +269 -6
- package/engine/buff.d.ts +110 -53
- package/engine/buff.lua +529 -288
- package/engine/internal/ability.d.ts +7 -1
- package/engine/internal/ability.lua +49 -9
- package/engine/internal/item/ability.lua +63 -11
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +16 -19
- package/engine/internal/item.lua +174 -94
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/armor-bonus.d.ts +2 -0
- 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 +35 -0
- package/engine/internal/unit/ability.lua +98 -9
- package/engine/internal/unit/add-item-to-slot.lua +4 -2
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- 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/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -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.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +43 -25
- package/engine/internal/unit.lua +384 -260
- package/engine/lightning.d.ts +4 -3
- package/engine/lightning.lua +21 -12
- package/engine/local-client.d.ts +7 -0
- package/engine/local-client.lua +86 -1
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -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/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- 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/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- 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/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -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/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +21 -17
- package/engine/object-data/entry/ability-type.lua +169 -28
- package/engine/object-data/entry/buff-type/applicable.lua +122 -137
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +28 -2
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/item-type.d.ts +1 -1
- package/engine/object-data/entry/item-type.lua +4 -4
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +25 -5
- package/engine/object-data/entry/unit-type.lua +258 -93
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-field/ability.d.ts +4 -4
- package/engine/object-field/ability.lua +9 -8
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +72 -3
- package/engine/object-field/unit.lua +268 -7
- package/engine/object-field.d.ts +26 -7
- package/engine/object-field.lua +360 -119
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +21 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -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 +12 -0
- package/engine/standard/fields/unit.lua +20 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +250 -10
- package/engine/unit.d.ts +6 -0
- package/engine/unit.lua +6 -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/objutil/buff.lua +11 -10
- package/objutil/object.lua +1 -1
- package/objutil/unit.lua +8 -0
- package/operation.lua +1 -4
- package/package.json +5 -5
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +2 -0
- package/utility/arrays.lua +11 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +5 -1
- package/utility/linked-set.lua +49 -1
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +3 -0
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/damage-metadata-by-target.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
package/engine/internal/item.lua
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
4
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
6
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
6
7
|
local __TS__Delete = ____lualib.__TS__Delete
|
|
7
8
|
local ____exports = {}
|
|
9
|
+
local invoke
|
|
8
10
|
local ____handle = require("core.types.handle")
|
|
9
11
|
local Handle = ____handle.Handle
|
|
10
12
|
local ____color = require("core.types.color")
|
|
11
13
|
local Color = ____color.Color
|
|
14
|
+
local ____event = require("event")
|
|
15
|
+
local Event = ____event.Event
|
|
12
16
|
local ____rect = require("core.types.rect")
|
|
13
17
|
local Rect = ____rect.Rect
|
|
14
18
|
local ____ability = require("engine.internal.ability")
|
|
15
19
|
local ItemAbility = ____ability.ItemAbility
|
|
16
20
|
local ____ability = require("engine.internal.item.ability")
|
|
17
21
|
local doAbilityAction = ____ability.doAbilityAction
|
|
22
|
+
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
23
|
+
local itemAbilityDummy = ____ability.itemAbilityDummy
|
|
24
|
+
local ____dummy_2Ditem = require("engine.internal.object-data.dummy-item")
|
|
25
|
+
local DUMMY_ITEM_ID = ____dummy_2Ditem.DUMMY_ITEM_ID
|
|
26
|
+
local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slot")
|
|
27
|
+
local SLOT_FILLER_ITEM_TYPE_ID = ____add_2Ditem_2Dto_2Dslot.SLOT_FILLER_ITEM_TYPE_ID
|
|
28
|
+
local ____vec2 = require("math.vec2")
|
|
29
|
+
local distance = ____vec2.distance
|
|
30
|
+
local itemChargesChangeEvent = __TS__New(Event)
|
|
18
31
|
local itemAddAbility = BlzItemAddAbility
|
|
19
32
|
local itemRemoveAbility = BlzItemRemoveAbility
|
|
20
33
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -24,10 +37,38 @@ local getAbilityId = BlzGetAbilityId
|
|
|
24
37
|
local getWidgetLife = GetWidgetLife
|
|
25
38
|
local removeItem = RemoveItem
|
|
26
39
|
local getHandleId = GetHandleId
|
|
40
|
+
local setRect = SetRect
|
|
41
|
+
local enumItemsInRect = EnumItemsInRect
|
|
42
|
+
local getEnumItem = GetEnumItem
|
|
43
|
+
local getItemTypeId = GetItemTypeId
|
|
44
|
+
local getItemX = GetItemX
|
|
45
|
+
local getItemY = GetItemY
|
|
46
|
+
local getItemCharges = GetItemCharges
|
|
47
|
+
local setItemCharges = SetItemCharges
|
|
48
|
+
local unitRemoveAbility = UnitRemoveAbility
|
|
49
|
+
local unitRemoveItem = UnitRemoveItem
|
|
50
|
+
local unitUseItem = UnitUseItem
|
|
51
|
+
local unitUseItemPoint = UnitUseItemPoint
|
|
52
|
+
local unitUseItemTarget = UnitUseItemTarget
|
|
53
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
|
+
local setItemDroppable = SetItemDroppable
|
|
55
|
+
local setItemPawnable = SetItemPawnable
|
|
56
|
+
local isItemPawnable = IsItemPawnable
|
|
27
57
|
local getItemIntegerField = BlzGetItemIntegerField
|
|
28
58
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
29
59
|
local getItemBooleanField = BlzGetItemBooleanField
|
|
60
|
+
local tableRemove = table.remove
|
|
61
|
+
_G.SetItemCharges = function(whichItem, charges)
|
|
62
|
+
setItemCharges(whichItem, charges)
|
|
63
|
+
invoke(
|
|
64
|
+
itemChargesChangeEvent,
|
|
65
|
+
____exports.Item:of(whichItem)
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
invoke = Event.invoke
|
|
30
69
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
70
|
+
---
|
|
71
|
+
-- @internal For use by internal systems only.
|
|
31
72
|
____exports.addAndGetAbility = function(handle, abilityTypeId)
|
|
32
73
|
if itemAddAbility(handle, abilityTypeId) then
|
|
33
74
|
return getItemAbility(handle, abilityTypeId)
|
|
@@ -53,21 +94,62 @@ local function getItemAbilities(handle, item)
|
|
|
53
94
|
end
|
|
54
95
|
return abilities
|
|
55
96
|
end
|
|
97
|
+
local function consumeCharge(handle)
|
|
98
|
+
do
|
|
99
|
+
local i = 0
|
|
100
|
+
local ability = getItemAbilityByIndex(handle, i)
|
|
101
|
+
while ability ~= nil do
|
|
102
|
+
unitRemoveAbility(
|
|
103
|
+
itemAbilityDummy,
|
|
104
|
+
getAbilityId(ability)
|
|
105
|
+
)
|
|
106
|
+
do
|
|
107
|
+
i = i + 1
|
|
108
|
+
ability = getItemAbilityByIndex(handle, i)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
return unitUseItem(itemAbilityDummy, handle) or unitUseItemPoint(itemAbilityDummy, handle, 0, 0) or unitUseItemTarget(itemAbilityDummy, handle, itemAbilityDummy)
|
|
113
|
+
end
|
|
114
|
+
local targetCollection
|
|
115
|
+
local targetCollectionNextIndex
|
|
116
|
+
local centerX
|
|
117
|
+
local centerY
|
|
118
|
+
local enumRange
|
|
119
|
+
local function collectIntoTarget()
|
|
120
|
+
local item = getEnumItem()
|
|
121
|
+
local typeId = getItemTypeId(item)
|
|
122
|
+
if typeId ~= DUMMY_ITEM_ID and typeId ~= SLOT_FILLER_ITEM_TYPE_ID then
|
|
123
|
+
targetCollection[targetCollectionNextIndex] = ____exports.Item:of(item)
|
|
124
|
+
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
local function collectIntoTargetRange()
|
|
128
|
+
local item = getEnumItem()
|
|
129
|
+
local typeId = getItemTypeId(item)
|
|
130
|
+
if distance(
|
|
131
|
+
getItemX(item),
|
|
132
|
+
getItemY(item),
|
|
133
|
+
centerX,
|
|
134
|
+
centerY
|
|
135
|
+
) <= enumRange and typeId ~= DUMMY_ITEM_ID and typeId ~= SLOT_FILLER_ITEM_TYPE_ID then
|
|
136
|
+
targetCollection[targetCollectionNextIndex] = ____exports.Item:of(item)
|
|
137
|
+
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
138
|
+
end
|
|
139
|
+
end
|
|
56
140
|
____exports.Item = __TS__Class()
|
|
57
141
|
local Item = ____exports.Item
|
|
58
142
|
Item.name = "Item"
|
|
59
143
|
__TS__ClassExtends(Item, Handle)
|
|
60
144
|
function Item.prototype.____constructor(self, handle)
|
|
61
145
|
Handle.prototype.____constructor(self, handle)
|
|
62
|
-
|
|
63
|
-
self[100] = abilities
|
|
64
|
-
local luaIndexByAbilityTypeId = {}
|
|
65
|
-
for i = 1, #abilities do
|
|
66
|
-
luaIndexByAbilityTypeId[abilities[i].typeId] = i
|
|
67
|
-
end
|
|
68
|
-
self[101] = luaIndexByAbilityTypeId
|
|
146
|
+
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
69
147
|
end
|
|
70
148
|
function Item.prototype.onDestroy(self)
|
|
149
|
+
local owner = self.owner
|
|
150
|
+
if owner ~= nil then
|
|
151
|
+
unitRemoveItem(owner.handle, self.handle)
|
|
152
|
+
end
|
|
71
153
|
local abilities = self[100]
|
|
72
154
|
for i = 1, #abilities do
|
|
73
155
|
abilities[i]:destroy()
|
|
@@ -78,67 +160,89 @@ end
|
|
|
78
160
|
function Item.create(self, id, x, y, skinId)
|
|
79
161
|
return self:of(BlzCreateItemWithSkin(id, x, y, skinId or id))
|
|
80
162
|
end
|
|
163
|
+
function Item.prototype.consumeCharge(self)
|
|
164
|
+
return self:consumeCharges(1)
|
|
165
|
+
end
|
|
166
|
+
function Item.prototype.consumeCharges(self, count)
|
|
167
|
+
local handle = self.handle
|
|
168
|
+
local charges = getItemCharges(handle)
|
|
169
|
+
if charges > count then
|
|
170
|
+
setItemCharges(handle, charges - count)
|
|
171
|
+
invoke(itemChargesChangeEvent, self)
|
|
172
|
+
return true
|
|
173
|
+
end
|
|
174
|
+
if charges == count then
|
|
175
|
+
if getItemBooleanField(handle, ITEM_BF_PERISHABLE) then
|
|
176
|
+
self:destroy()
|
|
177
|
+
return true
|
|
178
|
+
end
|
|
179
|
+
if not getItemBooleanField(handle, ITEM_BF_ACTIVELY_USED) then
|
|
180
|
+
setItemCharges(handle, 0)
|
|
181
|
+
invoke(itemChargesChangeEvent, self)
|
|
182
|
+
return true
|
|
183
|
+
end
|
|
184
|
+
setItemCharges(handle, 1)
|
|
185
|
+
local ____doAbilityActionForceDummy_2 = doAbilityActionForceDummy
|
|
186
|
+
local ____opt_0 = self.owner
|
|
187
|
+
____doAbilityActionForceDummy_2(handle, ____opt_0 and ____opt_0.handle, consumeCharge)
|
|
188
|
+
invoke(itemChargesChangeEvent, self)
|
|
189
|
+
return true
|
|
190
|
+
end
|
|
191
|
+
return false
|
|
192
|
+
end
|
|
81
193
|
function Item.prototype.addAbility(self, abilityTypeId)
|
|
82
194
|
local nativeAbility = doAbilityAction(self.handle, ____exports.addAndGetAbility, abilityTypeId)
|
|
83
195
|
if nativeAbility ~= nil then
|
|
84
196
|
local ability = ItemAbility:of(nativeAbility, abilityTypeId, self)
|
|
85
197
|
local abilities = self[100]
|
|
86
|
-
|
|
87
|
-
abilities[luaIndex] = ability
|
|
88
|
-
self[101][abilityTypeId] = luaIndex
|
|
198
|
+
abilities[#abilities + 1] = ability
|
|
89
199
|
return ability
|
|
90
200
|
end
|
|
91
201
|
return nil
|
|
92
202
|
end
|
|
93
203
|
function Item.prototype.removeAbility(self, abilityTypeId)
|
|
94
|
-
local
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
for j = luaIndex, abilityTypeIdsLength do
|
|
102
|
-
abilities[j] = abilities[j + 1]
|
|
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
|
|
103
211
|
end
|
|
104
212
|
end
|
|
105
|
-
return
|
|
213
|
+
return doAbilityAction(self.handle, itemRemoveAbility, abilityTypeId)
|
|
106
214
|
end
|
|
107
215
|
function Item.prototype.hasAbility(self, abilityTypeId)
|
|
108
|
-
return self
|
|
216
|
+
return doAbilityAction(self.handle, getItemAbility, abilityTypeId) ~= nil
|
|
109
217
|
end
|
|
110
218
|
function Item.prototype.getAbility(self, abilityTypeId)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
local collection = {}
|
|
116
|
-
SetRect(
|
|
117
|
-
enumRect,
|
|
118
|
-
pos.x - range,
|
|
119
|
-
pos.y - range,
|
|
120
|
-
pos.x + range,
|
|
121
|
-
pos.y + range
|
|
219
|
+
return ItemAbility:of(
|
|
220
|
+
doAbilityAction(self.handle, getItemAbility, abilityTypeId),
|
|
221
|
+
abilityTypeId,
|
|
222
|
+
self
|
|
122
223
|
)
|
|
123
|
-
|
|
224
|
+
end
|
|
225
|
+
function Item.getInRange(self, x, y, range)
|
|
226
|
+
targetCollection = {}
|
|
227
|
+
targetCollectionNextIndex = 1
|
|
228
|
+
centerX = x
|
|
229
|
+
centerY = y
|
|
230
|
+
enumRange = range
|
|
231
|
+
setRect(
|
|
124
232
|
enumRect,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
233
|
+
x - range,
|
|
234
|
+
y - range,
|
|
235
|
+
x + range,
|
|
236
|
+
y + range
|
|
129
237
|
)
|
|
130
|
-
|
|
238
|
+
enumItemsInRect(enumRect, nil, collectIntoTargetRange)
|
|
239
|
+
return targetCollection
|
|
131
240
|
end
|
|
132
241
|
function Item.getInRect(self, rect)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function()
|
|
138
|
-
collection[#collection + 1] = self:of(GetEnumItem())
|
|
139
|
-
end
|
|
140
|
-
)
|
|
141
|
-
return collection
|
|
242
|
+
targetCollection = {}
|
|
243
|
+
targetCollectionNextIndex = 1
|
|
244
|
+
enumItemsInRect(rect.handle, nil, collectIntoTarget)
|
|
245
|
+
return targetCollection
|
|
142
246
|
end
|
|
143
247
|
__TS__SetDescriptor(
|
|
144
248
|
Item.prototype,
|
|
@@ -228,65 +332,55 @@ __TS__SetDescriptor(
|
|
|
228
332
|
)
|
|
229
333
|
__TS__SetDescriptor(
|
|
230
334
|
Item.prototype,
|
|
231
|
-
"
|
|
232
|
-
{
|
|
233
|
-
get = function(self)
|
|
234
|
-
return BlzGetItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
235
|
-
end,
|
|
236
|
-
set = function(self, v)
|
|
237
|
-
SetItemDropOnDeath(self.handle, v)
|
|
238
|
-
end
|
|
239
|
-
},
|
|
240
|
-
true
|
|
241
|
-
)
|
|
242
|
-
__TS__SetDescriptor(
|
|
243
|
-
Item.prototype,
|
|
244
|
-
"droppable",
|
|
335
|
+
"dropsOnDeath",
|
|
245
336
|
{
|
|
246
337
|
get = function(self)
|
|
247
|
-
return
|
|
338
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
248
339
|
end,
|
|
249
|
-
set = function(self,
|
|
250
|
-
|
|
340
|
+
set = function(self, dropsOnDeath)
|
|
341
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
251
342
|
end
|
|
252
343
|
},
|
|
253
344
|
true
|
|
254
345
|
)
|
|
255
346
|
__TS__SetDescriptor(
|
|
256
347
|
Item.prototype,
|
|
257
|
-
"
|
|
348
|
+
"canBeDropped",
|
|
258
349
|
{
|
|
259
350
|
get = function(self)
|
|
260
|
-
return
|
|
351
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
261
352
|
end,
|
|
262
|
-
set = function(self,
|
|
263
|
-
|
|
353
|
+
set = function(self, canBeDropped)
|
|
354
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
264
355
|
end
|
|
265
356
|
},
|
|
266
357
|
true
|
|
267
358
|
)
|
|
268
359
|
__TS__SetDescriptor(
|
|
269
360
|
Item.prototype,
|
|
270
|
-
"
|
|
361
|
+
"perishes",
|
|
271
362
|
{
|
|
272
363
|
get = function(self)
|
|
273
|
-
return
|
|
364
|
+
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
274
365
|
end,
|
|
275
|
-
set = function(self,
|
|
276
|
-
|
|
366
|
+
set = function(self, perishes)
|
|
367
|
+
local handle = self.handle
|
|
368
|
+
local powerUp = isItemPowerup(handle)
|
|
369
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
370
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
277
371
|
end
|
|
278
372
|
},
|
|
279
373
|
true
|
|
280
374
|
)
|
|
281
375
|
__TS__SetDescriptor(
|
|
282
376
|
Item.prototype,
|
|
283
|
-
"
|
|
377
|
+
"isPowerUp",
|
|
284
378
|
{
|
|
285
379
|
get = function(self)
|
|
286
380
|
return isItemPowerup(self.handle)
|
|
287
381
|
end,
|
|
288
|
-
set = function(self,
|
|
289
|
-
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED,
|
|
382
|
+
set = function(self, isPowerUp)
|
|
383
|
+
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, isPowerUp)
|
|
290
384
|
end
|
|
291
385
|
},
|
|
292
386
|
true
|
|
@@ -320,22 +414,6 @@ __TS__SetDescriptor(
|
|
|
320
414
|
},
|
|
321
415
|
true
|
|
322
416
|
)
|
|
323
|
-
__TS__SetDescriptor(
|
|
324
|
-
Item.prototype,
|
|
325
|
-
"usable",
|
|
326
|
-
{
|
|
327
|
-
get = function(self)
|
|
328
|
-
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
329
|
-
end,
|
|
330
|
-
set = function(self, v)
|
|
331
|
-
local handle = self.handle
|
|
332
|
-
local powerup = isItemPowerup(handle)
|
|
333
|
-
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, v)
|
|
334
|
-
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerup)
|
|
335
|
-
end
|
|
336
|
-
},
|
|
337
|
-
true
|
|
338
|
-
)
|
|
339
417
|
__TS__SetDescriptor(
|
|
340
418
|
Item.prototype,
|
|
341
419
|
"visible",
|
|
@@ -526,10 +604,11 @@ __TS__SetDescriptor(
|
|
|
526
604
|
"charges",
|
|
527
605
|
{
|
|
528
606
|
get = function(self)
|
|
529
|
-
return
|
|
607
|
+
return getItemCharges(self.handle)
|
|
530
608
|
end,
|
|
531
609
|
set = function(self, v)
|
|
532
|
-
|
|
610
|
+
setItemCharges(self.handle, v)
|
|
611
|
+
invoke(itemChargesChangeEvent, self)
|
|
533
612
|
end
|
|
534
613
|
},
|
|
535
614
|
true
|
|
@@ -551,11 +630,12 @@ __TS__ObjectDefineProperty(
|
|
|
551
630
|
)
|
|
552
631
|
__TS__ObjectDefineProperty(
|
|
553
632
|
Item,
|
|
554
|
-
"
|
|
633
|
+
"destroyEvent",
|
|
555
634
|
{get = function(self)
|
|
556
635
|
return self.onDestroyEvent
|
|
557
636
|
end}
|
|
558
637
|
)
|
|
638
|
+
Item.chargesChangedEvent = itemChargesChangeEvent
|
|
559
639
|
local getManipulatedItem = GetManipulatedItem
|
|
560
640
|
local trigger = CreateTrigger()
|
|
561
641
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_PICKUP_ITEM)
|
|
@@ -8,6 +8,6 @@ local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_AB
|
|
|
8
8
|
-- @internal For use by internal systems only.
|
|
9
9
|
____exports.getAbilityDuration = function(ability, target)
|
|
10
10
|
local level = ability.level
|
|
11
|
-
return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
11
|
+
return target ~= nil and (target.isHero or target:getField(UNIT_IF_LEVEL) >= 6 or target:hasClassification(UnitClassification.RESISTANT)) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
12
12
|
end
|
|
13
13
|
return ____exports
|
|
@@ -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,21 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
3
|
+
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems only.
|
|
6
|
+
____exports.getFrameMinXMaxX = function()
|
|
7
|
+
local w = getLocalClientWidth()
|
|
8
|
+
local h = getLocalClientHeight()
|
|
9
|
+
local width4by3 = (w - h / 600 * 800) / 2
|
|
10
|
+
local pxtodpi = 0.6 / h
|
|
11
|
+
local minX = -width4by3 * pxtodpi
|
|
12
|
+
local maxX = minX + w * pxtodpi
|
|
13
|
+
return minX, maxX
|
|
14
|
+
end
|
|
15
|
+
---
|
|
16
|
+
-- @internal For use by internal systems only.
|
|
17
|
+
____exports.FRAME_MIN_Y = 0
|
|
18
|
+
---
|
|
19
|
+
-- @internal For use by internal systems only.
|
|
20
|
+
____exports.FRAME_MAX_Y = 0.6
|
|
21
|
+
return ____exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getLocationZ = GetLocationZ
|
|
3
|
+
local moveLocation = MoveLocation
|
|
4
|
+
local location = Location(0, 0)
|
|
5
|
+
---
|
|
6
|
+
-- @internal For use by internal systems only.
|
|
7
|
+
____exports.getTerrainZ = function(x, y)
|
|
8
|
+
moveLocation(location, x, y)
|
|
9
|
+
return getLocationZ(location)
|
|
10
|
+
end
|
|
11
|
+
return ____exports
|
|
@@ -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
|
|
@@ -150,3 +150,38 @@ declare module "../unit" {
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
+
declare module "../unit" {
|
|
154
|
+
namespace Unit {
|
|
155
|
+
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
declare module "../unit" {
|
|
159
|
+
namespace Unit {
|
|
160
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
declare module "../unit" {
|
|
164
|
+
namespace Unit {
|
|
165
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
declare module "../unit" {
|
|
169
|
+
namespace Unit {
|
|
170
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
declare module "../unit" {
|
|
174
|
+
namespace Unit {
|
|
175
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
declare module "../unit" {
|
|
179
|
+
namespace Unit {
|
|
180
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
declare module "../unit" {
|
|
184
|
+
namespace Unit {
|
|
185
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
186
|
+
}
|
|
187
|
+
}
|