Untitled

 avatar
unknown
plain_text
9 months ago
4.8 kB
31
Indexable
"silencer_glaives_of_wisdom_lua"
{
	"BaseClass"						"ability_lua"
	"ScriptFile"					"heroes/hero_silencer/silencer_glaives_of_wisdom_lua"
	"AbilityTextureName"			"silencer_glaives_of_wisdom"
	"FightRecapLevel"				"1"
	"MaxLevel"						"10"
	"HasScepterUpgrade"				"1"

	"precache"
	{
		"soundfile"	"soundevents/game_sounds_heroes/game_sounds_silencer.vsndevts"
		"particle"	"particles/units/heroes/hero_silencer/silencer_glaives_of_wisdom.vpcf"
	}

	"AbilityType"					"DOTA_ABILITY_TYPE_BASIC"
	"AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_AUTOCAST | DOTA_ABILITY_BEHAVIOR_ATTACK"
	"AbilityUnitTargetTeam"			"DOTA_UNIT_TARGET_TEAM_ENEMY"
	"AbilityUnitTargetType"			"DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
	"AbilityUnitDamageType"			"DAMAGE_TYPE_MAGICAL"
	"SpellImmunityType"				"SPELL_IMMUNITY_ENEMIES_NO"

	"AbilityCastRange"				"600"
	"AbilityDuration"				"0"
	"AbilityManaCost"				"5 10 15 20 25 30 35 40 45 50"

	"AbilityValues"
	{
		"intellect_damage_pct"
		{
			"value"				"15 20 25 30 35 40 45 50 55 60"
			"special_bonus_unique_glaives_of_wisdom_damage" "+20"
			"special_bonus_scepter"		"+20"
		}
		"steal_range"
		{
			"value"				"1200"
		}
		"bonus_int"
		{
			"value"				"0.5"
		}
		"stacks_per_kill"
		{
			"value"				"1"
		}
	}
}

silencer_glaives_of_wisdom_lua = class({})

LinkLuaModifier("modifier_generic_orb_effect_lua", "heroes/generic/modifier_generic_orb_effect_lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_silencer_glaives_of_wisdom_lua", "heroes/hero_silencer/silencer_glaives_of_wisdom_lua", LUA_MODIFIER_MOTION_NONE)

function silencer_glaives_of_wisdom_lua:GetIntrinsicModifierName()
	return "modifier_silencer_glaives_of_wisdom_lua"
end

function silencer_glaives_of_wisdom_lua:GetBehavior()
	return DOTA_ABILITY_BEHAVIOR_NO_TARGET
		 + DOTA_ABILITY_BEHAVIOR_AUTOCAST
		 + DOTA_ABILITY_BEHAVIOR_ATTACK
end

function silencer_glaives_of_wisdom_lua:GetAbilityTargetTeam()
	return DOTA_UNIT_TARGET_TEAM_ENEMY
end

function silencer_glaives_of_wisdom_lua:GetAbilityTargetType()
	return DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
end

function silencer_glaives_of_wisdom_lua:GetAbilityDamageType()
	return DAMAGE_TYPE_MAGICAL
end

function silencer_glaives_of_wisdom_lua:OnSpellStart()
	if self:GetToggleState() then
		EmitSoundOn("Hero_Silencer.GlaivesOfWisdom.ToggleOn", self:GetCaster())
	else
		EmitSoundOn("Hero_Silencer.GlaivesOfWisdom.ToggleOff", self:GetCaster())
	end
end

function silencer_glaives_of_wisdom_lua:GetProjectileName()
	return "particles/units/heroes/hero_silencer/silencer_glaives_of_wisdom.vpcf"
end

function silencer_glaives_of_wisdom_lua:OnOrbFire(params)
	EmitSoundOn("Hero_Silencer.GlaivesOfWisdom", self:GetCaster())
end

function silencer_glaives_of_wisdom_lua:OnOrbImpact(params)
	local caster = self:GetCaster()
	if not caster or not params.target or params.target:IsNull() then return end

	local int_mult = self:GetSpecialValueFor("intellect_damage_pct")
	local damage = caster:GetIntellect(false) * (int_mult / 100)

	local damageTable = {
		victim = params.target,
		attacker = caster,
		damage = damage,
		damage_type = self:GetAbilityDamageType(),
		ability = self,
	}
	ApplyDamage(damageTable)

	SendOverheadEventMessage(nil, OVERHEAD_ALERT_BONUS_SPELL_DAMAGE, params.target, damage, nil)
	EmitSoundOn("Hero_Silencer.GlaivesOfWisdom.Damage", params.target)
end

modifier_silencer_glaives_of_wisdom_lua = class({})

function modifier_silencer_glaives_of_wisdom_lua:IsHidden() return false end
function modifier_silencer_glaives_of_wisdom_lua:IsDebuff() return false end
function modifier_silencer_glaives_of_wisdom_lua:IsPurgable() return false end

function modifier_silencer_glaives_of_wisdom_lua:OnCreated()
	if not IsServer() then return end

	self:GetParent():AddNewModifier(
		self:GetCaster(),
		self:GetAbility(),
		"modifier_generic_orb_effect_lua",
		{}
	)

	self:SetStackCount(0)
end

function modifier_silencer_glaives_of_wisdom_lua:DeclareFunctions()
	return {
		MODIFIER_EVENT_ON_DEATH,
		MODIFIER_PROPERTY_STATS_INTELLECT_BONUS,
	}
end

function modifier_silencer_glaives_of_wisdom_lua:GetModifierBonusStats_Intellect()
	return self:GetStackCount() * self:GetAbility():GetSpecialValueFor("bonus_int")
end

function modifier_silencer_glaives_of_wisdom_lua:OnDeath(params)
	if not IsServer() then return end

	local attacker = params.attacker
	local killedUnit = params.unit

	if attacker ~= self:GetParent() or killedUnit:IsHero() then return end

	local stacksGained = self:GetAbility():GetSpecialValueFor("stacks_per_kill")
	self:SetStackCount(self:GetStackCount() + stacksGained)
end
Editor is loading...
Leave a Comment