warscript 0.0.1-dev.f5421e8 → 0.0.1-dev.f594e71
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/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +136 -58
- package/core/types/handle.lua +9 -9
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- package/core/types/player.d.ts +18 -1
- package/core/types/player.lua +76 -26
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/playerColor.lua +4 -3
- package/core/types/sound.d.ts +1 -1
- package/core/types/sound.lua +19 -9
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -1
- package/core/types/timer.lua +27 -2
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/decl/native.d.ts +1718 -964
- 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.lua +5 -5
- package/engine/behaviour/ability/damage.d.ts +9 -3
- package/engine/behaviour/ability/damage.lua +40 -49
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +23 -7
- 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 +12 -6
- package/engine/behaviour/ability.lua +49 -17
- 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 -3
- package/engine/behaviour/unit.lua +270 -6
- package/engine/buff.d.ts +75 -28
- package/engine/buff.lua +433 -196
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +11 -1
- package/engine/internal/ability.lua +100 -41
- 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.d.ts +1 -0
- package/engine/internal/item+owner.lua +19 -6
- package/engine/internal/item.d.ts +28 -16
- package/engine/internal/item.lua +241 -82
- 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 +113 -12
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/bonus.d.ts +6 -0
- package/engine/internal/unit/bonus.lua +33 -3
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/{item.lua → inventory.lua} +25 -26
- 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/pseudo-passive-abilities.d.ts +2 -0
- package/engine/internal/unit/pseudo-passive-abilities.lua +11 -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 +11 -11
- package/engine/internal/unit+damage.lua +43 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +39 -27
- package/engine/internal/unit.lua +382 -269
- package/engine/local-client.d.ts +27 -0
- package/engine/local-client.lua +370 -54
- 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/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
- package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
- package/engine/object-data/auxiliary/equipment-type.d.ts +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -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/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.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-set-name.d.ts +14 -3
- 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/apprehend.d.ts +22 -0
- package/engine/object-data/entry/ability-type/apprehend.lua +66 -0
- package/engine/object-data/entry/ability-type/armor-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
- package/engine/object-data/entry/ability-type/banshee.d.ts +8 -0
- package/engine/object-data/entry/ability-type/banshee.lua +13 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.lua +27 -0
- package/engine/object-data/entry/ability-type/banshees-wail.d.ts +31 -0
- package/engine/object-data/entry/ability-type/banshees-wail.lua +117 -0
- package/engine/object-data/entry/ability-type/battering-ram.d.ts +33 -0
- package/engine/object-data/entry/ability-type/battering-ram.lua +130 -0
- 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 +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +30 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- 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/heroic-slash.d.ts +18 -0
- package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
- package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
- package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
- package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
- package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
- package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
- package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -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-efficiency.d.ts +12 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -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/mind-control.d.ts +21 -0
- package/engine/object-data/entry/ability-type/mind-control.lua +78 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.d.ts +21 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.lua +52 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.d.ts +19 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.lua +65 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.d.ts +15 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.lua +26 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.d.ts +6 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.lua +12 -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/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.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/resolve.d.ts +12 -0
- package/engine/object-data/entry/ability-type/resolve.lua +39 -0
- package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
- package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
- package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
- package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -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/soul-lantern.d.ts +30 -0
- package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
- package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
- package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
- package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
- package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
- package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
- package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
- package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
- package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
- package/engine/object-data/entry/ability-type/talents.lua +27 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
- package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
- package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
- package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
- package/engine/object-data/entry/ability-type/warcry.lua +26 -0
- package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
- package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
- package/engine/object-data/entry/ability-type.d.ts +12 -3
- package/engine/object-data/entry/ability-type.lua +148 -7
- package/engine/object-data/entry/buff-type/applicable.lua +113 -104
- package/engine/object-data/entry/buff-type.d.ts +10 -12
- package/engine/object-data/entry/buff-type.lua +37 -27
- package/engine/object-data/entry/destructible-type.d.ts +32 -2
- package/engine/object-data/entry/destructible-type.lua +181 -0
- package/engine/object-data/entry/item-type.d.ts +12 -3
- package/engine/object-data/entry/item-type.lua +52 -0
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +64 -6
- package/engine/object-data/entry/unit-type.lua +531 -85
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +4 -1
- 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/ability-type.d.ts +3102 -7
- package/engine/standard/entries/ability-type.lua +0 -6
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -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 +10 -1
- package/engine/unit.lua +10 -1
- package/event.d.ts +1 -1
- 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 +11 -10
- package/objutil/object.lua +1 -1
- package/operation.d.ts +8 -1
- package/operation.lua +38 -18
- package/package.json +3 -23
- 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/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/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/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
@@ -55,14 +55,23 @@ export declare class UnrecognizedAbility extends Ability {
|
|
|
55
55
|
export declare class UnitAbility extends Ability {
|
|
56
56
|
readonly owner: Unit;
|
|
57
57
|
private readonly u;
|
|
58
|
+
private d?;
|
|
58
59
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
59
60
|
incrementHideCounter(): void;
|
|
60
61
|
decrementHideCounter(): void;
|
|
62
|
+
incrementDisableCounter(): void;
|
|
63
|
+
decrementDisableCounter(): void;
|
|
64
|
+
get isDisabled(): boolean;
|
|
61
65
|
get level(): number;
|
|
62
66
|
set level(v: number);
|
|
67
|
+
/** Uses the native percentage scale. */
|
|
68
|
+
get cooldownRemainingPercent(): number;
|
|
69
|
+
set cooldownRemainingPercent(percent: number);
|
|
63
70
|
get cooldownRemaining(): number;
|
|
64
71
|
set cooldownRemaining(cooldownRemaining: number);
|
|
72
|
+
startCooldown(cooldown: number): void;
|
|
65
73
|
interruptCast(): void;
|
|
74
|
+
protected onDestroy(): HandleDestructor;
|
|
66
75
|
static get onCreate(): Event<[UnitAbility]>;
|
|
67
76
|
static get onDestroy(): Event<[UnitAbility]>;
|
|
68
77
|
}
|
|
@@ -89,6 +98,7 @@ export declare class ItemAbility extends Ability {
|
|
|
89
98
|
get cooldownRemaining(): number;
|
|
90
99
|
set cooldownRemaining(cooldownRemaining: number);
|
|
91
100
|
interruptCast(): void;
|
|
101
|
+
protected onDestroy(): HandleDestructor;
|
|
92
102
|
static get onCreate(): Event<[ItemAbility]>;
|
|
93
103
|
static get onDestroy(): Event<[ItemAbility]>;
|
|
94
104
|
}
|
|
@@ -14,29 +14,32 @@ local abilityActionDummy = ____ability.abilityActionDummy
|
|
|
14
14
|
local doAbilityAction = ____ability.doAbilityAction
|
|
15
15
|
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
16
16
|
local startItemCooldown = ____ability.startItemCooldown
|
|
17
|
-
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
18
|
-
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
19
|
-
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
20
|
-
local setAbilityRealField = BlzSetAbilityRealField
|
|
21
|
-
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
22
|
-
local setAbilityStringField = BlzSetAbilityStringField
|
|
23
|
-
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
24
|
-
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
25
|
-
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
26
|
-
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
27
|
-
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
28
|
-
local getAbilityRealField = BlzGetAbilityRealField
|
|
29
17
|
local getAbilityBooleanField = BlzGetAbilityBooleanField
|
|
30
|
-
local
|
|
18
|
+
local getAbilityBooleanLevelField = BlzGetAbilityBooleanLevelField
|
|
19
|
+
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
31
20
|
local getAbilityIntegerLevelField = BlzGetAbilityIntegerLevelField
|
|
21
|
+
local getAbilityRealField = BlzGetAbilityRealField
|
|
32
22
|
local getAbilityRealLevelField = BlzGetAbilityRealLevelField
|
|
33
|
-
local
|
|
23
|
+
local getAbilityStringField = BlzGetAbilityStringField
|
|
34
24
|
local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
25
|
+
local getHandleId = GetHandleId
|
|
26
|
+
local getUnitAbilityCooldownPercent = BlzGetUnitAbilityCooldownPercent
|
|
35
27
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
28
|
+
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
29
|
+
local order2orderId = _G.OrderId
|
|
30
|
+
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
31
|
+
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
32
|
+
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
33
|
+
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
34
|
+
local setAbilityRealField = BlzSetAbilityRealField
|
|
35
|
+
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
36
|
+
local setAbilityStringField = BlzSetAbilityStringField
|
|
37
|
+
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
38
|
+
local setUnitAbilityCooldownPercent = BlzSetUnitAbilityCooldownPercent
|
|
39
|
+
local setUnitAbilityCooldownRemaining = BlzSetUnitAbilityCooldownRemaining
|
|
40
|
+
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
36
41
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
37
|
-
local
|
|
38
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
42
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
40
43
|
local unitHideAbility = BlzUnitHideAbility
|
|
41
44
|
local match = string.match
|
|
42
45
|
local ____type = _G.type
|
|
@@ -214,7 +217,6 @@ local levelRefreshFields = {
|
|
|
214
217
|
[fourCC("Neg1")] = true
|
|
215
218
|
}
|
|
216
219
|
local levelsField = ABILITY_IF_LEVELS
|
|
217
|
-
local order2orderId = _G.OrderId
|
|
218
220
|
local orderIdFieldByParentTypeId = {
|
|
219
221
|
[fourCC("ANcl")] = ABILITY_SLF_BASE_ORDER_ID_NCL6,
|
|
220
222
|
[fourCC("Aspb")] = ABILITY_SLF_BASE_ORDER_ID_SPB5,
|
|
@@ -231,6 +233,19 @@ ____exports.getOrderIdByAbilityTypeId = function(abilityTypeId)
|
|
|
231
233
|
local parentTypeId = availableFields[abilityTypeId]
|
|
232
234
|
return order2orderId(orders[____type(parentTypeId) == "number" and parentTypeId or abilityTypeId] or "")
|
|
233
235
|
end
|
|
236
|
+
---
|
|
237
|
+
-- @internal For use by internal systems only.
|
|
238
|
+
____exports.abilityTypeHasField = function(abilityTypeId, field)
|
|
239
|
+
field = ____type(field) == "number" and field or getHandleId(field)
|
|
240
|
+
if commonFields[field] then
|
|
241
|
+
return true
|
|
242
|
+
end
|
|
243
|
+
local id = availableFields[abilityTypeId]
|
|
244
|
+
if ____type(id) == "number" then
|
|
245
|
+
id = availableFields[id]
|
|
246
|
+
end
|
|
247
|
+
return not not (id and id[field])
|
|
248
|
+
end
|
|
234
249
|
____exports.Ability = __TS__Class()
|
|
235
250
|
local Ability = ____exports.Ability
|
|
236
251
|
Ability.name = "Ability"
|
|
@@ -246,15 +261,7 @@ function Ability.prototype.getSnapshot(self)
|
|
|
246
261
|
return nil
|
|
247
262
|
end
|
|
248
263
|
function Ability.prototype.hasField(self, field)
|
|
249
|
-
|
|
250
|
-
if commonFields[field] then
|
|
251
|
-
return true
|
|
252
|
-
end
|
|
253
|
-
local id = availableFields[self.typeId]
|
|
254
|
-
if ____type(id) == "number" then
|
|
255
|
-
id = availableFields[id]
|
|
256
|
-
end
|
|
257
|
-
return not not (id and id[field])
|
|
264
|
+
return ____exports.abilityTypeHasField(self.typeId, field)
|
|
258
265
|
end
|
|
259
266
|
function Ability.prototype.getField(self, field, level)
|
|
260
267
|
local fieldType = match(
|
|
@@ -402,9 +409,40 @@ end
|
|
|
402
409
|
function UnitAbility.prototype.decrementHideCounter(self)
|
|
403
410
|
unitHideAbility(self.u, self.typeId, false)
|
|
404
411
|
end
|
|
412
|
+
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
413
|
+
local unit = self.u
|
|
414
|
+
local typeId = self.typeId
|
|
415
|
+
unitHideAbility(unit, typeId, true)
|
|
416
|
+
unitDisableAbility(unit, typeId, true, false)
|
|
417
|
+
self.d = (self.d or 0) + 1
|
|
418
|
+
end
|
|
419
|
+
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
420
|
+
local unit = self.u
|
|
421
|
+
local typeId = self.typeId
|
|
422
|
+
unitDisableAbility(unit, typeId, false, false)
|
|
423
|
+
unitHideAbility(unit, typeId, true)
|
|
424
|
+
self.d = (self.d or 0) - 1
|
|
425
|
+
end
|
|
426
|
+
function UnitAbility.prototype.startCooldown(self, cooldown)
|
|
427
|
+
startUnitAbilityCooldown(self.u, self.typeId, cooldown)
|
|
428
|
+
end
|
|
405
429
|
function UnitAbility.prototype.interruptCast(self)
|
|
406
430
|
self.owner:interruptCast(self.typeId)
|
|
407
431
|
end
|
|
432
|
+
function UnitAbility.prototype.onDestroy(self)
|
|
433
|
+
if self.owner.state ~= 2 then
|
|
434
|
+
self.owner:removeAbility(self.typeId)
|
|
435
|
+
end
|
|
436
|
+
return UnitAbility.____super.prototype.onDestroy(self)
|
|
437
|
+
end
|
|
438
|
+
__TS__SetDescriptor(
|
|
439
|
+
UnitAbility.prototype,
|
|
440
|
+
"isDisabled",
|
|
441
|
+
{get = function(self)
|
|
442
|
+
return self.d ~= nil and self.d > 0
|
|
443
|
+
end},
|
|
444
|
+
true
|
|
445
|
+
)
|
|
408
446
|
__TS__SetDescriptor(
|
|
409
447
|
UnitAbility.prototype,
|
|
410
448
|
"level",
|
|
@@ -418,6 +456,19 @@ __TS__SetDescriptor(
|
|
|
418
456
|
},
|
|
419
457
|
true
|
|
420
458
|
)
|
|
459
|
+
__TS__SetDescriptor(
|
|
460
|
+
UnitAbility.prototype,
|
|
461
|
+
"cooldownRemainingPercent",
|
|
462
|
+
{
|
|
463
|
+
get = function(self)
|
|
464
|
+
return getUnitAbilityCooldownPercent(self.u, self.typeId)
|
|
465
|
+
end,
|
|
466
|
+
set = function(self, percent)
|
|
467
|
+
setUnitAbilityCooldownPercent(self.u, self.typeId, percent)
|
|
468
|
+
end
|
|
469
|
+
},
|
|
470
|
+
true
|
|
471
|
+
)
|
|
421
472
|
__TS__SetDescriptor(
|
|
422
473
|
UnitAbility.prototype,
|
|
423
474
|
"cooldownRemaining",
|
|
@@ -426,7 +477,7 @@ __TS__SetDescriptor(
|
|
|
426
477
|
return getUnitAbilityCooldownRemaining(self.u, self.typeId)
|
|
427
478
|
end,
|
|
428
479
|
set = function(self, cooldownRemaining)
|
|
429
|
-
|
|
480
|
+
setUnitAbilityCooldownRemaining(self.u, self.typeId, cooldownRemaining)
|
|
430
481
|
end
|
|
431
482
|
},
|
|
432
483
|
true
|
|
@@ -482,12 +533,20 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
482
533
|
)
|
|
483
534
|
end
|
|
484
535
|
function ItemAbility.prototype.interruptCast(self)
|
|
485
|
-
local
|
|
486
|
-
local
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
536
|
+
local item = self.owner
|
|
537
|
+
local itemHandle = item.handle
|
|
538
|
+
local ____opt_1 = item.owner
|
|
539
|
+
local itemOwnerHandle = ____opt_1 and ____opt_1.handle
|
|
540
|
+
local cooldownRemaining = doAbilityActionForceDummy(itemHandle, itemOwnerHandle, getAbilityCooldown, self.typeId)
|
|
541
|
+
if cooldownRemaining == 0 then
|
|
542
|
+
startItemCooldown(itemHandle, itemOwnerHandle, 0.015625)
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
function ItemAbility.prototype.onDestroy(self)
|
|
546
|
+
if self.owner.state ~= 2 then
|
|
547
|
+
self.owner:removeAbility(self.typeId)
|
|
490
548
|
end
|
|
549
|
+
return ItemAbility.____super.prototype.onDestroy(self)
|
|
491
550
|
end
|
|
492
551
|
__TS__SetDescriptor(
|
|
493
552
|
ItemAbility.prototype,
|
|
@@ -503,17 +562,17 @@ __TS__SetDescriptor(
|
|
|
503
562
|
{
|
|
504
563
|
get = function(self)
|
|
505
564
|
local item = self.owner
|
|
506
|
-
local
|
|
507
|
-
local
|
|
508
|
-
local
|
|
509
|
-
return
|
|
565
|
+
local ____doAbilityActionForceDummy_6 = doAbilityActionForceDummy
|
|
566
|
+
local ____item_handle_5 = item.handle
|
|
567
|
+
local ____opt_3 = item.owner
|
|
568
|
+
return ____doAbilityActionForceDummy_6(____item_handle_5, ____opt_3 and ____opt_3.handle, getAbilityCooldown, self.typeId)
|
|
510
569
|
end,
|
|
511
570
|
set = function(self, cooldownRemaining)
|
|
512
571
|
local item = self.owner
|
|
513
|
-
local
|
|
514
|
-
local
|
|
515
|
-
local
|
|
516
|
-
|
|
572
|
+
local ____startItemCooldown_10 = startItemCooldown
|
|
573
|
+
local ____item_handle_9 = item.handle
|
|
574
|
+
local ____opt_7 = item.owner
|
|
575
|
+
____startItemCooldown_10(____item_handle_9, ____opt_7 and ____opt_7.handle, cooldownRemaining)
|
|
517
576
|
end
|
|
518
577
|
},
|
|
519
578
|
true
|
|
@@ -20,6 +20,7 @@ local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slo
|
|
|
20
20
|
local unitAddItemToSlot = ____add_2Ditem_2Dto_2Dslot.unitAddItemToSlot
|
|
21
21
|
local isItemOwned = IsItemOwned
|
|
22
22
|
local isItemPowerup = IsItemPowerup
|
|
23
|
+
local getItemAbility = BlzGetItemAbility
|
|
23
24
|
local getItemX = GetItemX
|
|
24
25
|
local getItemY = GetItemY
|
|
25
26
|
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
@@ -31,6 +32,8 @@ local unitAddItem = UnitAddItem
|
|
|
31
32
|
local unitRemoveItem = UnitRemoveItem
|
|
32
33
|
local unitUseItem = UnitUseItem
|
|
33
34
|
local unitResetCooldown = UnitResetCooldown
|
|
35
|
+
local unitInventorySize = UnitInventorySize
|
|
36
|
+
local unitItemInSlot = UnitItemInSlot
|
|
34
37
|
local COOLDOWN_STARTER_ABILITY_TYPE_ID = compiletime(function()
|
|
35
38
|
if not currentMap then
|
|
36
39
|
return 0
|
|
@@ -55,22 +58,24 @@ local COOLDOWN_STARTER_ITEM_TYPE_ID = compiletime(function()
|
|
|
55
58
|
itemType.activelyUsed = true
|
|
56
59
|
return itemType.id
|
|
57
60
|
end)
|
|
58
|
-
|
|
61
|
+
---
|
|
62
|
+
-- @internal For use by internal systems only.
|
|
63
|
+
____exports.itemAbilityDummy = assert(CreateUnit(
|
|
59
64
|
Player.neutralVictim.handle,
|
|
60
65
|
dummyUnitId,
|
|
61
66
|
0,
|
|
62
67
|
0,
|
|
63
68
|
270
|
|
64
69
|
))
|
|
65
|
-
local cooldownStarterItem = UnitAddItemById(
|
|
66
|
-
local cooldownStarterAbility =
|
|
67
|
-
ShowUnit(
|
|
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)
|
|
68
73
|
local function startItemCooldownInternal(handle, cooldown)
|
|
69
74
|
local cooldownGroup = getItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP)
|
|
70
75
|
setItemIntegerField(handle, ITEM_IF_COOLDOWN_GROUP, COOLDOWN_STARTER_ABILITY_TYPE_ID)
|
|
71
76
|
setAbilityRealLevelField(cooldownStarterAbility, ABILITY_RLF_COOLDOWN, 0, cooldown)
|
|
72
|
-
unitResetCooldown(
|
|
73
|
-
unitUseItem(
|
|
77
|
+
unitResetCooldown(____exports.itemAbilityDummy)
|
|
78
|
+
unitUseItem(____exports.itemAbilityDummy, cooldownStarterItem)
|
|
74
79
|
Timer:run(restoreCooldownGroup, handle, cooldownGroup)
|
|
75
80
|
end
|
|
76
81
|
restoreCooldownGroup = function(handle, cooldownGroup)
|
|
@@ -85,7 +90,7 @@ ____exports.startItemCooldown = function(handle, owner, cooldown)
|
|
|
85
90
|
end
|
|
86
91
|
---
|
|
87
92
|
-- @internal For use by internal systems only.
|
|
88
|
-
____exports.abilityActionDummy =
|
|
93
|
+
____exports.abilityActionDummy = ____exports.itemAbilityDummy
|
|
89
94
|
---
|
|
90
95
|
-- @internal For use by internal systems only.
|
|
91
96
|
____exports.doAbilityAction = function(handle, action, ...)
|
|
@@ -104,11 +109,11 @@ ____exports.doAbilityAction = function(handle, action, ...)
|
|
|
104
109
|
end
|
|
105
110
|
x = getItemX(handle)
|
|
106
111
|
y = getItemY(handle)
|
|
107
|
-
unitAddItem(
|
|
112
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
108
113
|
end
|
|
109
114
|
local result = action(handle, ...)
|
|
110
115
|
if not isOwned then
|
|
111
|
-
unitRemoveItem(
|
|
116
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
112
117
|
setItemPosition(handle, x, y)
|
|
113
118
|
if isPowerup then
|
|
114
119
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
@@ -139,9 +144,9 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
139
144
|
isPowerup = true
|
|
140
145
|
end
|
|
141
146
|
unitRemoveItem(owner, handle)
|
|
142
|
-
unitAddItem(
|
|
147
|
+
unitAddItem(____exports.itemAbilityDummy, handle)
|
|
143
148
|
local result = action(handle, ...)
|
|
144
|
-
unitRemoveItem(
|
|
149
|
+
unitRemoveItem(____exports.itemAbilityDummy, handle)
|
|
145
150
|
unitAddItemToSlot(owner, handle, slot)
|
|
146
151
|
if isPowerup then
|
|
147
152
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
@@ -151,4 +156,51 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
151
156
|
end
|
|
152
157
|
return result
|
|
153
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
|
|
204
|
+
return result
|
|
205
|
+
end
|
|
154
206
|
return ____exports
|
|
@@ -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
|
|
@@ -5,13 +5,26 @@ local ____item = require("engine.internal.item")
|
|
|
5
5
|
local Item = ____item.Item
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
|
+
require("engine.internal.unit.equipment")
|
|
8
9
|
local ownerByItem = setmetatable({}, {__mode = "kv"})
|
|
9
|
-
Unit.itemPickedUpEvent:addListener(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
Unit.itemPickedUpEvent:addListener(
|
|
11
|
+
4,
|
|
12
|
+
function(unit, item)
|
|
13
|
+
ownerByItem[item] = unit
|
|
14
|
+
end
|
|
15
|
+
)
|
|
16
|
+
Unit.itemEquippedEvent:addListener(
|
|
17
|
+
4,
|
|
18
|
+
function(unit, item)
|
|
19
|
+
ownerByItem[item] = unit
|
|
20
|
+
end
|
|
21
|
+
)
|
|
22
|
+
Unit.itemDroppedEvent:addListener(
|
|
23
|
+
4,
|
|
24
|
+
function(unit, item)
|
|
25
|
+
ownerByItem[item] = nil
|
|
26
|
+
end
|
|
27
|
+
)
|
|
15
28
|
__TS__ObjectDefineProperty(
|
|
16
29
|
Item.prototype,
|
|
17
30
|
"owner",
|
|
@@ -2,22 +2,34 @@
|
|
|
2
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Color } from "../../core/types/color";
|
|
4
4
|
import { Event } from "../../event";
|
|
5
|
+
import { PlayerColor } from "../../core/types/playerColor";
|
|
6
|
+
import { EquipmentType } from "../object-data/auxiliary/equipment-type";
|
|
7
|
+
import { ItemTag } from "../object-data/auxiliary/item-tag";
|
|
5
8
|
import { ReadonlyRect } from "../../core/types/rect";
|
|
6
9
|
import { ItemAbility } from "./ability";
|
|
7
10
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
11
|
+
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
8
12
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
9
|
-
export declare const addAndGetAbility: (handle: jitem, abilityTypeId: AbilityTypeId) => jability | null;
|
|
10
13
|
declare const enum ItemPropertyKey {
|
|
11
14
|
ABILITIES = 100,
|
|
12
|
-
|
|
15
|
+
DEATH_TRIGGER = 101,
|
|
16
|
+
COLOR = 102
|
|
13
17
|
}
|
|
14
18
|
export declare class Item extends Handle<jitem> {
|
|
15
19
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
-
private readonly [ItemPropertyKey.
|
|
20
|
+
private readonly [ItemPropertyKey.DEATH_TRIGGER];
|
|
21
|
+
private [ItemPropertyKey.COLOR]?;
|
|
17
22
|
constructor(handle: jitem);
|
|
18
23
|
protected onDestroy(): HandleDestructor;
|
|
19
24
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
20
|
-
get
|
|
25
|
+
get isEquipped(): boolean;
|
|
26
|
+
get isInBag(): boolean;
|
|
27
|
+
get equipmentType(): EquipmentType;
|
|
28
|
+
get tag(): ItemTag;
|
|
29
|
+
get color(): PlayerColor;
|
|
30
|
+
set color(color: PlayerColor);
|
|
31
|
+
static getRandomTypeId(level: number, equipmentType?: EquipmentType, tag?: ItemTag, itemType?: jitemtype): ItemTypeId | undefined;
|
|
32
|
+
get typeId(): ItemTypeId;
|
|
21
33
|
set skinId(v: number);
|
|
22
34
|
get skinId(): number;
|
|
23
35
|
set name(v: string);
|
|
@@ -30,22 +42,18 @@ export declare class Item extends Handle<jitem> {
|
|
|
30
42
|
get extendedTooltip(): string;
|
|
31
43
|
set iconPath(v: string);
|
|
32
44
|
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;
|
|
45
|
+
set dropsOnDeath(dropsOnDeath: boolean);
|
|
46
|
+
get dropsOnDeath(): boolean;
|
|
47
|
+
set canBeDropped(canBeDropped: boolean);
|
|
48
|
+
get canBeDropped(): boolean;
|
|
49
|
+
set perishes(perishes: boolean);
|
|
50
|
+
get perishes(): boolean;
|
|
51
|
+
set isPowerUp(isPowerUp: boolean);
|
|
52
|
+
get isPowerUp(): boolean;
|
|
43
53
|
get isAlive(): boolean;
|
|
44
54
|
get isDead(): boolean;
|
|
45
55
|
set isInvulnerable(isInvulnerable: boolean);
|
|
46
56
|
get isInvulnerable(): boolean;
|
|
47
|
-
set usable(v: boolean);
|
|
48
|
-
get usable(): boolean;
|
|
49
57
|
set visible(v: boolean);
|
|
50
58
|
get visible(): boolean;
|
|
51
59
|
set level(v: number);
|
|
@@ -73,6 +81,8 @@ export declare class Item extends Handle<jitem> {
|
|
|
73
81
|
set position(v: Vec2);
|
|
74
82
|
set charges(v: number);
|
|
75
83
|
get charges(): number;
|
|
84
|
+
consumeCharge(): boolean;
|
|
85
|
+
consumeCharges(count: number): boolean;
|
|
76
86
|
addAbility(abilityTypeId: AbilityTypeId): ItemAbility | undefined;
|
|
77
87
|
removeAbility(abilityTypeId: AbilityTypeId): boolean;
|
|
78
88
|
hasAbility(abilityTypeId: AbilityTypeId): boolean;
|
|
@@ -82,5 +92,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
82
92
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
83
93
|
static get onCreate(): Event<[Item]>;
|
|
84
94
|
static get destroyEvent(): Event<[Item]>;
|
|
95
|
+
static readonly deathEvent: Event<[Item]>;
|
|
96
|
+
static readonly chargesChangedEvent: Event<[Item]>;
|
|
85
97
|
}
|
|
86
98
|
export {};
|