As title says, code:
function modifier_dire_tower_boss_glyph:OnAttack( keys )
local unit = self:GetParent() -- Get the unit that has this modifier attached
if unit:HasModifier("modifier_dire_tower_boss_glyph") then
self:SplitShot( keys.target)
end
end
function modifier_dire_tower_boss_glyph:OnProjectileHit_ExtraData(target, location, data)
print("sprojectiles")
local caster = self:GetCaster()
-- If there is no target don't continue
if not target or not data then
return
end
print("secondary shot")
caster:PerformAttack(target, false, false, true, false, false, false, false)
end
function modifier_dire_tower_boss_glyph:SplitShot(target )
local radius = self.parent:Script_GetAttackRange() + self.bonus_range
local enemies = FindUnitsInRadius(
self.parent:GetTeamNumber(),
self.parent:GetOrigin(),
nil,
radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_COURIER,
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE + DOTA_UNIT_TARGET_FLAG_NO_INVIS + DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES,
0,
false
)
local count = 0
for _,enemy in pairs(enemies) do
if enemy~=target then
local info = {
Target = enemy,
Source = self.parent,
Ability = self:GetAbility(),
EffectName = self.projectile_name,
iMoveSpeed = self.projectile_speed,
bDodgeable = true,
ExtraData = {
secondary_shot = true
}
}
ProjectileManager:CreateTrackingProjectile(info)
count = count + 1
if count >= self.count then break end
end
end
if count>0 then
EmitSoundOn( "Hero_Medusa.AttackSplit", self.parent )
end
end