function GroupActions takes nothing returns nothing
local unit target = GetEnumUnit()
local integer h = GetHandleId(target)
local integer id = LoadInteger(BrutalStrikes.hash, h, 1)
call BrutalStrikes(id).update(target)
endfunction
function loopActions takes nothing returns nothing
call ForGroup(BrutalStrikes.myGroup, function GroupActions)
endfunction
struct BrutalStrikes
static hashtable hash
static group myGroup
real counter = 0
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.03, true)
call TriggerAddAction(t, function loopActions)
set hash = InitHashtable()
set myGroup = CreateGroup()
endmethod
static method create takes unit caster, unit target returns thistype
local thistype this = thistype.allocate()
call UnitAddAbility(target, 'A000')
call SaveInteger(hash, GetHandleId(target), 1, this)
call GroupAddUnit(myGroup, target)
return this
endmethod
method update takes unit u returns nothing
set .counter = .counter + 0.03
if .counter >= 5 then
call GroupRemoveUnit(myGroup, u)
call UnitRemoveAbility(u, 'A000')
call deallocate(this)
endif
endmethod
endstruct