warscript 0.0.1-dev.e1acea3 → 0.0.1-dev.e4a5fce
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/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/emulate-impact.lua +1 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +4 -1
- package/engine/behaviour/ability/remove-buffs.lua +8 -2
- package/engine/behaviour/ability.d.ts +4 -1
- package/engine/behaviour/ability.lua +13 -0
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/object-field/ability.d.ts +5 -2
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityBehavior } from "../ability";
|
|
3
|
+
import { Destructor } from "../../../destroyable";
|
|
4
|
+
export declare class AlwaysEnabledAbilityBehavior extends AbilityBehavior {
|
|
5
|
+
protected onCreate(): void;
|
|
6
|
+
protected onDestroy(): Destructor;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____ability = require("engine.behaviour.ability")
|
|
7
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
8
|
+
local ____ability = require("engine.internal.ability")
|
|
9
|
+
local UnitAbility = ____ability.UnitAbility
|
|
10
|
+
local ____ability_2Ddisable_2Dcounter = require("engine.internal.misc.ability-disable-counter")
|
|
11
|
+
local increaseAbilityDisableCounter = ____ability_2Ddisable_2Dcounter.increaseAbilityDisableCounter
|
|
12
|
+
____exports.AlwaysEnabledAbilityBehavior = __TS__Class()
|
|
13
|
+
local AlwaysEnabledAbilityBehavior = ____exports.AlwaysEnabledAbilityBehavior
|
|
14
|
+
AlwaysEnabledAbilityBehavior.name = "AlwaysEnabledAbilityBehavior"
|
|
15
|
+
__TS__ClassExtends(AlwaysEnabledAbilityBehavior, AbilityBehavior)
|
|
16
|
+
function AlwaysEnabledAbilityBehavior.prototype.onCreate(self)
|
|
17
|
+
local ability = self.ability
|
|
18
|
+
if not __TS__InstanceOf(ability, UnitAbility) then
|
|
19
|
+
return
|
|
20
|
+
end
|
|
21
|
+
increaseAbilityDisableCounter(ability.owner.handle, ability.typeId, -10)
|
|
22
|
+
end
|
|
23
|
+
function AlwaysEnabledAbilityBehavior.prototype.onDestroy(self)
|
|
24
|
+
local ability = self.ability
|
|
25
|
+
if not __TS__InstanceOf(ability, UnitAbility) then
|
|
26
|
+
return AbilityBehavior.prototype.onDestroy(self)
|
|
27
|
+
end
|
|
28
|
+
increaseAbilityDisableCounter(ability.owner.handle, ability.typeId, 10)
|
|
29
|
+
return AbilityBehavior.prototype.onDestroy(self)
|
|
30
|
+
end
|
|
31
|
+
return ____exports
|
|
@@ -24,6 +24,7 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
24
24
|
else
|
|
25
25
|
caster:startAbilityCooldown(self.ability.typeId, cooldown)
|
|
26
26
|
end
|
|
27
|
+
self:flashCasterEffect(caster)
|
|
27
28
|
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
28
29
|
end
|
|
29
30
|
return ____exports
|
|
@@ -8,6 +8,9 @@ import { BuffResistanceType } from "../../object-data/auxiliary/buff-resistance-
|
|
|
8
8
|
export declare class RemoveBuffsSelfAbilityBehavior extends AbilityBehavior {
|
|
9
9
|
private readonly polarity?;
|
|
10
10
|
private readonly resistanceType?;
|
|
11
|
-
|
|
11
|
+
private readonly includeExpirationTimers?;
|
|
12
|
+
private readonly includeAuras?;
|
|
13
|
+
private readonly autoDispel?;
|
|
14
|
+
constructor(ability: Ability, polarity?: AbilityDependentValue<BuffPolarity> | undefined, resistanceType?: AbilityDependentValue<BuffResistanceType> | undefined, includeExpirationTimers?: AbilityDependentValue<boolean> | undefined, includeAuras?: AbilityDependentValue<boolean> | undefined, autoDispel?: AbilityDependentValue<boolean> | undefined);
|
|
12
15
|
onImpact(caster: Unit): void;
|
|
13
16
|
}
|
|
@@ -8,15 +8,21 @@ ____exports.RemoveBuffsSelfAbilityBehavior = __TS__Class()
|
|
|
8
8
|
local RemoveBuffsSelfAbilityBehavior = ____exports.RemoveBuffsSelfAbilityBehavior
|
|
9
9
|
RemoveBuffsSelfAbilityBehavior.name = "RemoveBuffsSelfAbilityBehavior"
|
|
10
10
|
__TS__ClassExtends(RemoveBuffsSelfAbilityBehavior, AbilityBehavior)
|
|
11
|
-
function RemoveBuffsSelfAbilityBehavior.prototype.____constructor(self, ability, polarity, resistanceType)
|
|
11
|
+
function RemoveBuffsSelfAbilityBehavior.prototype.____constructor(self, ability, polarity, resistanceType, includeExpirationTimers, includeAuras, autoDispel)
|
|
12
12
|
AbilityBehavior.prototype.____constructor(self, ability)
|
|
13
13
|
self.polarity = polarity
|
|
14
14
|
self.resistanceType = resistanceType
|
|
15
|
+
self.includeExpirationTimers = includeExpirationTimers
|
|
16
|
+
self.includeAuras = includeAuras
|
|
17
|
+
self.autoDispel = autoDispel
|
|
15
18
|
end
|
|
16
19
|
function RemoveBuffsSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
17
20
|
caster:removeBuffs(
|
|
18
21
|
self:resolveCurrentAbilityDependentValue(self.polarity),
|
|
19
|
-
self:resolveCurrentAbilityDependentValue(self.resistanceType)
|
|
22
|
+
self:resolveCurrentAbilityDependentValue(self.resistanceType),
|
|
23
|
+
self:resolveCurrentAbilityDependentValue(self.includeExpirationTimers),
|
|
24
|
+
self:resolveCurrentAbilityDependentValue(self.includeAuras),
|
|
25
|
+
self:resolveCurrentAbilityDependentValue(self.autoDispel)
|
|
20
26
|
)
|
|
21
27
|
end
|
|
22
28
|
return ____exports
|
|
@@ -19,12 +19,15 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
19
19
|
constructor(ability: Ability, parameters?: AbilityBehaviorParameters);
|
|
20
20
|
protected registerCommandEvent(orderTypeStringId?: string): void;
|
|
21
21
|
get ability(): Ability;
|
|
22
|
-
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string
|
|
22
|
+
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value: AbilityDependentValue<T>): T;
|
|
23
|
+
protected resolveCurrentAbilityDependentValue<T extends boolean | number | string>(value?: AbilityDependentValue<T>): T | undefined;
|
|
24
|
+
protected flashCasterEffect(widget: Widget): void;
|
|
23
25
|
protected flashAreaEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
24
26
|
protected flashEffect(x: number, y: number, ...parametersOrDuration: [parameters?: EffectParameters] | [duration?: number, parameters?: EffectParameters]): void;
|
|
25
27
|
protected flashSpecialEffect(...args: [...pointOrWidget: [x: number, y: number] | [widget: Widget], duration?: number]): void;
|
|
26
28
|
private static MissileLaunchConfig;
|
|
27
29
|
private get missileLaunchConfig();
|
|
30
|
+
protected onCreate(): void;
|
|
28
31
|
onMissileArrival(...parameters: NonNullable<Parameters["missileParameters"]>): void;
|
|
29
32
|
onUnitGainAbility(_unit: Unit): void;
|
|
30
33
|
onUnitLoseAbility(_unit: Unit): void;
|
|
@@ -15,6 +15,8 @@ local ____effect = require("core.types.effect")
|
|
|
15
15
|
local Effect = ____effect.Effect
|
|
16
16
|
local ____ability = require("engine.standard.fields.ability")
|
|
17
17
|
local AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
18
|
+
local CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = ____ability.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD
|
|
19
|
+
local CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
18
20
|
local EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
19
21
|
local MISSILE_ARC_ABILITY_FLOAT_FIELD = ____ability.MISSILE_ARC_ABILITY_FLOAT_FIELD
|
|
20
22
|
local MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
@@ -77,6 +79,7 @@ function AbilityBehavior.prototype.____constructor(self, ability, parameters)
|
|
|
77
79
|
if parameters and parameters.isExclusiveOnImpactHandler then
|
|
78
80
|
exclusiveOnImpactHandlerAbilityBehaviorByAbility[ability] = self
|
|
79
81
|
end
|
|
82
|
+
self:onCreate()
|
|
80
83
|
end
|
|
81
84
|
function AbilityBehavior.prototype.registerCommandEvent(self, orderTypeStringId)
|
|
82
85
|
if orderTypeStringId == nil then
|
|
@@ -91,6 +94,14 @@ end
|
|
|
91
94
|
function AbilityBehavior.prototype.resolveCurrentAbilityDependentValue(self, value)
|
|
92
95
|
return resolveCurrentAbilityDependentValue(self.ability, value)
|
|
93
96
|
end
|
|
97
|
+
function AbilityBehavior.prototype.flashCasterEffect(self, widget)
|
|
98
|
+
local attachmentPoint = CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD:getValue(self.ability)
|
|
99
|
+
Effect:flash(
|
|
100
|
+
CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.ability, 0),
|
|
101
|
+
widget,
|
|
102
|
+
attachmentPoint ~= "" and attachmentPoint or "origin"
|
|
103
|
+
)
|
|
104
|
+
end
|
|
94
105
|
function AbilityBehavior.prototype.flashAreaEffect(self, x, y, ...)
|
|
95
106
|
Effect:flash(
|
|
96
107
|
AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD:getValue(self.ability, 0),
|
|
@@ -124,6 +135,8 @@ function AbilityBehavior.prototype.flashSpecialEffect(self, xOrWidget, yOrDurati
|
|
|
124
135
|
)
|
|
125
136
|
end
|
|
126
137
|
end
|
|
138
|
+
function AbilityBehavior.prototype.onCreate(self)
|
|
139
|
+
end
|
|
127
140
|
function AbilityBehavior.prototype.onMissileArrival(self, ...)
|
|
128
141
|
end
|
|
129
142
|
function AbilityBehavior.prototype.onUnitGainAbility(self, _unit)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local disableAbility = BlzUnitDisableAbility
|
|
3
|
+
---
|
|
4
|
+
-- @internal For use by internal systems only.
|
|
5
|
+
____exports.increaseAbilityDisableCounter = function(unit, abilityTypeId, times)
|
|
6
|
+
for _ = 1, times do
|
|
7
|
+
disableAbility(unit, abilityTypeId, true, false)
|
|
8
|
+
end
|
|
9
|
+
for _ = times, -1 do
|
|
10
|
+
disableAbility(unit, abilityTypeId, false, false)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
return ____exports
|
|
@@ -130,5 +130,8 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
|
|
|
130
130
|
protected getNativeFieldValue(instance: Ability, level: number): CombatClassifications;
|
|
131
131
|
protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
|
|
132
132
|
}
|
|
133
|
-
export type AbilityDependentValue<ValueType extends boolean | number | string
|
|
134
|
-
export declare const resolveCurrentAbilityDependentValue:
|
|
133
|
+
export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
|
|
134
|
+
export declare const resolveCurrentAbilityDependentValue: {
|
|
135
|
+
<ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>): ValueType;
|
|
136
|
+
<ValueType extends boolean | number | string>(ability: Ability, value?: AbilityDependentValue<ValueType>): ValueType | undefined;
|
|
137
|
+
};
|
|
@@ -687,6 +687,8 @@ export declare const DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD: Abilit
|
|
|
687
687
|
export declare const ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD: AbilityBooleanLevelField & symbol;
|
|
688
688
|
export declare const ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD: AbilityStringLevelField & symbol;
|
|
689
689
|
export declare const CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
690
|
+
export declare const CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
691
|
+
export declare const CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
690
692
|
export declare const TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
|
|
691
693
|
export declare const TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
692
694
|
export declare const TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
|
|
@@ -698,6 +698,8 @@ ____exports.DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBoolean
|
|
|
698
698
|
____exports.ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBooleanLevelField:create(fourCC("Ntm4"))
|
|
699
699
|
____exports.ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD = AbilityStringLevelField:create(fourCC("aart"))
|
|
700
700
|
____exports.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("acat"))
|
|
701
|
+
____exports.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("acap"))
|
|
702
|
+
____exports.CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("aca1"))
|
|
701
703
|
____exports.TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("atat"))
|
|
702
704
|
____exports.TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata0"))
|
|
703
705
|
____exports.TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata1"))
|
package/package.json
CHANGED