warscript 0.0.1-dev.4381d09 → 0.0.1-dev.43d3477
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 +112 -37
- 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 +73 -25
- 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 +2 -1
- package/core/types/tileCell.lua +5 -0
- 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 +705 -7
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +10 -2
- package/engine/behavior.lua +157 -76
- 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.lua +5 -4
- 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.d.ts +13 -6
- package/engine/behaviour/ability.lua +56 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -5
- package/engine/behaviour/unit/stun-immunity.lua +6 -5
- package/engine/behaviour/unit.d.ts +8 -3
- package/engine/behaviour/unit.lua +102 -24
- package/engine/buff.d.ts +73 -24
- package/engine/buff.lua +418 -166
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +56 -36
- 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 +27 -4
- package/engine/internal/item.d.ts +20 -5
- package/engine/internal/item.lua +146 -57
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- 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.lua +18 -6
- 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 +63 -2
- 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 +30 -20
- package/engine/internal/unit.d.ts +16 -28
- package/engine/internal/unit.lua +178 -257
- package/engine/local-client.d.ts +28 -0
- package/engine/local-client.lua +324 -54
- 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/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/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/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-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 +18 -3
- package/engine/object-data/entry/ability-type.lua +221 -4
- 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 +51 -2
- package/engine/object-data/entry/unit-type.lua +415 -37
- 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.lua +2 -2
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +10 -2
- package/engine/object-field.lua +268 -123
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +8 -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 +21 -0
- package/engine/standard/entries/buff-type.lua +19 -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 -3
- package/engine/standard/fields/unit.lua +15 -2
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +2 -1
- 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 +10 -8
- 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/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 +44 -0
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- 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/unit-ability-level-natives.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,
|
|
@@ -682,41 +706,57 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
682
706
|
nextSyncId = ____nextSyncId_1 + 1
|
|
683
707
|
self.syncId = ____nextSyncId_1
|
|
684
708
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
685
|
-
assert(
|
|
686
|
-
|
|
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
|
+
)
|
|
687
719
|
if unitAddAbility(
|
|
688
720
|
handle,
|
|
689
721
|
fourCC("Amrf")
|
|
690
722
|
) then
|
|
691
|
-
assert(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
723
|
+
assert(
|
|
724
|
+
unitRemoveAbility(
|
|
725
|
+
handle,
|
|
726
|
+
fourCC("Amrf")
|
|
727
|
+
),
|
|
728
|
+
"fly ability must be removed after addition",
|
|
729
|
+
self
|
|
730
|
+
)
|
|
695
731
|
end
|
|
696
732
|
unitBySyncId[self.syncId] = self
|
|
697
733
|
local ____ = self.abilities
|
|
698
734
|
end
|
|
699
|
-
function Unit.prototype.getEvent(self,
|
|
700
|
-
self.events = self.events or (
|
|
701
|
-
local eventId = GetHandleId(
|
|
702
|
-
|
|
703
|
-
|
|
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(
|
|
704
741
|
TriggerEvent,
|
|
705
742
|
function(trigger)
|
|
706
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
743
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
707
744
|
end,
|
|
708
745
|
collector or (function() return {} end)
|
|
709
746
|
)
|
|
747
|
+
self.events:put(eventId, event)
|
|
710
748
|
end
|
|
711
|
-
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))
|
|
712
756
|
end
|
|
713
757
|
function Unit.prototype.onDestroy(self)
|
|
714
758
|
local handle = self.handle
|
|
715
|
-
self
|
|
716
|
-
self[108] = getUnitY(handle)
|
|
717
|
-
if not self._owner then
|
|
718
|
-
self._owner = Player:of(getOwningPlayer(handle))
|
|
719
|
-
end
|
|
759
|
+
self:saveData()
|
|
720
760
|
local abilities = self.abilities
|
|
721
761
|
for ____, ability in ipairs(abilities) do
|
|
722
762
|
ability:destroy()
|
|
@@ -734,7 +774,9 @@ function Unit.prototype.onDestroy(self)
|
|
|
734
774
|
end
|
|
735
775
|
local eventsToDestroy = self._eventsToDestroy
|
|
736
776
|
if eventsToDestroy ~= nil then
|
|
737
|
-
|
|
777
|
+
for ____, event in ipairs(eventsToDestroy) do
|
|
778
|
+
event:destroy()
|
|
779
|
+
end
|
|
738
780
|
end
|
|
739
781
|
if getUnitAbilityLevel(handle, leaveDetectAbilityId) > 0 then
|
|
740
782
|
unitRemoveAbility(handle, leaveDetectAbilityId)
|
|
@@ -752,7 +794,11 @@ function Unit.prototype.addAttackHandler(self, condition, action)
|
|
|
752
794
|
self._attackHandlers = handlers
|
|
753
795
|
if #handlers == 1 then
|
|
754
796
|
local handle = self.handle
|
|
755
|
-
assert(
|
|
797
|
+
assert(
|
|
798
|
+
unitAddAbility(handle, attackHandlerAbilityId) and UnitMakeAbilityPermanent(handle, true, attackHandlerAbilityId),
|
|
799
|
+
"attack handler ability must be added",
|
|
800
|
+
self
|
|
801
|
+
)
|
|
756
802
|
end
|
|
757
803
|
return handler
|
|
758
804
|
end
|
|
@@ -836,16 +882,18 @@ function Unit.prototype.queueAnimation(self, animation)
|
|
|
836
882
|
QueueUnitAnimation(self.handle, animation)
|
|
837
883
|
end
|
|
838
884
|
function Unit.prototype.chooseWeapon(self, target)
|
|
839
|
-
|
|
840
|
-
|
|
885
|
+
local firstWeapon = self.firstWeapon
|
|
886
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
887
|
+
return firstWeapon
|
|
841
888
|
end
|
|
842
|
-
|
|
843
|
-
|
|
889
|
+
local secondWeapon = self.secondWeapon
|
|
890
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
891
|
+
return secondWeapon
|
|
844
892
|
end
|
|
845
893
|
return nil
|
|
846
894
|
end
|
|
847
895
|
function Unit.prototype.delayHealthChecks(self)
|
|
848
|
-
self[
|
|
896
|
+
self[104] = (self[104] or 0) + 1
|
|
849
897
|
Timer:run(delayHealthChecksCallback, self)
|
|
850
898
|
end
|
|
851
899
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -909,7 +957,7 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
909
957
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
910
958
|
end
|
|
911
959
|
function Unit.prototype.itemInSlot(self, slot)
|
|
912
|
-
return Item:of(
|
|
960
|
+
return Item:of(UnitItemInSlot(self.handle, slot))
|
|
913
961
|
end
|
|
914
962
|
function Unit.prototype.addAbility(self, abilityId)
|
|
915
963
|
local ability = UnitAbility:of(
|
|
@@ -963,24 +1011,6 @@ end
|
|
|
963
1011
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
964
1012
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
965
1013
|
end
|
|
966
|
-
function Unit.prototype.interruptMovement(self)
|
|
967
|
-
local handle = self.handle
|
|
968
|
-
unitDisableAbility(
|
|
969
|
-
handle,
|
|
970
|
-
fourCC("Amov"),
|
|
971
|
-
true,
|
|
972
|
-
false
|
|
973
|
-
)
|
|
974
|
-
unitDisableAbility(
|
|
975
|
-
handle,
|
|
976
|
-
fourCC("Amov"),
|
|
977
|
-
false,
|
|
978
|
-
false
|
|
979
|
-
)
|
|
980
|
-
end
|
|
981
|
-
function Unit.prototype.interruptAttack(self)
|
|
982
|
-
unitInterruptAttack(self.handle)
|
|
983
|
-
end
|
|
984
1014
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
985
1015
|
local handle = self.handle
|
|
986
1016
|
unitDisableAbility(handle, abilityId, true, false)
|
|
@@ -1051,18 +1081,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
1051
1081
|
end
|
|
1052
1082
|
function Unit.prototype.incrementStunCounter(self)
|
|
1053
1083
|
local stunCounter = self[102] or 0
|
|
1054
|
-
if not self[101] or stunCounter >= 0 then
|
|
1084
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
1055
1085
|
BlzPauseUnitEx(self.handle, true)
|
|
1056
1086
|
end
|
|
1057
1087
|
self[102] = stunCounter + 1
|
|
1058
1088
|
end
|
|
1059
1089
|
function Unit.prototype.decrementStunCounter(self)
|
|
1060
1090
|
local stunCounter = self[102] or 0
|
|
1061
|
-
if not self[101] or stunCounter >= 1 then
|
|
1091
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
1062
1092
|
BlzPauseUnitEx(self.handle, false)
|
|
1063
1093
|
end
|
|
1064
1094
|
self[102] = stunCounter - 1
|
|
1065
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
|
|
1066
1122
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
1067
1123
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
1068
1124
|
owner.handle,
|
|
@@ -1259,7 +1315,7 @@ __TS__SetDescriptor(
|
|
|
1259
1315
|
Unit.prototype,
|
|
1260
1316
|
"isStunned",
|
|
1261
1317
|
{get = function(self)
|
|
1262
|
-
return getUnitCurrentOrder(self.handle) ==
|
|
1318
|
+
return getUnitCurrentOrder(self.handle) == 851973
|
|
1263
1319
|
end},
|
|
1264
1320
|
true
|
|
1265
1321
|
)
|
|
@@ -1349,19 +1405,6 @@ __TS__SetDescriptor(
|
|
|
1349
1405
|
},
|
|
1350
1406
|
true
|
|
1351
1407
|
)
|
|
1352
|
-
__TS__SetDescriptor(
|
|
1353
|
-
Unit.prototype,
|
|
1354
|
-
"strengthBase",
|
|
1355
|
-
{
|
|
1356
|
-
get = function(self)
|
|
1357
|
-
return getHeroStr(self.handle, false)
|
|
1358
|
-
end,
|
|
1359
|
-
set = function(self, strengthBase)
|
|
1360
|
-
setHeroStr(self.handle, strengthBase, true)
|
|
1361
|
-
end
|
|
1362
|
-
},
|
|
1363
|
-
true
|
|
1364
|
-
)
|
|
1365
1408
|
__TS__SetDescriptor(
|
|
1366
1409
|
Unit.prototype,
|
|
1367
1410
|
"strengthBonus",
|
|
@@ -1379,19 +1422,6 @@ __TS__SetDescriptor(
|
|
|
1379
1422
|
end},
|
|
1380
1423
|
true
|
|
1381
1424
|
)
|
|
1382
|
-
__TS__SetDescriptor(
|
|
1383
|
-
Unit.prototype,
|
|
1384
|
-
"agilityBase",
|
|
1385
|
-
{
|
|
1386
|
-
get = function(self)
|
|
1387
|
-
return getHeroAgi(self.handle, false)
|
|
1388
|
-
end,
|
|
1389
|
-
set = function(self, agilityBase)
|
|
1390
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1391
|
-
end
|
|
1392
|
-
},
|
|
1393
|
-
true
|
|
1394
|
-
)
|
|
1395
1425
|
__TS__SetDescriptor(
|
|
1396
1426
|
Unit.prototype,
|
|
1397
1427
|
"agilityBonus",
|
|
@@ -1409,19 +1439,6 @@ __TS__SetDescriptor(
|
|
|
1409
1439
|
end},
|
|
1410
1440
|
true
|
|
1411
1441
|
)
|
|
1412
|
-
__TS__SetDescriptor(
|
|
1413
|
-
Unit.prototype,
|
|
1414
|
-
"intelligenceBase",
|
|
1415
|
-
{
|
|
1416
|
-
get = function(self)
|
|
1417
|
-
return getHeroInt(self.handle, false)
|
|
1418
|
-
end,
|
|
1419
|
-
set = function(self, intelligenceBase)
|
|
1420
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1421
|
-
end
|
|
1422
|
-
},
|
|
1423
|
-
true
|
|
1424
|
-
)
|
|
1425
1442
|
__TS__SetDescriptor(
|
|
1426
1443
|
Unit.prototype,
|
|
1427
1444
|
"intelligenceBonus",
|
|
@@ -1470,7 +1487,7 @@ __TS__SetDescriptor(
|
|
|
1470
1487
|
"isTeamGlowVisible",
|
|
1471
1488
|
{
|
|
1472
1489
|
get = function(self)
|
|
1473
|
-
return not self[
|
|
1490
|
+
return not self[107]
|
|
1474
1491
|
end,
|
|
1475
1492
|
set = function(self, isTeamGlowVisible)
|
|
1476
1493
|
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
@@ -1480,7 +1497,7 @@ __TS__SetDescriptor(
|
|
|
1480
1497
|
else
|
|
1481
1498
|
____temp_7 = nil
|
|
1482
1499
|
end
|
|
1483
|
-
self[
|
|
1500
|
+
self[107] = ____temp_7
|
|
1484
1501
|
end
|
|
1485
1502
|
},
|
|
1486
1503
|
true
|
|
@@ -1490,7 +1507,7 @@ __TS__SetDescriptor(
|
|
|
1490
1507
|
"color",
|
|
1491
1508
|
{set = function(self, color)
|
|
1492
1509
|
SetUnitColor(self.handle, color.handle)
|
|
1493
|
-
if self[
|
|
1510
|
+
if self[107] then
|
|
1494
1511
|
BlzShowUnitTeamGlow(self.handle, false)
|
|
1495
1512
|
end
|
|
1496
1513
|
end},
|
|
@@ -1514,14 +1531,14 @@ __TS__SetDescriptor(
|
|
|
1514
1531
|
"maxHealth",
|
|
1515
1532
|
{
|
|
1516
1533
|
get = function(self)
|
|
1517
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1534
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1518
1535
|
end,
|
|
1519
1536
|
set = function(self, maxHealth)
|
|
1520
|
-
if maxHealth < 1 and self[
|
|
1521
|
-
self[
|
|
1537
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1538
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1522
1539
|
maxHealth = 1
|
|
1523
1540
|
end
|
|
1524
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1541
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1525
1542
|
end
|
|
1526
1543
|
},
|
|
1527
1544
|
true
|
|
@@ -1563,10 +1580,10 @@ __TS__SetDescriptor(
|
|
|
1563
1580
|
"health",
|
|
1564
1581
|
{
|
|
1565
1582
|
get = function(self)
|
|
1566
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1583
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1567
1584
|
end,
|
|
1568
1585
|
set = function(self, health)
|
|
1569
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1586
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1570
1587
|
end
|
|
1571
1588
|
},
|
|
1572
1589
|
true
|
|
@@ -1642,25 +1659,12 @@ __TS__SetDescriptor(
|
|
|
1642
1659
|
},
|
|
1643
1660
|
true
|
|
1644
1661
|
)
|
|
1645
|
-
__TS__SetDescriptor(
|
|
1646
|
-
Unit.prototype,
|
|
1647
|
-
"flyHeight",
|
|
1648
|
-
{
|
|
1649
|
-
get = function(self)
|
|
1650
|
-
return getUnitFlyHeight(self.handle)
|
|
1651
|
-
end,
|
|
1652
|
-
set = function(self, v)
|
|
1653
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1654
|
-
end
|
|
1655
|
-
},
|
|
1656
|
-
true
|
|
1657
|
-
)
|
|
1658
1662
|
__TS__SetDescriptor(
|
|
1659
1663
|
Unit.prototype,
|
|
1660
1664
|
"x",
|
|
1661
1665
|
{
|
|
1662
1666
|
get = function(self)
|
|
1663
|
-
return self[
|
|
1667
|
+
return self[108] or getUnitX(self.handle)
|
|
1664
1668
|
end,
|
|
1665
1669
|
set = function(self, v)
|
|
1666
1670
|
SetUnitX(self.handle, v)
|
|
@@ -1673,7 +1677,7 @@ __TS__SetDescriptor(
|
|
|
1673
1677
|
"y",
|
|
1674
1678
|
{
|
|
1675
1679
|
get = function(self)
|
|
1676
|
-
return self[
|
|
1680
|
+
return self[109] or getUnitY(self.handle)
|
|
1677
1681
|
end,
|
|
1678
1682
|
set = function(self, v)
|
|
1679
1683
|
SetUnitY(self.handle, v)
|
|
@@ -1778,14 +1782,18 @@ __TS__SetDescriptor(
|
|
|
1778
1782
|
local handle = self.handle
|
|
1779
1783
|
if isPaused and not IsUnitPaused(handle) then
|
|
1780
1784
|
self[101] = true
|
|
1781
|
-
|
|
1782
|
-
|
|
1785
|
+
if (self[103] or 0) <= 0 then
|
|
1786
|
+
for _ = self[102] or 0, -1 do
|
|
1787
|
+
BlzPauseUnitEx(handle, true)
|
|
1788
|
+
end
|
|
1783
1789
|
end
|
|
1784
1790
|
PauseUnit(handle, true)
|
|
1785
1791
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1786
1792
|
PauseUnit(handle, false)
|
|
1787
|
-
|
|
1788
|
-
|
|
1793
|
+
if (self[103] or 0) <= 0 then
|
|
1794
|
+
for _ = self[102] or 0, -1 do
|
|
1795
|
+
BlzPauseUnitEx(handle, false)
|
|
1796
|
+
end
|
|
1789
1797
|
end
|
|
1790
1798
|
self[101] = nil
|
|
1791
1799
|
end
|
|
@@ -1843,20 +1851,6 @@ __TS__SetDescriptor(
|
|
|
1843
1851
|
},
|
|
1844
1852
|
true
|
|
1845
1853
|
)
|
|
1846
|
-
__TS__SetDescriptor(
|
|
1847
|
-
Unit.prototype,
|
|
1848
|
-
"scale",
|
|
1849
|
-
{
|
|
1850
|
-
get = function(self)
|
|
1851
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1852
|
-
end,
|
|
1853
|
-
set = function(self, v)
|
|
1854
|
-
setUnitScale(self.handle, v, v, v)
|
|
1855
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1856
|
-
end
|
|
1857
|
-
},
|
|
1858
|
-
true
|
|
1859
|
-
)
|
|
1860
1854
|
__TS__SetDescriptor(
|
|
1861
1855
|
Unit.prototype,
|
|
1862
1856
|
"timeScale",
|
|
@@ -1883,7 +1877,7 @@ __TS__SetDescriptor(
|
|
|
1883
1877
|
Unit.prototype,
|
|
1884
1878
|
"pathingCollisionRange",
|
|
1885
1879
|
{get = function(self)
|
|
1886
|
-
return 16 * (min(
|
|
1880
|
+
return 16 * (math.min(
|
|
1887
1881
|
getUnitCollisionSize(self.handle) // 16,
|
|
1888
1882
|
3
|
|
1889
1883
|
) + 1)
|
|
@@ -1993,30 +1987,6 @@ __TS__SetDescriptor(
|
|
|
1993
1987
|
end},
|
|
1994
1988
|
true
|
|
1995
1989
|
)
|
|
1996
|
-
__TS__SetDescriptor(
|
|
1997
|
-
Unit.prototype,
|
|
1998
|
-
"onUnitInRange",
|
|
1999
|
-
{get = function(self)
|
|
2000
|
-
local handle = self.handle
|
|
2001
|
-
local onUnitInRange = setmetatable(
|
|
2002
|
-
{},
|
|
2003
|
-
{__index = function(self, value)
|
|
2004
|
-
local event = __TS__New(
|
|
2005
|
-
TriggerEvent,
|
|
2006
|
-
function(trigger)
|
|
2007
|
-
TriggerRegisterUnitInRangeSimple(trigger, value, handle)
|
|
2008
|
-
end,
|
|
2009
|
-
function() return ____exports.Unit:of(handle) end
|
|
2010
|
-
)
|
|
2011
|
-
rawset(self, value, event)
|
|
2012
|
-
return event
|
|
2013
|
-
end}
|
|
2014
|
-
)
|
|
2015
|
-
rawset(self, "onUnitInRange", onUnitInRange)
|
|
2016
|
-
return onUnitInRange
|
|
2017
|
-
end},
|
|
2018
|
-
true
|
|
2019
|
-
)
|
|
2020
1990
|
__TS__SetDescriptor(
|
|
2021
1991
|
Unit.prototype,
|
|
2022
1992
|
"onManaEqual",
|
|
@@ -2152,6 +2122,11 @@ __TS__SetDescriptor(
|
|
|
2152
2122
|
end},
|
|
2153
2123
|
true
|
|
2154
2124
|
)
|
|
2125
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2126
|
+
____exports.UnitTriggerEvent,
|
|
2127
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2128
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2129
|
+
)
|
|
2155
2130
|
Unit.deathEvent = __TS__New(
|
|
2156
2131
|
____exports.UnitTriggerEvent,
|
|
2157
2132
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -2169,7 +2144,7 @@ Unit.onResurrect = __TS__New(
|
|
|
2169
2144
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
2170
2145
|
dead[unit] = true
|
|
2171
2146
|
end)
|
|
2172
|
-
____exports.Unit.onImmediateOrder[
|
|
2147
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2173
2148
|
if dead[unit] and not IsUnitType(unit.handle, UNIT_TYPE_DEAD) then
|
|
2174
2149
|
dead[unit] = false
|
|
2175
2150
|
invoke(event, unit)
|
|
@@ -2186,7 +2161,7 @@ Unit.morphEvent = __TS__New(
|
|
|
2186
2161
|
invoke(event, unit)
|
|
2187
2162
|
end
|
|
2188
2163
|
end
|
|
2189
|
-
____exports.Unit.onImmediateOrder[
|
|
2164
|
+
____exports.Unit.onImmediateOrder[852056]:addListener(function(unit)
|
|
2190
2165
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
2191
2166
|
Timer:run(ifNotLeft, unit)
|
|
2192
2167
|
end
|
|
@@ -2468,12 +2443,7 @@ Unit.onDamaging = (function()
|
|
|
2468
2443
|
preventRetaliation = damagingEventPreventRetaliation
|
|
2469
2444
|
}
|
|
2470
2445
|
if data.isAttack and source then
|
|
2471
|
-
|
|
2472
|
-
if weapon == -1 then
|
|
2473
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2474
|
-
weapon = 0
|
|
2475
|
-
end
|
|
2476
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2446
|
+
data.weapon = source:chooseWeapon(target)
|
|
2477
2447
|
end
|
|
2478
2448
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2479
2449
|
invoke(
|
|
@@ -2618,7 +2588,7 @@ Unit.onDamage = __TS__New(
|
|
|
2618
2588
|
invoke(event, source, target, evData)
|
|
2619
2589
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2620
2590
|
local bonusHealth = math.ceil(evData.amount)
|
|
2621
|
-
target[
|
|
2591
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2622
2592
|
BlzSetUnitMaxHP(
|
|
2623
2593
|
target.handle,
|
|
2624
2594
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2632,7 +2602,7 @@ Unit.onDamage = __TS__New(
|
|
|
2632
2602
|
evData[0],
|
|
2633
2603
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2634
2604
|
)
|
|
2635
|
-
target[
|
|
2605
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2636
2606
|
SetWidgetLife(
|
|
2637
2607
|
target.handle,
|
|
2638
2608
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2658,7 +2628,7 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2658
2628
|
function()
|
|
2659
2629
|
local unit = getTriggerUnit()
|
|
2660
2630
|
local item = getManipulatedItem()
|
|
2661
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2631
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2662
2632
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2663
2633
|
end
|
|
2664
2634
|
return IgnoreEvent
|
|
@@ -2670,10 +2640,10 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2670
2640
|
function()
|
|
2671
2641
|
local unitHandle = getTriggerUnit()
|
|
2672
2642
|
local itemHandle = getManipulatedItem()
|
|
2673
|
-
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (
|
|
2643
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not isItemIgnoredInEvents(itemHandle) then
|
|
2674
2644
|
local unit = ____exports.Unit:of(unitHandle)
|
|
2675
2645
|
local item = Item:of(itemHandle)
|
|
2676
|
-
if item
|
|
2646
|
+
if ownerByItem[item] ~= unit then
|
|
2677
2647
|
return unit, item
|
|
2678
2648
|
end
|
|
2679
2649
|
end
|
|
@@ -2686,17 +2656,12 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2686
2656
|
function()
|
|
2687
2657
|
local unit = getTriggerUnit()
|
|
2688
2658
|
local item = getManipulatedItem()
|
|
2689
|
-
if getUnitTypeId(unit) ~= dummyUnitId and not (
|
|
2659
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not isItemIgnoredInEvents(item) then
|
|
2690
2660
|
return ____exports.Unit:of(unit), Item:of(item)
|
|
2691
2661
|
end
|
|
2692
2662
|
return IgnoreEvent
|
|
2693
2663
|
end
|
|
2694
2664
|
)
|
|
2695
|
-
Unit.itemStackedEvent = __TS__New(
|
|
2696
|
-
____exports.UnitTriggerEvent,
|
|
2697
|
-
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2698
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2699
|
-
)
|
|
2700
2665
|
__TS__ObjectDefineProperty(
|
|
2701
2666
|
Unit,
|
|
2702
2667
|
"itemChargesChangedEvent",
|
|
@@ -2712,51 +2677,6 @@ __TS__ObjectDefineProperty(
|
|
|
2712
2677
|
return event
|
|
2713
2678
|
end}
|
|
2714
2679
|
)
|
|
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
2680
|
__TS__ObjectDefineProperty(
|
|
2761
2681
|
Unit,
|
|
2762
2682
|
"onCreate",
|
|
@@ -2782,6 +2702,10 @@ __TS__ObjectDefineProperty(
|
|
|
2782
2702
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2783
2703
|
return destroyEvent
|
|
2784
2704
|
end}
|
|
2705
|
+
)
|
|
2706
|
+
Unit.synchronize = synchronizer(
|
|
2707
|
+
function(unit) return unit.syncId end,
|
|
2708
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2785
2709
|
);
|
|
2786
2710
|
(function(self)
|
|
2787
2711
|
local leaveAbilityIds = postcompile(function()
|
|
@@ -2799,11 +2723,7 @@ __TS__ObjectDefineProperty(
|
|
|
2799
2723
|
function(____, id) return fourCC(id) end
|
|
2800
2724
|
)
|
|
2801
2725
|
end)
|
|
2802
|
-
for ____, leaveOrderId in ipairs({
|
|
2803
|
-
orderId("undefend"),
|
|
2804
|
-
orderId("magicundefense"),
|
|
2805
|
-
orderId("unimmolation")
|
|
2806
|
-
}) do
|
|
2726
|
+
for ____, leaveOrderId in ipairs({852056, 852479, 852178}) do
|
|
2807
2727
|
____exports.Unit.onImmediateOrder[leaveOrderId]:addListener(function(unit)
|
|
2808
2728
|
local handle = unit.handle
|
|
2809
2729
|
for i = 1, #leaveAbilityIds do
|
|
@@ -2811,7 +2731,8 @@ __TS__ObjectDefineProperty(
|
|
|
2811
2731
|
return
|
|
2812
2732
|
end
|
|
2813
2733
|
end
|
|
2814
|
-
unit:
|
|
2734
|
+
unit:saveData()
|
|
2735
|
+
Timer:run(unit, "destroy")
|
|
2815
2736
|
end)
|
|
2816
2737
|
end
|
|
2817
2738
|
end)(Unit)
|