dEN5

dEN5

Jan 11th, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1. "xunjiliehuo"
  2. {
  3. "BaseClass" "ability_datadriven"
  4. "AbilityTextureName" "ember_spirit_sleight_of_fist"
  5. "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
  6. "MaxLevel" "4"
  7. "precache"
  8. {
  9. "soundfile" "soundevents/game_sounds_heroes/game_sounds_ember_spirit.vsndevts"
  10. "particle" "particles/units/heroes/hero_ember_spirit/ember_spirit_sleight_of_fist_caster.vpcf"
  11. }
  12. "Modifiers"
  13. {
  14. "modifier_xunjiliehuo_applier"
  15. {
  16. "Passive" "1"
  17. "IsHidden" "1"
  18. "OnAttackLanded"
  19. {
  20. "Random"
  21. {
  22. "Chance" "%chance"
  23. "OnSuccess"
  24. {
  25. "FireSound"
  26. {
  27. "Target" "CASTER"
  28. "EffectName" "Hero_EmberSpirit.SleightOfFist.Cast"
  29. }
  30. "RunScript"
  31. {
  32. "ScriptFile" "abilities/ember_spirit.lua"
  33. "Function" "xunjiliehuo_init"
  34. "Target" "TARGET"
  35. }
  36. "ApplyModifier"
  37. {
  38. "Target" "CASTER"
  39. "ModifierName" "modifier_xunjiliehuo_caster"
  40. }
  41. }
  42. }
  43. }
  44. }
  45. "modifier_xunjiliehuo_caster"
  46. {
  47. "IsPurgable" "0"
  48. "States"
  49. {
  50. "MODIFIER_STATE_NO_UNIT_COLLISION" "MODIFIER_STATE_VALUE_ENABLED"
  51. "MODIFIER_STATE_ROOTED" "MODIFIER_STATE_VALUE_ENABLED"
  52. }
  53. }
  54. "modifier_xunjiliehuo_dummy"
  55. {
  56. "IsPurgable" "0"
  57. "IsHidden" "1"
  58. "OnCreated"
  59. {
  60. "AttachEffect"
  61. {
  62. "Target" "TARGET"
  63. "EffectName" "particles/units/heroes/hero_ember_spirit/ember_spirit_sleight_of_fist_caster.vpcf"
  64. "EffectAttachType" "start_at_customorigin"
  65. "ControlPointEntities"
  66. {
  67. "TARGET" "attach_hitloc"
  68. }
  69. }
  70. }
  71. "States"
  72. {
  73. "MODIFIER_STATE_INVULNERABLE" "MODIFIER_STATE_VALUE_ENABLED"
  74. "MODIFIER_STATE_NO_HEALTH_BAR" "MODIFIER_STATE_VALUE_ENABLED"
  75. "MODIFIER_STATE_NO_UNIT_COLLISION" "MODIFIER_STATE_VALUE_ENABLED"
  76. "MODIFIER_STATE_NOT_ON_MINIMAP" "MODIFIER_STATE_VALUE_ENABLED"
  77. "MODIFIER_STATE_UNSELECTABLE" "MODIFIER_STATE_VALUE_ENABLED"
  78. "MODIFIER_STATE_COMMAND_RESTRICTED" "MODIFIER_STATE_VALUE_ENABLED"
  79. "MODIFIER_STATE_DISARMED" "MODIFIER_STATE_VALUE_ENABLED"
  80. }
  81. }
  82. }
  83. "AbilitySpecial"
  84. {
  85. "01"
  86. {
  87. "var_type" "FIELD_INTEGER"
  88. "chance" "10"
  89. }
  90. "02"
  91. {
  92. "var_type" "FIELD_FLOAT"
  93. "radius" "500"
  94. }
  95. "03"
  96. {
  97. "var_type" "FIELD_FLOAT"
  98. "max_target" "3 3 4 5"
  99. }
  100. }
  101. }
  102.  
  103. lua
  104.  
  105. function xunjiliehuo_init( keys )
  106. -- 无法重复触发
  107. if keys.caster.xunjiliehuo_active ~= nil and keys.caster.xunjiliehuo_action == true then
  108. return nil
  109. end
  110.  
  111. -- Inheritted variables
  112. local caster = keys.caster
  113. local targetPoint = keys.target:GetAbsOrigin()
  114. local ability = keys.ability
  115. local radius = ability:GetLevelSpecialValueFor( "radius", ability:GetLevel() - 1 )
  116. local max_target = ability:GetLevelSpecialValueFor("max_target", ability:GetLevel() - 1)
  117. local attack_interval = 0.1
  118.  
  119. local casterModifierName = "modifier_xunjiliehuo_caster"
  120. local dummyModifierName = "modifier_xunjiliehuo_dummy"
  121. local particleSlashName = "particles/units/heroes/hero_ember_spirit/ember_spirit_sleightoffist_tgt.vpcf"
  122. local particleTrailName = "particles/units/heroes/hero_ember_spirit/ember_spirit_sleightoffist_trail.vpcf"
  123. local particleCastName = "particles/units/heroes/hero_ember_spirit/ember_spirit_xunjiliehuo_cast.vpcf"
  124. local slashSound = "Hero_EmberSpirit.SleightOfFist.Damage"
  125.  
  126. -- Targeting variables
  127. local targetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY
  128. local targetType = DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO
  129. local targetFlag = DOTA_UNIT_TARGET_FLAG_NO_INVIS
  130. local unitOrder = FIND_ANY_ORDER
  131.  
  132. -- Necessary varaibles
  133. local counter = 0
  134. caster.xunjiliehuo_active = true
  135. local caster_origin = caster:GetAbsOrigin()
  136. -- local dummy = CreateUnitByName( caster:GetName(), caster:GetAbsOrigin(), false, caster, nil, caster:GetTeamNumber() )
  137. -- dummy.__isDummy = true
  138. -- ability:ApplyDataDrivenModifier( caster, dummy, dummyModifierName, {} )
  139.  
  140. -- Casting particles
  141. local castFxIndex = ParticleManager:CreateParticle( particleCastName, PATTACH_CUSTOMORIGIN, caster )
  142. ParticleManager:SetParticleControl( castFxIndex, 0, targetPoint )
  143. ParticleManager:SetParticleControl( castFxIndex, 1, Vector( radius, 0, 0 ) )
  144.  
  145. Timer( 0.1, function()
  146. ParticleManager:DestroyParticle( castFxIndex, false )
  147. ParticleManager:ReleaseParticleIndex( castFxIndex )
  148. end
  149. )
  150.  
  151. -- Start function
  152. local castFxIndex = ParticleManager:CreateParticle( particleCastName, PATTACH_CUSTOMORIGIN, caster )
  153. local units = FindUnitsInRadius(
  154. caster:GetTeamNumber(), targetPoint, caster, radius, targetTeam,
  155. targetType, targetFlag, unitOrder, false
  156. )
  157.  
  158. for _, target in pairs( units ) do
  159. counter = counter + 1
  160. if counter >= max_target then
  161. counter = max_target
  162. break
  163. end
  164. ability:ApplyDataDrivenModifier( caster, target, modifierTargetName, {} )
  165. Timer( counter * attack_interval, function()
  166. -- Only jump to it if it's alive
  167. if target:IsAlive() then
  168. -- Create trail particles
  169. local trailFxIndex = ParticleManager:CreateParticle( particleTrailName, PATTACH_CUSTOMORIGIN, target )
  170. ParticleManager:SetParticleControl( trailFxIndex, 0, target:GetAbsOrigin() )
  171. ParticleManager:SetParticleControl( trailFxIndex, 1, caster:GetAbsOrigin() )
  172.  
  173. Timer( 0.1, function()
  174. ParticleManager:DestroyParticle( trailFxIndex, false )
  175. ParticleManager:ReleaseParticleIndex( trailFxIndex )
  176. return nil
  177. end
  178. )
  179.  
  180. -- Move hero there
  181. -- FindClearSpaceForUnit( caster, target:GetAbsOrigin(), false )
  182. caster:PerformAttack( target, true, true, true, false, true, false, true)
  183.  
  184. -- 造成当前攻击升级等级 * 敏捷系数的伤害
  185. -- ????
  186.  
  187. -- Slash particles
  188. local slashFxIndex = ParticleManager:CreateParticle( particleSlashName, PATTACH_ABSORIGIN_FOLLOW, target )
  189. StartSoundEvent( slashSound, caster )
  190.  
  191. Timer( 0.1, function()
  192. ParticleManager:DestroyParticle( slashFxIndex, false )
  193. ParticleManager:ReleaseParticleIndex( slashFxIndex )
  194. StopSoundEvent( slashSound, caster )
  195. return nil
  196. end
  197. )
  198.  
  199. end
  200. return nil
  201. end
  202. )
  203. end
  204.  
  205. -- Return caster to origin position
  206. Timer( ( counter + 1 ) * attack_interval, function()
  207. FindClearSpaceForUnit( caster, caster_origin, false )
  208. -- dummy:RemoveSelf()
  209. caster:RemoveModifierByName( casterModifierName )
  210. caster.xunjiliehuo_active = false
  211. return nil
  212. end
  213. )
  214. end
Advertisement
Add Comment
Please, Sign In to add comment