function Getsuga_Tenshou_Loop takes nothing returns nothing local timer t = GetExpiredTimer () local integer i = GetHandleId(t) local unit dummy = LoadUnitHandle(udg_Hash,i,1) local real Range = LoadReal(udg_Hash,i,2) local real MAXRange = LoadReal(udg_Hash,i,3) local real Speed = LoadReal(udg_Hash,i,4) local real angle = LoadReal(udg_Hash,i,5) local real damage = LoadReal(udg_Hash,i,6) local group DG = LoadGroupHandle(udg_Hash,i,7) local group TG = CreateGroup() local real x1 = GetUnitX(dummy) local real y1 = GetUnitY(dummy) local real x3 = (x1 + Speed * Cos(angle)) local real y3 = (y1 + Speed * Sin(angle)) local unit u
call SetUnitPosition(dummy,x3,y3) set Range = Range + Speed call SaveReal(udg_Hash,GetHandleId(t),2,Range)
call GroupEnumUnitsInRange(TG, x3, y3, 256., null) loop set u = FirstOfGroup(TG) if IsUnitInGroup(u, DG) == false and IsUnitEnemy(u,GetOwningPlayer(dummy)) == true then call UnitDamageTarget(dummy, u, damage, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null) call GroupAddUnit(DG, u) endif call GroupRemoveUnit(TG, u) exitwhen u == null endloop
call SaveGroupHandle(udg_Hash,i,7,DG)
if Range >= MAXRange then call PauseTimer(t) call DestroyTimer(t) call RemoveUnit(dummy) endif
call DestroyGroup(TG) call DestroyGroup(DG) set TG = null set DG = null set dummy = null endfunction
function Getsuga_Tenshou_Act takes nothing returns nothing //НЕ ТРОГАТЬ local unit UnitCaster = GetSpellAbilityUnit() local real x1 = GetUnitX(UnitCaster) local real y1 = GetUnitY(UnitCaster) local real x2 = GetLocationX(GetSpellTargetLoc()) local real y2 = GetLocationY(GetSpellTargetLoc()) local real angle = Atan2(y2 - y1, x2 - x1) //НАСТРОИТЬ ПОД СЕБЯ local integer SpellID = 'A000' local integer DummyType = 'h000' local integer lvl = (GetUnitAbilityLevel(UnitCaster,SpellID)) local real Damage = 150 * lvl local real Speed = 25 + 3 * lvl local real MAXRange = 800 + 200 * lvl //ОПЯТЬ НЕ ТРОГАТЬ local real Range = 0 local real x3 = (x1 + Speed * Cos(angle)) local real y3 = (y1 + Speed * Sin(angle)) local timer t = CreateTimer() local integer i = GetHandleId(t) local group DG = CreateGroup() local unit dummy = CreateUnit(GetOwningPlayer(UnitCaster),DummyType,x3,y3,GetUnitFacing(UnitCaster))
set t = null set UnitCaster = null set dummy = null call DestroyGroup(DG) set DG = null endfunction
function InitTrig_Getsuga_Tenshou takes nothing returns nothing local trigger t = CreateTrigger( ) local integer i = 0 loop call TriggerRegisterPlayerUnitEvent(t, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null) set i = i + 1 exitwhen i == 16 endloop
call TriggerAddCondition( t, Condition( function Getsuga_Tenshou_Con ) ) call TriggerAddAction( t, function Getsuga_Tenshou_Act )