warscript 0.0.1-dev.d410c75 → 0.0.1-dev.d5494fc
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/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/sound.d.ts +17 -25
- package/core/types/sound.lua +91 -46
- package/core/types/timer.d.ts +6 -7
- package/core/types/timer.lua +18 -21
- package/core/util.lua +6 -1
- package/decl/native.d.ts +840 -786
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +8 -2
- package/engine/behaviour/ability/damage.lua +18 -31
- package/engine/behaviour/ability/emulate-impact.lua +7 -0
- package/engine/behaviour/ability.d.ts +5 -1
- package/engine/behaviour/ability.lua +18 -4
- package/engine/behaviour/unit.d.ts +2 -0
- package/engine/buff.d.ts +13 -8
- package/engine/buff.lua +81 -50
- package/engine/internal/item.d.ts +2 -1
- package/engine/internal/mechanics/ability-duration.lua +1 -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 -2
- package/engine/internal/unit.lua +81 -32
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- 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/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -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/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +0 -9
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/curse.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.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/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +13 -11
- package/engine/object-data/entry/ability-type.lua +65 -6
- package/engine/object-data/entry/buff-type/applicable.lua +8 -3
- 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/sound-preset.d.ts +18 -2
- package/engine/object-data/entry/sound-preset.lua +105 -15
- package/engine/object-data/entry/unit-type.d.ts +2 -2
- package/engine/object-data/entry/unit-type.lua +97 -87
- package/engine/object-data/entry.d.ts +1 -1
- 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/objutil/unit.lua +2 -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
- package/utility/reflection.lua +11 -7
|
@@ -41,6 +41,7 @@ function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitGainAbility(self, unit
|
|
|
41
41
|
____opt_0:destroy()
|
|
42
42
|
end
|
|
43
43
|
self.unitBehavior = __TS__New(self.unitBehaviorConstructor, unit)
|
|
44
|
+
self.unitBehavior.sourceAbilityBehavior = self
|
|
44
45
|
self:update()
|
|
45
46
|
end
|
|
46
47
|
function ApplyUnitBehaviorAbilityBehavior.prototype.onUnitLoseAbility(self)
|
|
@@ -4,23 +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
|
+
import { CombatClassifications } from "../../object-data/auxiliary/combat-classification";
|
|
9
|
+
import { AttackType } from "../../object-data/auxiliary/attack-type";
|
|
8
10
|
export type DamageAbilityBehaviorParameters = {
|
|
9
11
|
damagePerStrength?: AbilityDependentValue<number>;
|
|
10
12
|
damagePerAgility?: AbilityDependentValue<number>;
|
|
11
13
|
damagePerIntelligence?: AbilityDependentValue<number>;
|
|
12
|
-
attackType?: AttackType
|
|
14
|
+
attackType?: AbilityDependentValue<AttackType>;
|
|
13
15
|
damageType?: DamageType;
|
|
14
16
|
weaponType?: WeaponType;
|
|
17
|
+
metadata?: AbilityDependentValue<string | number | boolean>;
|
|
15
18
|
};
|
|
16
19
|
export type DamageAreaAbilityBehaviorParameters = DamageAbilityBehaviorParameters & {
|
|
17
20
|
maximumDamage?: AbilityDependentValue<number>;
|
|
21
|
+
areaOfEffect?: AbilityDependentValue<number>;
|
|
22
|
+
allowedTargetCombatClassifications?: AbilityDependentValue<CombatClassifications>;
|
|
18
23
|
};
|
|
19
24
|
declare abstract class DamageAbilityBehavior<T extends DamageAbilityBehaviorParameters = DamageAbilityBehaviorParameters> extends AbilityBehavior {
|
|
20
25
|
protected readonly damage: AbilityDependentValue<number>;
|
|
21
26
|
protected readonly parameters?: T | undefined;
|
|
22
27
|
protected constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: T | undefined);
|
|
23
28
|
protected calculateDamage(caster: Unit): number;
|
|
29
|
+
protected damageTarget(caster: Unit, target: Widget, damage?: number): void;
|
|
24
30
|
}
|
|
25
31
|
export declare class DamageSelfAbilityBehavior extends DamageAbilityBehavior {
|
|
26
32
|
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAbilityBehaviorParameters);
|
|
@@ -34,6 +34,19 @@ function DamageAbilityBehavior.prototype.calculateDamage(self, caster)
|
|
|
34
34
|
end
|
|
35
35
|
return damage
|
|
36
36
|
end
|
|
37
|
+
function DamageAbilityBehavior.prototype.damageTarget(self, caster, target, damage)
|
|
38
|
+
local parameters = self.parameters
|
|
39
|
+
caster:damageTarget(
|
|
40
|
+
target,
|
|
41
|
+
damage or self:calculateDamage(caster),
|
|
42
|
+
nil,
|
|
43
|
+
nil,
|
|
44
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.attackType),
|
|
45
|
+
parameters and parameters.damageType,
|
|
46
|
+
parameters and parameters.weaponType,
|
|
47
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.metadata)
|
|
48
|
+
)
|
|
49
|
+
end
|
|
37
50
|
____exports.DamageSelfAbilityBehavior = __TS__Class()
|
|
38
51
|
local DamageSelfAbilityBehavior = ____exports.DamageSelfAbilityBehavior
|
|
39
52
|
DamageSelfAbilityBehavior.name = "DamageSelfAbilityBehavior"
|
|
@@ -42,16 +55,7 @@ function DamageSelfAbilityBehavior.prototype.____constructor(self, ability, dama
|
|
|
42
55
|
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
43
56
|
end
|
|
44
57
|
function DamageSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
45
|
-
|
|
46
|
-
caster:damageTarget(
|
|
47
|
-
caster,
|
|
48
|
-
self:calculateDamage(caster),
|
|
49
|
-
nil,
|
|
50
|
-
nil,
|
|
51
|
-
parameters and parameters.attackType,
|
|
52
|
-
parameters and parameters.damageType,
|
|
53
|
-
parameters and parameters.weaponType
|
|
54
|
-
)
|
|
58
|
+
self:damageTarget(caster, caster)
|
|
55
59
|
end
|
|
56
60
|
____exports.DamageTargetAbilityBehavior = __TS__Class()
|
|
57
61
|
local DamageTargetAbilityBehavior = ____exports.DamageTargetAbilityBehavior
|
|
@@ -61,16 +65,7 @@ function DamageTargetAbilityBehavior.prototype.____constructor(self, ability, da
|
|
|
61
65
|
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
62
66
|
end
|
|
63
67
|
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
|
-
)
|
|
68
|
+
self:damageTarget(caster, target)
|
|
74
69
|
end
|
|
75
70
|
local DamageAreaAbilityBehavior = __TS__Class()
|
|
76
71
|
DamageAreaAbilityBehavior.name = "DamageAreaAbilityBehavior"
|
|
@@ -82,10 +77,10 @@ function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
|
82
77
|
local parameters = self.parameters
|
|
83
78
|
local targets = Unit.getAllowedTargetsInCollisionRange(
|
|
84
79
|
caster,
|
|
85
|
-
self:resolveCurrentAbilityDependentValue(ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
80
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.allowedTargetCombatClassifications or ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
86
81
|
x,
|
|
87
82
|
y,
|
|
88
|
-
self:resolveCurrentAbilityDependentValue(AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
83
|
+
self:resolveCurrentAbilityDependentValue(parameters and parameters.areaOfEffect or AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
89
84
|
)
|
|
90
85
|
local damage = self:calculateDamage(caster)
|
|
91
86
|
local maximumDamage = self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0)
|
|
@@ -93,15 +88,7 @@ function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
|
93
88
|
damage = maximumDamage / #targets
|
|
94
89
|
end
|
|
95
90
|
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
|
-
)
|
|
91
|
+
self:damageTarget(caster, target, damage)
|
|
105
92
|
end
|
|
106
93
|
end
|
|
107
94
|
____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
|
|
@@ -22,13 +22,17 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
22
22
|
protected subscribe<T extends boolean | number | string>(value: SubscribableAbilityDependentValue<T>): void;
|
|
23
23
|
protected registerCommandEvent(orderTypeStringId?: string): void;
|
|
24
24
|
get ability(): Ability;
|
|
25
|
+
get unit(): Unit | undefined;
|
|
25
26
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
26
27
|
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value?: AbilityDependentValue<T>): T | undefined;
|
|
27
28
|
protected flashCasterEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
28
29
|
protected flashTargetEffect(widget: Widget, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
29
30
|
protected flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
30
31
|
protected flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
31
|
-
protected flashSpecialEffect(...args: [
|
|
32
|
+
protected flashSpecialEffect(...args: [
|
|
33
|
+
...pointOrWidget: [x: number, y: number] | [widget: Widget],
|
|
34
|
+
...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]
|
|
35
|
+
]): void;
|
|
32
36
|
private static MissileLaunchConfig;
|
|
33
37
|
private get missileLaunchConfig();
|
|
34
38
|
protected onCreate(): void;
|
|
@@ -148,13 +148,14 @@ function AbilityBehavior.prototype.flashEffect(self, x, y, ...)
|
|
|
148
148
|
...
|
|
149
149
|
)
|
|
150
150
|
end
|
|
151
|
-
function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget,
|
|
151
|
+
function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrParametersOrDuration, durationOrParameters, parameters)
|
|
152
152
|
if type(xOrWidget) == "number" then
|
|
153
153
|
Effect:flash(
|
|
154
154
|
SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.ability, 0),
|
|
155
155
|
xOrWidget,
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
yOrParametersOrDuration,
|
|
157
|
+
durationOrParameters,
|
|
158
|
+
parameters
|
|
158
159
|
)
|
|
159
160
|
else
|
|
160
161
|
local attachmentPoint = SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD:getValue(self.ability)
|
|
@@ -162,7 +163,8 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrDurati
|
|
|
162
163
|
SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.ability, 0),
|
|
163
164
|
xOrWidget,
|
|
164
165
|
attachmentPoint ~= "" and attachmentPoint or "origin",
|
|
165
|
-
|
|
166
|
+
yOrParametersOrDuration,
|
|
167
|
+
durationOrParameters
|
|
166
168
|
)
|
|
167
169
|
end
|
|
168
170
|
end
|
|
@@ -237,6 +239,18 @@ __TS__SetDescriptor(
|
|
|
237
239
|
end},
|
|
238
240
|
true
|
|
239
241
|
)
|
|
242
|
+
__TS__SetDescriptor(
|
|
243
|
+
AbilityBehavior.prototype,
|
|
244
|
+
"unit",
|
|
245
|
+
{get = function(self)
|
|
246
|
+
local owner = self.object.owner
|
|
247
|
+
if __TS__InstanceOf(owner, Unit) then
|
|
248
|
+
return owner
|
|
249
|
+
end
|
|
250
|
+
return owner.owner
|
|
251
|
+
end},
|
|
252
|
+
true
|
|
253
|
+
)
|
|
240
254
|
AbilityBehavior.MissileLaunchConfig = ____class_2
|
|
241
255
|
__TS__SetDescriptor(
|
|
242
256
|
AbilityBehavior.prototype,
|
|
@@ -5,9 +5,11 @@ import { DamageEvent, DamagingEvent, Unit } from "../internal/unit";
|
|
|
5
5
|
import "../internal/unit+ability";
|
|
6
6
|
import "../internal/unit-missile-launch";
|
|
7
7
|
import { Item } from "../internal/item";
|
|
8
|
+
import type { AbilityBehavior } from "./ability";
|
|
8
9
|
export type UnitBehaviorConstructor<Args extends any[]> = new (unit: Unit, ...args: Args) => UnitBehavior;
|
|
9
10
|
export declare abstract class UnitBehavior<PeriodicActionParameters extends any[] = any[]> extends Behavior<Unit, PeriodicActionParameters> {
|
|
10
11
|
constructor(unit: Unit);
|
|
12
|
+
readonly sourceAbilityBehavior?: AbilityBehavior;
|
|
11
13
|
get unit(): Unit;
|
|
12
14
|
onAutoAttackStart(target: Unit): void;
|
|
13
15
|
onAutoAttackFinish(target: Unit): void;
|
package/engine/buff.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
64
64
|
durationIncreaseOnAutoAttack?: NumberParameterValueType;
|
|
65
65
|
maximumRemainingDuration?: NumberParameterValueType;
|
|
66
66
|
maximumDuration?: NumberParameterValueType;
|
|
67
|
+
turnsIntoGhost?: BooleanParameterValueType;
|
|
67
68
|
stuns?: BooleanParameterValueType;
|
|
68
69
|
ignoresStunImmunity?: BooleanParameterValueType;
|
|
69
70
|
providesStunImmunity?: BooleanParameterValueType;
|
|
@@ -116,13 +117,14 @@ declare const enum BuffPropertyKey {
|
|
|
116
117
|
MAXIMUM_DAMAGE_DEALT_EVENT_COUNT = 132,
|
|
117
118
|
DAMAGE_RECEIVED_EVENT_COUNT = 133,
|
|
118
119
|
MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT = 134,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
TURNS_INTO_GHOST = 135,
|
|
121
|
+
STUNS = 136,
|
|
122
|
+
IGNORES_STUN_IMMUNITY = 137,
|
|
123
|
+
DISABLES_AUTO_ATTACK = 138,
|
|
124
|
+
PROVIDES_INVULNERABILITY = 139,
|
|
125
|
+
KILLS_ON_EXPIRATION = 140,
|
|
126
|
+
EXPLODES_ON_EXPIRATION = 141,
|
|
127
|
+
MISS_PROBABILITY = 142
|
|
126
128
|
}
|
|
127
129
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
128
130
|
LEAST_DURATION = 0
|
|
@@ -136,7 +138,7 @@ export type BuffConstructorParameters<AdditionalParameters extends BuffAdditiona
|
|
|
136
138
|
polarity: BuffPolarityParameterType,
|
|
137
139
|
resistanceType: BuffResistanceTypeParameterType,
|
|
138
140
|
...abilityOrParameters: [
|
|
139
|
-
ability
|
|
141
|
+
ability?: Ability,
|
|
140
142
|
parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>
|
|
141
143
|
] | [parameters?: BuffParameters & Omit<AdditionalParameters, keyof BuffParameters>]
|
|
142
144
|
];
|
|
@@ -178,6 +180,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
178
180
|
private [BuffPropertyKey.DAMAGE_DEALT_EVENT_COUNT]?;
|
|
179
181
|
private [BuffPropertyKey.MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
180
182
|
private [BuffPropertyKey.DAMAGE_RECEIVED_EVENT_COUNT]?;
|
|
183
|
+
private [BuffPropertyKey.TURNS_INTO_GHOST]?;
|
|
181
184
|
private [BuffPropertyKey.STUNS]?;
|
|
182
185
|
private [BuffPropertyKey.IGNORES_STUN_IMMUNITY]?;
|
|
183
186
|
private [BuffPropertyKey.DISABLES_AUTO_ATTACK]?;
|
|
@@ -231,6 +234,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
231
234
|
set receivedDamageFactor(receivedDamageFactor: number);
|
|
232
235
|
get armorIncrease(): number;
|
|
233
236
|
set armorIncrease(armorIncrease: number);
|
|
237
|
+
get turnsIntoGhost(): boolean;
|
|
238
|
+
set turnsIntoGhost(turnsIntoGhost: boolean);
|
|
234
239
|
get stuns(): boolean;
|
|
235
240
|
set stuns(stuns: boolean);
|
|
236
241
|
get ignoresStunImmunity(): boolean;
|
package/engine/buff.lua
CHANGED
|
@@ -109,6 +109,7 @@ local buffParametersKeys = {
|
|
|
109
109
|
durationIncreaseOnAutoAttack = true,
|
|
110
110
|
maximumDuration = true,
|
|
111
111
|
maximumRemainingDuration = true,
|
|
112
|
+
turnsIntoGhost = true,
|
|
112
113
|
stuns = true,
|
|
113
114
|
ignoresStunImmunity = true,
|
|
114
115
|
providesStunImmunity = true,
|
|
@@ -174,6 +175,7 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
174
175
|
end
|
|
175
176
|
end
|
|
176
177
|
local buffBooleanParameters = {
|
|
178
|
+
"turnsIntoGhost",
|
|
177
179
|
"stuns",
|
|
178
180
|
"ignoresStunImmunity",
|
|
179
181
|
"disablesAutoAttack",
|
|
@@ -321,7 +323,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
321
323
|
typeId = selectBuffTypeIdWithLeastDuration(typeIdOrTypeIds, _unit)
|
|
322
324
|
polarity = resistanceTypeOrPolarity
|
|
323
325
|
resistanceType = abilityOrParametersOrResistanceType
|
|
324
|
-
if __TS__InstanceOf(parametersOrAbility, Ability) then
|
|
326
|
+
if __TS__InstanceOf(parametersOrAbility, Ability) or parametersOrAbility == nil then
|
|
325
327
|
ability = parametersOrAbility
|
|
326
328
|
else
|
|
327
329
|
ability = nil
|
|
@@ -331,7 +333,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
331
333
|
typeId = typeIdOrTypeIds
|
|
332
334
|
polarity = polarityOrTypeIdSelectionPolicy
|
|
333
335
|
resistanceType = resistanceTypeOrPolarity
|
|
334
|
-
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) then
|
|
336
|
+
if __TS__InstanceOf(abilityOrParametersOrResistanceType, Ability) or abilityOrParametersOrResistanceType == nil then
|
|
335
337
|
ability = abilityOrParametersOrResistanceType
|
|
336
338
|
parameters = parametersOrAbility
|
|
337
339
|
else
|
|
@@ -340,7 +342,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
340
342
|
end
|
|
341
343
|
end
|
|
342
344
|
self.typeId = typeId
|
|
343
|
-
if not __TS__InstanceOf(ability, Ability) then
|
|
345
|
+
if not (__TS__InstanceOf(ability, Ability) or ability == nil) then
|
|
344
346
|
parameters = ability
|
|
345
347
|
ability = nil
|
|
346
348
|
end
|
|
@@ -371,7 +373,7 @@ function Buff.prototype.____constructor(self, _unit, typeIdOrTypeIds, polarityOr
|
|
|
371
373
|
local missProbability = parameters and parameters.missProbability or defaultParameters.missProbability
|
|
372
374
|
if missProbability ~= nil then
|
|
373
375
|
missProbability = resolveNumberValue(ability, level, missProbability)
|
|
374
|
-
self[
|
|
376
|
+
self[142] = missProbability
|
|
375
377
|
end
|
|
376
378
|
local buffByTypeId = buffByTypeIdByUnit[_unit]
|
|
377
379
|
if buffByTypeId == nil then
|
|
@@ -592,15 +594,21 @@ function Buff.prototype.onDestroy(self)
|
|
|
592
594
|
behavior:destroy()
|
|
593
595
|
end
|
|
594
596
|
end
|
|
595
|
-
if self[
|
|
597
|
+
if self[139] then
|
|
598
|
+
unit:decrementInvulnerabilityCounter()
|
|
599
|
+
end
|
|
600
|
+
if self[138] then
|
|
596
601
|
unit:decrementDisableAutoAttackCounter()
|
|
597
602
|
end
|
|
598
|
-
if self[
|
|
599
|
-
if self[
|
|
603
|
+
if self[136] then
|
|
604
|
+
if self[137] then
|
|
600
605
|
unit:decrementStunCounter()
|
|
601
606
|
end
|
|
602
607
|
unit:decrementStunCounter()
|
|
603
608
|
end
|
|
609
|
+
if self[135] then
|
|
610
|
+
unit:decrementGhostCounter()
|
|
611
|
+
end
|
|
604
612
|
if self._abilityTypeIds ~= nil then
|
|
605
613
|
for abilityTypeId in pairs(self._abilityTypeIds) do
|
|
606
614
|
unit:removeAbility(abilityTypeId)
|
|
@@ -655,9 +663,9 @@ function Buff.prototype.onExpiration(self)
|
|
|
655
663
|
if self[121] ~= nil then
|
|
656
664
|
(self[102] or unit):healTarget(unit, self[120] or 0)
|
|
657
665
|
end
|
|
658
|
-
if self[
|
|
666
|
+
if self[141] then
|
|
659
667
|
unit:explode()
|
|
660
|
-
elseif self[
|
|
668
|
+
elseif self[140] then
|
|
661
669
|
unit:kill()
|
|
662
670
|
end
|
|
663
671
|
end
|
|
@@ -963,7 +971,7 @@ __TS__SetDescriptor(
|
|
|
963
971
|
)
|
|
964
972
|
__TS__SetDescriptor(
|
|
965
973
|
Buff.prototype,
|
|
966
|
-
"
|
|
974
|
+
"turnsIntoGhost",
|
|
967
975
|
{
|
|
968
976
|
get = function(self)
|
|
969
977
|
local ____self__135_54 = self[135]
|
|
@@ -972,18 +980,12 @@ __TS__SetDescriptor(
|
|
|
972
980
|
end
|
|
973
981
|
return ____self__135_54
|
|
974
982
|
end,
|
|
975
|
-
set = function(self,
|
|
976
|
-
if not
|
|
977
|
-
|
|
978
|
-
self.object:decrementStunCounter()
|
|
979
|
-
end
|
|
980
|
-
self.object:decrementStunCounter()
|
|
983
|
+
set = function(self, turnsIntoGhost)
|
|
984
|
+
if not turnsIntoGhost and self[135] then
|
|
985
|
+
self.object:decrementGhostCounter()
|
|
981
986
|
self[135] = nil
|
|
982
|
-
elseif
|
|
983
|
-
|
|
984
|
-
self.object:incrementStunCounter()
|
|
985
|
-
end
|
|
986
|
-
self.object:incrementStunCounter()
|
|
987
|
+
elseif turnsIntoGhost and not self[135] then
|
|
988
|
+
self.object:incrementGhostCounter()
|
|
987
989
|
self[135] = true
|
|
988
990
|
end
|
|
989
991
|
end
|
|
@@ -992,7 +994,7 @@ __TS__SetDescriptor(
|
|
|
992
994
|
)
|
|
993
995
|
__TS__SetDescriptor(
|
|
994
996
|
Buff.prototype,
|
|
995
|
-
"
|
|
997
|
+
"stuns",
|
|
996
998
|
{
|
|
997
999
|
get = function(self)
|
|
998
1000
|
local ____self__136_55 = self[136]
|
|
@@ -1001,16 +1003,18 @@ __TS__SetDescriptor(
|
|
|
1001
1003
|
end
|
|
1002
1004
|
return ____self__136_55
|
|
1003
1005
|
end,
|
|
1004
|
-
set = function(self,
|
|
1005
|
-
if not
|
|
1006
|
-
if self[
|
|
1006
|
+
set = function(self, stuns)
|
|
1007
|
+
if not stuns and self[136] then
|
|
1008
|
+
if self[137] then
|
|
1007
1009
|
self.object:decrementStunCounter()
|
|
1008
1010
|
end
|
|
1011
|
+
self.object:decrementStunCounter()
|
|
1009
1012
|
self[136] = nil
|
|
1010
|
-
elseif
|
|
1011
|
-
if self[
|
|
1013
|
+
elseif stuns and not self[136] then
|
|
1014
|
+
if self[137] then
|
|
1012
1015
|
self.object:incrementStunCounter()
|
|
1013
1016
|
end
|
|
1017
|
+
self.object:incrementStunCounter()
|
|
1014
1018
|
self[136] = true
|
|
1015
1019
|
end
|
|
1016
1020
|
end
|
|
@@ -1019,7 +1023,7 @@ __TS__SetDescriptor(
|
|
|
1019
1023
|
)
|
|
1020
1024
|
__TS__SetDescriptor(
|
|
1021
1025
|
Buff.prototype,
|
|
1022
|
-
"
|
|
1026
|
+
"ignoresStunImmunity",
|
|
1023
1027
|
{
|
|
1024
1028
|
get = function(self)
|
|
1025
1029
|
local ____self__137_56 = self[137]
|
|
@@ -1028,12 +1032,16 @@ __TS__SetDescriptor(
|
|
|
1028
1032
|
end
|
|
1029
1033
|
return ____self__137_56
|
|
1030
1034
|
end,
|
|
1031
|
-
set = function(self,
|
|
1032
|
-
if not
|
|
1033
|
-
self
|
|
1035
|
+
set = function(self, ignoresStunImmunity)
|
|
1036
|
+
if not ignoresStunImmunity and self[137] then
|
|
1037
|
+
if self[136] then
|
|
1038
|
+
self.object:decrementStunCounter()
|
|
1039
|
+
end
|
|
1034
1040
|
self[137] = nil
|
|
1035
|
-
elseif
|
|
1036
|
-
self
|
|
1041
|
+
elseif ignoresStunImmunity and not self[137] then
|
|
1042
|
+
if self[136] then
|
|
1043
|
+
self.object:incrementStunCounter()
|
|
1044
|
+
end
|
|
1037
1045
|
self[137] = true
|
|
1038
1046
|
end
|
|
1039
1047
|
end
|
|
@@ -1042,7 +1050,7 @@ __TS__SetDescriptor(
|
|
|
1042
1050
|
)
|
|
1043
1051
|
__TS__SetDescriptor(
|
|
1044
1052
|
Buff.prototype,
|
|
1045
|
-
"
|
|
1053
|
+
"disablesAutoAttack",
|
|
1046
1054
|
{
|
|
1047
1055
|
get = function(self)
|
|
1048
1056
|
local ____self__138_57 = self[138]
|
|
@@ -1051,12 +1059,12 @@ __TS__SetDescriptor(
|
|
|
1051
1059
|
end
|
|
1052
1060
|
return ____self__138_57
|
|
1053
1061
|
end,
|
|
1054
|
-
set = function(self,
|
|
1055
|
-
if not
|
|
1056
|
-
self.object:
|
|
1062
|
+
set = function(self, disablesAutoAttack)
|
|
1063
|
+
if not disablesAutoAttack and self[138] then
|
|
1064
|
+
self.object:decrementDisableAutoAttackCounter()
|
|
1057
1065
|
self[138] = nil
|
|
1058
|
-
elseif
|
|
1059
|
-
self.object:
|
|
1066
|
+
elseif disablesAutoAttack and not self[138] then
|
|
1067
|
+
self.object:incrementDisableAutoAttackCounter()
|
|
1060
1068
|
self[138] = true
|
|
1061
1069
|
end
|
|
1062
1070
|
end
|
|
@@ -1065,7 +1073,7 @@ __TS__SetDescriptor(
|
|
|
1065
1073
|
)
|
|
1066
1074
|
__TS__SetDescriptor(
|
|
1067
1075
|
Buff.prototype,
|
|
1068
|
-
"
|
|
1076
|
+
"providesInvulnerability",
|
|
1069
1077
|
{
|
|
1070
1078
|
get = function(self)
|
|
1071
1079
|
local ____self__139_58 = self[139]
|
|
@@ -1074,10 +1082,12 @@ __TS__SetDescriptor(
|
|
|
1074
1082
|
end
|
|
1075
1083
|
return ____self__139_58
|
|
1076
1084
|
end,
|
|
1077
|
-
set = function(self,
|
|
1078
|
-
if not
|
|
1085
|
+
set = function(self, providesInvulnerability)
|
|
1086
|
+
if not providesInvulnerability and self[139] then
|
|
1087
|
+
self.object:decrementInvulnerabilityCounter()
|
|
1079
1088
|
self[139] = nil
|
|
1080
|
-
elseif
|
|
1089
|
+
elseif providesInvulnerability and not self[139] then
|
|
1090
|
+
self.object:incrementInvulnerabilityCounter()
|
|
1081
1091
|
self[139] = true
|
|
1082
1092
|
end
|
|
1083
1093
|
end
|
|
@@ -1086,7 +1096,7 @@ __TS__SetDescriptor(
|
|
|
1086
1096
|
)
|
|
1087
1097
|
__TS__SetDescriptor(
|
|
1088
1098
|
Buff.prototype,
|
|
1089
|
-
"
|
|
1099
|
+
"killsOnExpiration",
|
|
1090
1100
|
{
|
|
1091
1101
|
get = function(self)
|
|
1092
1102
|
local ____self__140_59 = self[140]
|
|
@@ -1105,6 +1115,27 @@ __TS__SetDescriptor(
|
|
|
1105
1115
|
},
|
|
1106
1116
|
true
|
|
1107
1117
|
)
|
|
1118
|
+
__TS__SetDescriptor(
|
|
1119
|
+
Buff.prototype,
|
|
1120
|
+
"explodesOnExpiration",
|
|
1121
|
+
{
|
|
1122
|
+
get = function(self)
|
|
1123
|
+
local ____self__141_60 = self[141]
|
|
1124
|
+
if ____self__141_60 == nil then
|
|
1125
|
+
____self__141_60 = false
|
|
1126
|
+
end
|
|
1127
|
+
return ____self__141_60
|
|
1128
|
+
end,
|
|
1129
|
+
set = function(self, killsOnExpiration)
|
|
1130
|
+
if not killsOnExpiration and self[141] then
|
|
1131
|
+
self[141] = nil
|
|
1132
|
+
elseif killsOnExpiration and not self[141] then
|
|
1133
|
+
self[141] = true
|
|
1134
|
+
end
|
|
1135
|
+
end
|
|
1136
|
+
},
|
|
1137
|
+
true
|
|
1138
|
+
)
|
|
1108
1139
|
__TS__SetDescriptor(
|
|
1109
1140
|
Buff.prototype,
|
|
1110
1141
|
"maximumDamageDealtEventCount",
|
|
@@ -1221,13 +1252,13 @@ __TS__SetDescriptor(
|
|
|
1221
1252
|
"remainingDuration",
|
|
1222
1253
|
{
|
|
1223
1254
|
get = function(self)
|
|
1224
|
-
local
|
|
1225
|
-
return
|
|
1255
|
+
local ____opt_61 = self._timer
|
|
1256
|
+
return ____opt_61 and ____opt_61.remaining or 0
|
|
1226
1257
|
end,
|
|
1227
1258
|
set = function(self, remainingDuration)
|
|
1228
|
-
local
|
|
1229
|
-
local
|
|
1230
|
-
local remainingDurationDelta =
|
|
1259
|
+
local ____remainingDuration_65 = remainingDuration
|
|
1260
|
+
local ____opt_63 = self._timer
|
|
1261
|
+
local remainingDurationDelta = ____remainingDuration_65 - (____opt_63 and ____opt_63.remaining or 0)
|
|
1231
1262
|
if remainingDurationDelta ~= 0 then
|
|
1232
1263
|
self[103] = self[103] + remainingDurationDelta
|
|
1233
1264
|
if remainingDuration <= 0 then
|
|
@@ -1242,7 +1273,7 @@ __TS__SetDescriptor(
|
|
|
1242
1273
|
remainingDuration,
|
|
1243
1274
|
self._spellStealPriority,
|
|
1244
1275
|
self._learnLevelMinimum,
|
|
1245
|
-
self[
|
|
1276
|
+
self[142]
|
|
1246
1277
|
) then
|
|
1247
1278
|
local timer = self._timer
|
|
1248
1279
|
if timer == nil then
|
|
@@ -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);
|
|
@@ -8,6 +8,6 @@ local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_AB
|
|
|
8
8
|
-- @internal For use by internal systems only.
|
|
9
9
|
____exports.getAbilityDuration = function(ability, target)
|
|
10
10
|
local level = ability.level
|
|
11
|
-
return target ~= nil and target:hasClassification(UnitClassification.RESISTANT) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
11
|
+
return target ~= nil and (target.isHero or target:getField(UNIT_IF_LEVEL) >= 6 or target:hasClassification(UnitClassification.RESISTANT)) and DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level) or DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD:getValue(ability, level)
|
|
12
12
|
end
|
|
13
13
|
return ____exports
|
|
@@ -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
|
}
|