warscript 0.0.1-dev.bad60be → 0.0.1-dev.bc4cd10
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 +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 +14 -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 +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/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- 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 +56 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +9 -5
- package/engine/behaviour/unit/stun-immunity.lua +17 -7
- package/engine/behaviour/unit.d.ts +16 -5
- package/engine/behaviour/unit.lua +135 -27
- package/engine/buff.d.ts +73 -27
- package/engine/buff.lua +424 -193
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +7 -1
- package/engine/internal/ability.lua +90 -47
- package/engine/internal/item/ability.lua +2 -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 +14 -14
- package/engine/internal/unit/ability.lua +86 -47
- 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 +3 -3
- package/engine/internal/unit/order.lua +10 -10
- 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.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 +19 -32
- package/engine/internal/unit.lua +241 -341
- 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-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +30 -0
- 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/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 +25 -6
- package/engine/object-data/entry/ability-type.lua +249 -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 +62 -4
- package/engine/object-data/entry/unit-type.lua +474 -38
- 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 +27 -5
- package/engine/object-field/unit.lua +82 -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 +11 -2
- package/engine/standard/fields/unit.lua +16 -1
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +1 -1
- package/engine/text-tag.lua +92 -17
- 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 -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 +2 -0
- package/utility/arrays.lua +20 -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/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
|
@@ -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
|
|
@@ -62,6 +60,10 @@ local ____attributes = require("attributes")
|
|
|
62
60
|
local isAttribute = ____attributes.isAttribute
|
|
63
61
|
local ____ability = require("engine.internal.item.ability")
|
|
64
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
|
|
65
67
|
local match = string.match
|
|
66
68
|
local ____tostring = _G.tostring
|
|
67
69
|
local setUnitAnimation = SetUnitAnimation
|
|
@@ -71,16 +73,12 @@ local getUnitRealField = BlzGetUnitRealField
|
|
|
71
73
|
local getHeroStr = GetHeroStr
|
|
72
74
|
local getHeroAgi = GetHeroAgi
|
|
73
75
|
local getHeroInt = GetHeroInt
|
|
74
|
-
local setHeroStr = SetHeroStr
|
|
75
|
-
local setHeroAgi = SetHeroAgi
|
|
76
|
-
local setHeroInt = SetHeroInt
|
|
77
76
|
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
78
77
|
local getUnitStringField = BlzGetUnitStringField
|
|
79
78
|
local setUnitIntegerField = BlzSetUnitIntegerField
|
|
80
79
|
local setUnitRealField = BlzSetUnitRealField
|
|
81
80
|
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
82
81
|
local setUnitStringField = BlzSetUnitStringField
|
|
83
|
-
local setUnitScale = SetUnitScale
|
|
84
82
|
local setUnitPosition = SetUnitPosition
|
|
85
83
|
local setUnitTimeScale = SetUnitTimeScale
|
|
86
84
|
local getHandleId = GetHandleId
|
|
@@ -108,7 +106,6 @@ local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
|
108
106
|
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
109
107
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
110
108
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
111
|
-
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
112
109
|
local isUnitInvisible = IsUnitInvisible
|
|
113
110
|
local isUnitVisible = IsUnitVisible
|
|
114
111
|
local getUnitX = GetUnitX
|
|
@@ -384,15 +381,27 @@ local modifiers = {
|
|
|
384
381
|
end,
|
|
385
382
|
armor = function(unit, value)
|
|
386
383
|
if UnitAddAbility(unit, armorBonusAbilityId) then
|
|
387
|
-
assert(
|
|
384
|
+
assert(
|
|
385
|
+
UnitMakeAbilityPermanent(unit, true, armorBonusAbilityId),
|
|
386
|
+
"armor bonus ability must be made permanent",
|
|
387
|
+
unit
|
|
388
|
+
)
|
|
388
389
|
end
|
|
389
|
-
local ability = assert(
|
|
390
|
-
|
|
391
|
-
ability,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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
|
+
)
|
|
396
405
|
end
|
|
397
406
|
}
|
|
398
407
|
local getters = {
|
|
@@ -410,6 +419,19 @@ function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
|
410
419
|
self.unit = unit
|
|
411
420
|
self.index = index
|
|
412
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
|
+
)
|
|
413
435
|
__TS__SetDescriptor(
|
|
414
436
|
UnitWeapon.prototype,
|
|
415
437
|
"cooldown",
|
|
@@ -568,8 +590,6 @@ __TS__SetDescriptor(
|
|
|
568
590
|
},
|
|
569
591
|
true
|
|
570
592
|
)
|
|
571
|
-
local unitInventorySize = UnitInventorySize
|
|
572
|
-
local unitItemInSlot = UnitItemInSlot
|
|
573
593
|
local getItemAbility = BlzGetItemAbility
|
|
574
594
|
local getUnitAbility = BlzGetUnitAbility
|
|
575
595
|
local getUnitAbilityByIndex = BlzGetUnitAbilityByIndex
|
|
@@ -587,8 +607,8 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
587
607
|
____exports.Unit:of(unit)
|
|
588
608
|
)
|
|
589
609
|
end
|
|
590
|
-
for i = 0,
|
|
591
|
-
local item =
|
|
610
|
+
for i = 0, UnitInventorySize(unit) - 1 do
|
|
611
|
+
local item = UnitItemInSlot(unit, i)
|
|
592
612
|
if getItemAbility(item, abilityId) == ability then
|
|
593
613
|
return ItemAbility:of(
|
|
594
614
|
ability,
|
|
@@ -633,26 +653,30 @@ local fieldSetters = {
|
|
|
633
653
|
}
|
|
634
654
|
local dummies = {}
|
|
635
655
|
for ____, player in ipairs(Player.all) do
|
|
636
|
-
local dummy = assert(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
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
|
+
)
|
|
643
667
|
ShowUnit(dummy, false)
|
|
644
668
|
dummies[player] = dummy
|
|
645
669
|
end
|
|
646
670
|
local function delayHealthChecksCallback(unit)
|
|
647
|
-
local counter = (unit[
|
|
671
|
+
local counter = (unit[104] or 0) - 1
|
|
648
672
|
if counter ~= 0 then
|
|
649
|
-
unit[
|
|
673
|
+
unit[104] = counter
|
|
650
674
|
return
|
|
651
675
|
end
|
|
652
|
-
unit[
|
|
653
|
-
local healthBonus = unit[
|
|
676
|
+
unit[104] = nil
|
|
677
|
+
local healthBonus = unit[105]
|
|
654
678
|
if healthBonus ~= nil then
|
|
655
|
-
unit[
|
|
679
|
+
unit[105] = nil
|
|
656
680
|
local handle = unit.handle
|
|
657
681
|
BlzSetUnitMaxHP(
|
|
658
682
|
handle,
|
|
@@ -664,39 +688,13 @@ local nextSyncId = 1
|
|
|
664
688
|
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
665
689
|
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
666
690
|
local function addAbility(unit, abilityTypeId)
|
|
667
|
-
local
|
|
668
|
-
if unitAddAbility(
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
unit
|
|
673
|
-
)
|
|
674
|
-
local abilities = unit.abilities
|
|
675
|
-
abilities[#abilities + 1] = ability
|
|
676
|
-
return ability
|
|
677
|
-
end
|
|
678
|
-
return nil
|
|
679
|
-
end
|
|
680
|
-
local function getAbility(unit, abilityTypeId)
|
|
681
|
-
return UnitAbility:of(
|
|
682
|
-
getUnitAbility(unit.handle, abilityTypeId),
|
|
683
|
-
abilityTypeId,
|
|
684
|
-
unit
|
|
685
|
-
)
|
|
686
|
-
end
|
|
687
|
-
local function removeAbility(unit, abilityTypeId)
|
|
688
|
-
if unitRemoveAbility(unit.handle, abilityTypeId) then
|
|
689
|
-
local abilities = unit.abilities
|
|
690
|
-
for i = 1, #abilities do
|
|
691
|
-
if abilities[i].typeId == abilityTypeId then
|
|
692
|
-
abilities[i]:destroy()
|
|
693
|
-
tremove(abilities, i)
|
|
694
|
-
return true
|
|
695
|
-
end
|
|
696
|
-
end
|
|
697
|
-
return true
|
|
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
|
|
698
696
|
end
|
|
699
|
-
return
|
|
697
|
+
return ____unitAddAbility_result_0
|
|
700
698
|
end
|
|
701
699
|
____exports.Unit = __TS__Class()
|
|
702
700
|
local Unit = ____exports.Unit
|
|
@@ -704,45 +702,61 @@ Unit.name = "Unit"
|
|
|
704
702
|
__TS__ClassExtends(Unit, Handle)
|
|
705
703
|
function Unit.prototype.____constructor(self, handle)
|
|
706
704
|
Handle.prototype.____constructor(self, handle)
|
|
707
|
-
local
|
|
708
|
-
nextSyncId =
|
|
709
|
-
self.syncId =
|
|
705
|
+
local ____nextSyncId_1 = nextSyncId
|
|
706
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
707
|
+
self.syncId = ____nextSyncId_1
|
|
710
708
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
711
|
-
assert(
|
|
712
|
-
|
|
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
|
+
)
|
|
713
719
|
if unitAddAbility(
|
|
714
720
|
handle,
|
|
715
721
|
fourCC("Amrf")
|
|
716
722
|
) then
|
|
717
|
-
assert(
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
723
|
+
assert(
|
|
724
|
+
unitRemoveAbility(
|
|
725
|
+
handle,
|
|
726
|
+
fourCC("Amrf")
|
|
727
|
+
),
|
|
728
|
+
"fly ability must be removed after addition",
|
|
729
|
+
self
|
|
730
|
+
)
|
|
721
731
|
end
|
|
722
732
|
unitBySyncId[self.syncId] = self
|
|
723
733
|
local ____ = self.abilities
|
|
724
734
|
end
|
|
725
|
-
function Unit.prototype.getEvent(self,
|
|
726
|
-
self.events = self.events or (
|
|
727
|
-
local eventId = GetHandleId(
|
|
728
|
-
|
|
729
|
-
|
|
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(
|
|
730
741
|
TriggerEvent,
|
|
731
742
|
function(trigger)
|
|
732
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
743
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
733
744
|
end,
|
|
734
745
|
collector or (function() return {} end)
|
|
735
746
|
)
|
|
747
|
+
self.events:put(eventId, event)
|
|
736
748
|
end
|
|
737
|
-
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))
|
|
738
756
|
end
|
|
739
757
|
function Unit.prototype.onDestroy(self)
|
|
740
758
|
local handle = self.handle
|
|
741
|
-
self
|
|
742
|
-
self[108] = getUnitY(handle)
|
|
743
|
-
if not self._owner then
|
|
744
|
-
self._owner = Player:of(getOwningPlayer(handle))
|
|
745
|
-
end
|
|
759
|
+
self:saveData()
|
|
746
760
|
local abilities = self.abilities
|
|
747
761
|
for ____, ability in ipairs(abilities) do
|
|
748
762
|
ability:destroy()
|
|
@@ -760,7 +774,9 @@ function Unit.prototype.onDestroy(self)
|
|
|
760
774
|
end
|
|
761
775
|
local eventsToDestroy = self._eventsToDestroy
|
|
762
776
|
if eventsToDestroy ~= nil then
|
|
763
|
-
|
|
777
|
+
for ____, event in ipairs(eventsToDestroy) do
|
|
778
|
+
event:destroy()
|
|
779
|
+
end
|
|
764
780
|
end
|
|
765
781
|
if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
|
|
766
782
|
unitRemoveAbility(handle, leaveDetectAbilityId)
|
|
@@ -778,7 +794,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
|
|
|
778
794
|
self._attackHandlers = handlers
|
|
779
795
|
if #handlers == 1 then
|
|
780
796
|
local handle = self.handle
|
|
781
|
-
assert(
|
|
797
|
+
assert(
|
|
798
|
+
unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
|
|
799
|
+
"attack handler ability must be added",
|
|
800
|
+
self
|
|
801
|
+
)
|
|
782
802
|
end
|
|
783
803
|
return handler
|
|
784
804
|
end
|
|
@@ -807,8 +827,8 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
807
827
|
end}
|
|
808
828
|
end
|
|
809
829
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
810
|
-
local
|
|
811
|
-
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
|
|
812
832
|
end
|
|
813
833
|
function Unit.prototype.addClassification(self, classification)
|
|
814
834
|
return UnitAddType(self.handle, classification)
|
|
@@ -826,13 +846,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
826
846
|
return isUnitInvisible(self.handle, player.handle)
|
|
827
847
|
end
|
|
828
848
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
829
|
-
local
|
|
849
|
+
local ____temp_3
|
|
830
850
|
if type(x) == "number" then
|
|
831
|
-
|
|
851
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
832
852
|
else
|
|
833
|
-
|
|
853
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
834
854
|
end
|
|
835
|
-
return
|
|
855
|
+
return ____temp_3
|
|
836
856
|
end
|
|
837
857
|
function Unit.prototype.isAllyOf(self, unit)
|
|
838
858
|
return isUnitAlly(
|
|
@@ -862,16 +882,18 @@ function Unit.prototype.queueAnimation(self, animation)
|
|
|
862
882
|
QueueUnitAnimation(self.handle, animation)
|
|
863
883
|
end
|
|
864
884
|
function Unit.prototype.chooseWeapon(self, target)
|
|
865
|
-
|
|
866
|
-
|
|
885
|
+
local firstWeapon = self.firstWeapon
|
|
886
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
887
|
+
return firstWeapon
|
|
867
888
|
end
|
|
868
|
-
|
|
869
|
-
|
|
889
|
+
local secondWeapon = self.secondWeapon
|
|
890
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
891
|
+
return secondWeapon
|
|
870
892
|
end
|
|
871
893
|
return nil
|
|
872
894
|
end
|
|
873
895
|
function Unit.prototype.delayHealthChecks(self)
|
|
874
|
-
self[
|
|
896
|
+
self[104] = (self[104] or 0) + 1
|
|
875
897
|
Timer:run(delayHealthChecksCallback, self)
|
|
876
898
|
end
|
|
877
899
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -888,14 +910,14 @@ function Unit.prototype.kill(self)
|
|
|
888
910
|
killUnit(self.handle)
|
|
889
911
|
end
|
|
890
912
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
891
|
-
local
|
|
892
|
-
local
|
|
893
|
-
local
|
|
894
|
-
if
|
|
895
|
-
|
|
913
|
+
local ____ReviveHero_6 = ReviveHero
|
|
914
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
915
|
+
local ____doEffect_4 = doEffect
|
|
916
|
+
if ____doEffect_4 == nil then
|
|
917
|
+
____doEffect_4 = false
|
|
896
918
|
end
|
|
897
|
-
__TS__SparseArrayPush(
|
|
898
|
-
|
|
919
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
920
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
899
921
|
end
|
|
900
922
|
function Unit.prototype.healTarget(self, target, amount)
|
|
901
923
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -935,16 +957,19 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
935
957
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
936
958
|
end
|
|
937
959
|
function Unit.prototype.itemInSlot(self, slot)
|
|
938
|
-
return Item:of(
|
|
960
|
+
return Item:of(UnitItemInSlot(self.handle, slot))
|
|
939
961
|
end
|
|
940
962
|
function Unit.prototype.addAbility(self, abilityId)
|
|
941
|
-
|
|
942
|
-
self.handle,
|
|
963
|
+
local ability = UnitAbility:of(
|
|
964
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
943
965
|
abilityId,
|
|
944
|
-
|
|
945
|
-
self,
|
|
946
|
-
abilityId
|
|
966
|
+
self
|
|
947
967
|
)
|
|
968
|
+
if ability ~= nil then
|
|
969
|
+
local abilities = self.abilities
|
|
970
|
+
abilities[#abilities + 1] = ability
|
|
971
|
+
end
|
|
972
|
+
return ability
|
|
948
973
|
end
|
|
949
974
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
950
975
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -958,23 +983,21 @@ end
|
|
|
958
983
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
959
984
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
960
985
|
end
|
|
961
|
-
function Unit.prototype.
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
abilityId,
|
|
965
|
-
getAbility,
|
|
966
|
-
self,
|
|
967
|
-
abilityId
|
|
968
|
-
)
|
|
986
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
987
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
988
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
969
989
|
end
|
|
970
|
-
function Unit.prototype.removeAbility(self,
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
990
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
991
|
+
local abilities = self.abilities
|
|
992
|
+
for i = 1, #abilities do
|
|
993
|
+
if abilities[i].typeId == abilityTypeId then
|
|
994
|
+
local ability = abilities[i]
|
|
995
|
+
tremove(abilities, i)
|
|
996
|
+
ability:destroy()
|
|
997
|
+
return true
|
|
998
|
+
end
|
|
999
|
+
end
|
|
1000
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
978
1001
|
end
|
|
979
1002
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
980
1003
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -988,24 +1011,6 @@ end
|
|
|
988
1011
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
989
1012
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
990
1013
|
end
|
|
991
|
-
function Unit.prototype.interruptMovement(self)
|
|
992
|
-
local handle = self.handle
|
|
993
|
-
unitDisableAbility(
|
|
994
|
-
handle,
|
|
995
|
-
fourCC("Amov"),
|
|
996
|
-
true,
|
|
997
|
-
false
|
|
998
|
-
)
|
|
999
|
-
unitDisableAbility(
|
|
1000
|
-
handle,
|
|
1001
|
-
fourCC("Amov"),
|
|
1002
|
-
false,
|
|
1003
|
-
false
|
|
1004
|
-
)
|
|
1005
|
-
end
|
|
1006
|
-
function Unit.prototype.interruptAttack(self)
|
|
1007
|
-
unitInterruptAttack(self.handle)
|
|
1008
|
-
end
|
|
1009
1014
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
1010
1015
|
local handle = self.handle
|
|
1011
1016
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1076,18 +1081,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1076
1081
|
end
|
|
1077
1082
|
function Unit.prototype.incrementStunCounter(self)
|
|
1078
1083
|
local stunCounter = self[102] or 0
|
|
1079
|
-
if not self[101] or stunCounter >= 0 then
|
|
1084
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1080
1085
|
BlzPauseUnitEx(self.handle, true)
|
|
1081
1086
|
end
|
|
1082
1087
|
self[102] = stunCounter + 1
|
|
1083
1088
|
end
|
|
1084
1089
|
function Unit.prototype.decrementStunCounter(self)
|
|
1085
1090
|
local stunCounter = self[102] or 0
|
|
1086
|
-
if not self[101] or stunCounter >= 1 then
|
|
1091
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1087
1092
|
BlzPauseUnitEx(self.handle, false)
|
|
1088
1093
|
end
|
|
1089
1094
|
self[102] = stunCounter - 1
|
|
1090
1095
|
end
|
|
1096
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1097
|
+
local forceStunCounter = self[103] or 0
|
|
1098
|
+
if forceStunCounter == 0 then
|
|
1099
|
+
local handle = self.handle
|
|
1100
|
+
if not self[101] then
|
|
1101
|
+
for _ = self[102] or 0, -1 do
|
|
1102
|
+
BlzPauseUnitEx(handle, true)
|
|
1103
|
+
end
|
|
1104
|
+
end
|
|
1105
|
+
BlzPauseUnitEx(handle, true)
|
|
1106
|
+
end
|
|
1107
|
+
self[103] = forceStunCounter + 1
|
|
1108
|
+
end
|
|
1109
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1110
|
+
local forceStunCounter = self[103] or 0
|
|
1111
|
+
if forceStunCounter == 1 then
|
|
1112
|
+
local handle = self.handle
|
|
1113
|
+
if not self[101] then
|
|
1114
|
+
for _ = self[102] or 0, -1 do
|
|
1115
|
+
BlzPauseUnitEx(handle, false)
|
|
1116
|
+
end
|
|
1117
|
+
end
|
|
1118
|
+
BlzPauseUnitEx(handle, false)
|
|
1119
|
+
end
|
|
1120
|
+
self[103] = forceStunCounter - 1
|
|
1121
|
+
end
|
|
1091
1122
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1092
1123
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1093
1124
|
owner.handle,
|
|
@@ -1284,7 +1315,7 @@ __TS__SetDescriptor(
|
|
|
1284
1315
|
Unit.prototype,
|
|
1285
1316
|
"isStunned",
|
|
1286
1317
|
{get = function(self)
|
|
1287
|
-
return getUnitCurrentOrder(self.handle) ==
|
|
1318
|
+
return getUnitCurrentOrder(self.handle) == 851973
|
|
1288
1319
|
end},
|
|
1289
1320
|
true
|
|
1290
1321
|
)
|
|
@@ -1374,19 +1405,6 @@ __TS__SetDescriptor(
|
|
|
1374
1405
|
},
|
|
1375
1406
|
true
|
|
1376
1407
|
)
|
|
1377
|
-
__TS__SetDescriptor(
|
|
1378
|
-
Unit.prototype,
|
|
1379
|
-
"strengthBase",
|
|
1380
|
-
{
|
|
1381
|
-
get = function(self)
|
|
1382
|
-
return getHeroStr(self.handle, false)
|
|
1383
|
-
end,
|
|
1384
|
-
set = function(self, strengthBase)
|
|
1385
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1386
|
-
end
|
|
1387
|
-
},
|
|
1388
|
-
true
|
|
1389
|
-
)
|
|
1390
1408
|
__TS__SetDescriptor(
|
|
1391
1409
|
Unit.prototype,
|
|
1392
1410
|
"strengthBonus",
|
|
@@ -1404,19 +1422,6 @@ __TS__SetDescriptor(
|
|
|
1404
1422
|
end},
|
|
1405
1423
|
true
|
|
1406
1424
|
)
|
|
1407
|
-
__TS__SetDescriptor(
|
|
1408
|
-
Unit.prototype,
|
|
1409
|
-
"agilityBase",
|
|
1410
|
-
{
|
|
1411
|
-
get = function(self)
|
|
1412
|
-
return getHeroAgi(self.handle, false)
|
|
1413
|
-
end,
|
|
1414
|
-
set = function(self, agilityBase)
|
|
1415
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1416
|
-
end
|
|
1417
|
-
},
|
|
1418
|
-
true
|
|
1419
|
-
)
|
|
1420
1425
|
__TS__SetDescriptor(
|
|
1421
1426
|
Unit.prototype,
|
|
1422
1427
|
"agilityBonus",
|
|
@@ -1434,19 +1439,6 @@ __TS__SetDescriptor(
|
|
|
1434
1439
|
end},
|
|
1435
1440
|
true
|
|
1436
1441
|
)
|
|
1437
|
-
__TS__SetDescriptor(
|
|
1438
|
-
Unit.prototype,
|
|
1439
|
-
"intelligenceBase",
|
|
1440
|
-
{
|
|
1441
|
-
get = function(self)
|
|
1442
|
-
return getHeroInt(self.handle, false)
|
|
1443
|
-
end,
|
|
1444
|
-
set = function(self, intelligenceBase)
|
|
1445
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1446
|
-
end
|
|
1447
|
-
},
|
|
1448
|
-
true
|
|
1449
|
-
)
|
|
1450
1442
|
__TS__SetDescriptor(
|
|
1451
1443
|
Unit.prototype,
|
|
1452
1444
|
"intelligenceBonus",
|
|
@@ -1495,17 +1487,17 @@ __TS__SetDescriptor(
|
|
|
1495
1487
|
"isTeamGlowVisible",
|
|
1496
1488
|
{
|
|
1497
1489
|
get = function(self)
|
|
1498
|
-
return not self[
|
|
1490
|
+
return not self[107]
|
|
1499
1491
|
end,
|
|
1500
1492
|
set = function(self, isTeamGlowVisible)
|
|
1501
1493
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1502
|
-
local
|
|
1494
|
+
local ____temp_7
|
|
1503
1495
|
if not isTeamGlowVisible then
|
|
1504
|
-
|
|
1496
|
+
____temp_7 = true
|
|
1505
1497
|
else
|
|
1506
|
-
|
|
1498
|
+
____temp_7 = nil
|
|
1507
1499
|
end
|
|
1508
|
-
self[
|
|
1500
|
+
self[107] = ____temp_7
|
|
1509
1501
|
end
|
|
1510
1502
|
},
|
|
1511
1503
|
true
|
|
@@ -1515,7 +1507,7 @@ __TS__SetDescriptor(
|
|
|
1515
1507
|
"color",
|
|
1516
1508
|
{set = function(self, color)
|
|
1517
1509
|
SetUnitColor(self.handle, color.handle)
|
|
1518
|
-
if self[
|
|
1510
|
+
if self[107] then
|
|
1519
1511
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1520
1512
|
end
|
|
1521
1513
|
end},
|
|
@@ -1539,14 +1531,14 @@ __TS__SetDescriptor(
|
|
|
1539
1531
|
"maxHealth",
|
|
1540
1532
|
{
|
|
1541
1533
|
get = function(self)
|
|
1542
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1534
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1543
1535
|
end,
|
|
1544
1536
|
set = function(self, maxHealth)
|
|
1545
|
-
if maxHealth < 1 and self[
|
|
1546
|
-
self[
|
|
1537
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1538
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1547
1539
|
maxHealth = 1
|
|
1548
1540
|
end
|
|
1549
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1541
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1550
1542
|
end
|
|
1551
1543
|
},
|
|
1552
1544
|
true
|
|
@@ -1588,10 +1580,10 @@ __TS__SetDescriptor(
|
|
|
1588
1580
|
"health",
|
|
1589
1581
|
{
|
|
1590
1582
|
get = function(self)
|
|
1591
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1583
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1592
1584
|
end,
|
|
1593
1585
|
set = function(self, health)
|
|
1594
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1586
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1595
1587
|
end
|
|
1596
1588
|
},
|
|
1597
1589
|
true
|
|
@@ -1667,25 +1659,12 @@ __TS__SetDescriptor(
|
|
|
1667
1659
|
},
|
|
1668
1660
|
true
|
|
1669
1661
|
)
|
|
1670
|
-
__TS__SetDescriptor(
|
|
1671
|
-
Unit.prototype,
|
|
1672
|
-
"flyHeight",
|
|
1673
|
-
{
|
|
1674
|
-
get = function(self)
|
|
1675
|
-
return getUnitFlyHeight(self.handle)
|
|
1676
|
-
end,
|
|
1677
|
-
set = function(self, v)
|
|
1678
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1679
|
-
end
|
|
1680
|
-
},
|
|
1681
|
-
true
|
|
1682
|
-
)
|
|
1683
1662
|
__TS__SetDescriptor(
|
|
1684
1663
|
Unit.prototype,
|
|
1685
1664
|
"x",
|
|
1686
1665
|
{
|
|
1687
1666
|
get = function(self)
|
|
1688
|
-
return self[
|
|
1667
|
+
return self[108] or getUnitX(self.handle)
|
|
1689
1668
|
end,
|
|
1690
1669
|
set = function(self, v)
|
|
1691
1670
|
SetUnitX(self.handle, v)
|
|
@@ -1698,7 +1677,7 @@ __TS__SetDescriptor(
|
|
|
1698
1677
|
"y",
|
|
1699
1678
|
{
|
|
1700
1679
|
get = function(self)
|
|
1701
|
-
return self[
|
|
1680
|
+
return self[109] or getUnitY(self.handle)
|
|
1702
1681
|
end,
|
|
1703
1682
|
set = function(self, v)
|
|
1704
1683
|
SetUnitY(self.handle, v)
|
|
@@ -1803,14 +1782,18 @@ __TS__SetDescriptor(
|
|
|
1803
1782
|
local handle = self.handle
|
|
1804
1783
|
if isPaused and not IsUnitPaused(handle) then
|
|
1805
1784
|
self[101] = true
|
|
1806
|
-
|
|
1807
|
-
|
|
1785
|
+
if (self[103] or 0) <= 0 then
|
|
1786
|
+
for _ = self[102] or 0, -1 do
|
|
1787
|
+
BlzPauseUnitEx(handle, true)
|
|
1788
|
+
end
|
|
1808
1789
|
end
|
|
1809
1790
|
PauseUnit(handle, true)
|
|
1810
1791
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1811
1792
|
PauseUnit(handle, false)
|
|
1812
|
-
|
|
1813
|
-
|
|
1793
|
+
if (self[103] or 0) <= 0 then
|
|
1794
|
+
for _ = self[102] or 0, -1 do
|
|
1795
|
+
BlzPauseUnitEx(handle, false)
|
|
1796
|
+
end
|
|
1814
1797
|
end
|
|
1815
1798
|
self[101] = nil
|
|
1816
1799
|
end
|
|
@@ -1868,20 +1851,6 @@ __TS__SetDescriptor(
|
|
|
1868
1851
|
},
|
|
1869
1852
|
true
|
|
1870
1853
|
)
|
|
1871
|
-
__TS__SetDescriptor(
|
|
1872
|
-
Unit.prototype,
|
|
1873
|
-
"scale",
|
|
1874
|
-
{
|
|
1875
|
-
get = function(self)
|
|
1876
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1877
|
-
end,
|
|
1878
|
-
set = function(self, v)
|
|
1879
|
-
setUnitScale(self.handle, v, v, v)
|
|
1880
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1881
|
-
end
|
|
1882
|
-
},
|
|
1883
|
-
true
|
|
1884
|
-
)
|
|
1885
1854
|
__TS__SetDescriptor(
|
|
1886
1855
|
Unit.prototype,
|
|
1887
1856
|
"timeScale",
|
|
@@ -1908,7 +1877,7 @@ __TS__SetDescriptor(
|
|
|
1908
1877
|
Unit.prototype,
|
|
1909
1878
|
"pathingCollisionRange",
|
|
1910
1879
|
{get = function(self)
|
|
1911
|
-
return 16 * (min(
|
|
1880
|
+
return 16 * (math.min(
|
|
1912
1881
|
getUnitCollisionSize(self.handle) // 16,
|
|
1913
1882
|
3
|
|
1914
1883
|
) + 1)
|
|
@@ -2018,30 +1987,6 @@ __TS__SetDescriptor(
|
|
|
2018
1987
|
end},
|
|
2019
1988
|
true
|
|
2020
1989
|
)
|
|
2021
|
-
__TS__SetDescriptor(
|
|
2022
|
-
Unit.prototype,
|
|
2023
|
-
"onUnitInRange",
|
|
2024
|
-
{get = function(self)
|
|
2025
|
-
local handle = self.handle
|
|
2026
|
-
local onUnitInRange = setmetatable(
|
|
2027
|
-
{},
|
|
2028
|
-
{__index = function(self, value)
|
|
2029
|
-
local event = __TS__New(
|
|
2030
|
-
TriggerEvent,
|
|
2031
|
-
function(trigger)
|
|
2032
|
-
TriggerRegisterUnitInRangeSimple(trigger, value, handle)
|
|
2033
|
-
end,
|
|
2034
|
-
function() return ____exports.Unit:of(handle) end
|
|
2035
|
-
)
|
|
2036
|
-
rawset(self, value, event)
|
|
2037
|
-
return event
|
|
2038
|
-
end}
|
|
2039
|
-
)
|
|
2040
|
-
rawset(self, "onUnitInRange", onUnitInRange)
|
|
2041
|
-
return onUnitInRange
|
|
2042
|
-
end},
|
|
2043
|
-
true
|
|
2044
|
-
)
|
|
2045
1990
|
__TS__SetDescriptor(
|
|
2046
1991
|
Unit.prototype,
|
|
2047
1992
|
"onManaEqual",
|
|
@@ -2177,6 +2122,11 @@ __TS__SetDescriptor(
|
|
|
2177
2122
|
end},
|
|
2178
2123
|
true
|
|
2179
2124
|
)
|
|
2125
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2126
|
+
____exports.UnitTriggerEvent,
|
|
2127
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2128
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2129
|
+
)
|
|
2180
2130
|
Unit.deathEvent = __TS__New(
|
|
2181
2131
|
____exports.UnitTriggerEvent,
|
|
2182
2132
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2194,7 +2144,7 @@ Unit.onResurrect = __TS__New(
|
|
|
2194
2144
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
2195
2145
|
dead[unit] = true
|
|
2196
2146
|
end)
|
|
2197
|
-
____exports.Unit.onImmediateOrder[
|
|
2147
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2198
2148
|
if dead[unit] and not IsUnitType(unit.handle, UNIT_TYPE_DEAD) then
|
|
2199
2149
|
dead[unit] = false
|
|
2200
2150
|
invoke(event, unit)
|
|
@@ -2211,7 +2161,7 @@ Unit.morphEvent = __TS__New(
|
|
|
2211
2161
|
invoke(event, unit)
|
|
2212
2162
|
end
|
|
2213
2163
|
end
|
|
2214
|
-
____exports.Unit.onImmediateOrder[
|
|
2164
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2215
2165
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
2216
2166
|
Timer:run(ifNotLeft, unit)
|
|
2217
2167
|
end
|
|
@@ -2252,25 +2202,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2252
2202
|
InitializingEvent,
|
|
2253
2203
|
function(event)
|
|
2254
2204
|
local function listener(unit, id)
|
|
2255
|
-
local
|
|
2205
|
+
local ____GetSpellTargetUnit_result_10
|
|
2256
2206
|
if GetSpellTargetUnit() then
|
|
2257
|
-
|
|
2207
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2258
2208
|
else
|
|
2259
|
-
local
|
|
2209
|
+
local ____GetSpellTargetItem_result_9
|
|
2260
2210
|
if GetSpellTargetItem() then
|
|
2261
|
-
|
|
2211
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2262
2212
|
else
|
|
2263
|
-
local
|
|
2213
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2264
2214
|
if GetSpellTargetDestructable() then
|
|
2265
|
-
|
|
2215
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2266
2216
|
else
|
|
2267
|
-
|
|
2217
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2268
2218
|
end
|
|
2269
|
-
|
|
2219
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2270
2220
|
end
|
|
2271
|
-
|
|
2221
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2272
2222
|
end
|
|
2273
|
-
local target =
|
|
2223
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2274
2224
|
if target then
|
|
2275
2225
|
invoke(event, unit, id, target)
|
|
2276
2226
|
end
|
|
@@ -2493,12 +2443,7 @@ Unit.onDamaging = (function()
|
|
|
2493
2443
|
preventRetaliation = damagingEventPreventRetaliation
|
|
2494
2444
|
}
|
|
2495
2445
|
if data.isAttack and source then
|
|
2496
|
-
|
|
2497
|
-
if weapon == -1 then
|
|
2498
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2499
|
-
weapon = 0
|
|
2500
|
-
end
|
|
2501
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2446
|
+
data.weapon = source:chooseWeapon(target)
|
|
2502
2447
|
end
|
|
2503
2448
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2504
2449
|
invoke(
|
|
@@ -2643,7 +2588,7 @@ Unit.onDamage = __TS__New(
|
|
|
2643
2588
|
invoke(event, source, target, evData)
|
|
2644
2589
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2645
2590
|
local bonusHealth = math.ceil(evData.amount)
|
|
2646
|
-
target[
|
|
2591
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2647
2592
|
BlzSetUnitMaxHP(
|
|
2648
2593
|
target.handle,
|
|
2649
2594
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2657,7 +2602,7 @@ Unit.onDamage = __TS__New(
|
|
|
2657
2602
|
evData[0],
|
|
2658
2603
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2659
2604
|
)
|
|
2660
|
-
target[
|
|
2605
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2661
2606
|
SetWidgetLife(
|
|
2662
2607
|
target.handle,
|
|
2663
2608
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2683,7 +2628,7 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2683
2628
|
function()
|
|
2684
2629
|
local unit = getTriggerUnit()
|
|
2685
2630
|
local item = getManipulatedItem()
|
|
2686
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2631
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2687
2632
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2688
2633
|
end
|
|
2689
2634
|
return IgnoreEvent
|
|
@@ -2693,10 +2638,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2693
2638
|
____exports.UnitTriggerEvent,
|
|
2694
2639
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2695
2640
|
function()
|
|
2696
|
-
local
|
|
2697
|
-
local
|
|
2698
|
-
if getUnitTypeId(
|
|
2699
|
-
|
|
2641
|
+
local unitHandle = getTriggerUnit()
|
|
2642
|
+
local itemHandle = getManipulatedItem()
|
|
2643
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not isItemIgnoredInEvents(itemHandle) then
|
|
2644
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2645
|
+
local item = Item:of(itemHandle)
|
|
2646
|
+
if ownerByItem[item] ~= unit then
|
|
2647
|
+
return unit, item
|
|
2648
|
+
end
|
|
2700
2649
|
end
|
|
2701
2650
|
return IgnoreEvent
|
|
2702
2651
|
end
|
|
@@ -2707,17 +2656,12 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2707
2656
|
function()
|
|
2708
2657
|
local unit = getTriggerUnit()
|
|
2709
2658
|
local item = getManipulatedItem()
|
|
2710
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2659
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2711
2660
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2712
2661
|
end
|
|
2713
2662
|
return IgnoreEvent
|
|
2714
2663
|
end
|
|
2715
2664
|
)
|
|
2716
|
-
Unit.itemStackedEvent = __TS__New(
|
|
2717
|
-
____exports.UnitTriggerEvent,
|
|
2718
|
-
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2719
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2720
|
-
)
|
|
2721
2665
|
__TS__ObjectDefineProperty(
|
|
2722
2666
|
Unit,
|
|
2723
2667
|
"itemChargesChangedEvent",
|
|
@@ -2733,51 +2677,6 @@ __TS__ObjectDefineProperty(
|
|
|
2733
2677
|
return event
|
|
2734
2678
|
end}
|
|
2735
2679
|
)
|
|
2736
|
-
__TS__ObjectDefineProperty(
|
|
2737
|
-
Unit,
|
|
2738
|
-
"itemUseOrderEvent",
|
|
2739
|
-
{get = function(self)
|
|
2740
|
-
local event = __TS__New(Event)
|
|
2741
|
-
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2742
|
-
local slot = order - orderId("useslot0")
|
|
2743
|
-
local function listener(unit)
|
|
2744
|
-
local item = unit.items[slot + 1]
|
|
2745
|
-
if item ~= nil then
|
|
2746
|
-
invoke(event, unit, item)
|
|
2747
|
-
end
|
|
2748
|
-
end
|
|
2749
|
-
self.onImmediateOrder[order]:addListener(listener)
|
|
2750
|
-
self.onTargetOrder[order]:addListener(listener)
|
|
2751
|
-
self.onPointOrder[order]:addListener(listener)
|
|
2752
|
-
end
|
|
2753
|
-
rawset(self, "itemUseOrderEvent", event)
|
|
2754
|
-
return event
|
|
2755
|
-
end}
|
|
2756
|
-
)
|
|
2757
|
-
__TS__ObjectDefineProperty(
|
|
2758
|
-
Unit,
|
|
2759
|
-
"itemMoveOrderEvent",
|
|
2760
|
-
{get = function(self)
|
|
2761
|
-
local event = __TS__New(Event)
|
|
2762
|
-
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2763
|
-
local slotTo = order - orderId("moveslot0")
|
|
2764
|
-
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2765
|
-
local slotFrom = unit.items:findSlot(item)
|
|
2766
|
-
if slotFrom ~= nil then
|
|
2767
|
-
invoke(
|
|
2768
|
-
event,
|
|
2769
|
-
unit,
|
|
2770
|
-
item,
|
|
2771
|
-
slotFrom,
|
|
2772
|
-
slotTo
|
|
2773
|
-
)
|
|
2774
|
-
end
|
|
2775
|
-
end)
|
|
2776
|
-
end
|
|
2777
|
-
rawset(self, "itemMoveOrderEvent", event)
|
|
2778
|
-
return event
|
|
2779
|
-
end}
|
|
2780
|
-
)
|
|
2781
2680
|
__TS__ObjectDefineProperty(
|
|
2782
2681
|
Unit,
|
|
2783
2682
|
"onCreate",
|
|
@@ -2803,6 +2702,10 @@ __TS__ObjectDefineProperty(
|
|
|
2803
2702
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2804
2703
|
return destroyEvent
|
|
2805
2704
|
end}
|
|
2705
|
+
)
|
|
2706
|
+
Unit.synchronize = synchronizer(
|
|
2707
|
+
function(unit) return unit.syncId end,
|
|
2708
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2806
2709
|
);
|
|
2807
2710
|
(function(self)
|
|
2808
2711
|
local leaveAbilityIds = postcompile(function()
|
|
@@ -2820,11 +2723,7 @@ __TS__ObjectDefineProperty(
|
|
|
2820
2723
|
function(____, id) return fourCC(id) end
|
|
2821
2724
|
)
|
|
2822
2725
|
end)
|
|
2823
|
-
for ____, leaveOrderId in ipairs({
|
|
2824
|
-
orderId("undefend"),
|
|
2825
|
-
orderId("magicundefense"),
|
|
2826
|
-
orderId("unimmolation")
|
|
2827
|
-
}) do
|
|
2726
|
+
for ____, leaveOrderId in ipairs({852056, 852479, 852178}) do
|
|
2828
2727
|
____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
|
|
2829
2728
|
local handle = unit.handle
|
|
2830
2729
|
for i = 1, #leaveAbilityIds do
|
|
@@ -2832,7 +2731,8 @@ __TS__ObjectDefineProperty(
|
|
|
2832
2731
|
return
|
|
2833
2732
|
end
|
|
2834
2733
|
end
|
|
2835
|
-
unit:
|
|
2734
|
+
unit:saveData()
|
|
2735
|
+
Timer:run(unit, "destroy")
|
|
2836
2736
|
end)
|
|
2837
2737
|
end
|
|
2838
2738
|
end)(Unit)
|