warscript 0.0.1-dev.524fae9 → 0.0.1-dev.5354486
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/decl/native.d.ts +1 -0
- package/engine/ability-type-extended-tooltip.d.ts +8 -0
- package/engine/ability-type-extended-tooltip.lua +44 -0
- package/engine/behaviour/ability/emulate-impact.d.ts +14 -0
- package/engine/behaviour/ability/emulate-impact.lua +74 -1
- package/engine/behaviour/ability/instant-impact.d.ts +12 -1
- package/engine/behaviour/ability/instant-impact.lua +17 -2
- package/engine/behaviour/ability.d.ts +6 -0
- package/engine/behaviour/ability.lua +64 -8
- package/engine/buff.d.ts +53 -44
- package/engine/buff.lua +254 -227
- package/engine/internal/object-data/returned-melee-damage-factor.lua +21 -0
- package/engine/internal/unit/ability.lua +19 -15
- package/engine/internal/unit/bonus.d.ts +3 -0
- package/engine/internal/unit/bonus.lua +11 -0
- package/engine/internal/unit+ability.lua +10 -0
- package/engine/internal/unit.lua +3 -0
- package/engine/object-data/entry/ability-type/barrage.d.ts +12 -0
- package/engine/object-data/entry/ability-type/barrage.lua +52 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -3
- package/engine/object-data/entry/ability-type/blank-configurable.lua +2 -32
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.d.ts +23 -0
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +2 -2
- package/engine/object-data/entry/ability-type/channel.lua +3 -3
- package/engine/object-data/entry/ability-type/exhume-corpses.d.ts +14 -0
- package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
- package/engine/object-data/entry/ability-type.d.ts +8 -2
- package/engine/object-data/entry/ability-type.lua +42 -3
- package/engine/object-data/entry/buff-type/applicable.lua +10 -3
- package/engine/object-data/entry/unit-type.d.ts +10 -0
- package/engine/object-data/entry/unit-type.lua +34 -20
- package/engine/random.lua +1 -1
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/package.json +2 -2
- package/utility/arrays.d.ts +6 -1
- package/utility/arrays.lua +5 -0
- package/engine/internal/unit/pseudo-passive-abilities.lua +0 -11
- /package/engine/internal/{unit/pseudo-passive-abilities.d.ts → object-data/returned-melee-damage-factor.d.ts} +0 -0
package/decl/native.d.ts
CHANGED
|
@@ -2184,6 +2184,7 @@ declare const UNIT_WEAPON_IF_ATTACK_DAMAGE_SIDES_PER_DIE: junitweaponintegerfiel
|
|
|
2184
2184
|
declare const UNIT_WEAPON_IF_ATTACK_MAXIMUM_NUMBER_OF_TARGETS: junitweaponintegerfield
|
|
2185
2185
|
declare const UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE: junitweaponintegerfield
|
|
2186
2186
|
declare const UNIT_WEAPON_IF_ATTACK_WEAPON_SOUND: junitweaponintegerfield
|
|
2187
|
+
declare const UNIT_WEAPON_IF_ATTACK_WEAPON_TYPE: junitweaponintegerfield
|
|
2187
2188
|
declare const UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS: junitweaponintegerfield
|
|
2188
2189
|
declare const UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED: junitweaponintegerfield
|
|
2189
2190
|
declare const UNIT_WEAPON_RF_ATTACK_BACKSWING_POINT: junitweaponrealfield
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityTypeId } from "./object-data/entry/ability-type";
|
|
3
|
+
/**
|
|
4
|
+
* The ability type's own extended tooltip for the level, unaffected by local display
|
|
5
|
+
* overrides (see {@link overrideAbilityTypeExtendedTooltipLocally}). Use it instead of
|
|
6
|
+
* `BlzGetAbilityExtendedTooltip` wherever the type's tooltip serves as a template.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getAbilityTypeExtendedTooltip: (abilityTypeId: AbilityTypeId, level: number) => string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getAbilityExtendedTooltip = BlzGetAbilityExtendedTooltip
|
|
3
|
+
local setAbilityExtendedTooltip = BlzSetAbilityExtendedTooltip
|
|
4
|
+
local originalTooltipByLevelByAbilityTypeId = {}
|
|
5
|
+
local overriddenTooltipByLevelByAbilityTypeId = {}
|
|
6
|
+
--- The ability type's own extended tooltip for the level, unaffected by local display
|
|
7
|
+
-- overrides (see {@link overrideAbilityTypeExtendedTooltipLocally}). Use it instead of
|
|
8
|
+
-- `BlzGetAbilityExtendedTooltip` wherever the type's tooltip serves as a template.
|
|
9
|
+
____exports.getAbilityTypeExtendedTooltip = function(abilityTypeId, level)
|
|
10
|
+
local ____opt_0 = originalTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
11
|
+
return ____opt_0 and ____opt_0[level] or getAbilityExtendedTooltip(abilityTypeId, level)
|
|
12
|
+
end
|
|
13
|
+
--- Replaces the displayed extended tooltip of every ability of the type for the local
|
|
14
|
+
-- player only; `undefined` restores the type's own tooltip. The value is async: never
|
|
15
|
+
-- feed it back into synchronous logic.
|
|
16
|
+
--
|
|
17
|
+
-- @internal For use by internal systems only.
|
|
18
|
+
____exports.overrideAbilityTypeExtendedTooltipLocally = function(abilityTypeId, level, tooltip)
|
|
19
|
+
local overriddenTooltipByLevel = overriddenTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
20
|
+
if (overriddenTooltipByLevel and overriddenTooltipByLevel[level]) == tooltip then
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
local originalTooltipByLevel = originalTooltipByLevelByAbilityTypeId[abilityTypeId]
|
|
24
|
+
if originalTooltipByLevel == nil then
|
|
25
|
+
originalTooltipByLevel = {}
|
|
26
|
+
originalTooltipByLevelByAbilityTypeId[abilityTypeId] = originalTooltipByLevel
|
|
27
|
+
end
|
|
28
|
+
local originalTooltip = originalTooltipByLevel[level]
|
|
29
|
+
if originalTooltip == nil then
|
|
30
|
+
originalTooltip = getAbilityExtendedTooltip(abilityTypeId, level)
|
|
31
|
+
originalTooltipByLevel[level] = originalTooltip
|
|
32
|
+
end
|
|
33
|
+
if overriddenTooltipByLevel == nil then
|
|
34
|
+
overriddenTooltipByLevel = {}
|
|
35
|
+
overriddenTooltipByLevelByAbilityTypeId[abilityTypeId] = overriddenTooltipByLevel
|
|
36
|
+
end
|
|
37
|
+
if tooltip == nil then
|
|
38
|
+
overriddenTooltipByLevel[level] = nil
|
|
39
|
+
else
|
|
40
|
+
overriddenTooltipByLevel[level] = tooltip
|
|
41
|
+
end
|
|
42
|
+
setAbilityExtendedTooltip(abilityTypeId, tooltip or originalTooltip, level)
|
|
43
|
+
end
|
|
44
|
+
return ____exports
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { AbilityBehavior } from "../ability";
|
|
3
3
|
import { Unit } from "../../internal/unit";
|
|
4
|
+
import { Item } from "../../internal/item";
|
|
5
|
+
import { Destructable } from "../../../core/types/destructable";
|
|
4
6
|
export declare abstract class EmulateImpactAbilityBehavior extends AbilityBehavior {
|
|
7
|
+
/**
|
|
8
|
+
* Pays the cost of the cast and invokes only the common impact event: for impacts
|
|
9
|
+
* that have no cast target to report, such as ones triggered by a command.
|
|
10
|
+
*/
|
|
5
11
|
protected emulateImpact(caster: Unit): boolean;
|
|
12
|
+
protected emulateUnitTargetImpact(caster: Unit, target: Unit): boolean;
|
|
13
|
+
protected emulateItemTargetImpact(caster: Unit, target: Item): boolean;
|
|
14
|
+
protected emulateDestructibleTargetImpact(caster: Unit, target: Destructable): boolean;
|
|
15
|
+
protected emulatePointTargetImpact(caster: Unit, x: number, y: number): boolean;
|
|
16
|
+
protected emulateNoTargetImpact(caster: Unit): boolean;
|
|
17
|
+
/** Invokes the common impact event and the one matching the target, as a real impact. */
|
|
18
|
+
private emulateTargetImpact;
|
|
19
|
+
private payEmulatedImpact;
|
|
6
20
|
}
|
|
@@ -17,11 +17,85 @@ local ____ability = require("engine.internal.ability")
|
|
|
17
17
|
local UnitAbility = ____ability.UnitAbility
|
|
18
18
|
local ____event = require("event")
|
|
19
19
|
local Event = ____event.Event
|
|
20
|
+
local ____ability = require("engine.internal.unit.ability")
|
|
21
|
+
local emulateAbilityImpactEvent = ____ability.emulateAbilityImpactEvent
|
|
20
22
|
____exports.EmulateImpactAbilityBehavior = __TS__Class()
|
|
21
23
|
local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
|
|
22
24
|
EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
|
|
23
25
|
__TS__ClassExtends(EmulateImpactAbilityBehavior, AbilityBehavior)
|
|
24
26
|
function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
27
|
+
if not self:payEmulatedImpact(caster) then
|
|
28
|
+
return false
|
|
29
|
+
end
|
|
30
|
+
Event.invoke(Unit.abilityImpactEvent, caster, self.ability)
|
|
31
|
+
return true
|
|
32
|
+
end
|
|
33
|
+
function EmulateImpactAbilityBehavior.prototype.emulateUnitTargetImpact(self, caster, target)
|
|
34
|
+
return self:emulateTargetImpact(
|
|
35
|
+
caster,
|
|
36
|
+
target,
|
|
37
|
+
nil,
|
|
38
|
+
nil,
|
|
39
|
+
target.x,
|
|
40
|
+
target.y
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
function EmulateImpactAbilityBehavior.prototype.emulateItemTargetImpact(self, caster, target)
|
|
44
|
+
return self:emulateTargetImpact(
|
|
45
|
+
caster,
|
|
46
|
+
nil,
|
|
47
|
+
target,
|
|
48
|
+
nil,
|
|
49
|
+
target.x,
|
|
50
|
+
target.y
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
function EmulateImpactAbilityBehavior.prototype.emulateDestructibleTargetImpact(self, caster, target)
|
|
54
|
+
return self:emulateTargetImpact(
|
|
55
|
+
caster,
|
|
56
|
+
nil,
|
|
57
|
+
nil,
|
|
58
|
+
target,
|
|
59
|
+
target.x,
|
|
60
|
+
target.y
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
function EmulateImpactAbilityBehavior.prototype.emulatePointTargetImpact(self, caster, x, y)
|
|
64
|
+
return self:emulateTargetImpact(
|
|
65
|
+
caster,
|
|
66
|
+
nil,
|
|
67
|
+
nil,
|
|
68
|
+
nil,
|
|
69
|
+
x,
|
|
70
|
+
y
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
function EmulateImpactAbilityBehavior.prototype.emulateNoTargetImpact(self, caster)
|
|
74
|
+
return self:emulateTargetImpact(
|
|
75
|
+
caster,
|
|
76
|
+
nil,
|
|
77
|
+
nil,
|
|
78
|
+
nil,
|
|
79
|
+
0,
|
|
80
|
+
0
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
function EmulateImpactAbilityBehavior.prototype.emulateTargetImpact(self, caster, targetUnit, targetItem, targetDestructible, x, y)
|
|
84
|
+
if not self:payEmulatedImpact(caster) then
|
|
85
|
+
return false
|
|
86
|
+
end
|
|
87
|
+
emulateAbilityImpactEvent(
|
|
88
|
+
caster,
|
|
89
|
+
self.ability,
|
|
90
|
+
targetUnit,
|
|
91
|
+
targetItem,
|
|
92
|
+
targetDestructible,
|
|
93
|
+
x,
|
|
94
|
+
y
|
|
95
|
+
)
|
|
96
|
+
return true
|
|
97
|
+
end
|
|
98
|
+
function EmulateImpactAbilityBehavior.prototype.payEmulatedImpact(self, caster)
|
|
25
99
|
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
26
100
|
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
27
101
|
if self.ability.cooldownRemaining ~= 0 or caster.mana < manaCost or __TS__InstanceOf(self.ability, UnitAbility) and self.ability.isDisabled then
|
|
@@ -38,7 +112,6 @@ function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
|
38
112
|
if soundPresetId ~= "" then
|
|
39
113
|
Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
|
|
40
114
|
end
|
|
41
|
-
Event.invoke(Unit.abilityImpactEvent, caster, self.ability)
|
|
42
115
|
return true
|
|
43
116
|
end
|
|
44
117
|
return ____exports
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "../../internal/unit";
|
|
3
|
+
import { Item } from "../../internal/item";
|
|
4
|
+
import { Destructable } from "../../../core/types/destructable";
|
|
3
5
|
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
6
|
+
/**
|
|
7
|
+
* Makes the ability take effect as soon as its cast starts, skipping the cast animation:
|
|
8
|
+
* the impact events fire with the cast's target, so target-specific impact handlers
|
|
9
|
+
* (`onPointTargetImpact`, `onUnitTargetImpact`, ...) work as with a native impact.
|
|
10
|
+
*/
|
|
4
11
|
export declare class InstantImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
5
|
-
|
|
12
|
+
onUnitTargetCastingStart(caster: Unit, target: Unit): void;
|
|
13
|
+
onItemTargetCastingStart(caster: Unit, target: Item): void;
|
|
14
|
+
onDestructibleTargetCastingStart(caster: Unit, target: Destructable): void;
|
|
15
|
+
onPointTargetCastingStart(caster: Unit, x: number, y: number): void;
|
|
16
|
+
onNoTargetCastingStart(caster: Unit): void;
|
|
6
17
|
}
|
|
@@ -4,11 +4,26 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
6
6
|
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
7
|
+
--- Makes the ability take effect as soon as its cast starts, skipping the cast animation:
|
|
8
|
+
-- the impact events fire with the cast's target, so target-specific impact handlers
|
|
9
|
+
-- (`onPointTargetImpact`, `onUnitTargetImpact`, ...) work as with a native impact.
|
|
7
10
|
____exports.InstantImpactAbilityBehavior = __TS__Class()
|
|
8
11
|
local InstantImpactAbilityBehavior = ____exports.InstantImpactAbilityBehavior
|
|
9
12
|
InstantImpactAbilityBehavior.name = "InstantImpactAbilityBehavior"
|
|
10
13
|
__TS__ClassExtends(InstantImpactAbilityBehavior, EmulateImpactAbilityBehavior)
|
|
11
|
-
function InstantImpactAbilityBehavior.prototype.
|
|
12
|
-
self:
|
|
14
|
+
function InstantImpactAbilityBehavior.prototype.onUnitTargetCastingStart(self, caster, target)
|
|
15
|
+
self:emulateUnitTargetImpact(caster, target)
|
|
16
|
+
end
|
|
17
|
+
function InstantImpactAbilityBehavior.prototype.onItemTargetCastingStart(self, caster, target)
|
|
18
|
+
self:emulateItemTargetImpact(caster, target)
|
|
19
|
+
end
|
|
20
|
+
function InstantImpactAbilityBehavior.prototype.onDestructibleTargetCastingStart(self, caster, target)
|
|
21
|
+
self:emulateDestructibleTargetImpact(caster, target)
|
|
22
|
+
end
|
|
23
|
+
function InstantImpactAbilityBehavior.prototype.onPointTargetCastingStart(self, caster, x, y)
|
|
24
|
+
self:emulatePointTargetImpact(caster, x, y)
|
|
25
|
+
end
|
|
26
|
+
function InstantImpactAbilityBehavior.prototype.onNoTargetCastingStart(self, caster)
|
|
27
|
+
self:emulateNoTargetImpact(caster)
|
|
13
28
|
end
|
|
14
29
|
return ____exports
|
|
@@ -49,6 +49,12 @@ export declare abstract class AbilityBehavior<Parameters extends {
|
|
|
49
49
|
onUnitLoseAbility(_unit: Unit): void;
|
|
50
50
|
onCommand(caster: Unit, orderTypeStringId: string): void;
|
|
51
51
|
onCastingStart(caster: Unit): void;
|
|
52
|
+
onWidgetTargetCastingStart(caster: Unit, target: Widget): void;
|
|
53
|
+
onUnitTargetCastingStart(caster: Unit, target: Unit): void;
|
|
54
|
+
onItemTargetCastingStart(caster: Unit, target: Item): void;
|
|
55
|
+
onDestructibleTargetCastingStart(caster: Unit, target: Destructable): void;
|
|
56
|
+
onPointTargetCastingStart(caster: Unit, x: number, y: number): void;
|
|
57
|
+
onNoTargetCastingStart(caster: Unit): void;
|
|
52
58
|
onCastingFinish(caster: Unit): void;
|
|
53
59
|
onChannelingStart(caster: Unit): void;
|
|
54
60
|
onWidgetTargetChannelingStart(caster: Unit, target: Widget): void;
|
|
@@ -18,8 +18,10 @@ local ____effect = require("core.types.effect")
|
|
|
18
18
|
local Effect = ____effect.Effect
|
|
19
19
|
local ____ability = require("engine.standard.fields.ability")
|
|
20
20
|
local AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.AREA_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
21
|
+
local CASTER_EFFECT_COUNT_ABILITY_INTEGER_FIELD = ____ability.CASTER_EFFECT_COUNT_ABILITY_INTEGER_FIELD
|
|
21
22
|
local CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = ____ability.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD
|
|
22
23
|
local CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
24
|
+
local CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = ____ability.CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD
|
|
23
25
|
local DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_HERO_ABILITY_FLOAT_LEVEL_FIELD
|
|
24
26
|
local DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD = ____ability.DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD
|
|
25
27
|
local EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
@@ -28,14 +30,48 @@ local MISSILE_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.MISSILE_MODEL
|
|
|
28
30
|
local MISSILE_SPEED_ABILITY_INTEGER_FIELD = ____ability.MISSILE_SPEED_ABILITY_INTEGER_FIELD
|
|
29
31
|
local SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD = ____ability.SPECIAL_EFFECT_ATTACHMENT_POINT_STRING_FIELD
|
|
30
32
|
local SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.SPECIAL_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
33
|
+
local TARGET_EFFECT_COUNT_ABILITY_INTEGER_FIELD = ____ability.TARGET_EFFECT_COUNT_ABILITY_INTEGER_FIELD
|
|
34
|
+
local TARGET_EFFECT_FIFTH_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_FIFTH_ATTACHMENT_POINT_STRING_FIELD
|
|
31
35
|
local TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD
|
|
36
|
+
local TARGET_EFFECT_FOURTH_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_FOURTH_ATTACHMENT_POINT_STRING_FIELD
|
|
32
37
|
local TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = ____ability.TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
38
|
+
local TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD
|
|
39
|
+
local TARGET_EFFECT_SIXTH_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_SIXTH_ATTACHMENT_POINT_STRING_FIELD
|
|
40
|
+
local TARGET_EFFECT_THIRD_ATTACHMENT_POINT_STRING_FIELD = ____ability.TARGET_EFFECT_THIRD_ATTACHMENT_POINT_STRING_FIELD
|
|
33
41
|
local ____ability = require("engine.object-field.ability")
|
|
34
42
|
local AbilityField = ____ability.AbilityField
|
|
35
43
|
local AbilityLevelField = ____ability.AbilityLevelField
|
|
36
44
|
local resolveCurrentAbilityDependentValue = ____ability.resolveCurrentAbilityDependentValue
|
|
37
45
|
local ____missile = require("core.types.missile")
|
|
38
46
|
local Missile = ____missile.Missile
|
|
47
|
+
local CASTER_EFFECT_ATTACHMENT_POINT_STRING_FIELDS = {CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD, CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD}
|
|
48
|
+
local TARGET_EFFECT_ATTACHMENT_POINT_STRING_FIELDS = {
|
|
49
|
+
TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD,
|
|
50
|
+
TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD,
|
|
51
|
+
TARGET_EFFECT_THIRD_ATTACHMENT_POINT_STRING_FIELD,
|
|
52
|
+
TARGET_EFFECT_FOURTH_ATTACHMENT_POINT_STRING_FIELD,
|
|
53
|
+
TARGET_EFFECT_FIFTH_ATTACHMENT_POINT_STRING_FIELD,
|
|
54
|
+
TARGET_EFFECT_SIXTH_ATTACHMENT_POINT_STRING_FIELD
|
|
55
|
+
}
|
|
56
|
+
--- Flashes every preset of an effect preset list (caster/target effects): each model at
|
|
57
|
+
-- its own attachment point. The effect count field limits the list; at least the first
|
|
58
|
+
-- model is always flashed, as abilities without the count set expect.
|
|
59
|
+
local function flashEffectPresets(ability, modelPathsField, attachmentPointFields, effectCountField, widget, ...)
|
|
60
|
+
local count = math.min(
|
|
61
|
+
math.max(
|
|
62
|
+
effectCountField:getValue(ability),
|
|
63
|
+
1
|
|
64
|
+
),
|
|
65
|
+
#attachmentPointFields
|
|
66
|
+
)
|
|
67
|
+
for i = 0, count - 1 do
|
|
68
|
+
local modelPath = modelPathsField:getValue(ability, i)
|
|
69
|
+
if modelPath ~= "" then
|
|
70
|
+
local attachmentPoint = attachmentPointFields[i + 1]:getValue(ability)
|
|
71
|
+
Effect:flash(modelPath, widget, attachmentPoint ~= "" and attachmentPoint or "origin", ...)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
39
75
|
local createBehaviorFunctionsByAbilityTypeId = {}
|
|
40
76
|
local function invokeOnMissileArrival(_missile, success, abilityBehavior, ...)
|
|
41
77
|
if success then
|
|
@@ -126,20 +162,22 @@ function AbilityBehavior.prototype.getDuration(self, widget)
|
|
|
126
162
|
return self:resolveCurrentAbilityDependentValue(DURATION_NORMAL_ABILITY_FLOAT_LEVEL_FIELD)
|
|
127
163
|
end
|
|
128
164
|
function AbilityBehavior.prototype.flashCasterEffect(self, widget, ...)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
165
|
+
flashEffectPresets(
|
|
166
|
+
self.ability,
|
|
167
|
+
CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD,
|
|
168
|
+
CASTER_EFFECT_ATTACHMENT_POINT_STRING_FIELDS,
|
|
169
|
+
CASTER_EFFECT_COUNT_ABILITY_INTEGER_FIELD,
|
|
132
170
|
widget,
|
|
133
|
-
attachmentPoint ~= "" and attachmentPoint or "origin",
|
|
134
171
|
...
|
|
135
172
|
)
|
|
136
173
|
end
|
|
137
174
|
function AbilityBehavior.prototype.flashTargetEffect(self, widget, ...)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD
|
|
175
|
+
flashEffectPresets(
|
|
176
|
+
self.ability,
|
|
177
|
+
TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD,
|
|
178
|
+
TARGET_EFFECT_ATTACHMENT_POINT_STRING_FIELDS,
|
|
179
|
+
TARGET_EFFECT_COUNT_ABILITY_INTEGER_FIELD,
|
|
141
180
|
widget,
|
|
142
|
-
attachmentPoint ~= "" and attachmentPoint or "origin",
|
|
143
181
|
...
|
|
144
182
|
)
|
|
145
183
|
end
|
|
@@ -215,6 +253,18 @@ function AbilityBehavior.prototype.onCommand(self, caster, orderTypeStringId)
|
|
|
215
253
|
end
|
|
216
254
|
function AbilityBehavior.prototype.onCastingStart(self, caster)
|
|
217
255
|
end
|
|
256
|
+
function AbilityBehavior.prototype.onWidgetTargetCastingStart(self, caster, target)
|
|
257
|
+
end
|
|
258
|
+
function AbilityBehavior.prototype.onUnitTargetCastingStart(self, caster, target)
|
|
259
|
+
end
|
|
260
|
+
function AbilityBehavior.prototype.onItemTargetCastingStart(self, caster, target)
|
|
261
|
+
end
|
|
262
|
+
function AbilityBehavior.prototype.onDestructibleTargetCastingStart(self, caster, target)
|
|
263
|
+
end
|
|
264
|
+
function AbilityBehavior.prototype.onPointTargetCastingStart(self, caster, x, y)
|
|
265
|
+
end
|
|
266
|
+
function AbilityBehavior.prototype.onNoTargetCastingStart(self, caster)
|
|
267
|
+
end
|
|
218
268
|
function AbilityBehavior.prototype.onCastingFinish(self, caster)
|
|
219
269
|
end
|
|
220
270
|
function AbilityBehavior.prototype.onChannelingStart(self, caster)
|
|
@@ -299,6 +349,12 @@ __TS__SetDescriptor(
|
|
|
299
349
|
Unit.abilityGainedEvent:addListener(createUnitEventListener("onUnitGainAbility"))
|
|
300
350
|
Unit.abilityLostEvent:addListener(createUnitEventListener("onUnitLoseAbility"))
|
|
301
351
|
Unit.abilityCastingStartEvent:addListener(createUnitEventListener("onCastingStart"))
|
|
352
|
+
Unit.abilityWidgetTargetCastingStartEvent:addListener(createUnitEventListener("onWidgetTargetCastingStart"))
|
|
353
|
+
Unit.abilityUnitTargetCastingStartEvent:addListener(createUnitEventListener("onUnitTargetCastingStart"))
|
|
354
|
+
Unit.abilityItemTargetCastingStartEvent:addListener(createUnitEventListener("onItemTargetCastingStart"))
|
|
355
|
+
Unit.abilityDestructibleTargetCastingStartEvent:addListener(createUnitEventListener("onDestructibleTargetCastingStart"))
|
|
356
|
+
Unit.abilityPointTargetCastingStartEvent:addListener(createUnitEventListener("onPointTargetCastingStart"))
|
|
357
|
+
Unit.abilityNoTargetCastingStartEvent:addListener(createUnitEventListener("onNoTargetCastingStart"))
|
|
302
358
|
Unit.abilityCastingFinishEvent:addListener(createUnitEventListener("onCastingFinish"))
|
|
303
359
|
Unit.abilityChannelingStartEvent:addListener(createUnitEventListener("onChannelingStart"))
|
|
304
360
|
Unit.abilityWidgetTargetChannelingStartEvent:addListener(createUnitEventListener("onWidgetTargetChannelingStart"))
|
package/engine/buff.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { Widget } from "../core/types/widget";
|
|
|
14
14
|
import { Destructor } from "../destroyable";
|
|
15
15
|
import { Event } from "../event";
|
|
16
16
|
import { AbilityBehavior } from "./behaviour/ability";
|
|
17
|
+
import { SoundPresetId } from "./object-data/entry/sound-preset";
|
|
17
18
|
export type BuffConstructor<T extends Buff<any> = Buff<any>, Args extends any[] = any> = OmitConstructor<typeof Buff<any>> & (new (...args: Args) => T);
|
|
18
19
|
type EnumParameterValueType<T extends number> = T | AbilityEnumLevelField<T>;
|
|
19
20
|
type NumberParameterValueType = number | AbilityNumberField | AbilityNumberLevelField;
|
|
@@ -63,6 +64,8 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
63
64
|
missProbability?: NumberParameterValueType;
|
|
64
65
|
damageFactor?: NumberParameterValueType;
|
|
65
66
|
receivedDamageFactor?: NumberParameterValueType;
|
|
67
|
+
/** The factor of melee attack damage returned to the attacker, as Spiked Carapace. */
|
|
68
|
+
returnedMeleeDamageFactor?: NumberParameterValueType;
|
|
66
69
|
receivedMagicDamageFactor?: NumberParameterValueType;
|
|
67
70
|
durationIncreaseOnAutoAttack?: NumberParameterValueType;
|
|
68
71
|
maximumRemainingDuration?: NumberParameterValueType;
|
|
@@ -87,6 +90,8 @@ export type BuffParameters<T extends Buff<any> = Buff> = Buff extends T ? {
|
|
|
87
90
|
explodesOnExpiration?: BooleanParameterValueType;
|
|
88
91
|
abilityCooldownFactor?: NumberParameterValueType;
|
|
89
92
|
uniqueGroup?: BuffUniqueGroup;
|
|
93
|
+
/** Played on the unit whenever the buff is destroyed, whatever the reason. */
|
|
94
|
+
destructionSoundPresetId?: SoundPresetId;
|
|
90
95
|
} : BuffParameters & (T extends Buff<infer AdditionalParameters> ? AdditionalParameters : object);
|
|
91
96
|
declare const enum BuffPropertyKey {
|
|
92
97
|
STATE = 100,
|
|
@@ -94,50 +99,51 @@ declare const enum BuffPropertyKey {
|
|
|
94
99
|
SOURCE = 102,
|
|
95
100
|
DURATION = 103,
|
|
96
101
|
UNIQUE_GROUP = 104,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
102
|
+
DESTRUCTION_SOUND_PRESET_ID = 105,
|
|
103
|
+
EFFECT_MODEL_PATH = 106,
|
|
104
|
+
SPECIAL_EFFECT_MODEL_PATH = 107,
|
|
105
|
+
DURATION_INCREASE_ON_AUTO_ATTACK = 108,
|
|
106
|
+
MAXIMUM_DURATION = 109,
|
|
107
|
+
MAXIMUM_REMAINING_DURATION = 110,
|
|
108
|
+
DAMAGE_OVER_DURATION = 111,
|
|
109
|
+
DAMAGE_PER_INTERVAL = 112,
|
|
110
|
+
DAMAGE_INTERVAL = 113,
|
|
111
|
+
REMAINING_DAMAGE_OVER_DURATION = 114,
|
|
112
|
+
DAMAGE_INTERVAL_TIMER = 115,
|
|
113
|
+
HEALING_OVER_DURATION = 116,
|
|
114
|
+
HEALING_PER_INTERVAL = 117,
|
|
115
|
+
HEALING_INTERVAL = 118,
|
|
116
|
+
REMAINING_HEALING_OVER_DURATION = 119,
|
|
117
|
+
HEALING_INTERVAL_TIMER = 120,
|
|
118
|
+
DAMAGE_ON_EXPIRATION = 121,
|
|
119
|
+
HEALING_ON_EXPIRATION = 122,
|
|
120
|
+
DAMAGE_UPON_DEATH_ALLOWED_TARGET_CLASSIFICATIONS = 123,
|
|
121
|
+
DAMAGE_UPON_DEATH = 124,
|
|
122
|
+
DAMAGE_UPON_DEATH_RANGE = 125,
|
|
123
|
+
MEDIUM_DAMAGE_UPON_DEATH = 126,
|
|
124
|
+
MEDIUM_DAMAGE_UPON_DEATH_RANGE = 127,
|
|
125
|
+
SMALL_DAMAGE_UPON_DEATH = 128,
|
|
126
|
+
SMALL_DAMAGE_UPON_DEATH_RANGE = 129,
|
|
127
|
+
AUTO_ATTACK_COUNT = 130,
|
|
128
|
+
MAXIMUM_AUTO_ATTACK_COUNT = 131,
|
|
129
|
+
DAMAGE_DEALT_EVENT_COUNT = 132,
|
|
130
|
+
MAXIMUM_DAMAGE_DEALT_EVENT_COUNT = 133,
|
|
131
|
+
DAMAGE_RECEIVED_EVENT_COUNT = 134,
|
|
132
|
+
MAXIMUM_DAMAGE_RECEIVED_EVENT_COUNT = 135,
|
|
133
|
+
ABSORBED_DAMAGE_FACTOR = 136,
|
|
134
|
+
MAXIMUM_DAMAGE_ABSORBED = 137,
|
|
135
|
+
DAMAGE_ABSORBED = 138,
|
|
136
|
+
DESTROYS_ON_MAXIMUM_DAMAGE_ABSORBED = 139,
|
|
137
|
+
TURNS_INTO_GHOST = 140,
|
|
138
|
+
STUNS = 141,
|
|
139
|
+
IGNORES_STUN_IMMUNITY = 142,
|
|
140
|
+
DISABLES_AUTO_ATTACK = 143,
|
|
141
|
+
PROVIDES_INVULNERABILITY = 144,
|
|
142
|
+
KILLS_ON_EXPIRATION = 145,
|
|
143
|
+
EXPLODES_ON_EXPIRATION = 146,
|
|
144
|
+
MISS_PROBABILITY = 147,
|
|
145
|
+
ABILITY_COOLDOWN_FACTOR = 148,
|
|
146
|
+
ABILITY_COOLDOWN_MODIFIER = 149
|
|
141
147
|
}
|
|
142
148
|
export declare const enum BuffTypeIdSelectionPolicy {
|
|
143
149
|
LEAST_DURATION = 0
|
|
@@ -165,6 +171,7 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
165
171
|
private [BuffPropertyKey.SOURCE]?;
|
|
166
172
|
private [BuffPropertyKey.DURATION];
|
|
167
173
|
private [BuffPropertyKey.UNIQUE_GROUP]?;
|
|
174
|
+
private [BuffPropertyKey.DESTRUCTION_SOUND_PRESET_ID]?;
|
|
168
175
|
private [BuffPropertyKey.EFFECT_MODEL_PATH];
|
|
169
176
|
private [BuffPropertyKey.SPECIAL_EFFECT_MODEL_PATH];
|
|
170
177
|
private [BuffPropertyKey.DURATION_INCREASE_ON_AUTO_ATTACK]?;
|
|
@@ -251,6 +258,8 @@ export declare class Buff<AdditionalParameters extends Prohibit<Record<string, a
|
|
|
251
258
|
set damageFactor(damageFactor: number);
|
|
252
259
|
get receivedDamageFactor(): number;
|
|
253
260
|
set receivedDamageFactor(receivedDamageFactor: number);
|
|
261
|
+
get returnedMeleeDamageFactor(): number;
|
|
262
|
+
set returnedMeleeDamageFactor(returnedMeleeDamageFactor: number);
|
|
254
263
|
get armorIncrease(): number;
|
|
255
264
|
set armorIncrease(armorIncrease: number);
|
|
256
265
|
get maxHealthIncrease(): number;
|