|
发表于 2008-4-27 21:26:54
|
显示全部楼层
[codes=jass]function H2I takes handle h returns integer
return h
return 0
endfunction
function SetHandleHandle takes handle subject,string name,handle object returns nothing
call StoreInteger(udg_gamecache,I2S(H2I(subject)),name,H2I(object))
endfunction
function GetHandleUnit takes handle subject,string name returns unit
return GetStoredInteger(udg_gamecache,I2S(H2I(subject)),name)
return null
endfunction
function Ewsp_LOOP takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array tempUnit
local real array angle
local integer i = 0
local unit orderUnit=GetHandleUnit(t,"orderUnit")
local real UnitLocX = GetUnitX(orderUnit)
local real UnitLocY = GetUnitY(orderUnit)
local real tempLocX
local real tempLocY
local real a=0
local real b=0
local real zspeed = GetStoredInteger(udg_gamecache,I2S(H2I(t)),"zspeed")
local real zangle = GetStoredInteger(udg_gamecache,I2S(H2I(t)),"zangle")
local real xyspeed = GetStoredInteger(udg_gamecache,I2S(H2I(t)),"xyspeed")
local real xyangle = GetStoredInteger(udg_gamecache,I2S(H2I(t)),"xyangle")
local real radius = GetStoredReal(udg_gamecache,I2S(H2I(t)),"radius")
local real N = GetStoredReal(udg_gamecache,I2S(H2I(t)),"number")
local real S = GetStoredReal(udg_gamecache,I2S(H2I(t)),"speed")
local integer steps= GetStoredInteger(udg_gamecache,I2S(H2I(t)),"steps")
local integer count= GetStoredInteger(udg_gamecache,I2S(H2I(t)),"count")
local location point_a
local location point_b
local real angle_a_b
local real distance_a_b
if steps<count then
set steps=steps+1
call StoreInteger(udg_gamecache,I2S(H2I(t)),"steps",steps)
loop
exitwhen i>N
set i = i+1
set a = steps * xyspeed + xyangle
set b = steps * zspeed + zangle
set tempUnit = GetHandleUnit(t,I2S(1000+i))
set angle = i*360/N + steps*S
set point_a = Location(UnitLocX,UnitLocY)
set point_b = Location(UnitLocX + radius*CosBJ(angle)*CosBJ(b) , UnitLocY + radius*SinBJ(angle))
set angle_a_b = AngleBetweenPoints(point_a,point_b)
set distance_a_b = DistanceBetweenPoints(point_a,point_b)
set tempLocX = UnitLocX + distance_a_b * CosBJ(angle_a_b + a)
set tempLocY = UnitLocY + distance_a_b * SinBJ(angle_a_b + a)
call SetUnitX(tempUnit,tempLocX)
call SetUnitY(tempUnit,tempLocY)
call SetUnitFlyHeightBJ( tempUnit,radius*CosBJ(angle)*SinBJ(b)+400, 0.00 )
set tempUnit=null
set point_a = null
set point_b = null
endloop
call RemoveLocation(point_a)
call RemoveLocation(point_b)
else
set i=0
loop
set i=i+1
exitwhen i>N
call RemoveUnit(GetHandleUnit(t,I2S(1000+i)))
endloop
call FlushStoredMission(udg_gamecache,I2S(H2I(t)))
call DestroyTimer(t)
call SetUnitFlyHeightBJ(orderUnit,1, 0.00 )
call UnitRemoveAbilityBJ( 'Arav', orderUnit)
call SetUnitScalePercent( orderUnit, 100, 100, 100 )
call RemoveLocation(point_a)
call RemoveLocation(point_b)
endif
set orderUnit=null
endfunction
function CreateEwsp takes unit Hero,integer ewsp,integer Z,integer ZAngle,integer XY,integer XYAngle,integer N,real R,real T,real I,real S returns nothing
local unit orderUnit=Hero
local real UnitLocX = GetUnitX(orderUnit)
local real UnitLocY = GetUnitY(orderUnit)
local unit array tempUnit
local player Masterplayer = GetOwningPlayer(orderUnit)
local timer t=CreateTimer()
local real interval=I
local real lasttime=T
local real radius=R
local real tempLocX
local real tempLocY
local integer i=0
local integer steps=R2I(lasttime/interval)
call UnitAddAbilityBJ( 'Arav', Hero)
call SetUnitFlyHeightBJ(Hero,400, 0.00 )
call StoreInteger(udg_gamecache,I2S(H2I(t)),"zspeed",Z)
call StoreInteger(udg_gamecache,I2S(H2I(t)),"zangle",ZAngle)
call StoreInteger(udg_gamecache,I2S(H2I(t)),"xyspeed",XY)
call StoreInteger(udg_gamecache,I2S(H2I(t)),"xyangle",XYAngle)
call StoreInteger(udg_gamecache,I2S(H2I(t)),"count",steps)
set steps=0
call StoreInteger(udg_gamecache,I2S(H2I(t)),"steps",steps)
call StoreReal(udg_gamecache,I2S(H2I(t)),"radius",radius)
call StoreReal(udg_gamecache,I2S(H2I(t)),"number",N)
call StoreReal(udg_gamecache,I2S(H2I(t)),"speed",S)
loop
set i=i+1
exitwhen (i>N)
set tempLocX = UnitLocX + radius*Cos(2*i*bj_PI/N)
set tempLocY = UnitLocY + radius*Sin(2*i*bj_PI/N)
set tempUnit=CreateUnit(Masterplayer,ewsp,tempLocX,tempLocY,0)
call SetUnitVertexColorBJ(tempUnit,GetRandomReal(0,100),GetRandomReal(0,100),GetRandomReal(0,100),0)
call SetHandleHandle(t,I2S(1000+i),tempUnit)
call UnitGenerateAlarms( tempUnit, false )
endloop
call SetHandleHandle(t,"orderUnit",orderUnit)
call TimerStart(t,interval,true,function Ewsp_LOOP)
set t=null
set orderUnit=null
set i=0
loop
set i=i+1
exitwhen (i>N)
set tempUnit=null
endloop
endfunction
function Trig_a2_Actions takes nothing returns nothing
local integer i = 0
local integer array ewsp
local integer count = GetRandomInt(1,2)
local unit hero =null
if ( not ( GetSpellAbilityId() == 'AOww' ) ) then
return false
endif
set ewsp[0] = 'e001'
set ewsp[1] = 'e002'
set ewsp[2] = 'e000'
set ewsp[3] = 'e003'
set hero = GetTriggerUnit()
call SetUnitScalePercent( hero, 2, 2, 2 )
loop
exitwhen i > count
//CreateEwsp(触发单位,马甲类型,垂直翻转速度,垂直初始角度,水平旋转角度,水平初始角度,马甲数量,半径,持续时间,timer周期,水平自转速度)
call CreateEwsp(hero,ewsp[GetRandomInt(0,3)],GetRandomInt(0,6),GetRandomInt(0,9)*10,GetRandomInt(0,6),GetRandomInt(0,9)*10,24,GetRandomReal(2,4)*100,8,0.04,GetRandomInt(0,6))
//call CreateEwsp(hero,ewsp[1],3,0,0,0,24,250,8,0.04,6)
//call CreateEwsp(hero,ewsp[1],3,60,0,0,24,250,8,0.04,6)
//call CreateEwsp(hero,ewsp[1],3,120,0,0,24,250,8,0.04,6)
//call CreateEwsp(hero,ewsp[1],0,0,3,90,24,250,8,0.04,6)
//call CreateEwsp(hero,ewsp[1],0,60,3,90,24,250,8,0.04,6)
//call CreateEwsp(hero,ewsp[1],0,120,3,90,24,250,8,0.04,6)
set i = i+1
endloop
endfunction[/codes] |
|