warscript 0.0.1-dev.697548e → 0.0.1-dev.69b6655
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/types/frame.d.ts +1 -0
- package/core/types/frame.lua +112 -37
- package/core/types/handle.lua +6 -9
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- 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 +13 -8
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/decl/native.d.ts +705 -7
- package/engine/behaviour/ability/damage.lua +11 -14
- package/engine/behaviour/ability/emulate-impact.lua +5 -4
- package/engine/behaviour/ability.d.ts +1 -0
- package/engine/behaviour/ability.lua +11 -0
- package/engine/behaviour/unit.d.ts +1 -0
- package/engine/behaviour/unit.lua +1 -0
- package/engine/buff.d.ts +13 -10
- package/engine/buff.lua +66 -17
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +52 -33
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item+owner.d.ts +1 -0
- package/engine/internal/item+owner.lua +7 -0
- package/engine/internal/item.d.ts +16 -5
- package/engine/internal/item.lua +130 -57
- package/engine/internal/unit/ability.lua +15 -3
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/{item.lua → inventory.lua} +25 -26
- 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+damage.d.ts +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit.d.ts +0 -1
- package/engine/internal/unit.lua +2 -7
- package/engine/local-client.d.ts +25 -0
- package/engine/local-client.lua +364 -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 +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -0
- package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- 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/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/healing-modifier.d.ts +9 -0
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/heroic-slash.d.ts +18 -0
- package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
- package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
- package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
- package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
- package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
- package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
- package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.d.ts +12 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -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/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 +10 -3
- package/engine/object-data/entry/ability-type.lua +53 -0
- 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 +6 -2
- package/engine/object-data/entry/destructible-type.lua +26 -0
- package/engine/object-data/entry/item-type.d.ts +12 -3
- package/engine/object-data/entry/item-type.lua +52 -0
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +47 -2
- package/engine/object-data/entry/unit-type.lua +383 -49
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +4 -1
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/standard/entries/ability-type.d.ts +3102 -7
- package/engine/standard/entries/ability-type.lua +0 -6
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -0
- package/engine/standard/fields/item.d.ts +4 -0
- package/engine/standard/fields/item.lua +6 -0
- package/engine/unit.d.ts +4 -1
- package/engine/unit.lua +4 -1
- package/event.d.ts +1 -1
- package/lualib_bundle.lua +46 -117
- package/math.d.ts +2 -0
- package/math.lua +14 -0
- package/network.lua +25 -1
- package/operation.d.ts +8 -1
- package/operation.lua +49 -35
- package/package.json +3 -23
- package/utility/linked-map.d.ts +2 -1
- package/utility/linked-map.lua +6 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +6 -0
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
|
@@ -4,8 +4,6 @@ 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
|
|
@@ -82,21 +80,20 @@ function DamageAreaAbilityBehavior.prototype.____constructor(self, ability, dama
|
|
|
82
80
|
end
|
|
83
81
|
function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
84
82
|
local parameters = self.parameters
|
|
85
|
-
|
|
86
|
-
caster,
|
|
87
|
-
self:resolveCurrentAbilityDependentValue(parameters and parameters.allowedTargetCombatClassifications or ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
83
|
+
caster:damageArea(
|
|
88
84
|
x,
|
|
89
85
|
y,
|
|
90
|
-
self:resolveCurrentAbilityDependentValue(parameters and parameters.areaOfEffect or AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
86
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.areaOfEffect or AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD),
|
|
87
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.allowedTargetCombatClassifications or ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
88
|
+
self.precalculatedDamage or self:calculateDamage(caster),
|
|
89
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0),
|
|
90
|
+
nil,
|
|
91
|
+
nil,
|
|
92
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.attackType),
|
|
93
|
+
parameters and parameters.damageType,
|
|
94
|
+
parameters and parameters.weaponType,
|
|
95
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.metadata)
|
|
91
96
|
)
|
|
92
|
-
local damage = self.precalculatedDamage or self:calculateDamage(caster)
|
|
93
|
-
local maximumDamage = self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0)
|
|
94
|
-
if maximumDamage ~= 0 and damage > maximumDamage then
|
|
95
|
-
damage = maximumDamage / #targets
|
|
96
|
-
end
|
|
97
|
-
for ____, target in ipairs(targets) do
|
|
98
|
-
self:damageTarget(caster, target, damage)
|
|
99
|
-
end
|
|
100
97
|
end
|
|
101
98
|
____exports.DamageSelfAreaAbilityBehavior = __TS__Class()
|
|
102
99
|
local DamageSelfAreaAbilityBehavior = ____exports.DamageSelfAreaAbilityBehavior
|
|
@@ -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
|
|
@@ -31,7 +28,11 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
31
28
|
return false
|
|
32
29
|
end
|
|
33
30
|
caster.mana = caster.mana - manaCost
|
|
34
|
-
|
|
31
|
+
if cooldown == 0 then
|
|
32
|
+
self.ability:interruptCast()
|
|
33
|
+
else
|
|
34
|
+
self.ability.cooldownRemaining = cooldown
|
|
35
|
+
end
|
|
35
36
|
self:flashCasterEffect(caster)
|
|
36
37
|
local soundPresetId = self.ability:getField(ABILITY_SF_EFFECT_SOUND)
|
|
37
38
|
if soundPresetId ~= "" then
|
|
@@ -26,6 +26,7 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
26
26
|
get unit(): Unit | undefined;
|
|
27
27
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
28
28
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value?: AbilityDependentValue<T>): T | undefined;
|
|
29
|
+
protected getDuration(widget: Widget): number;
|
|
29
30
|
flashCasterEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
30
31
|
flashTargetEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
31
32
|
flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
@@ -9,6 +9,7 @@ local ____behavior = require("engine.behavior")
|
|
|
9
9
|
local Behavior = ____behavior.Behavior
|
|
10
10
|
local ____unit = require("engine.internal.unit")
|
|
11
11
|
local Unit = ____unit.Unit
|
|
12
|
+
local UnitClassification = ____unit.UnitClassification
|
|
12
13
|
require("engine.internal.unit.ability")
|
|
13
14
|
local ____ability = require("engine.internal.ability")
|
|
14
15
|
local Ability = ____ability.Ability
|
|
@@ -18,6 +19,8 @@ local ____ability = require("engine.standard.fields.ability")
|
|
|
18
19
|
local AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
19
20
|
local CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = ____ability.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD
|
|
20
21
|
local CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
22
|
+
local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
|
|
23
|
+
local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
|
|
21
24
|
local EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
22
25
|
local MISSILE_ARC_ABILITY_FLOAT_FIELD = ____ability.MISSILE_ARC_ABILITY_FLOAT_FIELD
|
|
23
26
|
local MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
@@ -113,6 +116,14 @@ end
|
|
|
113
116
|
function AbilityBehavior.prototype.resolveCurrentAbilityDependentValue(self, value)
|
|
114
117
|
return resolveCurrentAbilityDependentValue(self.ability, value)
|
|
115
118
|
end
|
|
119
|
+
function AbilityBehavior.prototype.getDuration(self, widget)
|
|
120
|
+
if __TS__InstanceOf(widget, Unit) then
|
|
121
|
+
if widget.isHero or widget:getField(UNIT_IF_LEVEL) >= 6 or widget:hasClassification(UnitClassification.RESISTANT) then
|
|
122
|
+
return self:resolveCurrentAbilityDependentValue(DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
return self:resolveCurrentAbilityDependentValue(DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD)
|
|
126
|
+
end
|
|
116
127
|
function AbilityBehavior.prototype.flashCasterEffect(self, widget, ...)
|
|
117
128
|
local attachmentPoint = CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD:getValue(self.ability)
|
|
118
129
|
Effect:flash(
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Behavior, BehaviorPriority } from "../behavior";
|
|
3
3
|
import { Ability } from "../internal/ability";
|
|
4
4
|
import { DamageEvent, DamagingEvent, Unit } from "../internal/unit";
|
|
5
|
+
import "../internal/unit/equipment";
|
|
5
6
|
import "../internal/unit+ability";
|
|
6
7
|
import "../internal/unit-missile-launch";
|
|
7
8
|
import { Item } from "../internal/item";
|
|
@@ -8,6 +8,7 @@ local ____behavior = require("engine.behavior")
|
|
|
8
8
|
local Behavior = ____behavior.Behavior
|
|
9
9
|
local ____unit = require("engine.internal.unit")
|
|
10
10
|
local Unit = ____unit.Unit
|
|
11
|
+
require("engine.internal.unit.equipment")
|
|
11
12
|
require("engine.internal.unit+ability")
|
|
12
13
|
require("engine.internal.unit-missile-launch")
|
|
13
14
|
local ____linked_2Dset = require("utility.linked-set")
|
package/engine/buff.d.ts
CHANGED
|
@@ -23,6 +23,13 @@ export type BuffPolarityParameterType = EnumParameterValueType<BuffPolarity>;
|
|
|
23
23
|
export type BuffResistanceTypeParameterType = EnumParameterValueType<BuffResistanceType>;
|
|
24
24
|
export declare class BuffUniqueGroup {
|
|
25
25
|
}
|
|
26
|
+
export type BuffAbilityParameters = {
|
|
27
|
+
readonly fields?: [AbilityNumberField | AbilityNumberLevelField, NumberParameterValueType][];
|
|
28
|
+
/** Default `true`. */
|
|
29
|
+
readonly isButtonVisible?: boolean;
|
|
30
|
+
/** Default is the level of the source ability or 0 if it is absent. */
|
|
31
|
+
readonly level?: number;
|
|
32
|
+
};
|
|
26
33
|
export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
27
34
|
spellStealPriority?: number;
|
|
28
35
|
level?: number;
|
|
@@ -30,16 +37,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
30
37
|
learnLevelMinimum?: number;
|
|
31
38
|
source?: Unit;
|
|
32
39
|
behaviorConstructors?: (new (unit: Unit) => UnitBehavior)[];
|
|
33
|
-
abilityTypeIds?: Record<AbilityTypeId,
|
|
34
|
-
readonly fields?: [
|
|
35
|
-
AbilityNumberField | AbilityNumberLevelField,
|
|
36
|
-
NumberParameterValueType
|
|
37
|
-
][];
|
|
38
|
-
/** Default `true`. */
|
|
39
|
-
readonly isButtonVisible?: boolean;
|
|
40
|
-
/** Default is the level of the source ability or 0 if it is absent. */
|
|
41
|
-
readonly level?: number;
|
|
42
|
-
}>;
|
|
40
|
+
abilityTypeIds?: Partial<Record<AbilityTypeId, BuffAbilityParameters>>;
|
|
43
41
|
damageUponDeathAllowedTargetCombatClassifications?: CombatClassifications | AbilityCombatClassificationsLevelField;
|
|
44
42
|
damageUponDeath?: NumberParameterValueType;
|
|
45
43
|
damageUponDeathRange?: NumberParameterValueType;
|
|
@@ -219,6 +217,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
219
217
|
[K in keyof Omit<AdditionalParameters, keyof BuffParameters>]: AdditionalParameters[K] extends AbilityDependentValue<infer T> ? T : AdditionalParameters[K];
|
|
220
218
|
};
|
|
221
219
|
private readonly handle;
|
|
220
|
+
readonly previousBuff?: Buff;
|
|
222
221
|
private _timer?;
|
|
223
222
|
private readonly _level?;
|
|
224
223
|
private readonly _spellStealPriority?;
|
|
@@ -313,10 +312,14 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
313
312
|
]): void;
|
|
314
313
|
private flash;
|
|
315
314
|
expire(): void;
|
|
315
|
+
/** Dispels this buff, invoking onDispel before removing it. */
|
|
316
|
+
dispel(source?: Unit): void;
|
|
316
317
|
protected onCreate(): void;
|
|
317
318
|
protected onDestroy(): Destructor;
|
|
318
319
|
static apply<T extends Buff<any>, Args extends any[]>(this: BuffConstructor<T, Args>, ...args: Args): T | undefined;
|
|
319
320
|
static getByTypeId<T extends Buff<any>, Args extends any[]>(this: BuffConstructor<T, Args>, unit: Unit, typeId: ApplicableBuffTypeId): T | undefined;
|
|
321
|
+
/** Called for dispelling, never for a direct destroy() or replacement. */
|
|
322
|
+
onDispel(source: Unit | undefined): void;
|
|
320
323
|
onExpiration(): void;
|
|
321
324
|
onDeath(source: Unit | undefined): void;
|
|
322
325
|
onDamageDealt(target: Unit, event: DamageEvent): void;
|
package/engine/buff.lua
CHANGED
|
@@ -254,6 +254,10 @@ local function destroyBuff(buff)
|
|
|
254
254
|
buff:destroy()
|
|
255
255
|
end
|
|
256
256
|
local function expireBuff(buff)
|
|
257
|
+
if buff.isDestroyed or buff[100] ~= 1 then
|
|
258
|
+
return
|
|
259
|
+
end
|
|
260
|
+
buff[100] = 2
|
|
257
261
|
local remainingDamageOverDuration = buff[113] or 0
|
|
258
262
|
local remainingHealingOverDuration = buff[113] or 0
|
|
259
263
|
if remainingDamageOverDuration ~= 0 or remainingHealingOverDuration ~= 0 then
|
|
@@ -404,7 +408,8 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
404
408
|
buffByTypeId = {}
|
|
405
409
|
buffByTypeIdByUnit[_unit] = buffByTypeId
|
|
406
410
|
end
|
|
407
|
-
|
|
411
|
+
self.previousBuff = buffByTypeId[typeId]
|
|
412
|
+
local ____opt_15 = self.previousBuff
|
|
408
413
|
if ____opt_15 ~= nil then
|
|
409
414
|
____opt_15:destroy()
|
|
410
415
|
end
|
|
@@ -481,7 +486,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
481
486
|
self._abilityTypeIds = abilityTypeIds
|
|
482
487
|
end
|
|
483
488
|
for ____, abilityTypeId in ipairs(sortedKeysUnnested(parametersAbilityTypeIds)) do
|
|
484
|
-
local abilityParameters = parametersAbilityTypeIds[abilityTypeId]
|
|
489
|
+
local abilityParameters = checkNotNull(parametersAbilityTypeIds[abilityTypeId])
|
|
485
490
|
local addedAbility = _unit:addAbility(abilityTypeId)
|
|
486
491
|
if addedAbility ~= nil then
|
|
487
492
|
_unit:makeAbilityPermanent(abilityTypeId, true)
|
|
@@ -590,6 +595,20 @@ end
|
|
|
590
595
|
function Buff.prototype.expire(self)
|
|
591
596
|
expireBuff(self)
|
|
592
597
|
end
|
|
598
|
+
function Buff.prototype.dispel(self, source)
|
|
599
|
+
if self.isDestroyed or self[100] ~= 1 then
|
|
600
|
+
return
|
|
601
|
+
end
|
|
602
|
+
self[100] = 2
|
|
603
|
+
do
|
|
604
|
+
pcall(function()
|
|
605
|
+
self:onDispel(source)
|
|
606
|
+
end)
|
|
607
|
+
do
|
|
608
|
+
self:destroy()
|
|
609
|
+
end
|
|
610
|
+
end
|
|
611
|
+
end
|
|
593
612
|
function Buff.prototype.onCreate(self)
|
|
594
613
|
end
|
|
595
614
|
function Buff.prototype.onDestroy(self)
|
|
@@ -680,6 +699,8 @@ function Buff.getByTypeId(self, unit, typeId)
|
|
|
680
699
|
end
|
|
681
700
|
return nil
|
|
682
701
|
end
|
|
702
|
+
function Buff.prototype.onDispel(self, source)
|
|
703
|
+
end
|
|
683
704
|
function Buff.prototype.onExpiration(self)
|
|
684
705
|
local unit = self.unit
|
|
685
706
|
if self[120] ~= nil then
|
|
@@ -1472,35 +1493,40 @@ __TS__SetDescriptor(
|
|
|
1472
1493
|
Buff.createdEvent = buffCreatedEvent
|
|
1473
1494
|
Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
1474
1495
|
(function(self)
|
|
1475
|
-
local function destroyBuffIfNeeded(buff)
|
|
1476
|
-
|
|
1477
|
-
|
|
1496
|
+
local function destroyBuffIfNeeded(buff, isDispel, source)
|
|
1497
|
+
local currentHandle = getUnitAbility(buff[101].handle, buff.typeId)
|
|
1498
|
+
if currentHandle ~= buff.handle and buff[100] == 1 then
|
|
1499
|
+
if isDispel and currentHandle == nil and buff.unit.isAlive and buff.resistanceType == 1 and (buff._timer == nil or buff.remainingDuration > 0) then
|
|
1500
|
+
buff:dispel(source)
|
|
1501
|
+
else
|
|
1502
|
+
buff:destroy()
|
|
1503
|
+
end
|
|
1478
1504
|
end
|
|
1479
1505
|
end
|
|
1480
|
-
____exports.checkBuff = function(unit, buffTypeId)
|
|
1506
|
+
____exports.checkBuff = function(unit, buffTypeId, isDispel, source)
|
|
1481
1507
|
local buffByTypeId = buffByTypeIdByUnit[unit]
|
|
1482
1508
|
if buffByTypeId ~= nil then
|
|
1483
1509
|
local buff = buffByTypeId[buffTypeId]
|
|
1484
1510
|
if buff ~= nil then
|
|
1485
|
-
destroyBuffIfNeeded(buff)
|
|
1511
|
+
destroyBuffIfNeeded(buff, isDispel, source)
|
|
1486
1512
|
end
|
|
1487
1513
|
end
|
|
1488
1514
|
end
|
|
1489
|
-
____exports.checkBuffs = function(unit)
|
|
1490
|
-
____exports.Buff:forAll(unit, destroyBuffIfNeeded)
|
|
1515
|
+
____exports.checkBuffs = function(unit, isDispel, source)
|
|
1516
|
+
____exports.Buff:forAll(unit, destroyBuffIfNeeded, isDispel, source)
|
|
1491
1517
|
end
|
|
1492
1518
|
Unit.abilityChannelingStartEvent:addListener(
|
|
1493
1519
|
0,
|
|
1494
1520
|
function(caster)
|
|
1495
|
-
____exports.checkBuffs(caster)
|
|
1496
|
-
Timer:run(____exports.checkBuffs, caster)
|
|
1521
|
+
____exports.checkBuffs(caster, true, caster)
|
|
1522
|
+
Timer:run(____exports.checkBuffs, caster, true, caster)
|
|
1497
1523
|
end
|
|
1498
1524
|
)
|
|
1499
1525
|
Unit.abilityUnitTargetChannelingStartEvent:addListener(
|
|
1500
1526
|
0,
|
|
1501
1527
|
function(caster, ability, target)
|
|
1502
|
-
____exports.checkBuffs(target)
|
|
1503
|
-
Timer:run(____exports.checkBuffs, target)
|
|
1528
|
+
____exports.checkBuffs(target, true, caster)
|
|
1529
|
+
Timer:run(____exports.checkBuffs, target, true, caster)
|
|
1504
1530
|
end
|
|
1505
1531
|
)
|
|
1506
1532
|
Unit.abilityPointTargetChannelingStartEvent:addListener(
|
|
@@ -1511,17 +1537,40 @@ Buff.beingDestroyedEvent = buffBeingDestroyedEvent;
|
|
|
1511
1537
|
y,
|
|
1512
1538
|
ability:getField(ABILITY_RLF_AREA_OF_EFFECT)
|
|
1513
1539
|
)
|
|
1514
|
-
forEach(units, ____exports.checkBuffs)
|
|
1515
|
-
Timer:run(
|
|
1540
|
+
forEach(units, ____exports.checkBuffs, true, caster)
|
|
1541
|
+
Timer:run(
|
|
1542
|
+
forEach,
|
|
1543
|
+
units,
|
|
1544
|
+
____exports.checkBuffs,
|
|
1545
|
+
true,
|
|
1546
|
+
caster
|
|
1547
|
+
)
|
|
1548
|
+
end
|
|
1549
|
+
)
|
|
1550
|
+
Unit.abilityNoTargetChannelingStartEvent:addListener(
|
|
1551
|
+
0,
|
|
1552
|
+
function(caster, ability)
|
|
1553
|
+
local radius = ability:getField(ABILITY_RLF_AREA_OF_EFFECT)
|
|
1554
|
+
if radius > 0 then
|
|
1555
|
+
local units = Unit:getInCollisionRange(caster.x, caster.y, radius)
|
|
1556
|
+
forEach(units, ____exports.checkBuffs, true, caster)
|
|
1557
|
+
Timer:run(
|
|
1558
|
+
forEach,
|
|
1559
|
+
units,
|
|
1560
|
+
____exports.checkBuffs,
|
|
1561
|
+
true,
|
|
1562
|
+
caster
|
|
1563
|
+
)
|
|
1564
|
+
end
|
|
1516
1565
|
end
|
|
1517
1566
|
)
|
|
1518
1567
|
Unit.onDamage:addListener(
|
|
1519
1568
|
0,
|
|
1520
1569
|
function(source, target)
|
|
1521
1570
|
if source ~= nil then
|
|
1522
|
-
____exports.checkBuffs
|
|
1571
|
+
Timer:run(____exports.checkBuffs, source, false)
|
|
1523
1572
|
end
|
|
1524
|
-
____exports.checkBuffs
|
|
1573
|
+
Timer:run(____exports.checkBuffs, target, false)
|
|
1525
1574
|
end
|
|
1526
1575
|
)
|
|
1527
1576
|
buffCreatedEvent:addListener(function(buff)
|
package/engine/index.d.ts
CHANGED
|
@@ -64,8 +64,12 @@ export declare class UnitAbility extends Ability {
|
|
|
64
64
|
get isDisabled(): boolean;
|
|
65
65
|
get level(): number;
|
|
66
66
|
set level(v: number);
|
|
67
|
+
/** Uses the native percentage scale. */
|
|
68
|
+
get cooldownRemainingPercent(): number;
|
|
69
|
+
set cooldownRemainingPercent(percent: number);
|
|
67
70
|
get cooldownRemaining(): number;
|
|
68
71
|
set cooldownRemaining(cooldownRemaining: number);
|
|
72
|
+
startCooldown(cooldown: number): void;
|
|
69
73
|
interruptCast(): void;
|
|
70
74
|
protected onDestroy(): HandleDestructor;
|
|
71
75
|
static get onCreate(): Event<[UnitAbility]>;
|
|
@@ -14,31 +14,33 @@ local abilityActionDummy = ____ability.abilityActionDummy
|
|
|
14
14
|
local doAbilityAction = ____ability.doAbilityAction
|
|
15
15
|
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
16
16
|
local startItemCooldown = ____ability.startItemCooldown
|
|
17
|
-
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
18
|
-
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
19
|
-
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
20
|
-
local setAbilityRealField = BlzSetAbilityRealField
|
|
21
|
-
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
22
|
-
local setAbilityStringField = BlzSetAbilityStringField
|
|
23
|
-
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
24
|
-
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
25
|
-
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
26
|
-
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
27
|
-
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
28
|
-
local getAbilityRealField = BlzGetAbilityRealField
|
|
29
17
|
local getAbilityBooleanField = BlzGetAbilityBooleanField
|
|
30
|
-
local
|
|
18
|
+
local getAbilityBooleanLevelField = BlzGetAbilityBooleanLevelField
|
|
19
|
+
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
31
20
|
local getAbilityIntegerLevelField = BlzGetAbilityIntegerLevelField
|
|
21
|
+
local getAbilityRealField = BlzGetAbilityRealField
|
|
32
22
|
local getAbilityRealLevelField = BlzGetAbilityRealLevelField
|
|
33
|
-
local
|
|
23
|
+
local getAbilityStringField = BlzGetAbilityStringField
|
|
34
24
|
local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
25
|
+
local getHandleId = GetHandleId
|
|
26
|
+
local getUnitAbilityCooldownPercent = BlzGetUnitAbilityCooldownPercent
|
|
35
27
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
28
|
+
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
29
|
+
local order2orderId = _G.OrderId
|
|
30
|
+
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
31
|
+
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
32
|
+
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
33
|
+
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
34
|
+
local setAbilityRealField = BlzSetAbilityRealField
|
|
35
|
+
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
36
|
+
local setAbilityStringField = BlzSetAbilityStringField
|
|
37
|
+
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
38
|
+
local setUnitAbilityCooldownPercent = BlzSetUnitAbilityCooldownPercent
|
|
39
|
+
local setUnitAbilityCooldownRemaining = BlzSetUnitAbilityCooldownRemaining
|
|
40
|
+
local setUnitAbilityLevel = SetUnitAbilityLevel
|
|
36
41
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
37
|
-
local getHandleId = GetHandleId
|
|
38
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
|
-
local unitHideAbility = BlzUnitHideAbility
|
|
41
42
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
43
|
+
local unitHideAbility = BlzUnitHideAbility
|
|
42
44
|
local match = string.match
|
|
43
45
|
local ____type = _G.type
|
|
44
46
|
local ____tostring = _G.tostring
|
|
@@ -215,7 +217,6 @@ local levelRefreshFields = {
|
|
|
215
217
|
[fourCC("Neg1")] = true
|
|
216
218
|
}
|
|
217
219
|
local levelsField = ABILITY_IF_LEVELS
|
|
218
|
-
local order2orderId = _G.OrderId
|
|
219
220
|
local orderIdFieldByParentTypeId = {
|
|
220
221
|
[fourCC("ANcl")] = ABILITY_SLF_BASE_ORDER_ID_NCL6,
|
|
221
222
|
[fourCC("Aspb")] = ABILITY_SLF_BASE_ORDER_ID_SPB5,
|
|
@@ -422,6 +423,9 @@ function UnitAbility.prototype.decrementDisableCounter(self)
|
|
|
422
423
|
unitHideAbility(unit, typeId, true)
|
|
423
424
|
self.d = (self.d or 0) - 1
|
|
424
425
|
end
|
|
426
|
+
function UnitAbility.prototype.startCooldown(self, cooldown)
|
|
427
|
+
startUnitAbilityCooldown(self.u, self.typeId, cooldown)
|
|
428
|
+
end
|
|
425
429
|
function UnitAbility.prototype.interruptCast(self)
|
|
426
430
|
self.owner:interruptCast(self.typeId)
|
|
427
431
|
end
|
|
@@ -452,6 +456,19 @@ __TS__SetDescriptor(
|
|
|
452
456
|
},
|
|
453
457
|
true
|
|
454
458
|
)
|
|
459
|
+
__TS__SetDescriptor(
|
|
460
|
+
UnitAbility.prototype,
|
|
461
|
+
"cooldownRemainingPercent",
|
|
462
|
+
{
|
|
463
|
+
get = function(self)
|
|
464
|
+
return getUnitAbilityCooldownPercent(self.u, self.typeId)
|
|
465
|
+
end,
|
|
466
|
+
set = function(self, percent)
|
|
467
|
+
setUnitAbilityCooldownPercent(self.u, self.typeId, percent)
|
|
468
|
+
end
|
|
469
|
+
},
|
|
470
|
+
true
|
|
471
|
+
)
|
|
455
472
|
__TS__SetDescriptor(
|
|
456
473
|
UnitAbility.prototype,
|
|
457
474
|
"cooldownRemaining",
|
|
@@ -460,7 +477,7 @@ __TS__SetDescriptor(
|
|
|
460
477
|
return getUnitAbilityCooldownRemaining(self.u, self.typeId)
|
|
461
478
|
end,
|
|
462
479
|
set = function(self, cooldownRemaining)
|
|
463
|
-
|
|
480
|
+
setUnitAbilityCooldownRemaining(self.u, self.typeId, cooldownRemaining)
|
|
464
481
|
end
|
|
465
482
|
},
|
|
466
483
|
true
|
|
@@ -516,11 +533,13 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
516
533
|
)
|
|
517
534
|
end
|
|
518
535
|
function ItemAbility.prototype.interruptCast(self)
|
|
519
|
-
local
|
|
520
|
-
local
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
536
|
+
local item = self.owner
|
|
537
|
+
local itemHandle = item.handle
|
|
538
|
+
local ____opt_1 = item.owner
|
|
539
|
+
local itemOwnerHandle = ____opt_1 and ____opt_1.handle
|
|
540
|
+
local cooldownRemaining = doAbilityActionForceDummy(itemHandle, itemOwnerHandle, getAbilityCooldown, self.typeId)
|
|
541
|
+
if cooldownRemaining == 0 then
|
|
542
|
+
startItemCooldown(itemHandle, itemOwnerHandle, 0.015625)
|
|
524
543
|
end
|
|
525
544
|
end
|
|
526
545
|
function ItemAbility.prototype.onDestroy(self)
|
|
@@ -543,17 +562,17 @@ __TS__SetDescriptor(
|
|
|
543
562
|
{
|
|
544
563
|
get = function(self)
|
|
545
564
|
local item = self.owner
|
|
546
|
-
local
|
|
547
|
-
local
|
|
548
|
-
local
|
|
549
|
-
return
|
|
565
|
+
local ____doAbilityActionForceDummy_6 = doAbilityActionForceDummy
|
|
566
|
+
local ____item_handle_5 = item.handle
|
|
567
|
+
local ____opt_3 = item.owner
|
|
568
|
+
return ____doAbilityActionForceDummy_6(____item_handle_5, ____opt_3 and ____opt_3.handle, getAbilityCooldown, self.typeId)
|
|
550
569
|
end,
|
|
551
570
|
set = function(self, cooldownRemaining)
|
|
552
571
|
local item = self.owner
|
|
553
|
-
local
|
|
554
|
-
local
|
|
555
|
-
local
|
|
556
|
-
|
|
572
|
+
local ____startItemCooldown_10 = startItemCooldown
|
|
573
|
+
local ____item_handle_9 = item.handle
|
|
574
|
+
local ____opt_7 = item.owner
|
|
575
|
+
____startItemCooldown_10(____item_handle_9, ____opt_7 and ____opt_7.handle, cooldownRemaining)
|
|
557
576
|
end
|
|
558
577
|
},
|
|
559
578
|
true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____item = require("engine.internal.item")
|
|
5
|
+
local Item = ____item.Item
|
|
6
|
+
local ____item = require("engine.standard.fields.item")
|
|
7
|
+
local CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD = ____item.CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD
|
|
8
|
+
local IS_ACTIVELY_USED_ITEM_FIELD = ____item.IS_ACTIVELY_USED_ITEM_FIELD
|
|
9
|
+
__TS__ObjectDefineProperty(
|
|
10
|
+
Item.prototype,
|
|
11
|
+
"canBeSold",
|
|
12
|
+
{
|
|
13
|
+
get = function(self)
|
|
14
|
+
return CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:getValue(self)
|
|
15
|
+
end,
|
|
16
|
+
set = function(self, value)
|
|
17
|
+
CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:setValue(self, value)
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
__TS__ObjectDefineProperty(
|
|
22
|
+
Item.prototype,
|
|
23
|
+
"isActivelyUsed",
|
|
24
|
+
{
|
|
25
|
+
get = function(self)
|
|
26
|
+
return IS_ACTIVELY_USED_ITEM_FIELD:getValue(self)
|
|
27
|
+
end,
|
|
28
|
+
set = function(self, value)
|
|
29
|
+
IS_ACTIVELY_USED_ITEM_FIELD:setValue(self, value)
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
return ____exports
|
|
@@ -5,6 +5,7 @@ local ____item = require("engine.internal.item")
|
|
|
5
5
|
local Item = ____item.Item
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
|
+
require("engine.internal.unit.equipment")
|
|
8
9
|
local ownerByItem = setmetatable({}, {__mode = "kv"})
|
|
9
10
|
Unit.itemPickedUpEvent:addListener(
|
|
10
11
|
4,
|
|
@@ -12,6 +13,12 @@ Unit.itemPickedUpEvent:addListener(
|
|
|
12
13
|
ownerByItem[item] = unit
|
|
13
14
|
end
|
|
14
15
|
)
|
|
16
|
+
Unit.itemEquippedEvent:addListener(
|
|
17
|
+
4,
|
|
18
|
+
function(unit, item)
|
|
19
|
+
ownerByItem[item] = unit
|
|
20
|
+
end
|
|
21
|
+
)
|
|
15
22
|
Unit.itemDroppedEvent:addListener(
|
|
16
23
|
4,
|
|
17
24
|
function(unit, item)
|
|
@@ -2,19 +2,33 @@
|
|
|
2
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Color } from "../../core/types/color";
|
|
4
4
|
import { Event } from "../../event";
|
|
5
|
+
import { PlayerColor } from "../../core/types/playerColor";
|
|
6
|
+
import { EquipmentType } from "../object-data/auxiliary/equipment-type";
|
|
7
|
+
import { ItemTag } from "../object-data/auxiliary/item-tag";
|
|
5
8
|
import { ReadonlyRect } from "../../core/types/rect";
|
|
6
9
|
import { ItemAbility } from "./ability";
|
|
7
10
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
8
11
|
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
9
12
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
13
|
declare const enum ItemPropertyKey {
|
|
11
|
-
ABILITIES = 100
|
|
14
|
+
ABILITIES = 100,
|
|
15
|
+
DEATH_TRIGGER = 101,
|
|
16
|
+
COLOR = 102
|
|
12
17
|
}
|
|
13
18
|
export declare class Item extends Handle<jitem> {
|
|
14
19
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
20
|
+
private readonly [ItemPropertyKey.DEATH_TRIGGER];
|
|
21
|
+
private [ItemPropertyKey.COLOR]?;
|
|
15
22
|
constructor(handle: jitem);
|
|
16
23
|
protected onDestroy(): HandleDestructor;
|
|
17
24
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
25
|
+
get isEquipped(): boolean;
|
|
26
|
+
get isInBag(): boolean;
|
|
27
|
+
get equipmentType(): EquipmentType;
|
|
28
|
+
get tag(): ItemTag;
|
|
29
|
+
get color(): PlayerColor;
|
|
30
|
+
set color(color: PlayerColor);
|
|
31
|
+
static getRandomTypeId(level: number, equipmentType?: EquipmentType, tag?: ItemTag, itemType?: jitemtype): ItemTypeId | undefined;
|
|
18
32
|
get typeId(): ItemTypeId;
|
|
19
33
|
set skinId(v: number);
|
|
20
34
|
get skinId(): number;
|
|
@@ -32,8 +46,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
32
46
|
get dropsOnDeath(): boolean;
|
|
33
47
|
set canBeDropped(canBeDropped: boolean);
|
|
34
48
|
get canBeDropped(): boolean;
|
|
35
|
-
set canBeSold(canBeSold: boolean);
|
|
36
|
-
get canBeSold(): boolean;
|
|
37
49
|
set perishes(perishes: boolean);
|
|
38
50
|
get perishes(): boolean;
|
|
39
51
|
set isPowerUp(isPowerUp: boolean);
|
|
@@ -42,8 +54,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
42
54
|
get isDead(): boolean;
|
|
43
55
|
set isInvulnerable(isInvulnerable: boolean);
|
|
44
56
|
get isInvulnerable(): boolean;
|
|
45
|
-
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
-
get isActivelyUsed(): boolean;
|
|
47
57
|
set visible(v: boolean);
|
|
48
58
|
get visible(): boolean;
|
|
49
59
|
set level(v: number);
|
|
@@ -82,6 +92,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
82
92
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
83
93
|
static get onCreate(): Event<[Item]>;
|
|
84
94
|
static get destroyEvent(): Event<[Item]>;
|
|
95
|
+
static readonly deathEvent: Event<[Item]>;
|
|
85
96
|
static readonly chargesChangedEvent: Event<[Item]>;
|
|
86
97
|
}
|
|
87
98
|
export {};
|