warscript 0.0.1-dev.fae1c72 → 0.0.1-dev.fcc9d08
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/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +13 -3
- package/core/types/effect.lua +116 -17
- package/core/types/frame.d.ts +8 -0
- package/core/types/frame.lua +93 -1
- package/core/types/sound.d.ts +1 -0
- package/core/types/sound.lua +32 -2
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -0
- package/engine/behavior.d.ts +6 -6
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +28 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +15 -3
- package/engine/behaviour/ability.lua +93 -34
- package/engine/behaviour/unit.d.ts +5 -0
- package/engine/behaviour/unit.lua +20 -0
- package/engine/buff.d.ts +95 -38
- package/engine/buff.lua +424 -200
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +16 -13
- package/engine/internal/ability.lua +80 -76
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/item.d.ts +2 -2
- package/engine/internal/item.lua +56 -25
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/bonus.d.ts +6 -2
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +27 -11
- package/engine/internal/unit.lua +175 -86
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/entry/ability-type/blank-configurable.lua +21 -1
- package/engine/object-data/entry/ability-type/curse.lua +2 -2
- package/engine/object-data/entry/ability-type.lua +8 -12
- package/engine/object-data/entry/buff-type/applicable.lua +10 -34
- package/engine/object-data/entry/item-type.d.ts +14 -0
- package/engine/object-data/entry/item-type.lua +91 -0
- package/engine/object-data/entry/unit-type.d.ts +7 -0
- package/engine/object-data/entry/unit-type.lua +53 -0
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +26 -3
- package/engine/object-field/ability.lua +54 -1
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +4 -0
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +3 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +7 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +1 -1
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +34 -3
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +11 -2
- package/utility/linked-set.lua +5 -2
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
|
@@ -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
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { AbilityBehavior } from "../ability";
|
|
3
3
|
import { Ability } from "../../internal/ability";
|
|
4
|
-
import { Buff, BuffConstructor, BuffParameters, BuffTypeIdSelectionPolicy } from "../../buff";
|
|
4
|
+
import { Buff, BuffConstructor, BuffParameters, BuffPolarityParameterType, BuffResistanceTypeParameterType, BuffTypeIdSelectionPolicy } from "../../buff";
|
|
5
5
|
import { Unit } from "../../internal/unit";
|
|
6
6
|
import { ApplicableBuffTypeId } from "../../object-data/entry/buff-type/applicable";
|
|
7
|
-
import { BuffResistanceType } from "../../object-data/auxiliary/buff-resistance-type";
|
|
8
|
-
import { BuffPolarity } from "../../object-data/auxiliary/buff-polarity";
|
|
9
7
|
import { Widget } from "../../../core/types/widget";
|
|
10
8
|
type BuffParametersType<T extends BuffConstructor> = BuffParameters & Omit<BuffAdditionalParametersType<T>, keyof BuffParameters>;
|
|
11
9
|
type BuffAdditionalParametersType<T extends BuffConstructor> = T extends BuffConstructor<Buff<infer AdditionalParameters>> ? AdditionalParameters : never;
|
|
@@ -17,8 +15,8 @@ export declare abstract class ApplyBuffAbilityBehavior<T extends BuffConstructor
|
|
|
17
15
|
typeIds: [ApplicableBuffTypeId, ...ApplicableBuffTypeId[]],
|
|
18
16
|
typeIdSelectionPolicy: BuffTypeIdSelectionPolicy
|
|
19
17
|
],
|
|
20
|
-
polarity:
|
|
21
|
-
resistanceType:
|
|
18
|
+
polarity: BuffPolarityParameterType,
|
|
19
|
+
resistanceType: BuffResistanceTypeParameterType,
|
|
22
20
|
parameters?: BuffParametersType<T>
|
|
23
21
|
]);
|
|
24
22
|
}
|
|
@@ -35,4 +33,9 @@ export declare class ApplyBuffTargetAreaAbilityBehavior<T extends BuffConstructo
|
|
|
35
33
|
onPointTargetImpact(caster: Unit, x: number, y: number): void;
|
|
36
34
|
onWidgetTargetImpact(caster: Unit, target: Widget): void;
|
|
37
35
|
}
|
|
36
|
+
export declare class ApplyBuffChannelingTargetAbilityBehavior<T extends BuffConstructor = typeof Buff> extends ApplyBuffAbilityBehavior<T> {
|
|
37
|
+
private buff?;
|
|
38
|
+
onUnitTargetChannelingStart(caster: Unit, target: Unit): void;
|
|
39
|
+
onStop(): void;
|
|
40
|
+
}
|
|
38
41
|
export {};
|
|
@@ -123,4 +123,36 @@ function ApplyBuffTargetAreaAbilityBehavior.prototype.onWidgetTargetImpact(self,
|
|
|
123
123
|
self.applyBuff(unit)
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
|
+
local behaviorByBuff = {}
|
|
127
|
+
____exports.ApplyBuffChannelingTargetAbilityBehavior = __TS__Class()
|
|
128
|
+
local ApplyBuffChannelingTargetAbilityBehavior = ____exports.ApplyBuffChannelingTargetAbilityBehavior
|
|
129
|
+
ApplyBuffChannelingTargetAbilityBehavior.name = "ApplyBuffChannelingTargetAbilityBehavior"
|
|
130
|
+
__TS__ClassExtends(ApplyBuffChannelingTargetAbilityBehavior, ____exports.ApplyBuffAbilityBehavior)
|
|
131
|
+
function ApplyBuffChannelingTargetAbilityBehavior.prototype.onUnitTargetChannelingStart(self, caster, target)
|
|
132
|
+
local previousBuff = self.buff
|
|
133
|
+
if previousBuff ~= nil then
|
|
134
|
+
behaviorByBuff[previousBuff] = nil
|
|
135
|
+
previousBuff:destroy()
|
|
136
|
+
end
|
|
137
|
+
local buff = self.applyBuff(target)
|
|
138
|
+
if buff ~= nil then
|
|
139
|
+
behaviorByBuff[buff] = self
|
|
140
|
+
end
|
|
141
|
+
self.buff = buff
|
|
142
|
+
end
|
|
143
|
+
function ApplyBuffChannelingTargetAbilityBehavior.prototype.onStop(self)
|
|
144
|
+
local buff = self.buff
|
|
145
|
+
if buff ~= nil then
|
|
146
|
+
behaviorByBuff[buff] = nil
|
|
147
|
+
buff:destroy()
|
|
148
|
+
self.buff = nil
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
Buff.destroyEvent:addListener(function(buff)
|
|
152
|
+
local behavior = behaviorByBuff[buff]
|
|
153
|
+
if behavior ~= nil then
|
|
154
|
+
behaviorByBuff[buff] = nil
|
|
155
|
+
behavior.ability:interruptCast()
|
|
156
|
+
end
|
|
157
|
+
end)
|
|
126
158
|
return ____exports
|
|
@@ -4,22 +4,44 @@ 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { AttackType, DamageType, WeaponType } from "../../internal/unit+damage";
|
|
8
|
+
export type DamageAbilityBehaviorParameters = {
|
|
9
|
+
damagePerStrength?: AbilityDependentValue<number>;
|
|
10
|
+
damagePerAgility?: AbilityDependentValue<number>;
|
|
11
|
+
damagePerIntelligence?: AbilityDependentValue<number>;
|
|
12
|
+
attackType?: AttackType;
|
|
13
|
+
damageType?: DamageType;
|
|
14
|
+
weaponType?: WeaponType;
|
|
15
|
+
};
|
|
16
|
+
export type DamageAreaAbilityBehaviorParameters = DamageAbilityBehaviorParameters & {
|
|
17
|
+
maximumDamage?: AbilityDependentValue<number>;
|
|
18
|
+
};
|
|
19
|
+
declare abstract class DamageAbilityBehavior<T extends DamageAbilityBehaviorParameters = DamageAbilityBehaviorParameters> extends AbilityBehavior {
|
|
20
|
+
protected readonly damage: AbilityDependentValue<number>;
|
|
21
|
+
protected readonly parameters?: T | undefined;
|
|
22
|
+
protected constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: T | undefined);
|
|
23
|
+
protected calculateDamage(caster: Unit): number;
|
|
24
|
+
}
|
|
25
|
+
export declare class DamageSelfAbilityBehavior extends DamageAbilityBehavior {
|
|
26
|
+
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAbilityBehaviorParameters);
|
|
10
27
|
onImpact(caster: Unit): void;
|
|
11
28
|
}
|
|
12
|
-
export declare class DamageTargetAbilityBehavior extends
|
|
13
|
-
|
|
14
|
-
constructor(ability: Ability, damage: AbilityDependentValue<number>);
|
|
29
|
+
export declare class DamageTargetAbilityBehavior extends DamageAbilityBehavior {
|
|
30
|
+
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAbilityBehaviorParameters);
|
|
15
31
|
onWidgetTargetImpact(caster: Unit, target: Widget): void;
|
|
16
32
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
declare abstract class DamageAreaAbilityBehavior extends DamageAbilityBehavior<DamageAreaAbilityBehaviorParameters> {
|
|
34
|
+
protected constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAreaAbilityBehaviorParameters);
|
|
35
|
+
protected damageArea(caster: Unit, x: number, y: number): void;
|
|
36
|
+
}
|
|
37
|
+
export declare class DamageSelfAreaAbilityBehavior extends DamageAreaAbilityBehavior {
|
|
38
|
+
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAreaAbilityBehaviorParameters);
|
|
39
|
+
onImpact(caster: Unit): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class DamageTargetAreaAbilityBehavior extends DamageAreaAbilityBehavior {
|
|
42
|
+
constructor(ability: Ability, damage: AbilityDependentValue<number>, parameters?: DamageAreaAbilityBehaviorParameters);
|
|
21
43
|
onNoTargetImpact(caster: Unit): void;
|
|
22
44
|
onWidgetTargetImpact(caster: Unit, target: Widget): void;
|
|
23
45
|
onPointTargetImpact(caster: Unit, x: number, y: number): void;
|
|
24
|
-
private damageArea;
|
|
25
46
|
}
|
|
47
|
+
export {};
|
|
@@ -9,53 +9,77 @@ 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
|
+
local DamageAbilityBehavior = __TS__Class()
|
|
13
|
+
DamageAbilityBehavior.name = "DamageAbilityBehavior"
|
|
14
|
+
__TS__ClassExtends(DamageAbilityBehavior, AbilityBehavior)
|
|
15
|
+
function DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
16
|
+
AbilityBehavior.prototype.____constructor(self, ability)
|
|
17
|
+
self.damage = damage
|
|
18
|
+
self.parameters = parameters
|
|
19
|
+
end
|
|
20
|
+
function DamageAbilityBehavior.prototype.calculateDamage(self, caster)
|
|
21
|
+
local parameters = self.parameters
|
|
22
|
+
local damage = self:resolveCurrentAbilityDependentValue(self.damage)
|
|
23
|
+
local damagePerStrength = self:resolveCurrentAbilityDependentValue(parameters and parameters.damagePerStrength or 0)
|
|
24
|
+
if damagePerStrength ~= 0 then
|
|
25
|
+
damage = damage + damagePerStrength * caster.strength
|
|
26
|
+
end
|
|
27
|
+
local damagePerAgility = self:resolveCurrentAbilityDependentValue(parameters and parameters.damagePerAgility or 0)
|
|
28
|
+
if damagePerAgility ~= 0 then
|
|
29
|
+
damage = damage + damagePerAgility * caster.agility
|
|
30
|
+
end
|
|
31
|
+
local damagePerIntelligence = self:resolveCurrentAbilityDependentValue(parameters and parameters.damagePerIntelligence or 0)
|
|
32
|
+
if damagePerIntelligence ~= 0 then
|
|
33
|
+
damage = damage + damagePerIntelligence * caster.intelligence
|
|
34
|
+
end
|
|
35
|
+
return damage
|
|
36
|
+
end
|
|
12
37
|
____exports.DamageSelfAbilityBehavior = __TS__Class()
|
|
13
38
|
local DamageSelfAbilityBehavior = ____exports.DamageSelfAbilityBehavior
|
|
14
39
|
DamageSelfAbilityBehavior.name = "DamageSelfAbilityBehavior"
|
|
15
|
-
__TS__ClassExtends(DamageSelfAbilityBehavior,
|
|
16
|
-
function DamageSelfAbilityBehavior.prototype.____constructor(self, ability, damage)
|
|
17
|
-
|
|
18
|
-
self.damage = damage
|
|
40
|
+
__TS__ClassExtends(DamageSelfAbilityBehavior, DamageAbilityBehavior)
|
|
41
|
+
function DamageSelfAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
42
|
+
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
19
43
|
end
|
|
20
44
|
function DamageSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
45
|
+
local parameters = self.parameters
|
|
21
46
|
caster:damageTarget(
|
|
22
47
|
caster,
|
|
23
|
-
self:
|
|
48
|
+
self:calculateDamage(caster),
|
|
49
|
+
nil,
|
|
50
|
+
nil,
|
|
51
|
+
parameters and parameters.attackType,
|
|
52
|
+
parameters and parameters.damageType,
|
|
53
|
+
parameters and parameters.weaponType
|
|
24
54
|
)
|
|
25
55
|
end
|
|
26
56
|
____exports.DamageTargetAbilityBehavior = __TS__Class()
|
|
27
57
|
local DamageTargetAbilityBehavior = ____exports.DamageTargetAbilityBehavior
|
|
28
58
|
DamageTargetAbilityBehavior.name = "DamageTargetAbilityBehavior"
|
|
29
|
-
__TS__ClassExtends(DamageTargetAbilityBehavior,
|
|
30
|
-
function DamageTargetAbilityBehavior.prototype.____constructor(self, ability, damage)
|
|
31
|
-
|
|
32
|
-
self.damage = damage
|
|
59
|
+
__TS__ClassExtends(DamageTargetAbilityBehavior, DamageAbilityBehavior)
|
|
60
|
+
function DamageTargetAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
61
|
+
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
33
62
|
end
|
|
34
63
|
function DamageTargetAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
64
|
+
local parameters = self.parameters
|
|
35
65
|
caster:damageTarget(
|
|
36
66
|
target,
|
|
37
|
-
self:
|
|
67
|
+
self:calculateDamage(caster),
|
|
68
|
+
nil,
|
|
69
|
+
nil,
|
|
70
|
+
parameters and parameters.attackType,
|
|
71
|
+
parameters and parameters.damageType,
|
|
72
|
+
parameters and parameters.weaponType
|
|
38
73
|
)
|
|
39
74
|
end
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
AbilityBehavior.prototype.____constructor(self, ability)
|
|
46
|
-
self.damage = damage
|
|
47
|
-
self.maximumDamage = maximumDamage
|
|
75
|
+
local DamageAreaAbilityBehavior = __TS__Class()
|
|
76
|
+
DamageAreaAbilityBehavior.name = "DamageAreaAbilityBehavior"
|
|
77
|
+
__TS__ClassExtends(DamageAreaAbilityBehavior, DamageAbilityBehavior)
|
|
78
|
+
function DamageAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
79
|
+
DamageAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
48
80
|
end
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
end
|
|
52
|
-
function DamageTargetAreaAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
53
|
-
self:damageArea(caster, target.x, target.y)
|
|
54
|
-
end
|
|
55
|
-
function DamageTargetAreaAbilityBehavior.prototype.onPointTargetImpact(self, caster, x, y)
|
|
56
|
-
self:damageArea(caster, x, y)
|
|
57
|
-
end
|
|
58
|
-
function DamageTargetAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
81
|
+
function DamageAreaAbilityBehavior.prototype.damageArea(self, caster, x, y)
|
|
82
|
+
local parameters = self.parameters
|
|
59
83
|
local targets = Unit.getAllowedTargetsInCollisionRange(
|
|
60
84
|
caster,
|
|
61
85
|
self:resolveCurrentAbilityDependentValue(ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
@@ -63,13 +87,47 @@ function DamageTargetAreaAbilityBehavior.prototype.damageArea(self, caster, x, y
|
|
|
63
87
|
y,
|
|
64
88
|
self:resolveCurrentAbilityDependentValue(AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
65
89
|
)
|
|
66
|
-
local damage = self:
|
|
67
|
-
local maximumDamage = self:resolveCurrentAbilityDependentValue(
|
|
90
|
+
local damage = self:calculateDamage(caster)
|
|
91
|
+
local maximumDamage = self:resolveCurrentAbilityDependentValue(parameters and parameters.maximumDamage or 0)
|
|
68
92
|
if maximumDamage ~= 0 and damage > maximumDamage then
|
|
69
93
|
damage = maximumDamage / #targets
|
|
70
94
|
end
|
|
71
95
|
for ____, target in ipairs(targets) do
|
|
72
|
-
caster:damageTarget(
|
|
96
|
+
caster:damageTarget(
|
|
97
|
+
target,
|
|
98
|
+
damage,
|
|
99
|
+
nil,
|
|
100
|
+
nil,
|
|
101
|
+
parameters and parameters.attackType,
|
|
102
|
+
parameters and parameters.damageType,
|
|
103
|
+
parameters and parameters.weaponType
|
|
104
|
+
)
|
|
73
105
|
end
|
|
74
106
|
end
|
|
107
|
+
____exports.DamageSelfAreaAbilityBehavior = __TS__Class()
|
|
108
|
+
local DamageSelfAreaAbilityBehavior = ____exports.DamageSelfAreaAbilityBehavior
|
|
109
|
+
DamageSelfAreaAbilityBehavior.name = "DamageSelfAreaAbilityBehavior"
|
|
110
|
+
__TS__ClassExtends(DamageSelfAreaAbilityBehavior, DamageAreaAbilityBehavior)
|
|
111
|
+
function DamageSelfAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
112
|
+
DamageAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
113
|
+
end
|
|
114
|
+
function DamageSelfAreaAbilityBehavior.prototype.onImpact(self, caster)
|
|
115
|
+
self:damageArea(caster, caster.x, caster.y)
|
|
116
|
+
end
|
|
117
|
+
____exports.DamageTargetAreaAbilityBehavior = __TS__Class()
|
|
118
|
+
local DamageTargetAreaAbilityBehavior = ____exports.DamageTargetAreaAbilityBehavior
|
|
119
|
+
DamageTargetAreaAbilityBehavior.name = "DamageTargetAreaAbilityBehavior"
|
|
120
|
+
__TS__ClassExtends(DamageTargetAreaAbilityBehavior, DamageAreaAbilityBehavior)
|
|
121
|
+
function DamageTargetAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
122
|
+
DamageAreaAbilityBehavior.prototype.____constructor(self, ability, damage, parameters)
|
|
123
|
+
end
|
|
124
|
+
function DamageTargetAreaAbilityBehavior.prototype.onNoTargetImpact(self, caster)
|
|
125
|
+
self:damageArea(caster, caster.x, caster.y)
|
|
126
|
+
end
|
|
127
|
+
function DamageTargetAreaAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
128
|
+
self:damageArea(caster, target.x, target.y)
|
|
129
|
+
end
|
|
130
|
+
function DamageTargetAreaAbilityBehavior.prototype.onPointTargetImpact(self, caster, x, y)
|
|
131
|
+
self:damageArea(caster, x, y)
|
|
132
|
+
end
|
|
75
133
|
return ____exports
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____ability = require("engine.behaviour.ability")
|
|
6
|
+
local AbilityBehavior = ____ability.AbilityBehavior
|
|
7
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
8
|
+
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
9
|
+
local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTEGER_LEVEL_FIELD
|
|
10
|
+
local ____math = require("math")
|
|
11
|
+
local max = ____math.max
|
|
12
|
+
local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
13
|
+
____exports.EmulateImpactAbilityBehavior = __TS__Class()
|
|
14
|
+
local EmulateImpactAbilityBehavior = ____exports.EmulateImpactAbilityBehavior
|
|
15
|
+
EmulateImpactAbilityBehavior.name = "EmulateImpactAbilityBehavior"
|
|
16
|
+
__TS__ClassExtends(EmulateImpactAbilityBehavior, AbilityBehavior)
|
|
17
|
+
function EmulateImpactAbilityBehavior.prototype.emulateImpact(self, caster)
|
|
18
|
+
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
19
|
+
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
20
|
+
if self.ability.cooldownRemaining ~= 0 or caster.mana < manaCost then
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
caster.mana = caster.mana - manaCost
|
|
24
|
+
self.ability.cooldownRemaining = max(cooldown, MINIMUM_POSITIVE_NORMALIZED_FLOAT)
|
|
25
|
+
self:flashCasterEffect(caster)
|
|
26
|
+
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -4,13 +4,40 @@ import { Ability } from "../../internal/ability";
|
|
|
4
4
|
import { Unit } from "../../internal/unit";
|
|
5
5
|
import { AbilityDependentValue } from "../../object-field/ability";
|
|
6
6
|
import { AbilityBehavior } from "../ability";
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export type HealAbilityBehaviorParameters = {
|
|
8
|
+
healingPerStrength?: AbilityDependentValue<number>;
|
|
9
|
+
healingPerAgility?: AbilityDependentValue<number>;
|
|
10
|
+
healingPerIntelligence?: AbilityDependentValue<number>;
|
|
11
|
+
};
|
|
12
|
+
export type HealAreaAbilityBehaviorParameters = HealAbilityBehaviorParameters & {
|
|
13
|
+
maximumHealing?: AbilityDependentValue<number>;
|
|
14
|
+
};
|
|
15
|
+
declare abstract class HealAbilityBehavior<T extends HealAbilityBehaviorParameters = HealAbilityBehaviorParameters> extends AbilityBehavior {
|
|
16
|
+
protected readonly healing: AbilityDependentValue<number>;
|
|
17
|
+
protected readonly parameters?: T | undefined;
|
|
18
|
+
protected constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: T | undefined);
|
|
19
|
+
protected calculateHealing(caster: Unit): number;
|
|
20
|
+
}
|
|
21
|
+
export declare class HealSelfAbilityBehavior extends HealAbilityBehavior {
|
|
22
|
+
constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: HealAbilityBehaviorParameters);
|
|
23
|
+
onImpact(caster: Unit): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class HealTargetAbilityBehavior extends HealAbilityBehavior {
|
|
26
|
+
constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: HealAbilityBehaviorParameters);
|
|
27
|
+
onWidgetTargetImpact(caster: Unit, target: Widget): void;
|
|
28
|
+
}
|
|
29
|
+
declare abstract class HealAreaAbilityBehavior extends HealAbilityBehavior<HealAreaAbilityBehaviorParameters> {
|
|
30
|
+
protected constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: HealAreaAbilityBehaviorParameters);
|
|
31
|
+
protected healArea(caster: Unit, x: number, y: number): void;
|
|
32
|
+
}
|
|
33
|
+
export declare class HealSelfAreaAbilityBehavior extends HealAreaAbilityBehavior {
|
|
34
|
+
constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: HealAreaAbilityBehaviorParameters);
|
|
10
35
|
onImpact(caster: Unit): void;
|
|
11
36
|
}
|
|
12
|
-
export declare class
|
|
13
|
-
|
|
14
|
-
|
|
37
|
+
export declare class HealTargetAreaAbilityBehavior extends HealAreaAbilityBehavior {
|
|
38
|
+
constructor(ability: Ability, healing: AbilityDependentValue<number>, parameters?: HealAreaAbilityBehaviorParameters);
|
|
39
|
+
onNoTargetImpact(caster: Unit): void;
|
|
15
40
|
onWidgetTargetImpact(caster: Unit, target: Widget): void;
|
|
41
|
+
onPointTargetImpact(caster: Unit, x: number, y: number): void;
|
|
16
42
|
}
|
|
43
|
+
export {};
|
|
@@ -2,34 +2,113 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
4
|
local ____exports = {}
|
|
5
|
+
local ____unit = require("engine.internal.unit")
|
|
6
|
+
local Unit = ____unit.Unit
|
|
5
7
|
local ____ability = require("engine.behaviour.ability")
|
|
6
8
|
local AbilityBehavior = ____ability.AbilityBehavior
|
|
9
|
+
local ____ability = require("engine.standard.fields.ability")
|
|
10
|
+
local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD
|
|
11
|
+
local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
|
|
12
|
+
local HealAbilityBehavior = __TS__Class()
|
|
13
|
+
HealAbilityBehavior.name = "HealAbilityBehavior"
|
|
14
|
+
__TS__ClassExtends(HealAbilityBehavior, AbilityBehavior)
|
|
15
|
+
function HealAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
16
|
+
AbilityBehavior.prototype.____constructor(self, ability)
|
|
17
|
+
self.healing = healing
|
|
18
|
+
self.parameters = parameters
|
|
19
|
+
end
|
|
20
|
+
function HealAbilityBehavior.prototype.calculateHealing(self, caster)
|
|
21
|
+
local parameters = self.parameters
|
|
22
|
+
local healing = self:resolveCurrentAbilityDependentValue(self.healing)
|
|
23
|
+
local healingPerStrength = self:resolveCurrentAbilityDependentValue(parameters and parameters.healingPerStrength or 0)
|
|
24
|
+
if healingPerStrength ~= 0 then
|
|
25
|
+
healing = healing + healingPerStrength * caster.strength
|
|
26
|
+
end
|
|
27
|
+
local healingPerAgility = self:resolveCurrentAbilityDependentValue(parameters and parameters.healingPerAgility or 0)
|
|
28
|
+
if healingPerAgility ~= 0 then
|
|
29
|
+
healing = healing + healingPerAgility * caster.agility
|
|
30
|
+
end
|
|
31
|
+
local healingPerIntelligence = self:resolveCurrentAbilityDependentValue(parameters and parameters.healingPerIntelligence or 0)
|
|
32
|
+
if healingPerIntelligence ~= 0 then
|
|
33
|
+
healing = healing + healingPerIntelligence * caster.intelligence
|
|
34
|
+
end
|
|
35
|
+
return healing
|
|
36
|
+
end
|
|
7
37
|
____exports.HealSelfAbilityBehavior = __TS__Class()
|
|
8
38
|
local HealSelfAbilityBehavior = ____exports.HealSelfAbilityBehavior
|
|
9
39
|
HealSelfAbilityBehavior.name = "HealSelfAbilityBehavior"
|
|
10
|
-
__TS__ClassExtends(HealSelfAbilityBehavior,
|
|
11
|
-
function HealSelfAbilityBehavior.prototype.____constructor(self, ability, healing)
|
|
12
|
-
|
|
13
|
-
self.healing = healing
|
|
40
|
+
__TS__ClassExtends(HealSelfAbilityBehavior, HealAbilityBehavior)
|
|
41
|
+
function HealSelfAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
42
|
+
HealAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
14
43
|
end
|
|
15
44
|
function HealSelfAbilityBehavior.prototype.onImpact(self, caster)
|
|
16
45
|
caster:healTarget(
|
|
17
46
|
caster,
|
|
18
|
-
self:
|
|
47
|
+
self:calculateHealing(caster)
|
|
19
48
|
)
|
|
20
49
|
end
|
|
21
50
|
____exports.HealTargetAbilityBehavior = __TS__Class()
|
|
22
51
|
local HealTargetAbilityBehavior = ____exports.HealTargetAbilityBehavior
|
|
23
52
|
HealTargetAbilityBehavior.name = "HealTargetAbilityBehavior"
|
|
24
|
-
__TS__ClassExtends(HealTargetAbilityBehavior,
|
|
25
|
-
function HealTargetAbilityBehavior.prototype.____constructor(self, ability, healing)
|
|
26
|
-
|
|
27
|
-
self.healing = healing
|
|
53
|
+
__TS__ClassExtends(HealTargetAbilityBehavior, HealAbilityBehavior)
|
|
54
|
+
function HealTargetAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
55
|
+
HealAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
28
56
|
end
|
|
29
57
|
function HealTargetAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
30
58
|
caster:healTarget(
|
|
31
59
|
target,
|
|
32
|
-
self:
|
|
60
|
+
self:calculateHealing(caster)
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
local HealAreaAbilityBehavior = __TS__Class()
|
|
64
|
+
HealAreaAbilityBehavior.name = "HealAreaAbilityBehavior"
|
|
65
|
+
__TS__ClassExtends(HealAreaAbilityBehavior, HealAbilityBehavior)
|
|
66
|
+
function HealAreaAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
67
|
+
HealAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
68
|
+
end
|
|
69
|
+
function HealAreaAbilityBehavior.prototype.healArea(self, caster, x, y)
|
|
70
|
+
local targets = Unit.getAllowedTargetsInCollisionRange(
|
|
71
|
+
caster,
|
|
72
|
+
self:resolveCurrentAbilityDependentValue(ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD),
|
|
73
|
+
x,
|
|
74
|
+
y,
|
|
75
|
+
self:resolveCurrentAbilityDependentValue(AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD)
|
|
33
76
|
)
|
|
77
|
+
local healing = self:calculateHealing(caster)
|
|
78
|
+
local ____self_resolveCurrentAbilityDependentValue_8 = self.resolveCurrentAbilityDependentValue
|
|
79
|
+
local ____opt_6 = self.parameters
|
|
80
|
+
local maximumHealing = ____self_resolveCurrentAbilityDependentValue_8(self, ____opt_6 and ____opt_6.maximumHealing or 0)
|
|
81
|
+
if maximumHealing ~= 0 and healing > maximumHealing then
|
|
82
|
+
healing = maximumHealing / #targets
|
|
83
|
+
end
|
|
84
|
+
for ____, target in ipairs(targets) do
|
|
85
|
+
caster:healTarget(target, healing)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
____exports.HealSelfAreaAbilityBehavior = __TS__Class()
|
|
89
|
+
local HealSelfAreaAbilityBehavior = ____exports.HealSelfAreaAbilityBehavior
|
|
90
|
+
HealSelfAreaAbilityBehavior.name = "HealSelfAreaAbilityBehavior"
|
|
91
|
+
__TS__ClassExtends(HealSelfAreaAbilityBehavior, HealAreaAbilityBehavior)
|
|
92
|
+
function HealSelfAreaAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
93
|
+
HealAreaAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
94
|
+
end
|
|
95
|
+
function HealSelfAreaAbilityBehavior.prototype.onImpact(self, caster)
|
|
96
|
+
self:healArea(caster, caster.x, caster.y)
|
|
97
|
+
end
|
|
98
|
+
____exports.HealTargetAreaAbilityBehavior = __TS__Class()
|
|
99
|
+
local HealTargetAreaAbilityBehavior = ____exports.HealTargetAreaAbilityBehavior
|
|
100
|
+
HealTargetAreaAbilityBehavior.name = "HealTargetAreaAbilityBehavior"
|
|
101
|
+
__TS__ClassExtends(HealTargetAreaAbilityBehavior, HealAreaAbilityBehavior)
|
|
102
|
+
function HealTargetAreaAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
103
|
+
HealAreaAbilityBehavior.prototype.____constructor(self, ability, healing, parameters)
|
|
104
|
+
end
|
|
105
|
+
function HealTargetAreaAbilityBehavior.prototype.onNoTargetImpact(self, caster)
|
|
106
|
+
self:healArea(caster, caster.x, caster.y)
|
|
107
|
+
end
|
|
108
|
+
function HealTargetAreaAbilityBehavior.prototype.onWidgetTargetImpact(self, caster, target)
|
|
109
|
+
self:healArea(caster, target.x, target.y)
|
|
110
|
+
end
|
|
111
|
+
function HealTargetAreaAbilityBehavior.prototype.onPointTargetImpact(self, caster, x, y)
|
|
112
|
+
self:healArea(caster, x, y)
|
|
34
113
|
end
|
|
35
114
|
return ____exports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import { AbilityBehavior } from "../ability";
|
|
3
2
|
import { Unit } from "../../internal/unit";
|
|
4
|
-
|
|
3
|
+
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
4
|
+
export declare class InstantImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
5
5
|
onCastingStart(caster: Unit): void;
|
|
6
6
|
}
|
|
@@ -2,28 +2,13 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
4
|
local ____exports = {}
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local ____ability = require("engine.standard.fields.ability")
|
|
8
|
-
local COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD = ____ability.COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD
|
|
9
|
-
local MANA_COST_ABILITY_INTEGER_LEVEL_FIELD = ____ability.MANA_COST_ABILITY_INTEGER_LEVEL_FIELD
|
|
5
|
+
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
6
|
+
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
10
7
|
____exports.InstantImpactAbilityBehavior = __TS__Class()
|
|
11
8
|
local InstantImpactAbilityBehavior = ____exports.InstantImpactAbilityBehavior
|
|
12
9
|
InstantImpactAbilityBehavior.name = "InstantImpactAbilityBehavior"
|
|
13
|
-
__TS__ClassExtends(InstantImpactAbilityBehavior,
|
|
10
|
+
__TS__ClassExtends(InstantImpactAbilityBehavior, EmulateImpactAbilityBehavior)
|
|
14
11
|
function InstantImpactAbilityBehavior.prototype.onCastingStart(self, caster)
|
|
15
|
-
|
|
16
|
-
local manaCost = self:resolveCurrentAbilityDependentValue(MANA_COST_ABILITY_INTEGER_LEVEL_FIELD)
|
|
17
|
-
local cooldown = self:resolveCurrentAbilityDependentValue(COOLDOWN_ABILITY_FLOAT_LEVEL_FIELD)
|
|
18
|
-
if caster:getAbilityRemainingCooldown(abilityTypeId) ~= 0 or caster.mana < manaCost then
|
|
19
|
-
return
|
|
20
|
-
end
|
|
21
|
-
caster.mana = caster.mana - manaCost
|
|
22
|
-
if cooldown == 0 then
|
|
23
|
-
caster:interruptCast(self.ability.typeId)
|
|
24
|
-
else
|
|
25
|
-
caster:startAbilityCooldown(self.ability.typeId, cooldown)
|
|
26
|
-
end
|
|
27
|
-
AbilityBehavior:forAll(self.ability, "onImpact", caster)
|
|
12
|
+
self:emulateImpact(caster)
|
|
28
13
|
end
|
|
29
14
|
return ____exports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Unit } from "../../internal/unit";
|
|
3
|
+
import { EmulateImpactAbilityBehavior } from "./emulate-impact";
|
|
4
|
+
import { Ability } from "../../internal/ability";
|
|
5
|
+
export declare class OnCommandImpactAbilityBehavior extends EmulateImpactAbilityBehavior {
|
|
6
|
+
constructor(ability: Ability);
|
|
7
|
+
onCommand(caster: Unit): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____unit = require("engine.internal.unit")
|
|
6
|
+
local Unit = ____unit.Unit
|
|
7
|
+
local ____emulate_2Dimpact = require("engine.behaviour.ability.emulate-impact")
|
|
8
|
+
local EmulateImpactAbilityBehavior = ____emulate_2Dimpact.EmulateImpactAbilityBehavior
|
|
9
|
+
____exports.OnCommandImpactAbilityBehavior = __TS__Class()
|
|
10
|
+
local OnCommandImpactAbilityBehavior = ____exports.OnCommandImpactAbilityBehavior
|
|
11
|
+
OnCommandImpactAbilityBehavior.name = "OnCommandImpactAbilityBehavior"
|
|
12
|
+
__TS__ClassExtends(OnCommandImpactAbilityBehavior, EmulateImpactAbilityBehavior)
|
|
13
|
+
function OnCommandImpactAbilityBehavior.prototype.____constructor(self, ability)
|
|
14
|
+
EmulateImpactAbilityBehavior.prototype.____constructor(self, ability)
|
|
15
|
+
self:registerCommandEvent()
|
|
16
|
+
end
|
|
17
|
+
function OnCommandImpactAbilityBehavior.prototype.onCommand(self, caster)
|
|
18
|
+
self:emulateImpact(caster)
|
|
19
|
+
end
|
|
20
|
+
Unit.itemUseOrderEvent:addListener(function(unit, item)
|
|
21
|
+
for ____, ability in ipairs(item.abilities) do
|
|
22
|
+
____exports.OnCommandImpactAbilityBehavior:forAll(ability, "onCommand", unit)
|
|
23
|
+
end
|
|
24
|
+
end)
|
|
25
|
+
return ____exports
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { AbilityBehavior } from "../ability";
|
|
3
|
+
import { Unit } from "../../internal/unit";
|
|
4
|
+
import { Ability } from "../../internal/ability";
|
|
5
|
+
import { AbilityDependentValue } from "../../object-field/ability";
|
|
6
|
+
import { BuffPolarity } from "../../object-data/auxiliary/buff-polarity";
|
|
7
|
+
import { BuffResistanceType } from "../../object-data/auxiliary/buff-resistance-type";
|
|
8
|
+
export declare class RemoveBuffsSelfAbilityBehavior extends AbilityBehavior {
|
|
9
|
+
private readonly polarity?;
|
|
10
|
+
private readonly resistanceType?;
|
|
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);
|
|
15
|
+
onImpact(caster: Unit): void;
|
|
16
|
+
}
|