function Attack_Filter takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
endfunction
function Attack_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'Acrs'
endfunction
function Attack_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = GetUnitFacing(u) * bj_DEGTORAD
local player p = GetOwningPlayer(u)
local unit t
local real x2
local real y2
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x ,y, 172+150, function Attack_Filter)
loop
set t = FirstOfGroup(bj_lastCreatedGroup)
exitwhen t == null
set x2 = GetUnitX(t)
set y2 = GetUnitY(t)
if IsUnitEnemy(t, p) and IsUnitInRangeXY(t, x, y, 150) and Cos(f-Atan2(y2-y, x2-x)) > 0 then
call UnitDamageTarget(u, t, 50, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_CLAW_HEAVY_SLICE)
call GroupClear(bj_lastCreatedGroup)
else
call GroupRemoveUnit(bj_lastCreatedGroup, t)
endif
endloop
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Attack takes nothing returns nothing
set gg_trg_Attack = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attack, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Attack, Condition( function Attack_Conditions ) )
call TriggerAddAction( gg_trg_Attack, function Attack_Actions )
endfunction