function CounterHelixConditions takes nothing returns boolean
return GetRandomInt(1,100) <= 15 and GetUnitAbilityLevel(GetTriggerUnit(), 'BFID') > 0
//replace BFID with your spell's rawcode
endfunction
function CounterHelixFilter takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit t = GetFilterUnit()
if IsUnitEnemy(t,GetOwningPlayer(u)) and not IsUnitType(t,UNIT_TYPE_DEAD) then
call UnitDamageTarget(u,t,75.+25.*GetUnitAbilityLevel(u,'SPID'),true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
//replace SPID with your counter helix spell rawcode
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",t,"origin"))
endif
set u = null
set t = null
return false
endfunction
function CounterHelixActions takes nothing returns nothing
local unit u = GetTriggerUnit()
call GroupEnumUnitsInRange(udg_enumGrp,GetUnitX(u),GetUnitY(u),200.,Filter(function CounterHelixFilter))
call SetUnitAnimation(u,"spin")
call DisableTrigger(GetTriggeringTrigger())
call TriggerSleepAction(.25)
call EnableTrigger(GetTriggeringTrigger())
call SetUnitAnimation(u,"stand")
set u = null
endfunction
function InitTrig_CounterHelix takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function CounterHelixConditions))
call TriggerAddAction(t,function CounterHelixActions)
endfunction