Name | Type | is_array | initial_value |
Bulwark | group | No | |
Jumpers | hashtable | No | |
JumpersGroup | group | No | |
JumpersGroupBuff | group | No |
function FastMove()
ForGroup(udg_JumpersGroup, function ()
local unit = GetEnumUnit()
local key = GetHandleId(unit)
local loc = LoadLocationHandle(udg_Jumpers, key, 0)
local step = LoadInteger(udg_Jumpers, key, 1)
local dest = LoadLocationHandle(udg_Jumpers, key, 2)
local x0 = GetLocationX(loc)
local y0 = GetLocationY(loc)
local x1 = GetLocationX(dest)
local y1 = GetLocationY(dest)
local dx = x1 - x0
local dy = y1 - y0
local totalSteps = 25
local d = step/totalSteps
local height = 100
SetUnitX(unit, x0 + dx * d)
SetUnitY(unit, y0 + dy * d)
SetUnitFlyHeight(unit,-Pow((step-totalSteps/2)*math.sqrt(height)/totalSteps*2,2)+height,1000)
SetUnitAnimationByIndex(unit, 6)
if step == totalSteps then
BlzSetUnitIntegerFieldBJ(unit, UNIT_IF_MOVE_TYPE, 4)
SetUnitPathing(unit, true)
GroupRemoveUnit(udg_JumpersGroup, unit)
SetUnitAnimationByIndex(unit, 0)
BlzUnitDisableAbility(unit, FourCC("A003"), false, false)
else
SaveInteger(udg_Jumpers, key, 1, step + 1)
end
end)
end
function LeapBuff(unit)
local key = GetHandleId(unit)
local timer = LoadTimerHandle(udg_Jumpers, key, 3)
if not timer then
timer = CreateTimer()
SaveTimerHandle(udg_Jumpers, key, 3, timer)
UnitAddAbility(unit, FourCC("A006"))
UnitAddAbility(unit, FourCC("A004"))
BlzUnitHideAbility(unit, FourCC("A006"),true)
end
TimerStart(timer, 5, false, function()
UnitRemoveAbility(unit, FourCC("A006"))
UnitRemoveAbility(unit, FourCC("A004"))
UnitRemoveBuffBJ(FourCC("B001"), unit)
DestroyTimer(timer)
SaveTimerHandle(udg_Jumpers, key, 3, nil)
end)
SetUnitAbilityLevel(unit, FourCC("A006"), GetUnitAbilityLevel(unit, FourCC("A003")))
SetUnitAbilityLevel(unit, FourCC("A004"), GetUnitAbilityLevel(unit, FourCC("A003")))
end