warscript 0.0.1-dev.539675b → 0.0.1-dev.54c2a71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +1 -0
- package/attributes.lua +9 -0
- package/core/dummy.lua +4 -2
- package/core/types/effect.d.ts +11 -1
- package/core/types/effect.lua +43 -77
- package/core/types/frame.d.ts +16 -2
- package/core/types/frame.lua +141 -77
- 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 +14 -9
- package/core/types/tileCell.d.ts +18 -3
- package/core/types/tileCell.lua +108 -0
- package/core/types/timer.d.ts +3 -1
- package/core/types/timer.lua +27 -2
- package/core/types/unit.d.ts +5 -0
- package/core/types/unit.lua +5 -0
- package/core/util.d.ts +3 -1
- package/core/util.lua +109 -3
- package/decl/native.d.ts +711 -11
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/ability-type-extended-tooltip.d.ts +8 -0
- package/engine/ability-type-extended-tooltip.lua +44 -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/apply-unit-behavior.lua +5 -0
- package/engine/behaviour/ability/damage.d.ts +4 -0
- package/engine/behaviour/ability/damage.lua +19 -15
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +7 -5
- package/engine/behaviour/ability/on-command-impact.d.ts +1 -0
- package/engine/behaviour/ability/on-command-impact.lua +1 -0
- 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 +13 -6
- package/engine/behaviour/ability.lua +62 -16
- 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 +27 -5
- package/engine/behaviour/unit.lua +181 -27
- 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 +10 -1
- package/engine/internal/ability.lua +99 -47
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item/owner-cache.d.ts +5 -0
- package/engine/internal/item/owner-cache.lua +4 -0
- package/engine/internal/item+owner.d.ts +2 -0
- package/engine/internal/item+owner.lua +37 -8
- package/engine/internal/item.d.ts +27 -14
- package/engine/internal/item.lua +185 -82
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- 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/misc/unit-ability-level-natives.d.ts +2 -0
- package/engine/internal/misc/unit-ability-level-natives.lua +12 -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/health-regeneration-rate-increase.d.ts +2 -0
- package/engine/internal/object-data/health-regeneration-rate-increase.lua +48 -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 -5
- package/engine/internal/unit/ability.lua +96 -21
- package/engine/internal/unit/add-item-to-slot-init.lua +3 -14
- package/engine/internal/unit/add-item-to-slot.lua +53 -12
- 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/bonus.d.ts +14 -0
- package/engine/internal/unit/bonus.lua +102 -8
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment-inventory.d.ts +44 -0
- package/engine/internal/unit/equipment-inventory.lua +233 -0
- package/engine/internal/unit/expiration-timer.lua +1 -1
- package/engine/internal/unit/extended-inventory.d.ts +25 -0
- package/engine/internal/unit/extended-inventory.lua +99 -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.lua +10 -1
- 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} +7 -3
- package/engine/internal/unit/inventory.lua +87 -0
- package/engine/internal/unit/item-container.d.ts +25 -0
- package/engine/internal/unit/item-container.lua +11 -0
- package/engine/internal/unit/item-order-events.d.ts +17 -0
- package/engine/internal/unit/item-order-events.lua +67 -0
- package/engine/internal/unit/item-slot.d.ts +27 -0
- package/engine/internal/unit/item-slot.lua +92 -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.d.ts +2 -1
- package/engine/internal/unit+ability.lua +73 -3
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit+rally.lua +9 -31
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit-missile-launch.lua +65 -27
- package/engine/internal/unit.d.ts +21 -34
- package/engine/internal/unit.lua +254 -327
- package/engine/local-client.d.ts +28 -0
- package/engine/local-client.lua +324 -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/attachment-preset.d.ts +7 -0
- package/engine/object-data/auxiliary/attachment-preset.lua +7 -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 +12 -0
- package/engine/object-data/auxiliary/equipment-type.lua +26 -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-class.d.ts +11 -0
- package/engine/object-data/auxiliary/item-class.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/order-type.d.ts +939 -0
- package/engine/object-data/auxiliary/order-type.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
- 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/aura-of-blight.d.ts +13 -0
- package/engine/object-data/entry/ability-type/aura-of-blight.lua +39 -0
- 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/blank-passive-with-cooldown.d.ts +23 -0
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +4 -0
- package/engine/object-data/entry/ability-type/blank-passive.lua +27 -7
- package/engine/object-data/entry/ability-type/breath-of-fire.d.ts +11 -0
- package/engine/object-data/entry/ability-type/breath-of-fire.lua +27 -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/exhume-corpses.d.ts +14 -0
- package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
- package/engine/object-data/entry/ability-type/firebolt.d.ts +7 -0
- package/engine/object-data/entry/ability-type/firebolt.lua +13 -0
- package/engine/object-data/entry/ability-type/flame-strike.d.ts +25 -0
- package/engine/object-data/entry/ability-type/flame-strike.lua +92 -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/healing-ward-aura.d.ts +13 -0
- package/engine/object-data/entry/ability-type/healing-ward-aura.lua +39 -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/item-life-regeneration.d.ts +10 -0
- package/engine/object-data/entry/ability-type/item-life-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/life-drain.d.ts +37 -0
- package/engine/object-data/entry/ability-type/life-drain.lua +144 -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/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/rain-of-fire.d.ts +7 -0
- package/engine/object-data/entry/ability-type/rain-of-fire.lua +13 -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/soul-burn.d.ts +22 -0
- package/engine/object-data/entry/ability-type/soul-burn.lua +79 -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 +31 -6
- package/engine/object-data/entry/ability-type.lua +288 -12
- package/engine/object-data/entry/buff-type/applicable.lua +113 -109
- package/engine/object-data/entry/buff-type.d.ts +6 -2
- package/engine/object-data/entry/buff-type.lua +26 -0
- 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 +18 -3
- package/engine/object-data/entry/item-type.lua +84 -0
- package/engine/object-data/entry/lightning-type.d.ts +6 -8
- package/engine/object-data/entry/lightning-type.lua +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +72 -4
- package/engine/object-data/entry/unit-type.lua +503 -53
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +6 -1
- package/engine/object-data/entry.lua +8 -0
- package/engine/object-field/ability.d.ts +3 -3
- 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 +31 -5
- package/engine/object-field/unit.lua +95 -0
- package/engine/object-field.d.ts +12 -4
- package/engine/object-field.lua +273 -126
- 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 +45 -0
- package/engine/standard/entries/buff-type.lua +43 -0
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/lightning-type.d.ts +42 -15
- package/engine/standard/entries/lightning-type.lua +0 -14
- 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 +26 -3
- package/engine/text-tag.lua +217 -11
- package/engine/unit.d.ts +11 -1
- package/engine/unit.lua +11 -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 -9
- 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 +8 -1
- package/utility/arrays.lua +25 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +4 -1
- package/utility/linked-set.lua +46 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -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 -26
- package/core/types/order.lua +0 -65
- package/engine/internal/unit/item.lua +0 -78
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/frame-coordinates.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/unit.lua
CHANGED
|
@@ -7,10 +7,10 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
8
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
9
9
|
local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
|
|
10
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
10
11
|
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
11
12
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
12
13
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
13
|
-
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
14
14
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
15
15
|
local Set = ____lualib.Set
|
|
16
16
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
@@ -47,12 +47,10 @@ local checkNotNull = ____preconditions.checkNotNull
|
|
|
47
47
|
local ____constants = require("engine.constants")
|
|
48
48
|
local HEALTH_REGENERATION_RATE_BONUS_PER_STRENGTH_POINT = ____constants.HEALTH_REGENERATION_RATE_BONUS_PER_STRENGTH_POINT
|
|
49
49
|
local MANA_REGENERATION_RATE_BONUS_PER_INTELLIGENCE_POINT = ____constants.MANA_REGENERATION_RATE_BONUS_PER_INTELLIGENCE_POINT
|
|
50
|
-
local ____arrays = require("utility.arrays")
|
|
51
|
-
local forEach = ____arrays.forEach
|
|
52
|
-
local ____math = require("math")
|
|
53
|
-
local min = ____math.min
|
|
54
50
|
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
-
local
|
|
51
|
+
local isItemIgnoredInEvents = ____ignore_2Devents_2Ditems.isItemIgnoredInEvents
|
|
52
|
+
local ____owner_2Dcache = require("engine.internal.item.owner-cache")
|
|
53
|
+
local ownerByItem = ____owner_2Dcache.ownerByItem
|
|
56
54
|
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
55
|
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
56
|
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
@@ -60,6 +58,12 @@ local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage
|
|
|
60
58
|
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
59
|
local ____attributes = require("attributes")
|
|
62
60
|
local isAttribute = ____attributes.isAttribute
|
|
61
|
+
local ____ability = require("engine.internal.item.ability")
|
|
62
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
63
|
+
local ____synchronization = require("engine.synchronization")
|
|
64
|
+
local synchronizer = ____synchronization.synchronizer
|
|
65
|
+
local ____linked_2Dmap = require("utility.linked-map")
|
|
66
|
+
local LinkedMap = ____linked_2Dmap.LinkedMap
|
|
63
67
|
local match = string.match
|
|
64
68
|
local ____tostring = _G.tostring
|
|
65
69
|
local setUnitAnimation = SetUnitAnimation
|
|
@@ -69,16 +73,12 @@ local getUnitRealField = BlzGetUnitRealField
|
|
|
69
73
|
local getHeroStr = GetHeroStr
|
|
70
74
|
local getHeroAgi = GetHeroAgi
|
|
71
75
|
local getHeroInt = GetHeroInt
|
|
72
|
-
local setHeroStr = SetHeroStr
|
|
73
|
-
local setHeroAgi = SetHeroAgi
|
|
74
|
-
local setHeroInt = SetHeroInt
|
|
75
76
|
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
76
77
|
local getUnitStringField = BlzGetUnitStringField
|
|
77
78
|
local setUnitIntegerField = BlzSetUnitIntegerField
|
|
78
79
|
local setUnitRealField = BlzSetUnitRealField
|
|
79
80
|
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
80
81
|
local setUnitStringField = BlzSetUnitStringField
|
|
81
|
-
local setUnitScale = SetUnitScale
|
|
82
82
|
local setUnitPosition = SetUnitPosition
|
|
83
83
|
local setUnitTimeScale = SetUnitTimeScale
|
|
84
84
|
local getHandleId = GetHandleId
|
|
@@ -106,7 +106,6 @@ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
|
106
106
|
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
107
107
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
108
108
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
109
|
-
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
110
109
|
local isUnitInvisible = IsUnitInvisible
|
|
111
110
|
local isUnitVisible = IsUnitVisible
|
|
112
111
|
local getUnitX = GetUnitX
|
|
@@ -123,10 +122,6 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
123
122
|
local getIssuedOrderId = GetIssuedOrderId
|
|
124
123
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
125
124
|
local unitAlive = UnitAlive
|
|
126
|
-
local unitAddType = UnitAddType
|
|
127
|
-
local unitRemoveType = UnitRemoveType
|
|
128
|
-
local isUnitIllusion = IsUnitIllusion
|
|
129
|
-
local isUnitType = IsUnitType
|
|
130
125
|
local isUnitAlly = IsUnitAlly
|
|
131
126
|
local isUnitEnemy = IsUnitEnemy
|
|
132
127
|
local getOwningPlayer = GetOwningPlayer
|
|
@@ -386,15 +381,27 @@ local modifiers = {
|
|
|
386
381
|
end,
|
|
387
382
|
armor = function(unit, value)
|
|
388
383
|
if UnitAddAbility(unit, armorBonusAbilityId) then
|
|
389
|
-
assert(
|
|
384
|
+
assert(
|
|
385
|
+
UnitMakeAbilityPermanent(unit, true, armorBonusAbilityId),
|
|
386
|
+
"armor bonus ability must be made permanent",
|
|
387
|
+
unit
|
|
388
|
+
)
|
|
390
389
|
end
|
|
391
|
-
local ability = assert(
|
|
392
|
-
|
|
393
|
-
ability,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
390
|
+
local ability = assert(
|
|
391
|
+
BlzGetUnitAbility(unit, armorBonusAbilityId),
|
|
392
|
+
"armor bonus ability must be existing",
|
|
393
|
+
unit
|
|
394
|
+
)
|
|
395
|
+
assert(
|
|
396
|
+
BlzSetAbilityRealLevelField(
|
|
397
|
+
ability,
|
|
398
|
+
armorBonusField,
|
|
399
|
+
0,
|
|
400
|
+
BlzGetAbilityRealLevelField(ability, armorBonusField, 0) + value
|
|
401
|
+
),
|
|
402
|
+
"armor bonus ability field must be set",
|
|
403
|
+
unit
|
|
404
|
+
)
|
|
398
405
|
end
|
|
399
406
|
}
|
|
400
407
|
local getters = {
|
|
@@ -412,6 +419,19 @@ function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
|
412
419
|
self.unit = unit
|
|
413
420
|
self.index = index
|
|
414
421
|
end
|
|
422
|
+
__TS__SetDescriptor(
|
|
423
|
+
UnitWeapon.prototype,
|
|
424
|
+
"isEnabled",
|
|
425
|
+
{
|
|
426
|
+
get = function(self)
|
|
427
|
+
return BlzGetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index)
|
|
428
|
+
end,
|
|
429
|
+
set = function(self, isEnabled)
|
|
430
|
+
BlzSetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index, isEnabled)
|
|
431
|
+
end
|
|
432
|
+
},
|
|
433
|
+
true
|
|
434
|
+
)
|
|
415
435
|
__TS__SetDescriptor(
|
|
416
436
|
UnitWeapon.prototype,
|
|
417
437
|
"cooldown",
|
|
@@ -570,8 +590,6 @@ __TS__SetDescriptor(
|
|
|
570
590
|
},
|
|
571
591
|
true
|
|
572
592
|
)
|
|
573
|
-
local unitInventorySize = UnitInventorySize
|
|
574
|
-
local unitItemInSlot = UnitItemInSlot
|
|
575
593
|
local getItemAbility = BlzGetItemAbility
|
|
576
594
|
local getUnitAbility = BlzGetUnitAbility
|
|
577
595
|
local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
|
|
@@ -589,8 +607,8 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
589
607
|
____exports.Unit:of(unit)
|
|
590
608
|
)
|
|
591
609
|
end
|
|
592
|
-
for i = 0,
|
|
593
|
-
local item =
|
|
610
|
+
for i = 0, UnitInventorySize(unit) - 1 do
|
|
611
|
+
local item = UnitItemInSlot(unit, i)
|
|
594
612
|
if getItemAbility(item, abilityId) == ability then
|
|
595
613
|
return ItemAbility:of(
|
|
596
614
|
ability,
|
|
@@ -635,26 +653,30 @@ local fieldSetters = {
|
|
|
635
653
|
}
|
|
636
654
|
local dummies = {}
|
|
637
655
|
for ____, player in ipairs(Player.all) do
|
|
638
|
-
local dummy = assert(
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
656
|
+
local dummy = assert(
|
|
657
|
+
createUnit(
|
|
658
|
+
player.handle,
|
|
659
|
+
dummyUnitId,
|
|
660
|
+
0,
|
|
661
|
+
0,
|
|
662
|
+
270
|
|
663
|
+
),
|
|
664
|
+
"dummy must be created",
|
|
665
|
+
player
|
|
666
|
+
)
|
|
645
667
|
ShowUnit(dummy, false)
|
|
646
668
|
dummies[player] = dummy
|
|
647
669
|
end
|
|
648
670
|
local function delayHealthChecksCallback(unit)
|
|
649
|
-
local counter = (unit[
|
|
671
|
+
local counter = (unit[104] or 0) - 1
|
|
650
672
|
if counter ~= 0 then
|
|
651
|
-
unit[
|
|
673
|
+
unit[104] = counter
|
|
652
674
|
return
|
|
653
675
|
end
|
|
654
|
-
unit[
|
|
655
|
-
local healthBonus = unit[
|
|
676
|
+
unit[104] = nil
|
|
677
|
+
local healthBonus = unit[105]
|
|
656
678
|
if healthBonus ~= nil then
|
|
657
|
-
unit[
|
|
679
|
+
unit[105] = nil
|
|
658
680
|
local handle = unit.handle
|
|
659
681
|
BlzSetUnitMaxHP(
|
|
660
682
|
handle,
|
|
@@ -665,51 +687,76 @@ end
|
|
|
665
687
|
local nextSyncId = 1
|
|
666
688
|
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
667
689
|
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
690
|
+
local function addAbility(unit, abilityTypeId)
|
|
691
|
+
local ____unitAddAbility_result_0
|
|
692
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
693
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
694
|
+
else
|
|
695
|
+
____unitAddAbility_result_0 = nil
|
|
696
|
+
end
|
|
697
|
+
return ____unitAddAbility_result_0
|
|
698
|
+
end
|
|
668
699
|
____exports.Unit = __TS__Class()
|
|
669
700
|
local Unit = ____exports.Unit
|
|
670
701
|
Unit.name = "Unit"
|
|
671
702
|
__TS__ClassExtends(Unit, Handle)
|
|
672
703
|
function Unit.prototype.____constructor(self, handle)
|
|
673
704
|
Handle.prototype.____constructor(self, handle)
|
|
674
|
-
local
|
|
675
|
-
nextSyncId =
|
|
676
|
-
self.syncId =
|
|
705
|
+
local ____nextSyncId_1 = nextSyncId
|
|
706
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
707
|
+
self.syncId = ____nextSyncId_1
|
|
677
708
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
678
|
-
assert(
|
|
679
|
-
|
|
709
|
+
assert(
|
|
710
|
+
unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId),
|
|
711
|
+
"leave detection ability must be added",
|
|
712
|
+
self
|
|
713
|
+
)
|
|
714
|
+
assert(
|
|
715
|
+
unitAddAbility(handle, morphDetectAbilityId),
|
|
716
|
+
"morph detection ability must be added",
|
|
717
|
+
self
|
|
718
|
+
)
|
|
680
719
|
if unitAddAbility(
|
|
681
720
|
handle,
|
|
682
721
|
fourCC("Amrf")
|
|
683
722
|
) then
|
|
684
|
-
assert(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
723
|
+
assert(
|
|
724
|
+
unitRemoveAbility(
|
|
725
|
+
handle,
|
|
726
|
+
fourCC("Amrf")
|
|
727
|
+
),
|
|
728
|
+
"fly ability must be removed after addition",
|
|
729
|
+
self
|
|
730
|
+
)
|
|
688
731
|
end
|
|
689
732
|
unitBySyncId[self.syncId] = self
|
|
690
733
|
local ____ = self.abilities
|
|
691
734
|
end
|
|
692
|
-
function Unit.prototype.getEvent(self,
|
|
693
|
-
self.events = self.events or (
|
|
694
|
-
local eventId = GetHandleId(
|
|
695
|
-
|
|
696
|
-
|
|
735
|
+
function Unit.prototype.getEvent(self, jevent, collector)
|
|
736
|
+
self.events = self.events or __TS__New(LinkedMap)
|
|
737
|
+
local eventId = GetHandleId(jevent)
|
|
738
|
+
local event = self.events:get(eventId)
|
|
739
|
+
if event == nil then
|
|
740
|
+
event = __TS__New(
|
|
697
741
|
TriggerEvent,
|
|
698
742
|
function(trigger)
|
|
699
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
743
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
700
744
|
end,
|
|
701
745
|
collector or (function() return {} end)
|
|
702
746
|
)
|
|
747
|
+
self.events:put(eventId, event)
|
|
703
748
|
end
|
|
704
|
-
return
|
|
749
|
+
return event
|
|
750
|
+
end
|
|
751
|
+
function Unit.prototype.saveData(self)
|
|
752
|
+
local handle = self.handle
|
|
753
|
+
self[108] = self[108] or getUnitX(handle)
|
|
754
|
+
self[109] = self[109] or getUnitY(handle)
|
|
755
|
+
self._owner = self._owner or Player:of(getOwningPlayer(handle))
|
|
705
756
|
end
|
|
706
757
|
function Unit.prototype.onDestroy(self)
|
|
707
758
|
local handle = self.handle
|
|
708
|
-
self
|
|
709
|
-
self[108] = getUnitY(handle)
|
|
710
|
-
if not self._owner then
|
|
711
|
-
self._owner = Player:of(getOwningPlayer(handle))
|
|
712
|
-
end
|
|
759
|
+
self:saveData()
|
|
713
760
|
local abilities = self.abilities
|
|
714
761
|
for ____, ability in ipairs(abilities) do
|
|
715
762
|
ability:destroy()
|
|
@@ -727,7 +774,9 @@ function Unit.prototype.onDestroy(self)
|
|
|
727
774
|
end
|
|
728
775
|
local eventsToDestroy = self._eventsToDestroy
|
|
729
776
|
if eventsToDestroy ~= nil then
|
|
730
|
-
|
|
777
|
+
for ____, event in ipairs(eventsToDestroy) do
|
|
778
|
+
event:destroy()
|
|
779
|
+
end
|
|
731
780
|
end
|
|
732
781
|
if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
|
|
733
782
|
unitRemoveAbility(handle, leaveDetectAbilityId)
|
|
@@ -745,7 +794,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
|
|
|
745
794
|
self._attackHandlers = handlers
|
|
746
795
|
if #handlers == 1 then
|
|
747
796
|
local handle = self.handle
|
|
748
|
-
assert(
|
|
797
|
+
assert(
|
|
798
|
+
unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
|
|
799
|
+
"attack handler ability must be added",
|
|
800
|
+
self
|
|
801
|
+
)
|
|
749
802
|
end
|
|
750
803
|
return handler
|
|
751
804
|
end
|
|
@@ -774,17 +827,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
774
827
|
end}
|
|
775
828
|
end
|
|
776
829
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
777
|
-
local
|
|
778
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
830
|
+
local ____combatClassification_2 = combatClassification
|
|
831
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
779
832
|
end
|
|
780
833
|
function Unit.prototype.addClassification(self, classification)
|
|
781
|
-
return
|
|
834
|
+
return UnitAddType(self.handle, classification)
|
|
782
835
|
end
|
|
783
836
|
function Unit.prototype.removeClassification(self, classification)
|
|
784
|
-
return
|
|
837
|
+
return UnitRemoveType(self.handle, classification)
|
|
785
838
|
end
|
|
786
839
|
function Unit.prototype.hasClassification(self, classification)
|
|
787
|
-
return
|
|
840
|
+
return IsUnitType(self.handle, classification)
|
|
788
841
|
end
|
|
789
842
|
function Unit.prototype.isVisibleTo(self, player)
|
|
790
843
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -793,13 +846,19 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
793
846
|
return isUnitInvisible(self.handle, player.handle)
|
|
794
847
|
end
|
|
795
848
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
796
|
-
local
|
|
849
|
+
local ____temp_4
|
|
797
850
|
if type(x) == "number" then
|
|
798
|
-
|
|
851
|
+
____temp_4 = isUnitInRangeXY(self.handle, x, y, range)
|
|
799
852
|
else
|
|
800
|
-
|
|
853
|
+
local ____temp_3
|
|
854
|
+
if __TS__InstanceOf(x, ____exports.Unit) then
|
|
855
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
856
|
+
else
|
|
857
|
+
____temp_3 = isUnitInRangeXY(self.handle, x.x, x.y, range)
|
|
858
|
+
end
|
|
859
|
+
____temp_4 = ____temp_3
|
|
801
860
|
end
|
|
802
|
-
return
|
|
861
|
+
return ____temp_4
|
|
803
862
|
end
|
|
804
863
|
function Unit.prototype.isAllyOf(self, unit)
|
|
805
864
|
return isUnitAlly(
|
|
@@ -829,16 +888,18 @@ function Unit.prototype.queueAnimation(self, animation)
|
|
|
829
888
|
QueueUnitAnimation(self.handle, animation)
|
|
830
889
|
end
|
|
831
890
|
function Unit.prototype.chooseWeapon(self, target)
|
|
832
|
-
|
|
833
|
-
|
|
891
|
+
local firstWeapon = self.firstWeapon
|
|
892
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
893
|
+
return firstWeapon
|
|
834
894
|
end
|
|
835
|
-
|
|
836
|
-
|
|
895
|
+
local secondWeapon = self.secondWeapon
|
|
896
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
897
|
+
return secondWeapon
|
|
837
898
|
end
|
|
838
899
|
return nil
|
|
839
900
|
end
|
|
840
901
|
function Unit.prototype.delayHealthChecks(self)
|
|
841
|
-
self[
|
|
902
|
+
self[104] = (self[104] or 0) + 1
|
|
842
903
|
Timer:run(delayHealthChecksCallback, self)
|
|
843
904
|
end
|
|
844
905
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -855,14 +916,14 @@ function Unit.prototype.kill(self)
|
|
|
855
916
|
killUnit(self.handle)
|
|
856
917
|
end
|
|
857
918
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
858
|
-
local
|
|
859
|
-
local
|
|
860
|
-
local
|
|
861
|
-
if
|
|
862
|
-
|
|
919
|
+
local ____ReviveHero_7 = ReviveHero
|
|
920
|
+
local ____array_6 = __TS__SparseArrayNew(self.handle, x, y)
|
|
921
|
+
local ____doEffect_5 = doEffect
|
|
922
|
+
if ____doEffect_5 == nil then
|
|
923
|
+
____doEffect_5 = false
|
|
863
924
|
end
|
|
864
|
-
__TS__SparseArrayPush(
|
|
865
|
-
|
|
925
|
+
__TS__SparseArrayPush(____array_6, ____doEffect_5)
|
|
926
|
+
____ReviveHero_7(__TS__SparseArraySpread(____array_6))
|
|
866
927
|
end
|
|
867
928
|
function Unit.prototype.healTarget(self, target, amount)
|
|
868
929
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -902,20 +963,19 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
902
963
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
903
964
|
end
|
|
904
965
|
function Unit.prototype.itemInSlot(self, slot)
|
|
905
|
-
return Item:of(
|
|
966
|
+
return Item:of(UnitItemInSlot(self.handle, slot))
|
|
906
967
|
end
|
|
907
968
|
function Unit.prototype.addAbility(self, abilityId)
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
969
|
+
local ability = UnitAbility:of(
|
|
970
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
971
|
+
abilityId,
|
|
972
|
+
self
|
|
973
|
+
)
|
|
974
|
+
if ability ~= nil then
|
|
914
975
|
local abilities = self.abilities
|
|
915
976
|
abilities[#abilities + 1] = ability
|
|
916
|
-
return ability
|
|
917
977
|
end
|
|
918
|
-
return
|
|
978
|
+
return ability
|
|
919
979
|
end
|
|
920
980
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
921
981
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -929,31 +989,21 @@ end
|
|
|
929
989
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
930
990
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
931
991
|
end
|
|
932
|
-
function Unit.prototype.
|
|
933
|
-
local
|
|
934
|
-
|
|
935
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
936
|
-
return nil
|
|
937
|
-
end
|
|
938
|
-
return UnitAbility:of(
|
|
939
|
-
getUnitAbility(self.handle, abilityId),
|
|
940
|
-
abilityId,
|
|
941
|
-
self
|
|
942
|
-
)
|
|
992
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
993
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
994
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
943
995
|
end
|
|
944
|
-
function Unit.prototype.removeAbility(self,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
end
|
|
996
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
997
|
+
local abilities = self.abilities
|
|
998
|
+
for i = 1, #abilities do
|
|
999
|
+
if abilities[i].typeId == abilityTypeId then
|
|
1000
|
+
local ability = abilities[i]
|
|
1001
|
+
tremove(abilities, i)
|
|
1002
|
+
ability:destroy()
|
|
1003
|
+
return true
|
|
953
1004
|
end
|
|
954
|
-
return true
|
|
955
1005
|
end
|
|
956
|
-
return
|
|
1006
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
957
1007
|
end
|
|
958
1008
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
959
1009
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -967,24 +1017,6 @@ end
|
|
|
967
1017
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
968
1018
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
969
1019
|
end
|
|
970
|
-
function Unit.prototype.interruptMovement(self)
|
|
971
|
-
local handle = self.handle
|
|
972
|
-
unitDisableAbility(
|
|
973
|
-
handle,
|
|
974
|
-
fourCC("Amov"),
|
|
975
|
-
true,
|
|
976
|
-
false
|
|
977
|
-
)
|
|
978
|
-
unitDisableAbility(
|
|
979
|
-
handle,
|
|
980
|
-
fourCC("Amov"),
|
|
981
|
-
false,
|
|
982
|
-
false
|
|
983
|
-
)
|
|
984
|
-
end
|
|
985
|
-
function Unit.prototype.interruptAttack(self)
|
|
986
|
-
unitInterruptAttack(self.handle)
|
|
987
|
-
end
|
|
988
1020
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
989
1021
|
local handle = self.handle
|
|
990
1022
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1055,18 +1087,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1055
1087
|
end
|
|
1056
1088
|
function Unit.prototype.incrementStunCounter(self)
|
|
1057
1089
|
local stunCounter = self[102] or 0
|
|
1058
|
-
if not self[101] or stunCounter >= 0 then
|
|
1090
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1059
1091
|
BlzPauseUnitEx(self.handle, true)
|
|
1060
1092
|
end
|
|
1061
1093
|
self[102] = stunCounter + 1
|
|
1062
1094
|
end
|
|
1063
1095
|
function Unit.prototype.decrementStunCounter(self)
|
|
1064
1096
|
local stunCounter = self[102] or 0
|
|
1065
|
-
if not self[101] or stunCounter >= 1 then
|
|
1097
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1066
1098
|
BlzPauseUnitEx(self.handle, false)
|
|
1067
1099
|
end
|
|
1068
1100
|
self[102] = stunCounter - 1
|
|
1069
1101
|
end
|
|
1102
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1103
|
+
local forceStunCounter = self[103] or 0
|
|
1104
|
+
if forceStunCounter == 0 then
|
|
1105
|
+
local handle = self.handle
|
|
1106
|
+
if not self[101] then
|
|
1107
|
+
for _ = self[102] or 0, -1 do
|
|
1108
|
+
BlzPauseUnitEx(handle, true)
|
|
1109
|
+
end
|
|
1110
|
+
end
|
|
1111
|
+
BlzPauseUnitEx(handle, true)
|
|
1112
|
+
end
|
|
1113
|
+
self[103] = forceStunCounter + 1
|
|
1114
|
+
end
|
|
1115
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1116
|
+
local forceStunCounter = self[103] or 0
|
|
1117
|
+
if forceStunCounter == 1 then
|
|
1118
|
+
local handle = self.handle
|
|
1119
|
+
if not self[101] then
|
|
1120
|
+
for _ = self[102] or 0, -1 do
|
|
1121
|
+
BlzPauseUnitEx(handle, false)
|
|
1122
|
+
end
|
|
1123
|
+
end
|
|
1124
|
+
BlzPauseUnitEx(handle, false)
|
|
1125
|
+
end
|
|
1126
|
+
self[103] = forceStunCounter - 1
|
|
1127
|
+
end
|
|
1070
1128
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1071
1129
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1072
1130
|
owner.handle,
|
|
@@ -1255,7 +1313,7 @@ __TS__SetDescriptor(
|
|
|
1255
1313
|
Unit.prototype,
|
|
1256
1314
|
"isIllusion",
|
|
1257
1315
|
{get = function(self)
|
|
1258
|
-
return
|
|
1316
|
+
return IsUnitIllusion(self.handle)
|
|
1259
1317
|
end},
|
|
1260
1318
|
true
|
|
1261
1319
|
)
|
|
@@ -1263,7 +1321,7 @@ __TS__SetDescriptor(
|
|
|
1263
1321
|
Unit.prototype,
|
|
1264
1322
|
"isStunned",
|
|
1265
1323
|
{get = function(self)
|
|
1266
|
-
return getUnitCurrentOrder(self.handle) ==
|
|
1324
|
+
return getUnitCurrentOrder(self.handle) == 851973
|
|
1267
1325
|
end},
|
|
1268
1326
|
true
|
|
1269
1327
|
)
|
|
@@ -1353,19 +1411,6 @@ __TS__SetDescriptor(
|
|
|
1353
1411
|
},
|
|
1354
1412
|
true
|
|
1355
1413
|
)
|
|
1356
|
-
__TS__SetDescriptor(
|
|
1357
|
-
Unit.prototype,
|
|
1358
|
-
"strengthBase",
|
|
1359
|
-
{
|
|
1360
|
-
get = function(self)
|
|
1361
|
-
return getHeroStr(self.handle, false)
|
|
1362
|
-
end,
|
|
1363
|
-
set = function(self, strengthBase)
|
|
1364
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1365
|
-
end
|
|
1366
|
-
},
|
|
1367
|
-
true
|
|
1368
|
-
)
|
|
1369
1414
|
__TS__SetDescriptor(
|
|
1370
1415
|
Unit.prototype,
|
|
1371
1416
|
"strengthBonus",
|
|
@@ -1383,19 +1428,6 @@ __TS__SetDescriptor(
|
|
|
1383
1428
|
end},
|
|
1384
1429
|
true
|
|
1385
1430
|
)
|
|
1386
|
-
__TS__SetDescriptor(
|
|
1387
|
-
Unit.prototype,
|
|
1388
|
-
"agilityBase",
|
|
1389
|
-
{
|
|
1390
|
-
get = function(self)
|
|
1391
|
-
return getHeroAgi(self.handle, false)
|
|
1392
|
-
end,
|
|
1393
|
-
set = function(self, agilityBase)
|
|
1394
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1395
|
-
end
|
|
1396
|
-
},
|
|
1397
|
-
true
|
|
1398
|
-
)
|
|
1399
1431
|
__TS__SetDescriptor(
|
|
1400
1432
|
Unit.prototype,
|
|
1401
1433
|
"agilityBonus",
|
|
@@ -1413,19 +1445,6 @@ __TS__SetDescriptor(
|
|
|
1413
1445
|
end},
|
|
1414
1446
|
true
|
|
1415
1447
|
)
|
|
1416
|
-
__TS__SetDescriptor(
|
|
1417
|
-
Unit.prototype,
|
|
1418
|
-
"intelligenceBase",
|
|
1419
|
-
{
|
|
1420
|
-
get = function(self)
|
|
1421
|
-
return getHeroInt(self.handle, false)
|
|
1422
|
-
end,
|
|
1423
|
-
set = function(self, intelligenceBase)
|
|
1424
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1425
|
-
end
|
|
1426
|
-
},
|
|
1427
|
-
true
|
|
1428
|
-
)
|
|
1429
1448
|
__TS__SetDescriptor(
|
|
1430
1449
|
Unit.prototype,
|
|
1431
1450
|
"intelligenceBonus",
|
|
@@ -1474,17 +1493,17 @@ __TS__SetDescriptor(
|
|
|
1474
1493
|
"isTeamGlowVisible",
|
|
1475
1494
|
{
|
|
1476
1495
|
get = function(self)
|
|
1477
|
-
return not self[
|
|
1496
|
+
return not self[107]
|
|
1478
1497
|
end,
|
|
1479
1498
|
set = function(self, isTeamGlowVisible)
|
|
1480
1499
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1481
|
-
local
|
|
1500
|
+
local ____temp_8
|
|
1482
1501
|
if not isTeamGlowVisible then
|
|
1483
|
-
|
|
1502
|
+
____temp_8 = true
|
|
1484
1503
|
else
|
|
1485
|
-
|
|
1504
|
+
____temp_8 = nil
|
|
1486
1505
|
end
|
|
1487
|
-
self[
|
|
1506
|
+
self[107] = ____temp_8
|
|
1488
1507
|
end
|
|
1489
1508
|
},
|
|
1490
1509
|
true
|
|
@@ -1494,7 +1513,7 @@ __TS__SetDescriptor(
|
|
|
1494
1513
|
"color",
|
|
1495
1514
|
{set = function(self, color)
|
|
1496
1515
|
SetUnitColor(self.handle, color.handle)
|
|
1497
|
-
if self[
|
|
1516
|
+
if self[107] then
|
|
1498
1517
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1499
1518
|
end
|
|
1500
1519
|
end},
|
|
@@ -1518,14 +1537,14 @@ __TS__SetDescriptor(
|
|
|
1518
1537
|
"maxHealth",
|
|
1519
1538
|
{
|
|
1520
1539
|
get = function(self)
|
|
1521
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1540
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1522
1541
|
end,
|
|
1523
1542
|
set = function(self, maxHealth)
|
|
1524
|
-
if maxHealth < 1 and self[
|
|
1525
|
-
self[
|
|
1543
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1544
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1526
1545
|
maxHealth = 1
|
|
1527
1546
|
end
|
|
1528
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1547
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1529
1548
|
end
|
|
1530
1549
|
},
|
|
1531
1550
|
true
|
|
@@ -1567,10 +1586,10 @@ __TS__SetDescriptor(
|
|
|
1567
1586
|
"health",
|
|
1568
1587
|
{
|
|
1569
1588
|
get = function(self)
|
|
1570
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1589
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1571
1590
|
end,
|
|
1572
1591
|
set = function(self, health)
|
|
1573
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1592
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1574
1593
|
end
|
|
1575
1594
|
},
|
|
1576
1595
|
true
|
|
@@ -1646,25 +1665,12 @@ __TS__SetDescriptor(
|
|
|
1646
1665
|
},
|
|
1647
1666
|
true
|
|
1648
1667
|
)
|
|
1649
|
-
__TS__SetDescriptor(
|
|
1650
|
-
Unit.prototype,
|
|
1651
|
-
"flyHeight",
|
|
1652
|
-
{
|
|
1653
|
-
get = function(self)
|
|
1654
|
-
return getUnitFlyHeight(self.handle)
|
|
1655
|
-
end,
|
|
1656
|
-
set = function(self, v)
|
|
1657
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1658
|
-
end
|
|
1659
|
-
},
|
|
1660
|
-
true
|
|
1661
|
-
)
|
|
1662
1668
|
__TS__SetDescriptor(
|
|
1663
1669
|
Unit.prototype,
|
|
1664
1670
|
"x",
|
|
1665
1671
|
{
|
|
1666
1672
|
get = function(self)
|
|
1667
|
-
return self[
|
|
1673
|
+
return self[108] or getUnitX(self.handle)
|
|
1668
1674
|
end,
|
|
1669
1675
|
set = function(self, v)
|
|
1670
1676
|
SetUnitX(self.handle, v)
|
|
@@ -1677,7 +1683,7 @@ __TS__SetDescriptor(
|
|
|
1677
1683
|
"y",
|
|
1678
1684
|
{
|
|
1679
1685
|
get = function(self)
|
|
1680
|
-
return self[
|
|
1686
|
+
return self[109] or getUnitY(self.handle)
|
|
1681
1687
|
end,
|
|
1682
1688
|
set = function(self, v)
|
|
1683
1689
|
SetUnitY(self.handle, v)
|
|
@@ -1782,14 +1788,18 @@ __TS__SetDescriptor(
|
|
|
1782
1788
|
local handle = self.handle
|
|
1783
1789
|
if isPaused and not IsUnitPaused(handle) then
|
|
1784
1790
|
self[101] = true
|
|
1785
|
-
|
|
1786
|
-
|
|
1791
|
+
if (self[103] or 0) <= 0 then
|
|
1792
|
+
for _ = self[102] or 0, -1 do
|
|
1793
|
+
BlzPauseUnitEx(handle, true)
|
|
1794
|
+
end
|
|
1787
1795
|
end
|
|
1788
1796
|
PauseUnit(handle, true)
|
|
1789
1797
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1790
1798
|
PauseUnit(handle, false)
|
|
1791
|
-
|
|
1792
|
-
|
|
1799
|
+
if (self[103] or 0) <= 0 then
|
|
1800
|
+
for _ = self[102] or 0, -1 do
|
|
1801
|
+
BlzPauseUnitEx(handle, false)
|
|
1802
|
+
end
|
|
1793
1803
|
end
|
|
1794
1804
|
self[101] = nil
|
|
1795
1805
|
end
|
|
@@ -1847,20 +1857,6 @@ __TS__SetDescriptor(
|
|
|
1847
1857
|
},
|
|
1848
1858
|
true
|
|
1849
1859
|
)
|
|
1850
|
-
__TS__SetDescriptor(
|
|
1851
|
-
Unit.prototype,
|
|
1852
|
-
"scale",
|
|
1853
|
-
{
|
|
1854
|
-
get = function(self)
|
|
1855
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1856
|
-
end,
|
|
1857
|
-
set = function(self, v)
|
|
1858
|
-
setUnitScale(self.handle, v, v, v)
|
|
1859
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1860
|
-
end
|
|
1861
|
-
},
|
|
1862
|
-
true
|
|
1863
|
-
)
|
|
1864
1860
|
__TS__SetDescriptor(
|
|
1865
1861
|
Unit.prototype,
|
|
1866
1862
|
"timeScale",
|
|
@@ -1887,7 +1883,7 @@ __TS__SetDescriptor(
|
|
|
1887
1883
|
Unit.prototype,
|
|
1888
1884
|
"pathingCollisionRange",
|
|
1889
1885
|
{get = function(self)
|
|
1890
|
-
return 16 * (min(
|
|
1886
|
+
return 16 * (math.min(
|
|
1891
1887
|
getUnitCollisionSize(self.handle) // 16,
|
|
1892
1888
|
3
|
|
1893
1889
|
) + 1)
|
|
@@ -1997,30 +1993,6 @@ __TS__SetDescriptor(
|
|
|
1997
1993
|
end},
|
|
1998
1994
|
true
|
|
1999
1995
|
)
|
|
2000
|
-
__TS__SetDescriptor(
|
|
2001
|
-
Unit.prototype,
|
|
2002
|
-
"onUnitInRange",
|
|
2003
|
-
{get = function(self)
|
|
2004
|
-
local handle = self.handle
|
|
2005
|
-
local onUnitInRange = setmetatable(
|
|
2006
|
-
{},
|
|
2007
|
-
{__index = function(self, value)
|
|
2008
|
-
local event = __TS__New(
|
|
2009
|
-
TriggerEvent,
|
|
2010
|
-
function(trigger)
|
|
2011
|
-
TriggerRegisterUnitInRangeSimple(trigger, value, handle)
|
|
2012
|
-
end,
|
|
2013
|
-
function() return ____exports.Unit:of(handle) end
|
|
2014
|
-
)
|
|
2015
|
-
rawset(self, value, event)
|
|
2016
|
-
return event
|
|
2017
|
-
end}
|
|
2018
|
-
)
|
|
2019
|
-
rawset(self, "onUnitInRange", onUnitInRange)
|
|
2020
|
-
return onUnitInRange
|
|
2021
|
-
end},
|
|
2022
|
-
true
|
|
2023
|
-
)
|
|
2024
1996
|
__TS__SetDescriptor(
|
|
2025
1997
|
Unit.prototype,
|
|
2026
1998
|
"onManaEqual",
|
|
@@ -2156,6 +2128,11 @@ __TS__SetDescriptor(
|
|
|
2156
2128
|
end},
|
|
2157
2129
|
true
|
|
2158
2130
|
)
|
|
2131
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2132
|
+
____exports.UnitTriggerEvent,
|
|
2133
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2134
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2135
|
+
)
|
|
2159
2136
|
Unit.deathEvent = __TS__New(
|
|
2160
2137
|
____exports.UnitTriggerEvent,
|
|
2161
2138
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2173,7 +2150,7 @@ Unit.onResurrect = __TS__New(
|
|
|
2173
2150
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
2174
2151
|
dead[unit] = true
|
|
2175
2152
|
end)
|
|
2176
|
-
____exports.Unit.onImmediateOrder[
|
|
2153
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2177
2154
|
if dead[unit] and not IsUnitType(unit.handle, UNIT_TYPE_DEAD) then
|
|
2178
2155
|
dead[unit] = false
|
|
2179
2156
|
invoke(event, unit)
|
|
@@ -2190,7 +2167,7 @@ Unit.morphEvent = __TS__New(
|
|
|
2190
2167
|
invoke(event, unit)
|
|
2191
2168
|
end
|
|
2192
2169
|
end
|
|
2193
|
-
____exports.Unit.onImmediateOrder[
|
|
2170
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2194
2171
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
2195
2172
|
Timer:run(ifNotLeft, unit)
|
|
2196
2173
|
end
|
|
@@ -2231,25 +2208,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2231
2208
|
InitializingEvent,
|
|
2232
2209
|
function(event)
|
|
2233
2210
|
local function listener(unit, id)
|
|
2234
|
-
local
|
|
2211
|
+
local ____GetSpellTargetUnit_result_11
|
|
2235
2212
|
if GetSpellTargetUnit() then
|
|
2236
|
-
|
|
2213
|
+
____GetSpellTargetUnit_result_11 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2237
2214
|
else
|
|
2238
|
-
local
|
|
2215
|
+
local ____GetSpellTargetItem_result_10
|
|
2239
2216
|
if GetSpellTargetItem() then
|
|
2240
|
-
|
|
2217
|
+
____GetSpellTargetItem_result_10 = Item:of(GetSpellTargetItem())
|
|
2241
2218
|
else
|
|
2242
|
-
local
|
|
2219
|
+
local ____GetSpellTargetDestructable_result_9
|
|
2243
2220
|
if GetSpellTargetDestructable() then
|
|
2244
|
-
|
|
2221
|
+
____GetSpellTargetDestructable_result_9 = Destructable:of(GetSpellTargetDestructable())
|
|
2245
2222
|
else
|
|
2246
|
-
|
|
2223
|
+
____GetSpellTargetDestructable_result_9 = nil
|
|
2247
2224
|
end
|
|
2248
|
-
|
|
2225
|
+
____GetSpellTargetItem_result_10 = ____GetSpellTargetDestructable_result_9
|
|
2249
2226
|
end
|
|
2250
|
-
|
|
2227
|
+
____GetSpellTargetUnit_result_11 = ____GetSpellTargetItem_result_10
|
|
2251
2228
|
end
|
|
2252
|
-
local target =
|
|
2229
|
+
local target = ____GetSpellTargetUnit_result_11
|
|
2253
2230
|
if target then
|
|
2254
2231
|
invoke(event, unit, id, target)
|
|
2255
2232
|
end
|
|
@@ -2472,12 +2449,7 @@ Unit.onDamaging = (function()
|
|
|
2472
2449
|
preventRetaliation = damagingEventPreventRetaliation
|
|
2473
2450
|
}
|
|
2474
2451
|
if data.isAttack and source then
|
|
2475
|
-
|
|
2476
|
-
if weapon == -1 then
|
|
2477
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2478
|
-
weapon = 0
|
|
2479
|
-
end
|
|
2480
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2452
|
+
data.weapon = source:chooseWeapon(target)
|
|
2481
2453
|
end
|
|
2482
2454
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2483
2455
|
invoke(
|
|
@@ -2622,7 +2594,7 @@ Unit.onDamage = __TS__New(
|
|
|
2622
2594
|
invoke(event, source, target, evData)
|
|
2623
2595
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2624
2596
|
local bonusHealth = math.ceil(evData.amount)
|
|
2625
|
-
target[
|
|
2597
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2626
2598
|
BlzSetUnitMaxHP(
|
|
2627
2599
|
target.handle,
|
|
2628
2600
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2636,7 +2608,7 @@ Unit.onDamage = __TS__New(
|
|
|
2636
2608
|
evData[0],
|
|
2637
2609
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2638
2610
|
)
|
|
2639
|
-
target[
|
|
2611
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2640
2612
|
SetWidgetLife(
|
|
2641
2613
|
target.handle,
|
|
2642
2614
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2662,7 +2634,7 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2662
2634
|
function()
|
|
2663
2635
|
local unit = getTriggerUnit()
|
|
2664
2636
|
local item = getManipulatedItem()
|
|
2665
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2637
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2666
2638
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2667
2639
|
end
|
|
2668
2640
|
return IgnoreEvent
|
|
@@ -2672,10 +2644,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2672
2644
|
____exports.UnitTriggerEvent,
|
|
2673
2645
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2674
2646
|
function()
|
|
2675
|
-
local
|
|
2676
|
-
local
|
|
2677
|
-
if getUnitTypeId(
|
|
2678
|
-
|
|
2647
|
+
local unitHandle = getTriggerUnit()
|
|
2648
|
+
local itemHandle = getManipulatedItem()
|
|
2649
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not isItemIgnoredInEvents(itemHandle) then
|
|
2650
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2651
|
+
local item = Item:of(itemHandle)
|
|
2652
|
+
if ownerByItem[item] ~= unit then
|
|
2653
|
+
return unit, item
|
|
2654
|
+
end
|
|
2679
2655
|
end
|
|
2680
2656
|
return IgnoreEvent
|
|
2681
2657
|
end
|
|
@@ -2686,17 +2662,12 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2686
2662
|
function()
|
|
2687
2663
|
local unit = getTriggerUnit()
|
|
2688
2664
|
local item = getManipulatedItem()
|
|
2689
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2665
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2690
2666
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2691
2667
|
end
|
|
2692
2668
|
return IgnoreEvent
|
|
2693
2669
|
end
|
|
2694
2670
|
)
|
|
2695
|
-
Unit.itemStackedEvent = __TS__New(
|
|
2696
|
-
____exports.UnitTriggerEvent,
|
|
2697
|
-
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2698
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2699
|
-
)
|
|
2700
2671
|
__TS__ObjectDefineProperty(
|
|
2701
2672
|
Unit,
|
|
2702
2673
|
"itemChargesChangedEvent",
|
|
@@ -2712,51 +2683,6 @@ __TS__ObjectDefineProperty(
|
|
|
2712
2683
|
return event
|
|
2713
2684
|
end}
|
|
2714
2685
|
)
|
|
2715
|
-
__TS__ObjectDefineProperty(
|
|
2716
|
-
Unit,
|
|
2717
|
-
"itemUseOrderEvent",
|
|
2718
|
-
{get = function(self)
|
|
2719
|
-
local event = __TS__New(Event)
|
|
2720
|
-
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2721
|
-
local slot = order - orderId("useslot0")
|
|
2722
|
-
local function listener(unit)
|
|
2723
|
-
local item = unit.items[slot + 1]
|
|
2724
|
-
if item ~= nil then
|
|
2725
|
-
invoke(event, unit, item)
|
|
2726
|
-
end
|
|
2727
|
-
end
|
|
2728
|
-
self.onImmediateOrder[order]:addListener(listener)
|
|
2729
|
-
self.onTargetOrder[order]:addListener(listener)
|
|
2730
|
-
self.onPointOrder[order]:addListener(listener)
|
|
2731
|
-
end
|
|
2732
|
-
rawset(self, "itemUseOrderEvent", event)
|
|
2733
|
-
return event
|
|
2734
|
-
end}
|
|
2735
|
-
)
|
|
2736
|
-
__TS__ObjectDefineProperty(
|
|
2737
|
-
Unit,
|
|
2738
|
-
"itemMoveOrderEvent",
|
|
2739
|
-
{get = function(self)
|
|
2740
|
-
local event = __TS__New(Event)
|
|
2741
|
-
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2742
|
-
local slotTo = order - orderId("moveslot0")
|
|
2743
|
-
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2744
|
-
local slotFrom = unit.items:findSlot(item)
|
|
2745
|
-
if slotFrom ~= nil then
|
|
2746
|
-
invoke(
|
|
2747
|
-
event,
|
|
2748
|
-
unit,
|
|
2749
|
-
item,
|
|
2750
|
-
slotFrom,
|
|
2751
|
-
slotTo
|
|
2752
|
-
)
|
|
2753
|
-
end
|
|
2754
|
-
end)
|
|
2755
|
-
end
|
|
2756
|
-
rawset(self, "itemMoveOrderEvent", event)
|
|
2757
|
-
return event
|
|
2758
|
-
end}
|
|
2759
|
-
)
|
|
2760
2686
|
__TS__ObjectDefineProperty(
|
|
2761
2687
|
Unit,
|
|
2762
2688
|
"onCreate",
|
|
@@ -2782,6 +2708,10 @@ __TS__ObjectDefineProperty(
|
|
|
2782
2708
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2783
2709
|
return destroyEvent
|
|
2784
2710
|
end}
|
|
2711
|
+
)
|
|
2712
|
+
Unit.synchronize = synchronizer(
|
|
2713
|
+
function(unit) return unit.syncId end,
|
|
2714
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2785
2715
|
);
|
|
2786
2716
|
(function(self)
|
|
2787
2717
|
local leaveAbilityIds = postcompile(function()
|
|
@@ -2799,11 +2729,7 @@ __TS__ObjectDefineProperty(
|
|
|
2799
2729
|
function(____, id) return fourCC(id) end
|
|
2800
2730
|
)
|
|
2801
2731
|
end)
|
|
2802
|
-
for ____, leaveOrderId in ipairs({
|
|
2803
|
-
orderId("undefend"),
|
|
2804
|
-
orderId("magicundefense"),
|
|
2805
|
-
orderId("unimmolation")
|
|
2806
|
-
}) do
|
|
2732
|
+
for ____, leaveOrderId in ipairs({852056, 852479, 852178}) do
|
|
2807
2733
|
____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
|
|
2808
2734
|
local handle = unit.handle
|
|
2809
2735
|
for i = 1, #leaveAbilityIds do
|
|
@@ -2811,7 +2737,8 @@ __TS__ObjectDefineProperty(
|
|
|
2811
2737
|
return
|
|
2812
2738
|
end
|
|
2813
2739
|
end
|
|
2814
|
-
unit:
|
|
2740
|
+
unit:saveData()
|
|
2741
|
+
Timer:run(unit, "destroy")
|
|
2815
2742
|
end)
|
|
2816
2743
|
end
|
|
2817
2744
|
end)(Unit)
|