warscript 0.0.1-dev.a4deb44 → 0.0.1-dev.a5a2f5e
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 +18 -0
- package/attributes.lua +32 -0
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +14 -6
- package/core/types/effect.lua +131 -35
- package/core/types/frame.d.ts +8 -1
- package/core/types/frame.lua +164 -23
- package/core/types/group.d.ts +0 -1
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/core/types/image.d.ts +0 -1
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/player.d.ts +17 -1
- package/core/types/player.lua +70 -24
- 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/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +18 -1
- package/decl/index.d.ts +1 -0
- package/decl/native.d.ts +846 -790
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +24 -11
- package/engine/behavior.lua +233 -73
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +36 -4
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +13 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +32 -9
- package/engine/behaviour/ability/damage.d.ts +42 -11
- package/engine/behaviour/ability/damage.lua +89 -37
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +44 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -15
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +25 -0
- package/engine/behaviour/ability/remove-buffs.lua +49 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +35 -7
- package/engine/behaviour/ability.lua +183 -27
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -7
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +48 -4
- package/engine/behaviour/unit.lua +292 -2
- package/engine/buff.d.ts +160 -53
- package/engine/buff.lua +711 -269
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +23 -14
- package/engine/internal/ability.lua +129 -85
- package/engine/internal/item/ability.lua +162 -4
- 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.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +3 -1
- package/engine/internal/mechanics/cast-ability.lua +89 -0
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- 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/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- 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 +45 -1
- package/engine/internal/unit/ability.lua +128 -17
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- 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 +17 -8
- package/engine/internal/unit/bonus.lua +56 -4
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +36 -0
- 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 +12 -3
- 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+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +70 -13
- package/engine/internal/unit.d.ts +97 -36
- package/engine/internal/unit.lua +701 -336
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +14 -2
- package/engine/local-client.lua +168 -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 -3
- 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/combat-classification.d.ts +0 -2
- 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/sound-preset-name.d.ts +5 -1
- 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.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- 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/channel.d.ts +0 -1
- 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/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -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/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- 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 -18
- package/engine/object-data/entry/ability-type.lua +177 -40
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +143 -202
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +6 -13
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +28 -3
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +15 -2
- package/engine/object-data/entry/item-type.lua +93 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -2
- 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 +65 -5
- package/engine/object-data/entry/unit-type.lua +555 -62
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +1 -2
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +18 -17
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +28 -5
- package/engine/object-field/ability.lua +61 -7
- 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 -8
- package/engine/object-field.lua +362 -117
- package/engine/random.d.ts +11 -0
- package/engine/random.lua +30 -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/entries/unit-type.d.ts +42 -1
- package/engine/standard/entries/unit-type.lua +42 -1
- package/engine/standard/fields/ability.d.ts +5 -3
- package/engine/standard/fields/ability.lua +5 -3
- 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 +10 -0
- package/engine/unit.lua +19 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/global/vec2.lua +1 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +147 -43
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +2 -2
- package/math.lua +14 -0
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +12 -11
- package/objutil/object.d.ts +0 -1
- package/objutil/object.lua +1 -1
- package/objutil/unit.d.ts +0 -1
- package/objutil/unit.lua +8 -0
- package/operation.lua +1 -4
- package/package.json +13 -14
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +25 -0
- package/patch-lualib.lua +1 -1
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +13 -5
- package/utility/arrays.lua +45 -3
- package/utility/bit-set.d.ts +0 -2
- 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/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +16 -4
- package/utility/linked-set.lua +54 -3
- package/utility/lua-maps.d.ts +16 -4
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +3 -2
- package/utility/lua-sets.lua +7 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +6 -2
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
- /package/engine/internal/{object-data/armor-increase.d.ts → mechanics/cast-ability.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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____rect = require("core.types.rect")
|
|
6
|
+
local Rect = ____rect.Rect
|
|
7
|
+
local ____region = require("core.types.region")
|
|
8
|
+
local Region = ____region.Region
|
|
9
|
+
____exports.GameMap = __TS__Class()
|
|
10
|
+
local GameMap = ____exports.GameMap
|
|
11
|
+
GameMap.name = "GameMap"
|
|
12
|
+
function GameMap.prototype.____constructor(self)
|
|
13
|
+
end
|
|
14
|
+
__TS__ObjectDefineProperty(
|
|
15
|
+
GameMap,
|
|
16
|
+
"worldBoundsRect",
|
|
17
|
+
{get = function(self)
|
|
18
|
+
local rect = Rect:of(GetWorldBounds())
|
|
19
|
+
rawset(self, "worldBoundsRect", rect)
|
|
20
|
+
return rect
|
|
21
|
+
end}
|
|
22
|
+
)
|
|
23
|
+
__TS__ObjectDefineProperty(
|
|
24
|
+
GameMap,
|
|
25
|
+
"worldBoundsRegion",
|
|
26
|
+
{get = function(self)
|
|
27
|
+
local region = Region:create(self.worldBoundsRect)
|
|
28
|
+
rawset(self, "worldBoundsRegion", region)
|
|
29
|
+
return region
|
|
30
|
+
end}
|
|
31
|
+
)
|
|
32
|
+
return ____exports
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import { Handle } from "../../core/types/handle";
|
|
2
|
+
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Event } from "../../event";
|
|
4
4
|
import type { Item } from "../../core/types/item";
|
|
5
5
|
import type { Unit } from "./unit";
|
|
6
6
|
import type { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
7
|
-
interface Fields<K, V> {
|
|
8
|
-
set(field: K, value: V): boolean;
|
|
9
|
-
get(field: K): V;
|
|
10
|
-
has(field: K): boolean;
|
|
11
|
-
}
|
|
12
|
-
interface AbilityLevel {
|
|
13
|
-
realFields: Fields<jabilityreallevelfield, number>;
|
|
14
|
-
}
|
|
15
7
|
export type jabilityfield = jabilityintegerfield | jabilityrealfield | jabilitybooleanfield | jabilitystringfield | jabilityintegerlevelfield | jabilityreallevelfield | jabilitybooleanlevelfield | jabilitystringlevelfield;
|
|
16
8
|
export declare class AbilitySnapshot {
|
|
17
9
|
}
|
|
@@ -20,7 +12,8 @@ export declare abstract class Ability extends Handle<jability> {
|
|
|
20
12
|
protected constructor(handle: jability, typeId: number);
|
|
21
13
|
toString(): string;
|
|
22
14
|
get parentTypeId(): number;
|
|
23
|
-
get
|
|
15
|
+
get orderTypeStringId(): string;
|
|
16
|
+
get orderTypeId(): number;
|
|
24
17
|
abstract readonly owner: Unit | Item;
|
|
25
18
|
getSnapshot(): AbilitySnapshot;
|
|
26
19
|
hasField(field: jabilityfield | number): boolean;
|
|
@@ -40,9 +33,11 @@ export declare abstract class Ability extends Handle<jability> {
|
|
|
40
33
|
setField(field: jabilityintegerlevelfield | jabilityreallevelfield, level: number, value: number): boolean;
|
|
41
34
|
setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
|
|
42
35
|
setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
|
|
43
|
-
get
|
|
44
|
-
get levels(): readonly AbilityLevel[];
|
|
36
|
+
get levelCount(): number;
|
|
45
37
|
abstract get level(): number;
|
|
38
|
+
abstract get cooldownRemaining(): number;
|
|
39
|
+
abstract set cooldownRemaining(cooldownRemaining: number);
|
|
40
|
+
abstract interruptCast(): void;
|
|
46
41
|
static get onCreate(): Event<[Ability]>;
|
|
47
42
|
static get destroyEvent(): Event<[Ability]>;
|
|
48
43
|
}
|
|
@@ -53,15 +48,26 @@ export declare class UnrecognizedAbility extends Ability {
|
|
|
53
48
|
readonly owner: Unit;
|
|
54
49
|
constructor(typeId: number, owner: Unit);
|
|
55
50
|
get level(): number;
|
|
51
|
+
get cooldownRemaining(): number;
|
|
52
|
+
set cooldownRemaining(_: number);
|
|
53
|
+
interruptCast(): void;
|
|
56
54
|
}
|
|
57
55
|
export declare class UnitAbility extends Ability {
|
|
58
56
|
readonly owner: Unit;
|
|
59
57
|
private readonly u;
|
|
58
|
+
private d?;
|
|
60
59
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
60
|
+
incrementHideCounter(): void;
|
|
61
|
+
decrementHideCounter(): void;
|
|
62
|
+
incrementDisableCounter(): void;
|
|
63
|
+
decrementDisableCounter(): void;
|
|
64
|
+
get isDisabled(): boolean;
|
|
61
65
|
get level(): number;
|
|
62
66
|
set level(v: number);
|
|
63
67
|
get cooldownRemaining(): number;
|
|
64
|
-
set cooldownRemaining(
|
|
68
|
+
set cooldownRemaining(cooldownRemaining: number);
|
|
69
|
+
interruptCast(): void;
|
|
70
|
+
protected onDestroy(): HandleDestructor;
|
|
65
71
|
static get onCreate(): Event<[UnitAbility]>;
|
|
66
72
|
static get onDestroy(): Event<[UnitAbility]>;
|
|
67
73
|
}
|
|
@@ -85,7 +91,10 @@ export declare class ItemAbility extends Ability {
|
|
|
85
91
|
setField(field: jabilitybooleanlevelfield, level: number, value: boolean): boolean;
|
|
86
92
|
setField(field: jabilitystringlevelfield, level: number, value: string): boolean;
|
|
87
93
|
get level(): number;
|
|
94
|
+
get cooldownRemaining(): number;
|
|
95
|
+
set cooldownRemaining(cooldownRemaining: number);
|
|
96
|
+
interruptCast(): void;
|
|
97
|
+
protected onDestroy(): HandleDestructor;
|
|
88
98
|
static get onCreate(): Event<[ItemAbility]>;
|
|
89
99
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
90
100
|
}
|
|
91
|
-
export {};
|
|
@@ -2,7 +2,6 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
4
|
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
-
local __TS__New = ____lualib.__TS__New
|
|
6
5
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
7
6
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
8
7
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
@@ -11,7 +10,10 @@ local ____exports = {}
|
|
|
11
10
|
local ____handle = require("core.types.handle")
|
|
12
11
|
local Handle = ____handle.Handle
|
|
13
12
|
local ____ability = require("engine.internal.item.ability")
|
|
13
|
+
local abilityActionDummy = ____ability.abilityActionDummy
|
|
14
14
|
local doAbilityAction = ____ability.doAbilityAction
|
|
15
|
+
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
16
|
+
local startItemCooldown = ____ability.startItemCooldown
|
|
15
17
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
16
18
|
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
17
19
|
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
@@ -33,7 +35,8 @@ local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
|
33
35
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
34
36
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
35
37
|
local getHandleId = GetHandleId
|
|
36
|
-
local
|
|
38
|
+
local unitHideAbility = BlzUnitHideAbility
|
|
39
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
37
40
|
local match = string.match
|
|
38
41
|
local ____type = _G.type
|
|
39
42
|
local ____tostring = _G.tostring
|
|
@@ -151,55 +154,6 @@ local orders = postcompile(function()
|
|
|
151
154
|
end
|
|
152
155
|
return orders
|
|
153
156
|
end)
|
|
154
|
-
local RealFields = __TS__Class()
|
|
155
|
-
RealFields.name = "RealFields"
|
|
156
|
-
function RealFields.prototype.____constructor(self, handle)
|
|
157
|
-
self.handle = handle
|
|
158
|
-
end
|
|
159
|
-
function RealFields.prototype.set(self, field, value)
|
|
160
|
-
return BlzSetAbilityRealField(self.handle, field, value)
|
|
161
|
-
end
|
|
162
|
-
function RealFields.prototype.get(self, field)
|
|
163
|
-
return BlzGetAbilityRealField(self.handle, field)
|
|
164
|
-
end
|
|
165
|
-
function RealFields.prototype.has(self, field)
|
|
166
|
-
local handle = self.handle
|
|
167
|
-
return BlzSetAbilityRealField(
|
|
168
|
-
handle,
|
|
169
|
-
field,
|
|
170
|
-
BlzGetAbilityRealField(handle, field)
|
|
171
|
-
)
|
|
172
|
-
end
|
|
173
|
-
local RealLevelFields = __TS__Class()
|
|
174
|
-
RealLevelFields.name = "RealLevelFields"
|
|
175
|
-
function RealLevelFields.prototype.____constructor(self, handle, level)
|
|
176
|
-
self.handle = handle
|
|
177
|
-
self.level = level
|
|
178
|
-
end
|
|
179
|
-
function RealLevelFields.prototype.set(self, field, value)
|
|
180
|
-
return BlzSetAbilityRealLevelField(self.handle, field, self.level, value)
|
|
181
|
-
end
|
|
182
|
-
function RealLevelFields.prototype.get(self, field)
|
|
183
|
-
return BlzGetAbilityRealLevelField(self.handle, field, self.level)
|
|
184
|
-
end
|
|
185
|
-
function RealLevelFields.prototype.has(self, field)
|
|
186
|
-
local handle = self.handle
|
|
187
|
-
return BlzSetAbilityRealLevelField(
|
|
188
|
-
handle,
|
|
189
|
-
field,
|
|
190
|
-
0,
|
|
191
|
-
BlzGetAbilityRealLevelField(handle, field, 0)
|
|
192
|
-
)
|
|
193
|
-
end
|
|
194
|
-
local realLevelMetatable = {__index = self}
|
|
195
|
-
local levelDescriptors = {realFields = function(self, handle, level)
|
|
196
|
-
return __TS__New(RealLevelFields, handle, level)
|
|
197
|
-
end}
|
|
198
|
-
local levelMetatable = {__index = function(self, key)
|
|
199
|
-
local fields = levelDescriptors[key](levelDescriptors, self.handle, self.level)
|
|
200
|
-
rawset(self, key, fields)
|
|
201
|
-
return fields
|
|
202
|
-
end}
|
|
203
157
|
local fieldGetters = {
|
|
204
158
|
abilityintegerfield = function(ability, field)
|
|
205
159
|
return getAbilityIntegerField(ability.handle, field)
|
|
@@ -276,6 +230,19 @@ ____exports.getOrderIdByAbilityTypeId = function(abilityTypeId)
|
|
|
276
230
|
local parentTypeId = availableFields[abilityTypeId]
|
|
277
231
|
return order2orderId(orders[____type(parentTypeId) == "number" and parentTypeId or abilityTypeId] or "")
|
|
278
232
|
end
|
|
233
|
+
---
|
|
234
|
+
-- @internal For use by internal systems only.
|
|
235
|
+
____exports.abilityTypeHasField = function(abilityTypeId, field)
|
|
236
|
+
field = ____type(field) == "number" and field or getHandleId(field)
|
|
237
|
+
if commonFields[field] then
|
|
238
|
+
return true
|
|
239
|
+
end
|
|
240
|
+
local id = availableFields[abilityTypeId]
|
|
241
|
+
if ____type(id) == "number" then
|
|
242
|
+
id = availableFields[id]
|
|
243
|
+
end
|
|
244
|
+
return not not (id and id[field])
|
|
245
|
+
end
|
|
279
246
|
____exports.Ability = __TS__Class()
|
|
280
247
|
local Ability = ____exports.Ability
|
|
281
248
|
Ability.name = "Ability"
|
|
@@ -291,15 +258,7 @@ function Ability.prototype.getSnapshot(self)
|
|
|
291
258
|
return nil
|
|
292
259
|
end
|
|
293
260
|
function Ability.prototype.hasField(self, field)
|
|
294
|
-
|
|
295
|
-
if commonFields[field] then
|
|
296
|
-
return true
|
|
297
|
-
end
|
|
298
|
-
local id = availableFields[self.typeId]
|
|
299
|
-
if ____type(id) == "number" then
|
|
300
|
-
id = availableFields[id]
|
|
301
|
-
end
|
|
302
|
-
return not not (id and id[field])
|
|
261
|
+
return ____exports.abilityTypeHasField(self.typeId, field)
|
|
303
262
|
end
|
|
304
263
|
function Ability.prototype.getField(self, field, level)
|
|
305
264
|
local fieldType = match(
|
|
@@ -346,43 +305,26 @@ __TS__SetDescriptor(
|
|
|
346
305
|
)
|
|
347
306
|
__TS__SetDescriptor(
|
|
348
307
|
Ability.prototype,
|
|
349
|
-
"
|
|
308
|
+
"orderTypeStringId",
|
|
350
309
|
{get = function(self)
|
|
351
310
|
local field = orderIdFieldByParentTypeId[self.parentTypeId]
|
|
352
|
-
return
|
|
311
|
+
return field ~= nil and getAbilityStringLevelField(self.handle, field, self.level) or (orders[self.parentTypeId] or "")
|
|
353
312
|
end},
|
|
354
313
|
true
|
|
355
314
|
)
|
|
356
315
|
__TS__SetDescriptor(
|
|
357
316
|
Ability.prototype,
|
|
358
|
-
"
|
|
317
|
+
"orderTypeId",
|
|
359
318
|
{get = function(self)
|
|
360
|
-
|
|
361
|
-
rawset(self, "realFields", realFields)
|
|
362
|
-
return realFields
|
|
319
|
+
return order2orderId(self.orderTypeStringId)
|
|
363
320
|
end},
|
|
364
321
|
true
|
|
365
322
|
)
|
|
366
323
|
__TS__SetDescriptor(
|
|
367
324
|
Ability.prototype,
|
|
368
|
-
"
|
|
325
|
+
"levelCount",
|
|
369
326
|
{get = function(self)
|
|
370
|
-
|
|
371
|
-
local levels = setmetatable(
|
|
372
|
-
{},
|
|
373
|
-
{
|
|
374
|
-
__len = function(self)
|
|
375
|
-
return BlzGetAbilityIntegerField(handle, ABILITY_IF_LEVELS)
|
|
376
|
-
end,
|
|
377
|
-
__index = function(self, i)
|
|
378
|
-
local level = setmetatable({handle = handle, level = i - 1}, levelMetatable)
|
|
379
|
-
self[i] = level
|
|
380
|
-
return level
|
|
381
|
-
end
|
|
382
|
-
}
|
|
383
|
-
)
|
|
384
|
-
rawset(self, "levels", levels)
|
|
385
|
-
return levels
|
|
327
|
+
return self:getField(ABILITY_IF_LEVELS)
|
|
386
328
|
end},
|
|
387
329
|
true
|
|
388
330
|
)
|
|
@@ -393,6 +335,17 @@ __TS__SetDescriptor(
|
|
|
393
335
|
end},
|
|
394
336
|
true
|
|
395
337
|
)
|
|
338
|
+
__TS__SetDescriptor(
|
|
339
|
+
Ability.prototype,
|
|
340
|
+
"cooldownRemaining",
|
|
341
|
+
{
|
|
342
|
+
get = function(self)
|
|
343
|
+
end,
|
|
344
|
+
set = function(self, cooldownRemaining)
|
|
345
|
+
end
|
|
346
|
+
},
|
|
347
|
+
true
|
|
348
|
+
)
|
|
396
349
|
__TS__ObjectDefineProperty(
|
|
397
350
|
Ability,
|
|
398
351
|
"onCreate",
|
|
@@ -416,6 +369,8 @@ function UnrecognizedAbility.prototype.____constructor(self, typeId, owner)
|
|
|
416
369
|
UnrecognizedAbility.____super.prototype.____constructor(self, nil, typeId)
|
|
417
370
|
self.owner = owner
|
|
418
371
|
end
|
|
372
|
+
function UnrecognizedAbility.prototype.interruptCast(self)
|
|
373
|
+
end
|
|
419
374
|
__TS__SetDescriptor(
|
|
420
375
|
UnrecognizedAbility.prototype,
|
|
421
376
|
"level",
|
|
@@ -424,6 +379,18 @@ __TS__SetDescriptor(
|
|
|
424
379
|
end},
|
|
425
380
|
true
|
|
426
381
|
)
|
|
382
|
+
__TS__SetDescriptor(
|
|
383
|
+
UnrecognizedAbility.prototype,
|
|
384
|
+
"cooldownRemaining",
|
|
385
|
+
{
|
|
386
|
+
get = function(self)
|
|
387
|
+
return 0
|
|
388
|
+
end,
|
|
389
|
+
set = function(self, _)
|
|
390
|
+
end
|
|
391
|
+
},
|
|
392
|
+
true
|
|
393
|
+
)
|
|
427
394
|
____exports.UnitAbility = __TS__Class()
|
|
428
395
|
local UnitAbility = ____exports.UnitAbility
|
|
429
396
|
UnitAbility.name = "UnitAbility"
|
|
@@ -433,6 +400,43 @@ function UnitAbility.prototype.____constructor(self, handle, typeId, owner)
|
|
|
433
400
|
self.owner = owner
|
|
434
401
|
self.u = owner.handle
|
|
435
402
|
end
|
|
403
|
+
function UnitAbility.prototype.incrementHideCounter(self)
|
|
404
|
+
unitHideAbility(self.u, self.typeId, true)
|
|
405
|
+
end
|
|
406
|
+
function UnitAbility.prototype.decrementHideCounter(self)
|
|
407
|
+
unitHideAbility(self.u, self.typeId, false)
|
|
408
|
+
end
|
|
409
|
+
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
410
|
+
local unit = self.u
|
|
411
|
+
local typeId = self.typeId
|
|
412
|
+
unitHideAbility(unit, typeId, true)
|
|
413
|
+
unitDisableAbility(unit, typeId, true, false)
|
|
414
|
+
self.d = (self.d or 0) + 1
|
|
415
|
+
end
|
|
416
|
+
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
417
|
+
local unit = self.u
|
|
418
|
+
local typeId = self.typeId
|
|
419
|
+
unitDisableAbility(unit, typeId, false, false)
|
|
420
|
+
unitHideAbility(unit, typeId, true)
|
|
421
|
+
self.d = (self.d or 0) - 1
|
|
422
|
+
end
|
|
423
|
+
function UnitAbility.prototype.interruptCast(self)
|
|
424
|
+
self.owner:interruptCast(self.typeId)
|
|
425
|
+
end
|
|
426
|
+
function UnitAbility.prototype.onDestroy(self)
|
|
427
|
+
if self.owner.state ~= 2 then
|
|
428
|
+
self.owner:removeAbility(self.typeId)
|
|
429
|
+
end
|
|
430
|
+
return UnitAbility.____super.prototype.onDestroy(self)
|
|
431
|
+
end
|
|
432
|
+
__TS__SetDescriptor(
|
|
433
|
+
UnitAbility.prototype,
|
|
434
|
+
"isDisabled",
|
|
435
|
+
{get = function(self)
|
|
436
|
+
return self.d ~= nil and self.d > 0
|
|
437
|
+
end},
|
|
438
|
+
true
|
|
439
|
+
)
|
|
436
440
|
__TS__SetDescriptor(
|
|
437
441
|
UnitAbility.prototype,
|
|
438
442
|
"level",
|
|
@@ -453,8 +457,8 @@ __TS__SetDescriptor(
|
|
|
453
457
|
get = function(self)
|
|
454
458
|
return getUnitAbilityCooldownRemaining(self.u, self.typeId)
|
|
455
459
|
end,
|
|
456
|
-
set = function(self,
|
|
457
|
-
startUnitAbilityCooldown(self.u, self.typeId,
|
|
460
|
+
set = function(self, cooldownRemaining)
|
|
461
|
+
startUnitAbilityCooldown(self.u, self.typeId, cooldownRemaining)
|
|
458
462
|
end
|
|
459
463
|
},
|
|
460
464
|
true
|
|
@@ -479,6 +483,9 @@ end
|
|
|
479
483
|
local function setAbilityField(_, ability, field, levelOrValue, value)
|
|
480
484
|
return ____exports.Ability.prototype.setField(ability, field, levelOrValue, value)
|
|
481
485
|
end
|
|
486
|
+
local function getAbilityCooldown(_, abilityTypeId)
|
|
487
|
+
return getUnitAbilityCooldownRemaining(abilityActionDummy, abilityTypeId)
|
|
488
|
+
end
|
|
482
489
|
____exports.ItemAbility = __TS__Class()
|
|
483
490
|
local ItemAbility = ____exports.ItemAbility
|
|
484
491
|
ItemAbility.name = "ItemAbility"
|
|
@@ -506,6 +513,22 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
506
513
|
value
|
|
507
514
|
)
|
|
508
515
|
end
|
|
516
|
+
function ItemAbility.prototype.interruptCast(self)
|
|
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
|
+
end
|
|
525
|
+
end
|
|
526
|
+
function ItemAbility.prototype.onDestroy(self)
|
|
527
|
+
if self.owner.state ~= 2 then
|
|
528
|
+
self.owner:removeAbility(self.typeId)
|
|
529
|
+
end
|
|
530
|
+
return ItemAbility.____super.prototype.onDestroy(self)
|
|
531
|
+
end
|
|
509
532
|
__TS__SetDescriptor(
|
|
510
533
|
ItemAbility.prototype,
|
|
511
534
|
"level",
|
|
@@ -514,6 +537,27 @@ __TS__SetDescriptor(
|
|
|
514
537
|
end},
|
|
515
538
|
true
|
|
516
539
|
)
|
|
540
|
+
__TS__SetDescriptor(
|
|
541
|
+
ItemAbility.prototype,
|
|
542
|
+
"cooldownRemaining",
|
|
543
|
+
{
|
|
544
|
+
get = function(self)
|
|
545
|
+
local item = self.owner
|
|
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
|
+
end,
|
|
551
|
+
set = function(self, cooldownRemaining)
|
|
552
|
+
local item = self.owner
|
|
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
|
+
end
|
|
558
|
+
},
|
|
559
|
+
true
|
|
560
|
+
)
|
|
517
561
|
__TS__ObjectDefineProperty(
|
|
518
562
|
ItemAbility,
|
|
519
563
|
"onCreate",
|
|
@@ -1,27 +1,103 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
local restoreCooldownGroup
|
|
2
3
|
local ____player = require("core.types.player")
|
|
3
4
|
local Player = ____player.Player
|
|
4
5
|
local ____dummy = require("objutil.dummy")
|
|
5
6
|
local dummyUnitId = ____dummy.dummyUnitId
|
|
7
|
+
local ____utility = require("engine.internal.utility")
|
|
8
|
+
local findUnitItemSlot = ____utility.findUnitItemSlot
|
|
9
|
+
local ____blank = require("engine.object-data.entry.item-type.blank")
|
|
10
|
+
local BlankItemType = ____blank.BlankItemType
|
|
11
|
+
local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.utility.object-data-entry-id-generator")
|
|
12
|
+
local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilityTypeIdGenerator
|
|
13
|
+
local ____math = require("math")
|
|
14
|
+
local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
15
|
+
local ____timer = require("core.types.timer")
|
|
16
|
+
local Timer = ____timer.Timer
|
|
17
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
18
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
19
|
+
local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slot")
|
|
20
|
+
local unitAddItemToSlot = ____add_2Ditem_2Dto_2Dslot.unitAddItemToSlot
|
|
6
21
|
local isItemOwned = IsItemOwned
|
|
7
22
|
local isItemPowerup = IsItemPowerup
|
|
23
|
+
local getItemAbility = BlzGetItemAbility
|
|
8
24
|
local getItemX = GetItemX
|
|
9
25
|
local getItemY = GetItemY
|
|
26
|
+
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
27
|
+
local setItemIntegerField = BlzSetItemIntegerField
|
|
28
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
10
29
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
11
30
|
local setItemPosition = SetItemPosition
|
|
12
31
|
local unitAddItem = UnitAddItem
|
|
13
32
|
local unitRemoveItem = UnitRemoveItem
|
|
14
|
-
local
|
|
33
|
+
local unitUseItem = UnitUseItem
|
|
34
|
+
local unitResetCooldown = UnitResetCooldown
|
|
35
|
+
local unitInventorySize = UnitInventorySize
|
|
36
|
+
local unitItemInSlot = UnitItemInSlot
|
|
37
|
+
local COOLDOWN_STARTER_ABILITY_TYPE_ID = compiletime(function()
|
|
38
|
+
if not currentMap then
|
|
39
|
+
return 0
|
|
40
|
+
end
|
|
41
|
+
local abilityType = currentMap.objects.ability:newObject(
|
|
42
|
+
util.id2s(abilityTypeIdGenerator:next()),
|
|
43
|
+
"Absk"
|
|
44
|
+
)
|
|
45
|
+
abilityType["bsk1+0"] = 0
|
|
46
|
+
abilityType["bsk2+0"] = 0
|
|
47
|
+
abilityType["bsk3+0"] = 0
|
|
48
|
+
abilityType["amcs+0"] = 0
|
|
49
|
+
abilityType["adur+0"] = MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
50
|
+
abilityType["ahdu+0"] = MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
51
|
+
return util.s2id(abilityType.id)
|
|
52
|
+
end)
|
|
53
|
+
local COOLDOWN_STARTER_ITEM_TYPE_ID = compiletime(function()
|
|
54
|
+
local itemType = BlankItemType:create()
|
|
55
|
+
itemType.name = "[Warscript/Dummy] Item Cooldown Starter"
|
|
56
|
+
itemType.abilityTypeIds = {COOLDOWN_STARTER_ABILITY_TYPE_ID}
|
|
57
|
+
itemType.cooldownGroupId = COOLDOWN_STARTER_ABILITY_TYPE_ID
|
|
58
|
+
itemType.activelyUsed = true
|
|
59
|
+
return itemType.id
|
|
60
|
+
end)
|
|
61
|
+
---
|
|
62
|
+
-- @internal For use by internal systems only.
|
|
63
|
+
____exports.itemAbilityDummy = assert(CreateUnit(
|
|
15
64
|
Player.neutralVictim.handle,
|
|
16
65
|
dummyUnitId,
|
|
17
66
|
0,
|
|
18
67
|
0,
|
|
19
68
|
270
|
|
20
69
|
))
|
|
21
|
-
|
|
70
|
+
local cooldownStarterItem = UnitAddItemById(____exports.itemAbilityDummy, COOLDOWN_STARTER_ITEM_TYPE_ID)
|
|
71
|
+
local cooldownStarterAbility = getItemAbility(cooldownStarterItem, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
72
|
+
ShowUnit(____exports.itemAbilityDummy, false)
|
|
73
|
+
local function startItemCooldownInternal(handle, cooldown)
|
|
74
|
+
local cooldownGroup = getItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP)
|
|
75
|
+
setItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
76
|
+
setAbilityRealLevelField(cooldownStarterAbility, ABILITY_RLF_COOLDOWN, 0, cooldown)
|
|
77
|
+
unitResetCooldown(____exports.itemAbilityDummy)
|
|
78
|
+
unitUseItem(____exports.itemAbilityDummy, cooldownStarterItem)
|
|
79
|
+
Timer:run(restoreCooldownGroup, handle, cooldownGroup)
|
|
80
|
+
end
|
|
81
|
+
restoreCooldownGroup = function(handle, cooldownGroup)
|
|
82
|
+
if getItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP) == COOLDOWN_STARTER_ABILITY_TYPE_ID then
|
|
83
|
+
setItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP, cooldownGroup)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
---
|
|
87
|
+
-- @internal For use by internal systems only.
|
|
88
|
+
____exports.startItemCooldown = function(handle, owner, cooldown)
|
|
89
|
+
____exports.doAbilityActionForceDummy(handle, owner, startItemCooldownInternal, cooldown)
|
|
90
|
+
end
|
|
91
|
+
---
|
|
92
|
+
-- @internal For use by internal systems only.
|
|
93
|
+
____exports.abilityActionDummy = ____exports.itemAbilityDummy
|
|
22
94
|
---
|
|
23
95
|
-- @internal For use by internal systems only.
|
|
24
96
|
____exports.doAbilityAction = function(handle, action, ...)
|
|
97
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[handle] ~= nil
|
|
98
|
+
if not isAlreadyIgnoredInEvents then
|
|
99
|
+
ignoreEventsItems[handle] = true
|
|
100
|
+
end
|
|
25
101
|
local isOwned = isItemOwned(handle)
|
|
26
102
|
local isPowerup
|
|
27
103
|
local x
|
|
@@ -33,16 +109,98 @@ ____exports.doAbilityAction = function(handle, action, ...)
|
|
|
33
109
|
end
|
|
34
110
|
x = getItemX(handle)
|
|
35
111
|
y = getItemY(handle)
|
|
36
|
-
unitAddItem(
|
|
112
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
37
113
|
end
|
|
38
114
|
local result = action(handle, ...)
|
|
39
115
|
if not isOwned then
|
|
40
|
-
unitRemoveItem(
|
|
116
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
41
117
|
setItemPosition(handle, x, y)
|
|
42
118
|
if isPowerup then
|
|
43
119
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
44
120
|
end
|
|
45
121
|
end
|
|
122
|
+
if not isAlreadyIgnoredInEvents then
|
|
123
|
+
ignoreEventsItems[handle] = nil
|
|
124
|
+
end
|
|
125
|
+
return result
|
|
126
|
+
end
|
|
127
|
+
---
|
|
128
|
+
-- @internal For use by internal systems only.
|
|
129
|
+
____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
130
|
+
if owner == nil then
|
|
131
|
+
return ____exports.doAbilityAction(handle, action, ...)
|
|
132
|
+
end
|
|
133
|
+
local slot = findUnitItemSlot(owner, handle)
|
|
134
|
+
if slot == nil then
|
|
135
|
+
return ____exports.doAbilityAction(handle, action, ...)
|
|
136
|
+
end
|
|
137
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[handle] ~= nil
|
|
138
|
+
if not isAlreadyIgnoredInEvents then
|
|
139
|
+
ignoreEventsItems[handle] = true
|
|
140
|
+
end
|
|
141
|
+
local isPowerup
|
|
142
|
+
if isItemPowerup(handle) then
|
|
143
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
144
|
+
isPowerup = true
|
|
145
|
+
end
|
|
146
|
+
unitRemoveItem(owner, handle)
|
|
147
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
148
|
+
local result = action(handle, ...)
|
|
149
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
150
|
+
unitAddItemToSlot(owner, handle, slot)
|
|
151
|
+
if isPowerup then
|
|
152
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
153
|
+
end
|
|
154
|
+
if not isAlreadyIgnoredInEvents then
|
|
155
|
+
ignoreEventsItems[handle] = nil
|
|
156
|
+
end
|
|
157
|
+
return result
|
|
158
|
+
end
|
|
159
|
+
local depth = 0
|
|
160
|
+
local itemBySlot = {}
|
|
161
|
+
---
|
|
162
|
+
-- @internal For use by internal systems only.
|
|
163
|
+
____exports.doUnitAbilityAction = function(unit, abilityTypeId, action, ...)
|
|
164
|
+
local ____depth_0 = depth
|
|
165
|
+
depth = ____depth_0 + 1
|
|
166
|
+
local offset = 6 * ____depth_0
|
|
167
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
168
|
+
local item = unitItemInSlot(unit, slot)
|
|
169
|
+
if getItemAbility(item, abilityTypeId) ~= nil then
|
|
170
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[item] ~= nil
|
|
171
|
+
if not isAlreadyIgnoredInEvents then
|
|
172
|
+
ignoreEventsItems[item] = true
|
|
173
|
+
end
|
|
174
|
+
unitRemoveItem(unit, item)
|
|
175
|
+
if not isAlreadyIgnoredInEvents then
|
|
176
|
+
ignoreEventsItems[item] = nil
|
|
177
|
+
end
|
|
178
|
+
itemBySlot[offset + slot] = item
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
local result = action(unit, ...)
|
|
182
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
183
|
+
local item = itemBySlot[offset + slot]
|
|
184
|
+
if item ~= nil then
|
|
185
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[item] ~= nil
|
|
186
|
+
if not isAlreadyIgnoredInEvents then
|
|
187
|
+
ignoreEventsItems[item] = true
|
|
188
|
+
end
|
|
189
|
+
local isPowerup = isItemPowerup(item)
|
|
190
|
+
if isPowerup then
|
|
191
|
+
setItemBooleanField(item, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
192
|
+
end
|
|
193
|
+
unitAddItemToSlot(unit, item, slot)
|
|
194
|
+
if isPowerup then
|
|
195
|
+
setItemBooleanField(item, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
196
|
+
end
|
|
197
|
+
if not isAlreadyIgnoredInEvents then
|
|
198
|
+
ignoreEventsItems[item] = nil
|
|
199
|
+
end
|
|
200
|
+
itemBySlot[offset + slot] = nil
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
depth = depth - 1
|
|
46
204
|
return result
|
|
47
205
|
end
|
|
48
206
|
return ____exports
|