Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "xunjiliehuo"
- {
- "BaseClass" "ability_datadriven"
- "AbilityTextureName" "ember_spirit_sleight_of_fist"
- "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
- "MaxLevel" "4"
- "precache"
- {
- "soundfile" "soundevents/game_sounds_heroes/game_sounds_ember_spirit.vsndevts"
- "particle" "particles/units/heroes/hero_ember_spirit/ember_spirit_sleight_of_fist_caster.vpcf"
- }
- "Modifiers"
- {
- "modifier_xunjiliehuo_applier"
- {
- "Passive" "1"
- "IsHidden" "1"
- "OnAttackLanded"
- {
- "Random"
- {
- "Chance" "%chance"
- "OnSuccess"
- {
- "FireSound"
- {
- "Target" "CASTER"
- "EffectName" "Hero_EmberSpirit.SleightOfFist.Cast"
- }
- "RunScript"
- {
- "ScriptFile" "abilities/ember_spirit.lua"
- "Function" "xunjiliehuo_init"
- "Target" "TARGET"
- }
- "ApplyModifier"
- {
- "Target" "CASTER"
- "ModifierName" "modifier_xunjiliehuo_caster"
- }
- }
- }
- }
- }
- "modifier_xunjiliehuo_caster"
- {
- "IsPurgable" "0"
- "States"
- {
- "MODIFIER_STATE_NO_UNIT_COLLISION" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_ROOTED" "MODIFIER_STATE_VALUE_ENABLED"
- }
- }
- "modifier_xunjiliehuo_dummy"
- {
- "IsPurgable" "0"
- "IsHidden" "1"
- "OnCreated"
- {
- "AttachEffect"
- {
- "Target" "TARGET"
- "EffectName" "particles/units/heroes/hero_ember_spirit/ember_spirit_sleight_of_fist_caster.vpcf"
- "EffectAttachType" "start_at_customorigin"
- "ControlPointEntities"
- {
- "TARGET" "attach_hitloc"
- }
- }
- }
- "States"
- {
- "MODIFIER_STATE_INVULNERABLE" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_NO_HEALTH_BAR" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_NO_UNIT_COLLISION" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_NOT_ON_MINIMAP" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_UNSELECTABLE" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_COMMAND_RESTRICTED" "MODIFIER_STATE_VALUE_ENABLED"
- "MODIFIER_STATE_DISARMED" "MODIFIER_STATE_VALUE_ENABLED"
- }
- }
- }
- "AbilitySpecial"
- {
- "01"
- {
- "var_type" "FIELD_INTEGER"
- "chance" "10"
- }
- "02"
- {
- "var_type" "FIELD_FLOAT"
- "radius" "500"
- }
- "03"
- {
- "var_type" "FIELD_FLOAT"
- "max_target" "3 3 4 5"
- }
- }
- }
- lua
- function xunjiliehuo_init( keys )
- -- 无法重复触发
- if keys.caster.xunjiliehuo_active ~= nil and keys.caster.xunjiliehuo_action == true then
- return nil
- end
- -- Inheritted variables
- local caster = keys.caster
- local targetPoint = keys.target:GetAbsOrigin()
- local ability = keys.ability
- local radius = ability:GetLevelSpecialValueFor( "radius", ability:GetLevel() - 1 )
- local max_target = ability:GetLevelSpecialValueFor("max_target", ability:GetLevel() - 1)
- local attack_interval = 0.1
- local casterModifierName = "modifier_xunjiliehuo_caster"
- local dummyModifierName = "modifier_xunjiliehuo_dummy"
- local particleSlashName = "particles/units/heroes/hero_ember_spirit/ember_spirit_sleightoffist_tgt.vpcf"
- local particleTrailName = "particles/units/heroes/hero_ember_spirit/ember_spirit_sleightoffist_trail.vpcf"
- local particleCastName = "particles/units/heroes/hero_ember_spirit/ember_spirit_xunjiliehuo_cast.vpcf"
- local slashSound = "Hero_EmberSpirit.SleightOfFist.Damage"
- -- Targeting variables
- local targetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY
- local targetType = DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO
- local targetFlag = DOTA_UNIT_TARGET_FLAG_NO_INVIS
- local unitOrder = FIND_ANY_ORDER
- -- Necessary varaibles
- local counter = 0
- caster.xunjiliehuo_active = true
- local caster_origin = caster:GetAbsOrigin()
- -- local dummy = CreateUnitByName( caster:GetName(), caster:GetAbsOrigin(), false, caster, nil, caster:GetTeamNumber() )
- -- dummy.__isDummy = true
- -- ability:ApplyDataDrivenModifier( caster, dummy, dummyModifierName, {} )
- -- Casting particles
- local castFxIndex = ParticleManager:CreateParticle( particleCastName, PATTACH_CUSTOMORIGIN, caster )
- ParticleManager:SetParticleControl( castFxIndex, 0, targetPoint )
- ParticleManager:SetParticleControl( castFxIndex, 1, Vector( radius, 0, 0 ) )
- Timer( 0.1, function()
- ParticleManager:DestroyParticle( castFxIndex, false )
- ParticleManager:ReleaseParticleIndex( castFxIndex )
- end
- )
- -- Start function
- local castFxIndex = ParticleManager:CreateParticle( particleCastName, PATTACH_CUSTOMORIGIN, caster )
- local units = FindUnitsInRadius(
- caster:GetTeamNumber(), targetPoint, caster, radius, targetTeam,
- targetType, targetFlag, unitOrder, false
- )
- for _, target in pairs( units ) do
- counter = counter + 1
- if counter >= max_target then
- counter = max_target
- break
- end
- ability:ApplyDataDrivenModifier( caster, target, modifierTargetName, {} )
- Timer( counter * attack_interval, function()
- -- Only jump to it if it's alive
- if target:IsAlive() then
- -- Create trail particles
- local trailFxIndex = ParticleManager:CreateParticle( particleTrailName, PATTACH_CUSTOMORIGIN, target )
- ParticleManager:SetParticleControl( trailFxIndex, 0, target:GetAbsOrigin() )
- ParticleManager:SetParticleControl( trailFxIndex, 1, caster:GetAbsOrigin() )
- Timer( 0.1, function()
- ParticleManager:DestroyParticle( trailFxIndex, false )
- ParticleManager:ReleaseParticleIndex( trailFxIndex )
- return nil
- end
- )
- -- Move hero there
- -- FindClearSpaceForUnit( caster, target:GetAbsOrigin(), false )
- caster:PerformAttack( target, true, true, true, false, true, false, true)
- -- 造成当前攻击升级等级 * 敏捷系数的伤害
- -- ????
- -- Slash particles
- local slashFxIndex = ParticleManager:CreateParticle( particleSlashName, PATTACH_ABSORIGIN_FOLLOW, target )
- StartSoundEvent( slashSound, caster )
- Timer( 0.1, function()
- ParticleManager:DestroyParticle( slashFxIndex, false )
- ParticleManager:ReleaseParticleIndex( slashFxIndex )
- StopSoundEvent( slashSound, caster )
- return nil
- end
- )
- end
- return nil
- end
- )
- end
- -- Return caster to origin position
- Timer( ( counter + 1 ) * attack_interval, function()
- FindClearSpaceForUnit( caster, caster_origin, false )
- -- dummy:RemoveSelf()
- caster:RemoveModifierByName( casterModifierName )
- caster.xunjiliehuo_active = false
- return nil
- end
- )
- end
Advertisement
Add Comment
Please, Sign In to add comment