232 lines
8.6 KiB
Lua
232 lines
8.6 KiB
Lua
local ____lualib = require("lualib_bundle")
|
|
local __TS__Class = ____lualib.__TS__Class
|
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
local ____exports = {}
|
|
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local BaseAbility = ____dota_ts_adapter.BaseAbility
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
____exports.grimstroke_ink_swell_custom = __TS__Class()
|
|
local grimstroke_ink_swell_custom = ____exports.grimstroke_ink_swell_custom
|
|
grimstroke_ink_swell_custom.name = "grimstroke_ink_swell_custom"
|
|
grimstroke_ink_swell_custom.____file_path = "scripts/vscripts/abilities/heroes/grimstroke/grimstroke_ink_swell_custom.lua"
|
|
__TS__ClassExtends(grimstroke_ink_swell_custom, BaseAbility)
|
|
function grimstroke_ink_swell_custom.prototype.OnSpellStart(self)
|
|
local caster = self:GetCaster()
|
|
local target = self:GetCursorTarget()
|
|
if not target then
|
|
return
|
|
end
|
|
local duration = self:GetSpecialValueFor("buff_duration")
|
|
target:AddNewModifier(caster, self, ____exports.modifier_grimstroke_ink_swell.name, {duration = duration})
|
|
local effectCast = ParticleManager:CreateParticle("particles/units/heroes/hero_grimstroke/grimstroke_cast_ink_swell.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
|
|
ParticleManager:ReleaseParticleIndex(effectCast)
|
|
EmitSoundOn("Hero_Grimstroke.InkSwell.Cast", caster)
|
|
end
|
|
grimstroke_ink_swell_custom = __TS__Decorate(
|
|
grimstroke_ink_swell_custom,
|
|
grimstroke_ink_swell_custom,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "grimstroke_ink_swell_custom"}
|
|
)
|
|
____exports.grimstroke_ink_swell_custom = grimstroke_ink_swell_custom
|
|
____exports.modifier_grimstroke_ink_swell = __TS__Class()
|
|
local modifier_grimstroke_ink_swell = ____exports.modifier_grimstroke_ink_swell
|
|
modifier_grimstroke_ink_swell.name = "modifier_grimstroke_ink_swell"
|
|
modifier_grimstroke_ink_swell.____file_path = "scripts/vscripts/abilities/heroes/grimstroke/grimstroke_ink_swell_custom.lua"
|
|
__TS__ClassExtends(modifier_grimstroke_ink_swell, BaseModifier)
|
|
function modifier_grimstroke_ink_swell.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.counter = 0
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.OnCreated(self)
|
|
if IsClient() then
|
|
return
|
|
end
|
|
local interval = self:GetAbility():GetSpecialValueFor("tick_rate")
|
|
local radius = self:GetAbility():GetSpecialValueFor("radius")
|
|
self:StartIntervalThink(interval)
|
|
local effectCast = ParticleManager:CreateParticle(
|
|
"particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_buff.vpcf",
|
|
PATTACH_OVERHEAD_FOLLOW,
|
|
self:GetParent()
|
|
)
|
|
ParticleManager:SetParticleControl(
|
|
effectCast,
|
|
2,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
ParticleManager:SetParticleControlEnt(
|
|
effectCast,
|
|
3,
|
|
self:GetParent(),
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
"attach_attack1",
|
|
self:GetParent():GetOrigin(),
|
|
true
|
|
)
|
|
self:AddParticle(
|
|
effectCast,
|
|
false,
|
|
false,
|
|
-1,
|
|
false,
|
|
true
|
|
)
|
|
EmitSoundOn(
|
|
"Hero_Grimstroke.InkSwell.Target",
|
|
self:GetParent()
|
|
)
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.OnDestroy(self)
|
|
if IsClient() then
|
|
return
|
|
end
|
|
local radius = self:GetAbility():GetSpecialValueFor("radius")
|
|
local enemies = FindUnitsInRadius(
|
|
self:GetParent():GetTeamNumber(),
|
|
self:GetParent():GetOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
bit.bor(DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_HERO),
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
local baseStun = self:GetAbility():GetSpecialValueFor("debuff_duration")
|
|
local maxMultiplier = self:GetAbility():GetSpecialValueFor("max_bonus_multiplier")
|
|
local baseDamage = self:GetAbility():GetSpecialValueFor("damage")
|
|
local maxCounter = self:GetAbility():GetSpecialValueFor("max_counter")
|
|
local multiplier = self.counter / maxCounter * maxMultiplier
|
|
local finalMultiplier = math.min(maxMultiplier, multiplier + 1)
|
|
local stun = baseStun * finalMultiplier
|
|
local damage = baseDamage * finalMultiplier
|
|
__TS__ArrayForEach(
|
|
enemies,
|
|
function(____, enemy)
|
|
ApplyDamage({
|
|
victim = enemy,
|
|
attacker = self:GetParent(),
|
|
damage = damage,
|
|
damage_type = DAMAGE_TYPE_MAGICAL,
|
|
ability = self:GetAbility()
|
|
})
|
|
enemy:AddNewModifier(
|
|
self:GetParent(),
|
|
self:GetAbility(),
|
|
"modifier_stunned",
|
|
{duration = stun}
|
|
)
|
|
end
|
|
)
|
|
StopSoundOn(
|
|
"Hero_Grimstroke.InkSwell.Target",
|
|
self:GetParent()
|
|
)
|
|
local effectCast = ParticleManager:CreateParticle(
|
|
"particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_aoe.vpcf",
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
self:GetParent()
|
|
)
|
|
ParticleManager:SetParticleControl(
|
|
effectCast,
|
|
2,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(effectCast)
|
|
EmitSoundOn(
|
|
"Hero_Grimstroke.InkSwell.Stun",
|
|
self:GetParent()
|
|
)
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE}
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.GetModifierMoveSpeedBonus_Percentage(self)
|
|
return self:GetAbility():GetSpecialValueFor("movespeed_bonus_pct")
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.CheckState(self)
|
|
return {[MODIFIER_STATE_ATTACK_IMMUNE] = true, [MODIFIER_STATE_DISARMED] = true, [MODIFIER_STATE_SILENCED] = true}
|
|
end
|
|
function modifier_grimstroke_ink_swell.prototype.OnIntervalThink(self)
|
|
if IsClient() then
|
|
return
|
|
end
|
|
local maxCounter = self:GetAbility():GetSpecialValueFor("max_counter")
|
|
local radius = self:GetAbility():GetSpecialValueFor("radius")
|
|
local maxMultiplier = self:GetAbility():GetSpecialValueFor("max_bonus_multiplier")
|
|
local multiplier = self.counter / maxCounter * maxMultiplier
|
|
local damagePerTick = self:GetAbility():GetSpecialValueFor("tick_dps_tooltip") * self:GetAbility():GetSpecialValueFor("tick_rate")
|
|
local damage = damagePerTick * math.min(maxMultiplier, multiplier + 1)
|
|
local enemies = FindUnitsInRadius(
|
|
self:GetParent():GetTeamNumber(),
|
|
self:GetParent():GetOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
DOTA_UNIT_TARGET_ALL,
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
__TS__ArrayForEach(
|
|
enemies,
|
|
function(____, enemy)
|
|
ApplyDamage({
|
|
victim = enemy,
|
|
attacker = self:GetParent(),
|
|
damage = damage,
|
|
damage_type = DAMAGE_TYPE_MAGICAL,
|
|
ability = self:GetAbility()
|
|
})
|
|
self.counter = self.counter + 1
|
|
local effectCast = ParticleManager:CreateParticle(
|
|
"particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_tick_damage.vpcf",
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
self:GetParent()
|
|
)
|
|
ParticleManager:SetParticleControlEnt(
|
|
effectCast,
|
|
0,
|
|
self:GetParent(),
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
"attach_hitloc",
|
|
Vector(0, 0, 0),
|
|
true
|
|
)
|
|
ParticleManager:SetParticleControlEnt(
|
|
effectCast,
|
|
1,
|
|
enemy,
|
|
PATTACH_POINT_FOLLOW,
|
|
"attach_hitloc",
|
|
Vector(0, 0, 0),
|
|
true
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(effectCast)
|
|
EmitSoundOn("Hero_Grimstroke.InkSwell.Damage", enemy)
|
|
end
|
|
)
|
|
end
|
|
modifier_grimstroke_ink_swell = __TS__Decorate(
|
|
modifier_grimstroke_ink_swell,
|
|
modifier_grimstroke_ink_swell,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_grimstroke_ink_swell"}
|
|
)
|
|
____exports.modifier_grimstroke_ink_swell = modifier_grimstroke_ink_swell
|
|
return ____exports
|