Покажи код
"pudge_rot_lua"
{
// General
//-------------------------------------------------------------------------------------------------------------
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_TOGGLE | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING"
"AbilityUnitDamageType" "DAMAGE_TYPE_MAGICAL"
"SpellImmunityType" "SPELL_IMMUNITY_ENEMIES_NO"
"FightRecapLevel" "1"
"BaseClass" "ability_lua"
"AbilityTextureName" "pudge_rot"
"ScriptFile" "pudge_rot_lua"
"MaxLevel" "1"
// Casting
//-------------------------------------------------------------------------------------------------------------
"AbilityCastPoint" "0"
"AbilityDamage" "50"
// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"rot_radius" "800"
}
"02"
{
"var_type" "FIELD_FLOAT"
"rot_tick" "0.2"
}
"03"
{
"var_type" "FIELD_INTEGER"
"rot_slow" "-20 -22 -24 -26"
}
"04"
{
"var_type" "FIELD_INTEGER"
"rot_damage" "3 60 85 110"
}
"05"
{
"var_type" "FIELD_INTEGER"
"rot_decrease" "-100"
}
}
}
pudge_rot_lua = class({})
LinkLuaModifier( "modifier_zombie_rot", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
function pudge_rot_lua:ProcsMagicStick()
return false
end
--------------------------------------------------------------------------------
function pudge_rot_lua:OnToggle()
if self:GetToggleState() then
self:GetCaster():AddNewModifier( self:GetCaster(), self, "modifier_pudge_rot_lua", nil )
if not self:GetCaster():IsChanneling() then
self:GetCaster():StartGesture( ACT_DOTA_CAST_ABILITY_ROT )
end
else
local hRotBuff = self:GetCaster():FindModifierByName( "modifier_pudge_rot_lua" )
if hRotBuff ~= nil then
hRotBuff:Destroy()
end
end
end
--------------------------------------------------------------------------------
modifier_pudge_rot_lua = class({})
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:IsDebuff()
return true
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:IsAura()
if self:GetCaster() == self:GetParent() then
return true
end
return false
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:GetModifierAura()
return "modifier_pudge_rot_lua"
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:GetAuraSearchTeam()
return DOTA_UNIT_TARGET_TEAM_ENEMY
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:GetAuraSearchType()
return DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:GetAuraRadius()
return self.rot_radius
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:OnCreated( kv )
self.rot_radius = self:GetAbility():GetSpecialValueFor( "rot_radius" )
self.rot_slow = self:GetAbility():GetSpecialValueFor( "rot_slow" )
self.rot_damage = self:GetAbility():GetSpecialValueFor( "rot_damage" )
self.rot_tick = self:GetAbility():GetSpecialValueFor( "rot_tick" )
if IsServer() then
if self:GetParent() == self:GetCaster() then
EmitSoundOn( "Hero_Pudge.Rot", self:GetCaster() )
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_pudge/pudge_rot.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() )
ParticleManager:SetParticleControl( nFXIndex, 1, Vector( self.rot_radius, 1, self.rot_radius ) )
self:AddParticle( nFXIndex, false, false, -1, false, false )
else
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_pudge/pudge_rot_recipient.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() )
self:AddParticle( nFXIndex, false, false, -1, false, false )
end
self:StartIntervalThink( self.rot_tick )
self:OnIntervalThink()
end
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:OnDestroy()
if IsServer() then
StopSoundOn( "Hero_Pudge.Rot", self:GetCaster() )
end
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE,
}
return funcs
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:GetModifierMoveSpeedBonus_Percentage( params )
if self:GetParent() == self:GetCaster() then
return 0
end
return self.rot_slow
end
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:OnIntervalThink()
self.rot_radius = self:GetAbility():GetSpecialValueFor( "rot_radius" )
self.rot_slow = self:GetAbility():GetSpecialValueFor( "rot_slow" )
self.rot_damage = self:GetAbility():GetSpecialValueFor( "rot_damage" )
self.rot_tick = self:GetAbility():GetSpecialValueFor( "rot_tick" )
if IsServer() then
local flDamagePerTick = self.rot_tick * self.rot_damage
if self:GetCaster():IsAlive() then
local damage = {
victim = self:GetParent(),
attacker = self:GetCaster(),
damage = flDamagePerTick,
damage_type = DAMAGE_TYPE_MAGICAL,
ability = self:GetAbility(),
}
ApplyDamage( damage )
end
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function modifier_pudge_rot_lua:OnCreated( kv )
self.rot_radius = self:GetAbility():GetSpecialValueFor( "rot_radius" )
self.rot_slow = self:GetAbility():GetSpecialValueFor( "rot_slow" )
self.rot_damage = self:GetAbility():GetSpecialValueFor( "rot_damage" )
self.rot_tick = self:GetAbility():GetSpecialValueFor( "rot_tick" )
if IsServer() then
if self:GetParent() == self:GetCaster() then
EmitSoundOn( "Hero_Pudge.Rot", self:GetCaster() )
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_pudge/pudge_rot.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() )
ParticleManager:SetParticleControl( nFXIndex, 1, Vector( self.rot_radius, 1, self.rot_radius ) )
self:AddParticle( nFXIndex, false, false, -1, false, false )
else
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_pudge/pudge_rot_recipient.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() )
self:AddParticle( nFXIndex, false, false, -1, false, false )
self:StartIntervalThink( self.rot_tick )
self:OnIntervalThink()
end
end
end