Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Start(keys)
- local ability = keys.ability
- ability.point = ability:GetCursorPosition()
- print(ability.point)
- end
- function PlaceEffect( keys )
- local caster = keys.caster
- local ability = keys.ability
- local target = keys.target
- local radius = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
- local delay = keys.ability:GetLevelSpecialValueFor("countdown", keys.ability:GetLevel() -1)
- local placed_particle = ParticleManager:CreateParticle("particles/robotscientistbombarea_particles/robot_scientist_bomb_aoe.vpcf", PATTACH_POINT_FOLLOW, target)
- ParticleManager:SetParticleControl(placed_particle, 0, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 1, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 2, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 3, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 4, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 5, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 6, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 7, ability.point)
- ParticleManager:SetParticleControl(placed_particle, 8, Vector(radius,radius,radius))
- Timers:CreateTimer(delay, function()
- ParticleManager:DestroyParticle(placed_particle, false)
- local boom_particle = ParticleManager:CreateParticle("particles/robotscientistbombexplosion_particles/robot_scientist_gnoblin_bomb_explosion.vpcf", PATTACH_CUSTOMORIGIN, target)
- ParticleManager:SetParticleControl(boom_particle, 0, ability.point)
- end)
- end
- function EffectHero(keys)
- local caster = keys.caster
- local target = keys.target
- local ability = keys.ability
- local radius = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
- target.hero_particle = ParticleManager:CreateParticle("particles/robotscientistbombarea_particles/robot_scientist_bomb_aoe.vpcf", PATTACH_POINT_FOLLOW, target)
- ParticleManager:SetParticleControlEnt(target.hero_particle, 0, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
- ParticleManager:SetParticleControlEnt(target.hero_particle, 2, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
- ParticleManager:SetParticleControlEnt(target.hero_particle, 7, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
- ParticleManager:SetParticleControl(target.hero_particle, 8, Vector(radius,radius,radius))
- end
- function vision_ground(keys)
- local caster = keys.caster
- local ability = keys.ability
- local vision = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
- AddFOWViewer(caster:GetTeam(), ability.point, vision, 0.1, true)
- end
- function vision_hero(keys)
- local caster = keys.caster
- local ability = keys.ability
- local target = keys.target
- local vision = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
- AddFOWViewer(caster:GetTeam(), target:GetAbsOrigin(), vision, 0.1, true)
- end
- function ProjHit(keys)
- local caster = keys.caster
- local ability = keys.ability
- ability.target = nil
- local cdr = ability:GetLevelSpecialValueFor("cooldown_reduction", ability:GetLevel() -1)
- ability.damage_radius = ability:GetLevelSpecialValueFor("damage_radius", ability:GetLevel() -1)
- local units = FindUnitsInRadius(caster:GetTeamNumber(), ability.point, nil, 125, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, 0, 0, false)
- local closest = 125
- for i,unit in ipairs(units) do
- -- Positioning and distance variables
- local unit_location = unit:GetAbsOrigin()
- local vector_distance = ability.point - unit_location
- local distance = (vector_distance):Length2D()
- -- If the hero is closer than the closest checked so far, then we set its distance as the new closest distance and it as the new target
- if distance < closest then
- closest = distance
- ability.target = unit
- end
- end
- if ability.target == nil then
- ability:ApplyDataDrivenThinker(caster, ability.point, "goblin_bomb_ground", {})
- else
- if not ability.target:HasModifier("goblin_bomb_target") then
- ability:ApplyDataDrivenModifier(caster, ability.target, "goblin_bomb_target", {})
- local old_cd = ability:GetCooldownTimeRemaining()
- ability:EndCooldown()
- if old_cd > cdr then
- ability:StartCooldown(old_cd - cdr)
- end
- else
- ability.target:RemoveModifierByName("goblin_bomb_target")
- ability:ApplyDataDrivenModifier(caster, ability.target, "goblin_bomb_target", {})
- --target:RemoveModifierByName("goblin_bomb_target")
- end
- end
- end
- function GroundExplosion( keys )
- local caster = keys.caster
- local ability = keys.ability
- --local point = ability:GetCursorPosition()
- local target = keys.target
- local damage_normal = ability:GetLevelSpecialValueFor("damage", ability:GetLevel() -1)
- local damage_buildings = ability:GetLevelSpecialValueFor("building_damage", ability:GetLevel() -1) * 0.01 * damage_normal
- local units = FindUnitsInRadius(caster:GetTeamNumber(), ability.point, nil, ability.damage_radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_BUILDING, 0, 0, false)
- for _,unit in pairs(units) do
- if not unit:IsBuilding() then
- local damageTable = {
- victim = unit,
- attacker = caster,
- damage = damage_normal,
- damage_type = DAMAGE_TYPE_MAGICAL,
- damage_flags = DOTA_DAMAGE_FLAG_NONE,
- ability = keys.ability,
- }
- ApplyDamage(damageTable)
- end
- if unit:IsBuilding() then
- local damageTable = {
- victim = unit,
- attacker = caster,
- damage = damage_buildings,
- damage_type = DAMAGE_TYPE_MAGICAL,
- damage_flags = DOTA_DAMAGE_FLAG_NONE,
- ability = keys.ability,
- }
- ApplyDamage(damageTable)
- end
- end
- --ParticleManager:DestroyParticle(placed_particle, false)
- StopSoundEvent("Chrono_tick", target)
- end
- function TargetExplosion( keys )
- local caster = keys.caster
- local ability = keys.ability
- local point = keys.target:GetAbsOrigin()
- local target = keys.target
- local damage_normal = ability:GetLevelSpecialValueFor("damage", ability:GetLevel() -1)
- local damage_buildings = ability:GetLevelSpecialValueFor("building_damage", ability:GetLevel() -1) * 0.01 * damage_normal
- local units = FindUnitsInRadius(caster:GetTeamNumber(), point, nil, ability.damage_radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_BUILDING, 0, 0, false)
- for _,unit in pairs(units) do
- if target:IsAlive() then
- if not unit:IsBuilding() then
- local damageTable = {
- victim = unit,
- attacker = caster,
- damage = damage_normal,
- damage_type = DAMAGE_TYPE_MAGICAL,
- damage_flags = DOTA_DAMAGE_FLAG_NONE,
- ability = keys.ability,
- }
- ApplyDamage(damageTable)
- end
- if unit:IsBuilding() then
- local damageTable = {
- victim = unit,
- attacker = caster,
- damage = damage_buildings,
- damage_type = DAMAGE_TYPE_MAGICAL,
- damage_flags = DOTA_DAMAGE_FLAG_NONE,
- ability = keys.ability,
- }
- ApplyDamage(damageTable)
- end
- end
- end
- ParticleManager:DestroyParticle(target.hero_particle, false)
- StopSoundEvent("Chrono_tick", target)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement