warscript 0.0.1-dev.f1df135 → 0.0.1-dev.f4350ae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +5 -0
- package/attributes.lua +8 -1
- package/core/types/sound.lua +5 -0
- package/decl/native.d.ts +840 -786
- package/engine/behaviour/ability/damage.d.ts +6 -3
- package/engine/behaviour/ability/damage.lua +24 -36
- package/engine/behaviour/ability/emulate-impact.lua +7 -0
- package/engine/internal/ability.d.ts +2 -0
- package/engine/internal/ability.lua +7 -0
- package/engine/internal/item.d.ts +2 -1
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit.d.ts +16 -3
- package/engine/internal/unit.lua +126 -37
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type.lua +7 -0
- package/engine/object-data/entry/buff-type/applicable.lua +5 -0
- package/engine/object-data/entry/buff-type.d.ts +5 -11
- package/engine/object-data/entry/buff-type.lua +11 -27
- package/engine/object-data/entry/unit-type.d.ts +2 -2
- package/engine/object-data/entry/unit-type.lua +94 -84
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field/unit.d.ts +46 -3
- package/engine/object-field/unit.lua +173 -7
- package/engine/object-field.d.ts +9 -1
- package/engine/object-field.lua +158 -76
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/objutil/buff.lua +1 -2
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +3 -0
- package/utility/lua-maps.lua +16 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
|
@@ -4,26 +4,29 @@ import { Ability } from "../../internal/ability";
|
|
|
4
4
|
import { Unit } from "../../internal/unit";
|
|
5
5
|
import { AbilityDependentValue } from "../../object-field/ability";
|
|
6
6
|
import { Widget } from "../../../core/types/widget";
|
|
7
|
-
import {
|
|
7
|
+
import { DamageType, WeaponType } from "../../internal/unit+damage";
|
|
8
8
|
import { CombatClassifications } from "../../object-data/auxiliary/combat-classification";
|
|
9
|
+
import { AttackType } from "../../object-data/auxiliary/attack-type";
|
|
9
10
|
export type DamageAbilityBehaviorParameters = {
|
|
10
11
|
damagePerStrength?: AbilityDependentValue<number>;
|
|
11
12
|
damagePerAgility?: AbilityDependentValue<number>;
|
|
12
13
|
damagePerIntelligence?: AbilityDependentValue<number>;
|
|
13
|
-
attackType?: AttackType
|
|
14
|
+
attackType?: AbilityDependentValue<AttackType>;
|
|
14
15
|
damageType?: DamageType;
|
|
15
16
|
weaponType?: WeaponType;
|
|
17
|
+
metadata?: AbilityDependentValue<string | number | boolean>;
|
|
16
18
|
};
|
|
17
19
|
export type DamageAreaAbilityBehaviorParameters = DamageAbilityBehaviorParameters & {
|
|
18
20
|
maximumDamage?: AbilityDependentValue<number>;
|
|
19
21
|
areaOfEffect?: AbilityDependentValue<number>;
|
|
20
22
|
allowedTargetCombatClassifications?: AbilityDependentValue<CombatClassifications>;
|
|
21
23
|
};
|
|
22
|
-
declare abstract class DamageAbilityBehavior<T extends DamageAbilityBehaviorParameters = DamageAbilityBehaviorParameters> extends AbilityBehavior {
|
|
24
|
+
export declare abstract class DamageAbilityBehavior<T extends DamageAbilityBehaviorParameters = DamageAbilityBehaviorParameters> extends AbilityBehavior {
|
|
23
25
|
protected readonly damage: AbilityDependentValue<number>;
|
|
24
26
|
protected readonly parameters?: T | undefined;
|
|
25
27
|
protected constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: T | undefined);
|
|
26
28
|
protected calculateDamage(caster: Unit): number;
|
|
29
|
+
protected damageTarget(caster: Unit, target: Widget, damage?: number): void;
|
|
27
30
|
}
|
|
28
31
|
export declare class DamageSelfAbilityBehavior extends DamageAbilityBehavior {
|
|
29
32
|
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAbilityBehaviorParameters);
|
|
@@ -9,7 +9,8 @@ local Unit = ____unit.Unit
|
|
|
9
9
|
local ____ability = require("engine.standard.fields.ability")
|
|
10
10
|
local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD
|
|
11
11
|
local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
|
|
12
|
-
|
|
12
|
+
____exports.DamageAbilityBehavior = __TS__Class()
|
|
13
|
+
local DamageAbilityBehavior = ____exports.DamageAbilityBehavior
|
|
13
14
|
DamageAbilityBehavior.name = "DamageAbilityBehavior"
|
|
14
15
|
__TS__ClassExtends(DamageAbilityBehavior, AbilityBehavior)
|
|
15
16
|
function DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
@@ -34,49 +35,44 @@ function DamageAbilityBehavior.prototype.calculateDamage(self, caster)
|
|
|
34
35
|
end
|
|
35
36
|
return damage
|
|
36
37
|
end
|
|
37
|
-
|
|
38
|
-
local DamageSelfAbilityBehavior = ____exports.DamageSelfAbilityBehavior
|
|
39
|
-
DamageSelfAbilityBehavior.name = "DamageSelfAbilityBehavior"
|
|
40
|
-
__TS__ClassExtends(DamageSelfAbilityBehavior, DamageAbilityBehavior)
|
|
41
|
-
function DamageSelfAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
42
|
-
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
43
|
-
end
|
|
44
|
-
function DamageSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
38
|
+
function DamageAbilityBehavior.prototype.damageTarget(self, caster, target, damage)
|
|
45
39
|
local parameters = self.parameters
|
|
46
40
|
caster:damageTarget(
|
|
47
|
-
|
|
48
|
-
self:calculateDamage(caster),
|
|
41
|
+
target,
|
|
42
|
+
damage or self:calculateDamage(caster),
|
|
49
43
|
nil,
|
|
50
44
|
nil,
|
|
51
|
-
parameters and parameters.attackType,
|
|
45
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.attackType),
|
|
52
46
|
parameters and parameters.damageType,
|
|
53
|
-
parameters and parameters.weaponType
|
|
47
|
+
parameters and parameters.weaponType,
|
|
48
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.metadata)
|
|
54
49
|
)
|
|
55
50
|
end
|
|
51
|
+
____exports.DamageSelfAbilityBehavior = __TS__Class()
|
|
52
|
+
local DamageSelfAbilityBehavior = ____exports.DamageSelfAbilityBehavior
|
|
53
|
+
DamageSelfAbilityBehavior.name = "DamageSelfAbilityBehavior"
|
|
54
|
+
__TS__ClassExtends(DamageSelfAbilityBehavior, ____exports.DamageAbilityBehavior)
|
|
55
|
+
function DamageSelfAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
56
|
+
DamageSelfAbilityBehavior.____super.prototype.____constructor(self, ability, damage, parameters)
|
|
57
|
+
end
|
|
58
|
+
function DamageSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
59
|
+
self:damageTarget(caster, caster)
|
|
60
|
+
end
|
|
56
61
|
____exports.DamageTargetAbilityBehavior = __TS__Class()
|
|
57
62
|
local DamageTargetAbilityBehavior = ____exports.DamageTargetAbilityBehavior
|
|
58
63
|
DamageTargetAbilityBehavior.name = "DamageTargetAbilityBehavior"
|
|
59
|
-
__TS__ClassExtends(DamageTargetAbilityBehavior, DamageAbilityBehavior)
|
|
64
|
+
__TS__ClassExtends(DamageTargetAbilityBehavior, ____exports.DamageAbilityBehavior)
|
|
60
65
|
function DamageTargetAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
61
|
-
|
|
66
|
+
DamageTargetAbilityBehavior.____super.prototype.____constructor(self, ability, damage, parameters)
|
|
62
67
|
end
|
|
63
68
|
function DamageTargetAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
64
|
-
|
|
65
|
-
caster:damageTarget(
|
|
66
|
-
target,
|
|
67
|
-
self:calculateDamage(caster),
|
|
68
|
-
nil,
|
|
69
|
-
nil,
|
|
70
|
-
parameters and parameters.attackType,
|
|
71
|
-
parameters and parameters.damageType,
|
|
72
|
-
parameters and parameters.weaponType
|
|
73
|
-
)
|
|
69
|
+
self:damageTarget(caster, target)
|
|
74
70
|
end
|
|
75
71
|
local DamageAreaAbilityBehavior = __TS__Class()
|
|
76
72
|
DamageAreaAbilityBehavior.name = "DamageAreaAbilityBehavior"
|
|
77
|
-
__TS__ClassExtends(DamageAreaAbilityBehavior, DamageAbilityBehavior)
|
|
73
|
+
__TS__ClassExtends(DamageAreaAbilityBehavior, ____exports.DamageAbilityBehavior)
|
|
78
74
|
function DamageAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
79
|
-
|
|
75
|
+
DamageAreaAbilityBehavior.____super.prototype.____constructor(self, ability, damage, parameters)
|
|
80
76
|
end
|
|
81
77
|
function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
82
78
|
local parameters = self.parameters
|
|
@@ -93,15 +89,7 @@ function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
|
93
89
|
damage = maximumDamage / #targets
|
|
94
90
|
end
|
|
95
91
|
for ____, target in ipairs(targets) do
|
|
96
|
-
|
|
97
|
-
target,
|
|
98
|
-
damage,
|
|
99
|
-
nil,
|
|
100
|
-
nil,
|
|
101
|
-
parameters and parameters.attackType,
|
|
102
|
-
parameters and parameters.damageType,
|
|
103
|
-
parameters and parameters.weaponType
|
|
104
|
-
)
|
|
92
|
+
self:damageTarget(caster, target, damage)
|
|
105
93
|
end
|
|
106
94
|
end
|
|
107
95
|
____exports.DamageSelfAreaAbilityBehavior = __TS__Class()
|
|
@@ -10,6 +10,9 @@ local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTE
|
|
|
10
10
|
local ____math = require("math")
|
|
11
11
|
local max = ____math.max
|
|
12
12
|
local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
13
|
+
local ____sound = require("core.types.sound")
|
|
14
|
+
local Sound3D = ____sound.Sound3D
|
|
15
|
+
local SoundSettings = ____sound.SoundSettings
|
|
13
16
|
____exports.EmulateImpactAbilityBehavior = __TS__Class()
|
|
14
17
|
local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
|
|
15
18
|
EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
|
|
@@ -23,6 +26,10 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
23
26
|
caster.mana = caster.mana - manaCost
|
|
24
27
|
self.ability.cooldownRemaining = max(cooldown, MINIMUM_POSITIVE_NORMALIZED_FLOAT)
|
|
25
28
|
self:flashCasterEffect(caster)
|
|
29
|
+
local soundPresetId = self.ability:getField(ABILITY_SF_EFFECT_SOUND)
|
|
30
|
+
if soundPresetId ~= "" then
|
|
31
|
+
Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
|
|
32
|
+
end
|
|
26
33
|
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
27
34
|
end
|
|
28
35
|
return ____exports
|
|
@@ -58,6 +58,8 @@ export declare class UnitAbility extends Ability {
|
|
|
58
58
|
constructor(handle: jability, typeId: number, owner: Unit);
|
|
59
59
|
incrementHideCounter(): void;
|
|
60
60
|
decrementHideCounter(): void;
|
|
61
|
+
incrementDisableCounter(): void;
|
|
62
|
+
decrementDisableCounter(): void;
|
|
61
63
|
get level(): number;
|
|
62
64
|
set level(v: number);
|
|
63
65
|
get cooldownRemaining(): number;
|
|
@@ -38,6 +38,7 @@ local getHandleId = GetHandleId
|
|
|
38
38
|
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
39
|
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
40
|
local unitHideAbility = BlzUnitHideAbility
|
|
41
|
+
local unitDisableAbility = BlzUnitDisableAbility
|
|
41
42
|
local match = string.match
|
|
42
43
|
local ____type = _G.type
|
|
43
44
|
local ____tostring = _G.tostring
|
|
@@ -402,6 +403,12 @@ end
|
|
|
402
403
|
function UnitAbility.prototype.decrementHideCounter(self)
|
|
403
404
|
unitHideAbility(self.u, self.typeId, false)
|
|
404
405
|
end
|
|
406
|
+
function UnitAbility.prototype.incrementDisableCounter(self)
|
|
407
|
+
unitDisableAbility(self.u, self.typeId, true, false)
|
|
408
|
+
end
|
|
409
|
+
function UnitAbility.prototype.decrementDisableCounter(self)
|
|
410
|
+
unitDisableAbility(self.u, self.typeId, false, false)
|
|
411
|
+
end
|
|
405
412
|
function UnitAbility.prototype.interruptCast(self)
|
|
406
413
|
self.owner:interruptCast(self.typeId)
|
|
407
414
|
end
|
|
@@ -5,6 +5,7 @@ import { Event } from "../../event";
|
|
|
5
5
|
import { ReadonlyRect } from "../../core/types/rect";
|
|
6
6
|
import { ItemAbility } from "./ability";
|
|
7
7
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
8
|
+
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
8
9
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
9
10
|
export declare const addAndGetAbility: (handle: jitem, abilityTypeId: AbilityTypeId) => jability | null;
|
|
10
11
|
declare const enum ItemPropertyKey {
|
|
@@ -17,7 +18,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
17
18
|
constructor(handle: jitem);
|
|
18
19
|
protected onDestroy(): HandleDestructor;
|
|
19
20
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
20
|
-
get typeId():
|
|
21
|
+
get typeId(): ItemTypeId;
|
|
21
22
|
set skinId(v: number);
|
|
22
23
|
get skinId(): number;
|
|
23
24
|
set name(v: string);
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Widget } from "../../core/types/widget";
|
|
3
|
-
|
|
4
|
-
export declare namespace AttackType {
|
|
5
|
-
const SPELL: jattacktype;
|
|
6
|
-
const NORMAL: jattacktype;
|
|
7
|
-
const PIERCE: jattacktype;
|
|
8
|
-
const SIEGE: jattacktype;
|
|
9
|
-
const MAGIC: jattacktype;
|
|
10
|
-
const CHAOS: jattacktype;
|
|
11
|
-
const HERO: jattacktype;
|
|
12
|
-
}
|
|
3
|
+
import { AttackType } from "../object-data/auxiliary/attack-type";
|
|
13
4
|
export type DamageType = jdamagetype;
|
|
14
5
|
export declare namespace DamageType {
|
|
15
6
|
const UNKNOWN: jdamagetype;
|
|
@@ -64,6 +55,6 @@ export declare namespace WeaponType {
|
|
|
64
55
|
}
|
|
65
56
|
declare module "./unit" {
|
|
66
57
|
interface Unit {
|
|
67
|
-
damageTarget(target: Widget, amount: number, attack?: boolean, ranged?: boolean, attackType?: AttackType, damageType?: DamageType, weaponType?: WeaponType): boolean;
|
|
58
|
+
damageTarget(target: Widget, amount: number, attack?: boolean, ranged?: boolean, attackType?: AttackType, damageType?: DamageType, weaponType?: WeaponType, metadata?: unknown): boolean;
|
|
68
59
|
}
|
|
69
60
|
}
|
|
@@ -7,21 +7,14 @@ local ____player = require("core.types.player")
|
|
|
7
7
|
local Player = ____player.Player
|
|
8
8
|
local ____dummy = require("objutil.dummy")
|
|
9
9
|
local dummyUnitId = ____dummy.dummyUnitId
|
|
10
|
+
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
11
|
+
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
12
|
+
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
13
|
+
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
10
14
|
local createUnit = CreateUnit
|
|
11
15
|
local getOwningPlayer = GetOwningPlayer
|
|
12
16
|
local showUnit = ShowUnit
|
|
13
17
|
local unitDamageTarget = UnitDamageTarget
|
|
14
|
-
____exports.AttackType = {}
|
|
15
|
-
local AttackType = ____exports.AttackType
|
|
16
|
-
do
|
|
17
|
-
AttackType.SPELL = ATTACK_TYPE_NORMAL
|
|
18
|
-
AttackType.NORMAL = ATTACK_TYPE_MELEE
|
|
19
|
-
AttackType.PIERCE = ATTACK_TYPE_PIERCE
|
|
20
|
-
AttackType.SIEGE = ATTACK_TYPE_SIEGE
|
|
21
|
-
AttackType.MAGIC = ATTACK_TYPE_MAGIC
|
|
22
|
-
AttackType.CHAOS = ATTACK_TYPE_CHAOS
|
|
23
|
-
AttackType.HERO = ATTACK_TYPE_HERO
|
|
24
|
-
end
|
|
25
18
|
____exports.DamageType = {}
|
|
26
19
|
local DamageType = ____exports.DamageType
|
|
27
20
|
do
|
|
@@ -88,7 +81,7 @@ for ____, player in ipairs(Player.all) do
|
|
|
88
81
|
showUnit(dummy, false)
|
|
89
82
|
dummies[player] = dummy
|
|
90
83
|
end
|
|
91
|
-
Unit.prototype.damageTarget = function(self, target, amount, attack, ranged, attackType, damageType, weaponType)
|
|
84
|
+
Unit.prototype.damageTarget = function(self, target, amount, attack, ranged, attackType, damageType, weaponType, metadata)
|
|
92
85
|
if attack == nil then
|
|
93
86
|
attack = false
|
|
94
87
|
end
|
|
@@ -96,7 +89,7 @@ Unit.prototype.damageTarget = function(self, target, amount, attack, ranged, att
|
|
|
96
89
|
ranged = false
|
|
97
90
|
end
|
|
98
91
|
if attackType == nil then
|
|
99
|
-
attackType =
|
|
92
|
+
attackType = 0
|
|
100
93
|
end
|
|
101
94
|
if damageType == nil then
|
|
102
95
|
damageType = ____exports.DamageType.MAGIC
|
|
@@ -109,13 +102,16 @@ Unit.prototype.damageTarget = function(self, target, amount, attack, ranged, att
|
|
|
109
102
|
if not getOwningPlayer(handle) then
|
|
110
103
|
handle = dummies[__TS__InstanceOf(target, Unit) and target.owner or (self._owner or Player.neutralAggressive)]
|
|
111
104
|
end
|
|
105
|
+
if __TS__InstanceOf(target, Unit) then
|
|
106
|
+
damageMetadataByTarget[target] = metadata
|
|
107
|
+
end
|
|
112
108
|
return unitDamageTarget(
|
|
113
109
|
handle,
|
|
114
110
|
targetHandle,
|
|
115
111
|
amount,
|
|
116
112
|
attack,
|
|
117
113
|
ranged,
|
|
118
|
-
attackType,
|
|
114
|
+
attackTypeToNative(attackType),
|
|
119
115
|
damageType,
|
|
120
116
|
weaponType
|
|
121
117
|
)
|
|
@@ -6,7 +6,6 @@ local ____exports = {}
|
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
8
|
local ____unit_2Bdamage = require("engine.internal.unit+damage")
|
|
9
|
-
local AttackType = ____unit_2Bdamage.AttackType
|
|
10
9
|
local DamageType = ____unit_2Bdamage.DamageType
|
|
11
10
|
local ____event = require("event")
|
|
12
11
|
local Event = ____event.Event
|
|
@@ -33,7 +32,7 @@ local spellStealEventStack = {}
|
|
|
33
32
|
Unit.onDamaging:addListener(function(source, target, event)
|
|
34
33
|
if event.amount == 0 and source ~= nil then
|
|
35
34
|
local count = countByUnit[source] or 0
|
|
36
|
-
if count > 0 and event.attackType ==
|
|
35
|
+
if count > 0 and event.attackType == 0 then
|
|
37
36
|
if event.damageType == DamageType.UNKNOWN then
|
|
38
37
|
spellStealEventStack[#spellStealEventStack + 1] = {
|
|
39
38
|
sourceBuffIds = source.buffIds,
|
|
@@ -11,6 +11,10 @@ import { Ability, UnitAbility } from "./ability";
|
|
|
11
11
|
import { Widget } from "../../core/types/widget";
|
|
12
12
|
import type { UnitTypeId } from "../object-data/entry/unit-type";
|
|
13
13
|
import { CombatClassification, CombatClassifications } from "../object-data/auxiliary/combat-classification";
|
|
14
|
+
import { MovementType } from "../object-data/auxiliary/movement-type";
|
|
15
|
+
import { UnitAttribute } from "../object-data/auxiliary/unit-attribute";
|
|
16
|
+
import { AttackType } from "../object-data/auxiliary/attack-type";
|
|
17
|
+
import { AttributesHolder } from "../../attributes";
|
|
14
18
|
export type UnitClassification = junittype;
|
|
15
19
|
export declare namespace UnitClassification {
|
|
16
20
|
const STRUCTURE: junittype;
|
|
@@ -19,6 +23,7 @@ export declare namespace UnitClassification {
|
|
|
19
23
|
const GROUND: junittype;
|
|
20
24
|
const SUMMONED: junittype;
|
|
21
25
|
const MECHANICAL: junittype;
|
|
26
|
+
const WORKER: junittype;
|
|
22
27
|
const ANCIENT: junittype;
|
|
23
28
|
const SUICIDAL: junittype;
|
|
24
29
|
const TAUREN: junittype;
|
|
@@ -36,15 +41,18 @@ type AbilityDispatcherTable<T extends any[] = []> = {
|
|
|
36
41
|
readonly [id: number]: Event<[Unit, Ability, ...T]>;
|
|
37
42
|
};
|
|
38
43
|
type AbilityEventDispatcher<T extends any[] = []> = Event<[Unit, Ability, ...T]> & AbilityDispatcherTable<T>;
|
|
39
|
-
export interface DamagingEvent {
|
|
44
|
+
export interface DamagingEvent extends AttributesHolder {
|
|
40
45
|
amount: number;
|
|
41
|
-
attackType:
|
|
46
|
+
attackType: AttackType;
|
|
42
47
|
damageType: jdamagetype;
|
|
43
48
|
weaponType: jweapontype;
|
|
49
|
+
metadata: unknown;
|
|
44
50
|
readonly isAttack: boolean;
|
|
45
51
|
readonly originalAmount: number;
|
|
52
|
+
readonly originalMetadata: unknown;
|
|
53
|
+
preventRetaliation(this: DamagingEvent): void;
|
|
46
54
|
}
|
|
47
|
-
export type DamageEvent = DamagingEvent & {
|
|
55
|
+
export type DamageEvent = Omit<DamagingEvent, "preventRetaliation"> & {
|
|
48
56
|
preventDeath<P extends any[]>(this: DamageEvent, callback: (this: void, ...parameters: P) => any, ...parameters: P): void;
|
|
49
57
|
};
|
|
50
58
|
export type AttackDamageEvent = DamagingEvent & {
|
|
@@ -161,6 +169,8 @@ export declare class Unit extends Handle<junit> {
|
|
|
161
169
|
set level(v: number);
|
|
162
170
|
get xp(): number;
|
|
163
171
|
set xp(v: number);
|
|
172
|
+
get primaryAttribute(): UnitAttribute;
|
|
173
|
+
set primaryAttribute(primaryAttribute: UnitAttribute);
|
|
164
174
|
get strengthBase(): number;
|
|
165
175
|
set strengthBase(strengthBase: number);
|
|
166
176
|
get strengthBonus(): number;
|
|
@@ -235,6 +245,8 @@ export declare class Unit extends Handle<junit> {
|
|
|
235
245
|
set timeScale(v: number);
|
|
236
246
|
get collisionSize(): number;
|
|
237
247
|
get pathingCollisionRange(): number;
|
|
248
|
+
get movementType(): MovementType;
|
|
249
|
+
set movementType(movementType: MovementType);
|
|
238
250
|
set pathing(v: boolean);
|
|
239
251
|
isSelected(player: Player): boolean;
|
|
240
252
|
explode(): void;
|
|
@@ -285,6 +297,7 @@ export declare class Unit extends Handle<junit> {
|
|
|
285
297
|
get onUnitInRange(): Record<number, Event<[Unit]>>;
|
|
286
298
|
get onManaEqual(): Record<number, Event<[Unit, number]>>;
|
|
287
299
|
get manaEvent(): Record<Operator, Record<number, Event<[Unit]>>>;
|
|
300
|
+
get targetAcquiredEvent(): Event;
|
|
288
301
|
get onSelect(): Event;
|
|
289
302
|
get onDeselect(): Event;
|
|
290
303
|
get onImmediateOrder(): Event<[number]>;
|