warscript 0.0.1-dev.3eed609 → 0.0.1-dev.3f0a5ea
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/core/dummy.lua +4 -2
- package/core/types/effect.d.ts +11 -1
- package/core/types/effect.lua +43 -77
- package/core/types/frame.d.ts +16 -2
- package/core/types/frame.lua +128 -67
- 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/missile.lua +8 -7
- package/core/types/player.d.ts +2 -1
- package/core/types/player.lua +18 -13
- 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 +7 -2
- package/core/types/tileCell.lua +11 -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 +706 -7
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/ability-type-extended-tooltip.d.ts +8 -0
- package/engine/ability-type-extended-tooltip.lua +44 -0
- package/engine/behavior.d.ts +4 -2
- package/engine/behavior.lua +69 -11
- 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 +14 -0
- package/engine/behaviour/ability/emulate-impact.lua +79 -5
- package/engine/behaviour/ability/instant-impact.d.ts +12 -1
- package/engine/behaviour/ability/instant-impact.lua +17 -2
- 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.d.ts +19 -6
- package/engine/behaviour/ability.lua +120 -9
- package/engine/behaviour/unit/stun-immunity.d.ts +1 -1
- package/engine/behaviour/unit/stun-immunity.lua +5 -4
- package/engine/behaviour/unit.d.ts +1 -0
- package/engine/behaviour/unit.lua +14 -3
- package/engine/buff.d.ts +103 -55
- package/engine/buff.lua +486 -270
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +7 -0
- package/engine/internal/ability.lua +65 -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/object-data/returned-melee-damage-factor.d.ts +2 -0
- package/engine/internal/object-data/returned-melee-damage-factor.lua +21 -0
- package/engine/internal/unit/ability.lua +16 -0
- 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 +17 -0
- package/engine/internal/unit/bonus.lua +113 -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.lua +3 -3
- 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/order.d.ts +3 -3
- package/engine/internal/unit/order.lua +10 -10
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.lua +3 -3
- package/engine/internal/unit+ability.d.ts +2 -1
- package/engine/internal/unit+ability.lua +73 -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 +96 -68
- package/engine/internal/unit-missile-launch.lua +25 -18
- package/engine/internal/unit.d.ts +4 -19
- package/engine/internal/unit.lua +132 -221
- package/engine/lightning.lua +4 -4
- package/engine/local-client.d.ts +27 -1
- package/engine/local-client.lua +298 -58
- 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/barrage.d.ts +12 -0
- package/engine/object-data/entry/ability-type/barrage.lua +52 -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.lua +2 -2
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.d.ts +23 -0
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +4 -0
- package/engine/object-data/entry/ability-type/blank-passive.lua +27 -7
- package/engine/object-data/entry/ability-type/breath-of-fire.d.ts +11 -0
- package/engine/object-data/entry/ability-type/breath-of-fire.lua +27 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +2 -2
- package/engine/object-data/entry/ability-type/channel.lua +3 -3
- package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/exhume-corpses.d.ts +14 -0
- package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
- package/engine/object-data/entry/ability-type/firebolt.d.ts +7 -0
- package/engine/object-data/entry/ability-type/firebolt.lua +13 -0
- package/engine/object-data/entry/ability-type/flame-strike.d.ts +25 -0
- package/engine/object-data/entry/ability-type/flame-strike.lua +92 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/healing-ward-aura.d.ts +13 -0
- package/engine/object-data/entry/ability-type/healing-ward-aura.lua +39 -0
- package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/heroic-slash.d.ts +18 -0
- package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
- package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
- package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
- package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
- package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
- package/engine/object-data/entry/ability-type/item-life-regeneration.d.ts +10 -0
- package/engine/object-data/entry/ability-type/item-life-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/life-drain.d.ts +37 -0
- package/engine/object-data/entry/ability-type/life-drain.lua +144 -0
- package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
- package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -0
- package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.d.ts +12 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/mind-control.d.ts +21 -0
- package/engine/object-data/entry/ability-type/mind-control.lua +78 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.d.ts +21 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.lua +52 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.d.ts +19 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.lua +65 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.d.ts +15 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.lua +26 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.d.ts +6 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.lua +12 -0
- package/engine/object-data/entry/ability-type/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/rain-of-fire.d.ts +7 -0
- package/engine/object-data/entry/ability-type/rain-of-fire.lua +13 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.lua +26 -0
- package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type/resolve.d.ts +12 -0
- package/engine/object-data/entry/ability-type/resolve.lua +39 -0
- package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
- package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
- package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
- package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -0
- package/engine/object-data/entry/ability-type/soul-burn.d.ts +22 -0
- package/engine/object-data/entry/ability-type/soul-burn.lua +79 -0
- package/engine/object-data/entry/ability-type/soul-lantern.d.ts +30 -0
- package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
- package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
- package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
- package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
- package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
- package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
- package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
- package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
- package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
- package/engine/object-data/entry/ability-type/talents.lua +27 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
- package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
- package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
- package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
- package/engine/object-data/entry/ability-type/warcry.lua +26 -0
- package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
- package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
- package/engine/object-data/entry/ability-type.d.ts +35 -8
- package/engine/object-data/entry/ability-type.lua +299 -11
- package/engine/object-data/entry/buff-type/applicable.lua +122 -111
- 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 +57 -2
- package/engine/object-data/entry/unit-type.lua +412 -64
- 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 +7 -4
- package/engine/object-field/unit.lua +4 -0
- package/engine/object-field.d.ts +3 -1
- package/engine/object-field.lua +177 -119
- 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 +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 -5
- package/engine/standard/fields/unit.lua +13 -4
- package/engine/text-tag.d.ts +17 -1
- package/engine/text-tag.lua +77 -40
- package/engine/unit.d.ts +8 -1
- package/engine/unit.lua +8 -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/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/arrays.d.ts +7 -1
- package/utility/arrays.lua +17 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +3 -1
- package/utility/linked-set.lua +27 -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/destroyable.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface Destroyable {
|
|
|
10
10
|
destroy(): void;
|
|
11
11
|
}
|
|
12
12
|
export declare abstract class AbstractDestroyable implements Destroyable {
|
|
13
|
+
get isDestroyed(): boolean;
|
|
13
14
|
/**
|
|
14
15
|
* An overriding function should always call the super one at the end of it,
|
|
15
16
|
* in the following manner: `return super.onDestroy()`.
|
package/destroyable.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local ____exception = require("exception")
|
|
6
7
|
local IllegalStateException = ____exception.IllegalStateException
|
|
@@ -28,4 +29,12 @@ function AbstractDestroyable.prototype.destroy(self)
|
|
|
28
29
|
end
|
|
29
30
|
return true
|
|
30
31
|
end
|
|
32
|
+
__TS__SetDescriptor(
|
|
33
|
+
AbstractDestroyable.prototype,
|
|
34
|
+
"isDestroyed",
|
|
35
|
+
{get = function(self)
|
|
36
|
+
return stateByDestroyable[self] ~= nil
|
|
37
|
+
end},
|
|
38
|
+
true
|
|
39
|
+
)
|
|
31
40
|
return ____exports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityTypeId } from "./object-data/entry/ability-type";
|
|
3
|
+
/**
|
|
4
|
+
* The ability type's own extended tooltip for the level, unaffected by local display
|
|
5
|
+
* overrides (see {@link overrideAbilityTypeExtendedTooltipLocally}). Use it instead of
|
|
6
|
+
* `BlzGetAbilityExtendedTooltip` wherever the type's tooltip serves as a template.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getAbilityTypeExtendedTooltip: (abilityTypeId: AbilityTypeId, level: number) => string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getAbilityExtendedTooltip = BlzGetAbilityExtendedTooltip
|
|
3
|
+
local setAbilityExtendedTooltip = BlzSetAbilityExtendedTooltip
|
|
4
|
+
local originalTooltipByLevelByAbilityTypeId = {}
|
|
5
|
+
local overriddenTooltipByLevelByAbilityTypeId = {}
|
|
6
|
+
--- The ability type's own extended tooltip for the level, unaffected by local display
|
|
7
|
+
-- overrides (see {@link overrideAbilityTypeExtendedTooltipLocally}). Use it instead of
|
|
8
|
+
-- `BlzGetAbilityExtendedTooltip` wherever the type's tooltip serves as a template.
|
|
9
|
+
____exports.getAbilityTypeExtendedTooltip = function(abilityTypeId, level)
|
|
10
|
+
local ____opt_0 = originalTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
11
|
+
return ____opt_0 and ____opt_0[level] or getAbilityExtendedTooltip(abilityTypeId, level)
|
|
12
|
+
end
|
|
13
|
+
--- Replaces the displayed extended tooltip of every ability of the type for the local
|
|
14
|
+
-- player only; `undefined` restores the type's own tooltip. The value is async: never
|
|
15
|
+
-- feed it back into synchronous logic.
|
|
16
|
+
--
|
|
17
|
+
-- @internal For use by internal systems only.
|
|
18
|
+
____exports.overrideAbilityTypeExtendedTooltipLocally = function(abilityTypeId, level, tooltip)
|
|
19
|
+
local overriddenTooltipByLevel = overriddenTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
20
|
+
if (overriddenTooltipByLevel and overriddenTooltipByLevel[level]) == tooltip then
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
local originalTooltipByLevel = originalTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
24
|
+
if originalTooltipByLevel == nil then
|
|
25
|
+
originalTooltipByLevel = {}
|
|
26
|
+
originalTooltipByLevelByAbilityTypeId[abilityTypeId] = originalTooltipByLevel
|
|
27
|
+
end
|
|
28
|
+
local originalTooltip = originalTooltipByLevel[level]
|
|
29
|
+
if originalTooltip == nil then
|
|
30
|
+
originalTooltip = getAbilityExtendedTooltip(abilityTypeId, level)
|
|
31
|
+
originalTooltipByLevel[level] = originalTooltip
|
|
32
|
+
end
|
|
33
|
+
if overriddenTooltipByLevel == nil then
|
|
34
|
+
overriddenTooltipByLevel = {}
|
|
35
|
+
overriddenTooltipByLevelByAbilityTypeId[abilityTypeId] = overriddenTooltipByLevel
|
|
36
|
+
end
|
|
37
|
+
if tooltip == nil then
|
|
38
|
+
overriddenTooltipByLevel[level] = nil
|
|
39
|
+
else
|
|
40
|
+
overriddenTooltipByLevel[level] = tooltip
|
|
41
|
+
end
|
|
42
|
+
setAbilityExtendedTooltip(abilityTypeId, tooltip or originalTooltip, level)
|
|
43
|
+
end
|
|
44
|
+
return ____exports
|
package/engine/behavior.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ export declare abstract class Behavior<T extends AnyNotNil, PeriodicActionParame
|
|
|
18
18
|
private [BehaviorPropertyKey.PREVIOUS_BEHAVIOR]?;
|
|
19
19
|
private [BehaviorPropertyKey.NEXT_BEHAVIOR]?;
|
|
20
20
|
private [BehaviorPropertyKey.TIMER]?;
|
|
21
|
-
|
|
21
|
+
constructor(object: T, priority?: BehaviorPriority);
|
|
22
22
|
protected onDestroy(): Destructor;
|
|
23
|
-
protected
|
|
23
|
+
protected registerGlobalEvent<K extends string, Args extends any[]>(this: Behavior<any, PeriodicActionParameters> & Record<K, (this: this, ...args: Args) => unknown>, event: Event<[...Args]>, listener: K): void;
|
|
24
|
+
protected deregisterGlobalEvent(event: Event<any>): boolean;
|
|
25
|
+
protected registerEvent<K extends string, Args extends any[]>(this: Behavior<any, PeriodicActionParameters> & Record<K, (this: this, ...args: Args) => unknown>, event: Event<[...Args]>, extractObject: (...args: Args) => T | undefined, listener: K): void;
|
|
24
26
|
protected deregisterEvent(event: Event<any>): boolean;
|
|
25
27
|
protected onPeriod(...parameters: PeriodicActionParameters): void;
|
|
26
28
|
protected startPeriodicAction(interval: number, ...parameters: PeriodicActionParameters): void;
|
package/engine/behavior.lua
CHANGED
|
@@ -57,9 +57,17 @@ local function reduceBehaviors(behaviorConstructor, object, operation, initial,
|
|
|
57
57
|
end
|
|
58
58
|
return accumulator
|
|
59
59
|
end
|
|
60
|
+
local behaviorsByGlobalEvent = {}
|
|
61
|
+
local listenerByBehaviorByGlobalEvent = {}
|
|
62
|
+
local globalEventsByBehavior = {}
|
|
60
63
|
local behaviorsByEvent = {}
|
|
61
64
|
local listenerByBehaviorByEvent = {}
|
|
62
65
|
local eventsByBehavior = {}
|
|
66
|
+
local function safeCallBehaviorListener(behavior, behaviors, listenerByBehavior, ...)
|
|
67
|
+
if behaviors[behavior] ~= nil then
|
|
68
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
63
71
|
____exports.Behavior = __TS__Class()
|
|
64
72
|
local Behavior = ____exports.Behavior
|
|
65
73
|
Behavior.name = "Behavior"
|
|
@@ -87,18 +95,32 @@ function Behavior.prototype.onDestroy(self)
|
|
|
87
95
|
if ____opt_0 ~= nil then
|
|
88
96
|
____opt_0:destroy()
|
|
89
97
|
end
|
|
90
|
-
local
|
|
91
|
-
if
|
|
92
|
-
for event in pairs(
|
|
93
|
-
local ____opt_2 =
|
|
98
|
+
local globalEvents = globalEventsByBehavior[self]
|
|
99
|
+
if globalEvents ~= nil then
|
|
100
|
+
for event in pairs(globalEvents) do
|
|
101
|
+
local ____opt_2 = behaviorsByGlobalEvent[event]
|
|
94
102
|
if ____opt_2 ~= nil then
|
|
95
103
|
____opt_2:remove(self)
|
|
96
104
|
end
|
|
97
|
-
local ____opt_4 =
|
|
105
|
+
local ____opt_4 = listenerByBehaviorByGlobalEvent[event]
|
|
98
106
|
if ____opt_4 ~= nil then
|
|
99
107
|
____opt_4[self] = nil
|
|
100
108
|
end
|
|
101
109
|
end
|
|
110
|
+
globalEventsByBehavior[self] = nil
|
|
111
|
+
end
|
|
112
|
+
local events = eventsByBehavior[self]
|
|
113
|
+
if events ~= nil then
|
|
114
|
+
for event in pairs(events) do
|
|
115
|
+
local ____opt_6 = behaviorsByEvent[event]
|
|
116
|
+
if ____opt_6 ~= nil then
|
|
117
|
+
____opt_6[self] = nil
|
|
118
|
+
end
|
|
119
|
+
local ____opt_8 = listenerByBehaviorByEvent[event]
|
|
120
|
+
if ____opt_8 ~= nil then
|
|
121
|
+
____opt_8[self] = nil
|
|
122
|
+
end
|
|
123
|
+
end
|
|
102
124
|
eventsByBehavior[self] = nil
|
|
103
125
|
end
|
|
104
126
|
local previousBehavior = self[0]
|
|
@@ -115,7 +137,35 @@ function Behavior.prototype.onDestroy(self)
|
|
|
115
137
|
end
|
|
116
138
|
return AbstractDestroyable.prototype.onDestroy(self)
|
|
117
139
|
end
|
|
118
|
-
function Behavior.prototype.
|
|
140
|
+
function Behavior.prototype.registerGlobalEvent(self, event, listener)
|
|
141
|
+
local listenerByBehavior = getOrPut(listenerByBehaviorByGlobalEvent, event, mutableLuaMap)
|
|
142
|
+
listenerByBehavior[self] = listener
|
|
143
|
+
getOrPut(globalEventsByBehavior, self, mutableLuaSet)[event] = true
|
|
144
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
145
|
+
if behaviors == nil then
|
|
146
|
+
event:addListener(function(...)
|
|
147
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
148
|
+
if behaviors ~= nil then
|
|
149
|
+
for behavior in pairs(behaviors) do
|
|
150
|
+
safeCall(behavior[listenerByBehavior[behavior]], behavior, ...)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end)
|
|
154
|
+
behaviors = __TS__New(LinkedSet)
|
|
155
|
+
behaviorsByGlobalEvent[event] = behaviors
|
|
156
|
+
end
|
|
157
|
+
behaviors:add(self)
|
|
158
|
+
end
|
|
159
|
+
function Behavior.prototype.deregisterGlobalEvent(self, event)
|
|
160
|
+
local behaviors = behaviorsByGlobalEvent[event]
|
|
161
|
+
if behaviors ~= nil and behaviors:remove(self) then
|
|
162
|
+
globalEventsByBehavior[self][event] = nil
|
|
163
|
+
listenerByBehaviorByGlobalEvent[event][self] = nil
|
|
164
|
+
return true
|
|
165
|
+
end
|
|
166
|
+
return false
|
|
167
|
+
end
|
|
168
|
+
function Behavior.prototype.registerEvent(self, event, extractObject, listener)
|
|
119
169
|
local listenerByBehavior = getOrPut(listenerByBehaviorByEvent, event, mutableLuaMap)
|
|
120
170
|
listenerByBehavior[self] = listener
|
|
121
171
|
getOrPut(eventsByBehavior, self, mutableLuaSet)[event] = true
|
|
@@ -124,19 +174,27 @@ function Behavior.prototype.registerEvent(self, event, listener)
|
|
|
124
174
|
event:addListener(function(...)
|
|
125
175
|
local behaviors = behaviorsByEvent[event]
|
|
126
176
|
if behaviors ~= nil then
|
|
127
|
-
|
|
128
|
-
|
|
177
|
+
local object = extractObject(...)
|
|
178
|
+
if object ~= nil then
|
|
179
|
+
____exports.Behavior:forAll(
|
|
180
|
+
object,
|
|
181
|
+
safeCallBehaviorListener,
|
|
182
|
+
behaviors,
|
|
183
|
+
listenerByBehavior,
|
|
184
|
+
...
|
|
185
|
+
)
|
|
129
186
|
end
|
|
130
187
|
end
|
|
131
188
|
end)
|
|
132
|
-
behaviors =
|
|
189
|
+
behaviors = {}
|
|
133
190
|
behaviorsByEvent[event] = behaviors
|
|
134
191
|
end
|
|
135
|
-
behaviors
|
|
192
|
+
behaviors[self] = true
|
|
136
193
|
end
|
|
137
194
|
function Behavior.prototype.deregisterEvent(self, event)
|
|
138
195
|
local behaviors = behaviorsByEvent[event]
|
|
139
|
-
if behaviors ~= nil and behaviors
|
|
196
|
+
if behaviors ~= nil and behaviors[self] ~= nil then
|
|
197
|
+
behaviors[self] = nil
|
|
140
198
|
eventsByBehavior[self][event] = nil
|
|
141
199
|
listenerByBehaviorByEvent[event][self] = nil
|
|
142
200
|
return true
|
|
@@ -27,7 +27,7 @@ function ApplyBuffAbilityBehavior.prototype.____constructor(self, ability, const
|
|
|
27
27
|
constructorOrTypeIdOrTypeIds,
|
|
28
28
|
typeIdOrTypeIdsOrPolarityOrTypeIdSelectionPolicy,
|
|
29
29
|
polarityOrTypeIdSelectionPolicyOrResistanceType,
|
|
30
|
-
|
|
30
|
+
self,
|
|
31
31
|
resistanceTypeOrPolarityOrParameters
|
|
32
32
|
)
|
|
33
33
|
end
|
|
@@ -39,7 +39,7 @@ function ApplyBuffAbilityBehavior.prototype.____constructor(self, ability, const
|
|
|
39
39
|
typeIdOrTypeIdsOrPolarityOrTypeIdSelectionPolicy,
|
|
40
40
|
polarityOrTypeIdSelectionPolicyOrResistanceType,
|
|
41
41
|
resistanceTypeOrPolarityOrParameters,
|
|
42
|
-
|
|
42
|
+
self,
|
|
43
43
|
parametersOrResistanceType
|
|
44
44
|
)
|
|
45
45
|
end
|
|
@@ -50,7 +50,7 @@ function ApplyBuffAbilityBehavior.prototype.____constructor(self, ability, const
|
|
|
50
50
|
typeIdOrTypeIdsOrPolarityOrTypeIdSelectionPolicy,
|
|
51
51
|
polarityOrTypeIdSelectionPolicyOrResistanceType,
|
|
52
52
|
resistanceTypeOrPolarityOrParameters,
|
|
53
|
-
|
|
53
|
+
self,
|
|
54
54
|
parametersOrResistanceType
|
|
55
55
|
)
|
|
56
56
|
end
|
|
@@ -62,7 +62,7 @@ function ApplyBuffAbilityBehavior.prototype.____constructor(self, ability, const
|
|
|
62
62
|
polarityOrTypeIdSelectionPolicyOrResistanceType,
|
|
63
63
|
resistanceTypeOrPolarityOrParameters,
|
|
64
64
|
parametersOrResistanceType,
|
|
65
|
-
|
|
65
|
+
self,
|
|
66
66
|
parameters
|
|
67
67
|
)
|
|
68
68
|
end
|
|
@@ -7,6 +7,8 @@ local __TS__New = ____lualib.__TS__New
|
|
|
7
7
|
local ____exports = {}
|
|
8
8
|
local ____ability = require("engine.behaviour.ability")
|
|
9
9
|
local AbilityBehavior = ____ability.AbilityBehavior
|
|
10
|
+
local ____unit = require("engine.internal.unit")
|
|
11
|
+
local Unit = ____unit.Unit
|
|
10
12
|
local ____ability = require("engine.object-field.ability")
|
|
11
13
|
local AbilityField = ____ability.AbilityField
|
|
12
14
|
local AbilityLevelField = ____ability.AbilityLevelField
|
|
@@ -56,4 +58,7 @@ end)
|
|
|
56
58
|
AbilityLevelField.valueChangeEvent:addListener(function(ability)
|
|
57
59
|
____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
|
|
58
60
|
end)
|
|
61
|
+
Unit.abilityLevelChangedEvent:addListener(function(_, ability)
|
|
62
|
+
____exports.ApplyUnitBehaviorAbilityBehavior:forAll(ability, "update")
|
|
63
|
+
end)
|
|
59
64
|
return ____exports
|
|
@@ -5,6 +5,7 @@ import { Unit } from "../../internal/unit";
|
|
|
5
5
|
import { AbilityDependentValue } from "../../object-field/ability";
|
|
6
6
|
import { Widget } from "../../../core/types/widget";
|
|
7
7
|
import { DamageType, WeaponType } from "../../internal/unit+damage";
|
|
8
|
+
import "../../internal/unit+damage";
|
|
8
9
|
import { CombatClassifications } from "../../object-data/auxiliary/combat-classification";
|
|
9
10
|
import { AttackType } from "../../object-data/auxiliary/attack-type";
|
|
10
11
|
export type DamageAbilityBehaviorParameters = {
|
|
@@ -25,8 +26,11 @@ export declare abstract class DamageAbilityBehavior<T extends DamageAbilityBehav
|
|
|
25
26
|
protected readonly damage: AbilityDependentValue<number>;
|
|
26
27
|
protected readonly parameters?: T | undefined;
|
|
27
28
|
protected constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: T | undefined);
|
|
29
|
+
protected precalculatedDamage?: number;
|
|
28
30
|
protected calculateDamage(caster: Unit): number;
|
|
29
31
|
protected damageTarget(caster: Unit, target: Widget, damage?: number): void;
|
|
32
|
+
onChannelingStart(caster: Unit): void;
|
|
33
|
+
onStop(): void;
|
|
30
34
|
}
|
|
31
35
|
export declare class DamageSelfAbilityBehavior extends DamageAbilityBehavior {
|
|
32
36
|
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAbilityBehaviorParameters);
|
|
@@ -4,11 +4,10 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____ability = require("engine.behaviour.ability")
|
|
6
6
|
local AbilityBehavior = ____ability.AbilityBehavior
|
|
7
|
-
local ____unit = require("engine.internal.unit")
|
|
8
|
-
local Unit = ____unit.Unit
|
|
9
7
|
local ____ability = require("engine.standard.fields.ability")
|
|
10
8
|
local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD
|
|
11
9
|
local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
|
|
10
|
+
require("engine.internal.unit+damage")
|
|
12
11
|
____exports.DamageAbilityBehavior = __TS__Class()
|
|
13
12
|
local DamageAbilityBehavior = ____exports.DamageAbilityBehavior
|
|
14
13
|
DamageAbilityBehavior.name = "DamageAbilityBehavior"
|
|
@@ -39,7 +38,7 @@ function DamageAbilityBehavior.prototype.damageTarget(self, caster, target, dama
|
|
|
39
38
|
local parameters = self.parameters
|
|
40
39
|
caster:damageTarget(
|
|
41
40
|
target,
|
|
42
|
-
damage or self:calculateDamage(caster),
|
|
41
|
+
damage or self.precalculatedDamage or self:calculateDamage(caster),
|
|
43
42
|
nil,
|
|
44
43
|
nil,
|
|
45
44
|
self:resolveCurrentAbilityDependentValue(parameters and parameters.attackType),
|
|
@@ -48,6 +47,12 @@ function DamageAbilityBehavior.prototype.damageTarget(self, caster, target, dama
|
|
|
48
47
|
self:resolveCurrentAbilityDependentValue(parameters and parameters.metadata)
|
|
49
48
|
)
|
|
50
49
|
end
|
|
50
|
+
function DamageAbilityBehavior.prototype.onChannelingStart(self, caster)
|
|
51
|
+
self.precalculatedDamage = self:calculateDamage(caster)
|
|
52
|
+
end
|
|
53
|
+
function DamageAbilityBehavior.prototype.onStop(self)
|
|
54
|
+
self.precalculatedDamage = nil
|
|
55
|
+
end
|
|
51
56
|
____exports.DamageSelfAbilityBehavior = __TS__Class()
|
|
52
57
|
local DamageSelfAbilityBehavior = ____exports.DamageSelfAbilityBehavior
|
|
53
58
|
DamageSelfAbilityBehavior.name = "DamageSelfAbilityBehavior"
|
|
@@ -76,21 +81,20 @@ function DamageAreaAbilityBehavior.prototype.____constructor(self, ability, dama
|
|
|
76
81
|
end
|
|
77
82
|
function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
78
83
|
local parameters = self.parameters
|
|
79
|
-
|
|
80
|
-
caster,
|
|
81
|
-
self:resolveCurrentAbilityDependentValue(parameters and parameters.allowedTargetCombatClassifications or ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
84
|
+
caster:damageArea(
|
|
82
85
|
x,
|
|
83
86
|
y,
|
|
84
|
-
self:resolveCurrentAbilityDependentValue(parameters and parameters.areaOfEffect or AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
87
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.areaOfEffect or AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD),
|
|
88
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.allowedTargetCombatClassifications or ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
89
|
+
self.precalculatedDamage or self:calculateDamage(caster),
|
|
90
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0),
|
|
91
|
+
nil,
|
|
92
|
+
nil,
|
|
93
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.attackType),
|
|
94
|
+
parameters and parameters.damageType,
|
|
95
|
+
parameters and parameters.weaponType,
|
|
96
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.metadata)
|
|
85
97
|
)
|
|
86
|
-
local damage = self:calculateDamage(caster)
|
|
87
|
-
local maximumDamage = self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0)
|
|
88
|
-
if maximumDamage ~= 0 and damage > maximumDamage then
|
|
89
|
-
damage = maximumDamage / #targets
|
|
90
|
-
end
|
|
91
|
-
for ____, target in ipairs(targets) do
|
|
92
|
-
self:damageTarget(caster, target, damage)
|
|
93
|
-
end
|
|
94
98
|
end
|
|
95
99
|
____exports.DamageSelfAreaAbilityBehavior = __TS__Class()
|
|
96
100
|
local DamageSelfAreaAbilityBehavior = ____exports.DamageSelfAreaAbilityBehavior
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { AbilityBehavior } from "../ability";
|
|
3
3
|
import { Unit } from "../../internal/unit";
|
|
4
|
+
import { Item } from "../../internal/item";
|
|
5
|
+
import { Destructable } from "../../../core/types/destructable";
|
|
4
6
|
export declare abstract class EmulateImpactAbilityBehavior extends AbilityBehavior {
|
|
7
|
+
/**
|
|
8
|
+
* Pays the cost of the cast and invokes only the common impact event: for impacts
|
|
9
|
+
* that have no cast target to report, such as ones triggered by a command.
|
|
10
|
+
*/
|
|
5
11
|
protected emulateImpact(caster: Unit): boolean;
|
|
12
|
+
protected emulateUnitTargetImpact(caster: Unit, target: Unit): boolean;
|
|
13
|
+
protected emulateItemTargetImpact(caster: Unit, target: Item): boolean;
|
|
14
|
+
protected emulateDestructibleTargetImpact(caster: Unit, target: Destructable): boolean;
|
|
15
|
+
protected emulatePointTargetImpact(caster: Unit, x: number, y: number): boolean;
|
|
16
|
+
protected emulateNoTargetImpact(caster: Unit): boolean;
|
|
17
|
+
/** Invokes the common impact event and the one matching the target, as a real impact. */
|
|
18
|
+
private emulateTargetImpact;
|
|
19
|
+
private payEmulatedImpact;
|
|
6
20
|
}
|
|
@@ -10,9 +10,6 @@ local Unit = ____unit.Unit
|
|
|
10
10
|
local ____ability = require("engine.standard.fields.ability")
|
|
11
11
|
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
12
12
|
local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTEGER_LEVEL_FIELD
|
|
13
|
-
local ____math = require("math")
|
|
14
|
-
local max = ____math.max
|
|
15
|
-
local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
16
13
|
local ____sound = require("core.types.sound")
|
|
17
14
|
local Sound3D = ____sound.Sound3D
|
|
18
15
|
local SoundSettings = ____sound.SoundSettings
|
|
@@ -20,24 +17,101 @@ local ____ability = require("engine.internal.ability")
|
|
|
20
17
|
local UnitAbility = ____ability.UnitAbility
|
|
21
18
|
local ____event = require("event")
|
|
22
19
|
local Event = ____event.Event
|
|
20
|
+
local ____ability = require("engine.internal.unit.ability")
|
|
21
|
+
local emulateAbilityImpactEvent = ____ability.emulateAbilityImpactEvent
|
|
23
22
|
____exports.EmulateImpactAbilityBehavior = __TS__Class()
|
|
24
23
|
local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
|
|
25
24
|
EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
|
|
26
25
|
__TS__ClassExtends(EmulateImpactAbilityBehavior, AbilityBehavior)
|
|
27
26
|
function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
27
|
+
if not self:payEmulatedImpact(caster) then
|
|
28
|
+
return false
|
|
29
|
+
end
|
|
30
|
+
Event.invoke(Unit.abilityImpactEvent, caster, self.ability)
|
|
31
|
+
return true
|
|
32
|
+
end
|
|
33
|
+
function EmulateImpactAbilityBehavior.prototype.emulateUnitTargetImpact(self, caster, target)
|
|
34
|
+
return self:emulateTargetImpact(
|
|
35
|
+
caster,
|
|
36
|
+
target,
|
|
37
|
+
nil,
|
|
38
|
+
nil,
|
|
39
|
+
target.x,
|
|
40
|
+
target.y
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
function EmulateImpactAbilityBehavior.prototype.emulateItemTargetImpact(self, caster, target)
|
|
44
|
+
return self:emulateTargetImpact(
|
|
45
|
+
caster,
|
|
46
|
+
nil,
|
|
47
|
+
target,
|
|
48
|
+
nil,
|
|
49
|
+
target.x,
|
|
50
|
+
target.y
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
function EmulateImpactAbilityBehavior.prototype.emulateDestructibleTargetImpact(self, caster, target)
|
|
54
|
+
return self:emulateTargetImpact(
|
|
55
|
+
caster,
|
|
56
|
+
nil,
|
|
57
|
+
nil,
|
|
58
|
+
target,
|
|
59
|
+
target.x,
|
|
60
|
+
target.y
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
function EmulateImpactAbilityBehavior.prototype.emulatePointTargetImpact(self, caster, x, y)
|
|
64
|
+
return self:emulateTargetImpact(
|
|
65
|
+
caster,
|
|
66
|
+
nil,
|
|
67
|
+
nil,
|
|
68
|
+
nil,
|
|
69
|
+
x,
|
|
70
|
+
y
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
function EmulateImpactAbilityBehavior.prototype.emulateNoTargetImpact(self, caster)
|
|
74
|
+
return self:emulateTargetImpact(
|
|
75
|
+
caster,
|
|
76
|
+
nil,
|
|
77
|
+
nil,
|
|
78
|
+
nil,
|
|
79
|
+
0,
|
|
80
|
+
0
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
function EmulateImpactAbilityBehavior.prototype.emulateTargetImpact(self, caster, targetUnit, targetItem, targetDestructible, x, y)
|
|
84
|
+
if not self:payEmulatedImpact(caster) then
|
|
85
|
+
return false
|
|
86
|
+
end
|
|
87
|
+
emulateAbilityImpactEvent(
|
|
88
|
+
caster,
|
|
89
|
+
self.ability,
|
|
90
|
+
targetUnit,
|
|
91
|
+
targetItem,
|
|
92
|
+
targetDestructible,
|
|
93
|
+
x,
|
|
94
|
+
y
|
|
95
|
+
)
|
|
96
|
+
return true
|
|
97
|
+
end
|
|
98
|
+
function EmulateImpactAbilityBehavior.prototype.payEmulatedImpact(self, caster)
|
|
28
99
|
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
29
100
|
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
30
101
|
if self.ability.cooldownRemaining ~= 0 or caster.mana < manaCost or __TS__InstanceOf(self.ability, UnitAbility) and self.ability.isDisabled then
|
|
31
102
|
return false
|
|
32
103
|
end
|
|
33
104
|
caster.mana = caster.mana - manaCost
|
|
34
|
-
|
|
105
|
+
if cooldown == 0 then
|
|
106
|
+
self.ability:interruptCast()
|
|
107
|
+
else
|
|
108
|
+
self.ability:startCooldown(cooldown)
|
|
109
|
+
end
|
|
35
110
|
self:flashCasterEffect(caster)
|
|
36
111
|
local soundPresetId = self.ability:getField(ABILITY_SF_EFFECT_SOUND)
|
|
37
112
|
if soundPresetId ~= "" then
|
|
38
113
|
Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
|
|
39
114
|
end
|
|
40
|
-
Event.invoke(Unit.abilityImpactEvent, caster, self.ability)
|
|
41
115
|
return true
|
|
42
116
|
end
|
|
43
117
|
return ____exports
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "../../internal/unit";
|
|
3
|
+
import { Item } from "../../internal/item";
|
|
4
|
+
import { Destructable } from "../../../core/types/destructable";
|
|
3
5
|
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
6
|
+
/**
|
|
7
|
+
* Makes the ability take effect as soon as its cast starts, skipping the cast animation:
|
|
8
|
+
* the impact events fire with the cast's target, so target-specific impact handlers
|
|
9
|
+
* (`onPointTargetImpact`, `onUnitTargetImpact`, ...) work as with a native impact.
|
|
10
|
+
*/
|
|
4
11
|
export declare class InstantImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
5
|
-
|
|
12
|
+
onUnitTargetCastingStart(caster: Unit, target: Unit): void;
|
|
13
|
+
onItemTargetCastingStart(caster: Unit, target: Item): void;
|
|
14
|
+
onDestructibleTargetCastingStart(caster: Unit, target: Destructable): void;
|
|
15
|
+
onPointTargetCastingStart(caster: Unit, x: number, y: number): void;
|
|
16
|
+
onNoTargetCastingStart(caster: Unit): void;
|
|
6
17
|
}
|
|
@@ -4,11 +4,26 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
6
6
|
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
7
|
+
--- Makes the ability take effect as soon as its cast starts, skipping the cast animation:
|
|
8
|
+
-- the impact events fire with the cast's target, so target-specific impact handlers
|
|
9
|
+
-- (`onPointTargetImpact`, `onUnitTargetImpact`, ...) work as with a native impact.
|
|
7
10
|
____exports.InstantImpactAbilityBehavior = __TS__Class()
|
|
8
11
|
local InstantImpactAbilityBehavior = ____exports.InstantImpactAbilityBehavior
|
|
9
12
|
InstantImpactAbilityBehavior.name = "InstantImpactAbilityBehavior"
|
|
10
13
|
__TS__ClassExtends(InstantImpactAbilityBehavior, EmulateImpactAbilityBehavior)
|
|
11
|
-
function InstantImpactAbilityBehavior.prototype.
|
|
12
|
-
self:
|
|
14
|
+
function InstantImpactAbilityBehavior.prototype.onUnitTargetCastingStart(self, caster, target)
|
|
15
|
+
self:emulateUnitTargetImpact(caster, target)
|
|
16
|
+
end
|
|
17
|
+
function InstantImpactAbilityBehavior.prototype.onItemTargetCastingStart(self, caster, target)
|
|
18
|
+
self:emulateItemTargetImpact(caster, target)
|
|
19
|
+
end
|
|
20
|
+
function InstantImpactAbilityBehavior.prototype.onDestructibleTargetCastingStart(self, caster, target)
|
|
21
|
+
self:emulateDestructibleTargetImpact(caster, target)
|
|
22
|
+
end
|
|
23
|
+
function InstantImpactAbilityBehavior.prototype.onPointTargetCastingStart(self, caster, x, y)
|
|
24
|
+
self:emulatePointTargetImpact(caster, x, y)
|
|
25
|
+
end
|
|
26
|
+
function InstantImpactAbilityBehavior.prototype.onNoTargetCastingStart(self, caster)
|
|
27
|
+
self:emulateNoTargetImpact(caster)
|
|
13
28
|
end
|
|
14
29
|
return ____exports
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "../../internal/unit";
|
|
3
|
+
import "../../internal/unit/item-order-events";
|
|
3
4
|
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
4
5
|
import { Ability } from "../../internal/ability";
|
|
5
6
|
export declare class OnCommandImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
@@ -4,6 +4,7 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____unit = require("engine.internal.unit")
|
|
6
6
|
local Unit = ____unit.Unit
|
|
7
|
+
require("engine.internal.unit.item-order-events")
|
|
7
8
|
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
8
9
|
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
9
10
|
____exports.OnCommandImpactAbilityBehavior = __TS__Class()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Behavior } from "../behavior";
|
|
3
|
-
import { Unit } from "../unit";
|
|
3
|
+
import { Unit } from "../internal/unit";
|
|
4
|
+
import "../internal/unit/ability";
|
|
5
|
+
import "../internal/unit+ability";
|
|
4
6
|
import { Ability } from "../internal/ability";
|
|
5
7
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
6
8
|
import { Widget } from "../../core/types/widget";
|
|
@@ -25,16 +27,21 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
25
27
|
get unit(): Unit | undefined;
|
|
26
28
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
27
29
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value?: AbilityDependentValue<T>): T | undefined;
|
|
28
|
-
protected
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
protected getDuration(widget: Widget): number;
|
|
31
|
+
flashCasterEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
32
|
+
flashTargetEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
33
|
+
flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
34
|
+
flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
35
|
+
flashSpecialEffect(...args: [
|
|
33
36
|
...pointOrWidget: [x: number, y: number] | [widget: Widget],
|
|
34
37
|
...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]
|
|
35
38
|
]): void;
|
|
36
39
|
private static MissileLaunchConfig;
|
|
37
40
|
private get missileLaunchConfig();
|
|
41
|
+
protected launchMissile(source: Unit, ...args: [
|
|
42
|
+
...pointOrWidget: [x: number, y: number] | [widget: Unit /** TODO: support Widget */],
|
|
43
|
+
...parameters: NonNullable<Parameters["missileParameters"]>
|
|
44
|
+
]): void;
|
|
38
45
|
protected onCreate(): void;
|
|
39
46
|
onValueChange(_value: ReadonlySubscribableAbilityDependentValue<string | number | boolean>): void;
|
|
40
47
|
onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
@@ -42,6 +49,12 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
42
49
|
onUnitLoseAbility(_unit: Unit): void;
|
|
43
50
|
onCommand(caster: Unit, orderTypeStringId: string): void;
|
|
44
51
|
onCastingStart(caster: Unit): void;
|
|
52
|
+
onWidgetTargetCastingStart(caster: Unit, target: Widget): void;
|
|
53
|
+
onUnitTargetCastingStart(caster: Unit, target: Unit): void;
|
|
54
|
+
onItemTargetCastingStart(caster: Unit, target: Item): void;
|
|
55
|
+
onDestructibleTargetCastingStart(caster: Unit, target: Destructable): void;
|
|
56
|
+
onPointTargetCastingStart(caster: Unit, x: number, y: number): void;
|
|
57
|
+
onNoTargetCastingStart(caster: Unit): void;
|
|
45
58
|
onCastingFinish(caster: Unit): void;
|
|
46
59
|
onChannelingStart(caster: Unit): void;
|
|
47
60
|
onWidgetTargetChannelingStart(caster: Unit, target: Widget): void;
|