Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.67 KB | None | 0 0
  1. function Start(keys)
  2. local ability = keys.ability
  3. ability.point = ability:GetCursorPosition()
  4. print(ability.point)
  5. end
  6.  
  7. function PlaceEffect( keys )
  8. local caster = keys.caster
  9. local ability = keys.ability
  10. local target = keys.target
  11. local radius = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
  12. local delay = keys.ability:GetLevelSpecialValueFor("countdown", keys.ability:GetLevel() -1)
  13. local placed_particle = ParticleManager:CreateParticle("particles/robotscientistbombarea_particles/robot_scientist_bomb_aoe.vpcf", PATTACH_POINT_FOLLOW, target)
  14.  
  15. ParticleManager:SetParticleControl(placed_particle, 0, ability.point)
  16. ParticleManager:SetParticleControl(placed_particle, 1, ability.point)
  17. ParticleManager:SetParticleControl(placed_particle, 2, ability.point)
  18. ParticleManager:SetParticleControl(placed_particle, 3, ability.point)
  19. ParticleManager:SetParticleControl(placed_particle, 4, ability.point)
  20. ParticleManager:SetParticleControl(placed_particle, 5, ability.point)
  21. ParticleManager:SetParticleControl(placed_particle, 6, ability.point)
  22. ParticleManager:SetParticleControl(placed_particle, 7, ability.point)
  23. ParticleManager:SetParticleControl(placed_particle, 8, Vector(radius,radius,radius))
  24.  
  25. Timers:CreateTimer(delay, function()
  26. ParticleManager:DestroyParticle(placed_particle, false)
  27. local boom_particle = ParticleManager:CreateParticle("particles/robotscientistbombexplosion_particles/robot_scientist_gnoblin_bomb_explosion.vpcf", PATTACH_CUSTOMORIGIN, target)
  28. ParticleManager:SetParticleControl(boom_particle, 0, ability.point)
  29. end)
  30. end
  31.  
  32. function EffectHero(keys)
  33. local caster = keys.caster
  34. local target = keys.target
  35. local ability = keys.ability
  36. local radius = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
  37. target.hero_particle = ParticleManager:CreateParticle("particles/robotscientistbombarea_particles/robot_scientist_bomb_aoe.vpcf", PATTACH_POINT_FOLLOW, target)
  38.  
  39. ParticleManager:SetParticleControlEnt(target.hero_particle, 0, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
  40. ParticleManager:SetParticleControlEnt(target.hero_particle, 2, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
  41. ParticleManager:SetParticleControlEnt(target.hero_particle, 7, target, PATTACH_POINT_FOLLOW, "attach_origin", target:GetAbsOrigin(), true)
  42. ParticleManager:SetParticleControl(target.hero_particle, 8, Vector(radius,radius,radius))
  43. end
  44.  
  45. function vision_ground(keys)
  46. local caster = keys.caster
  47. local ability = keys.ability
  48. local vision = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
  49.  
  50. AddFOWViewer(caster:GetTeam(), ability.point, vision, 0.1, true)
  51. end
  52.  
  53. function vision_hero(keys)
  54. local caster = keys.caster
  55. local ability = keys.ability
  56. local target = keys.target
  57. local vision = keys.ability:GetLevelSpecialValueFor("damage_radius", keys.ability:GetLevel() -1)
  58.  
  59. AddFOWViewer(caster:GetTeam(), target:GetAbsOrigin(), vision, 0.1, true)
  60. end
  61.  
  62. function ProjHit(keys)
  63. local caster = keys.caster
  64. local ability = keys.ability
  65. ability.target = nil
  66. local cdr = ability:GetLevelSpecialValueFor("cooldown_reduction", ability:GetLevel() -1)
  67. ability.damage_radius = ability:GetLevelSpecialValueFor("damage_radius", ability:GetLevel() -1)
  68. 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)
  69. local closest = 125
  70. for i,unit in ipairs(units) do
  71. -- Positioning and distance variables
  72. local unit_location = unit:GetAbsOrigin()
  73. local vector_distance = ability.point - unit_location
  74. local distance = (vector_distance):Length2D()
  75. -- 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
  76. if distance < closest then
  77. closest = distance
  78. ability.target = unit
  79.  
  80. end
  81. end
  82.  
  83. if ability.target == nil then
  84. ability:ApplyDataDrivenThinker(caster, ability.point, "goblin_bomb_ground", {})
  85. else
  86. if not ability.target:HasModifier("goblin_bomb_target") then
  87. ability:ApplyDataDrivenModifier(caster, ability.target, "goblin_bomb_target", {})
  88. local old_cd = ability:GetCooldownTimeRemaining()
  89. ability:EndCooldown()
  90. if old_cd > cdr then
  91. ability:StartCooldown(old_cd - cdr)
  92. end
  93. else
  94. ability.target:RemoveModifierByName("goblin_bomb_target")
  95. ability:ApplyDataDrivenModifier(caster, ability.target, "goblin_bomb_target", {})
  96. --target:RemoveModifierByName("goblin_bomb_target")
  97. end
  98. end
  99. end
  100.  
  101. function GroundExplosion( keys )
  102. local caster = keys.caster
  103. local ability = keys.ability
  104. --local point = ability:GetCursorPosition()
  105. local target = keys.target
  106. local damage_normal = ability:GetLevelSpecialValueFor("damage", ability:GetLevel() -1)
  107. local damage_buildings = ability:GetLevelSpecialValueFor("building_damage", ability:GetLevel() -1) * 0.01 * damage_normal
  108. 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)
  109. for _,unit in pairs(units) do
  110.  
  111. if not unit:IsBuilding() then
  112.  
  113. local damageTable = {
  114. victim = unit,
  115. attacker = caster,
  116. damage = damage_normal,
  117. damage_type = DAMAGE_TYPE_MAGICAL,
  118. damage_flags = DOTA_DAMAGE_FLAG_NONE,
  119. ability = keys.ability,
  120. }
  121. ApplyDamage(damageTable)
  122. end
  123.  
  124. if unit:IsBuilding() then
  125. local damageTable = {
  126. victim = unit,
  127. attacker = caster,
  128. damage = damage_buildings,
  129. damage_type = DAMAGE_TYPE_MAGICAL,
  130. damage_flags = DOTA_DAMAGE_FLAG_NONE,
  131. ability = keys.ability,
  132. }
  133. ApplyDamage(damageTable)
  134. end
  135. end
  136.  
  137. --ParticleManager:DestroyParticle(placed_particle, false)
  138. StopSoundEvent("Chrono_tick", target)
  139. end
  140.  
  141. function TargetExplosion( keys )
  142. local caster = keys.caster
  143. local ability = keys.ability
  144. local point = keys.target:GetAbsOrigin()
  145. local target = keys.target
  146. local damage_normal = ability:GetLevelSpecialValueFor("damage", ability:GetLevel() -1)
  147. local damage_buildings = ability:GetLevelSpecialValueFor("building_damage", ability:GetLevel() -1) * 0.01 * damage_normal
  148. 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)
  149. for _,unit in pairs(units) do
  150.  
  151. if target:IsAlive() then
  152.  
  153. if not unit:IsBuilding() then
  154.  
  155. local damageTable = {
  156. victim = unit,
  157. attacker = caster,
  158. damage = damage_normal,
  159. damage_type = DAMAGE_TYPE_MAGICAL,
  160. damage_flags = DOTA_DAMAGE_FLAG_NONE,
  161. ability = keys.ability,
  162. }
  163. ApplyDamage(damageTable)
  164. end
  165.  
  166. if unit:IsBuilding() then
  167. local damageTable = {
  168. victim = unit,
  169. attacker = caster,
  170. damage = damage_buildings,
  171. damage_type = DAMAGE_TYPE_MAGICAL,
  172. damage_flags = DOTA_DAMAGE_FLAG_NONE,
  173. ability = keys.ability,
  174. }
  175. ApplyDamage(damageTable)
  176. end
  177.  
  178. end
  179. end
  180. ParticleManager:DestroyParticle(target.hero_particle, false)
  181. StopSoundEvent("Chrono_tick", target)
  182. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement