|
发表于 2010-7-16 19:40:25
|
显示全部楼层
楼主你自己有负责人吗?
问出这种问题,还不是问原作者的,你要真想学JASS,自己看教程,或者直接提问都可以
你要想知道guo是怎么做的,我也告诉你了,拆开他的函数自己看
[jass]
function YDWETimerDestroyEffect takes real time,effect e returns nothing
local integer N=0
local integer i=0
if time==0 then
call DestroyEffect(e)
else
set N=TimerSystem_Steps+R2I(time/TimerSystem_Timeout)
set i=YDWEGetIntegerByString("YDWETimerDestroyEffect"+I2S(N),"DestroyEffectNumber")
set i=i+1
call YDWESaveIntegerByString("YDWETimerDestroyEffect"+I2S(N),"DestroyEffectNumber",i)
call YDWESaveEffectByString("YDWETimerDestroyEffect"+I2S(N),I2S(i),e)
call YDWETimerSystem(time)
endif
endfunction
function YDWETimerPatternDamage takes real x, real y returns nothing
local operate k = Temp_Struct
local group opt = CreateGroup()
local unit f=null
local unit u=null
local string part=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_part")
local string path=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_dsfx")
call GroupEnumUnitsInRange(opt, x, y, coll, null)
loop
set f = FirstOfGroup(opt)
exitwhen f == null
if IsUnitInGroup(f, k.g) == false then
if YDWETimerPatternEnemyFilter(f, k.u) then
call GroupAddUnit(k.g, f)
call UnitDamageTarget(k.u, f, k.data, true, true, TimerPattern_at, TimerPattern_dt, TimerPattern_wt)
call YDWETimerDestroyEffect( 2, AddSpecialEffectTarget(path, f, part) )
if not(k.recyclable) then
if GetUnitState(f, UNIT_STATE_LIFE) > 0.405 then
call YDWETimerPatternDummyCreateAider(k.u, x, y, allote, 0., k.dep, k.lord, f, 0., 0., k.order)
endif
call YDWETimerPatternRetrieve(k.u, k.perish)
call k.destroy()
//debug call BJDebugMsg("A one-time.")
endif
endif
endif
call GroupRemoveUnit(opt, f)
endloop
call DestroyGroup(opt)
set opt = null
set f = null
endfunction
function YDWETimerPatternTreeKill takes nothing returns nothing
local destructable d = GetEnumDestructable()
if GetWidgetLife(d) > 0.405 then
call KillDestructable(d)
endif
set d = null
endfunction
function YDWETimerPatternTreeFilter takes nothing returns boolean
local integer id = GetDestructableTypeId(GetFilterDestructable())
return id == 'LTlt' or id == 'ATtr' or id == 'BTtw' or id == 'KTtw' /*
*/or id == 'YTft' or id == 'JTct' or id == 'YTst' or id == 'YTct' /*
*/or id == 'YTwt' or id == 'JTtw' or id == 'DTsh' or id == 'FTtw' /*
*/or id == 'CTtr' or id == 'ITtw' or id == 'NTtw' or id == 'OTtw' /*
*/or id == 'ZTtw' or id == 'WTst' or id == 'GTsh' or id == 'VTlt' /*
*/or id == 'WTtw' or id == 'ATtc' or id == 'BTtc' or id == 'CTtc' /*
*/or id == 'ITtc' or id == 'NTtc' or id == 'ZTtc'
endfunction
function YDWETimerPatternRetrieve takes unit u, boolean wither returns nothing
if not(wither) then
call SetUnitFlyHeight(u, GetUnitDefaultFlyHeight(u), 5000.)
call SetUnitAnimation(u, "stand")
call SetUnitTimeScale(u, 1)
if (GetLocalPlayer() == GetOwningPlayer(u)) then
call ClearSelection()
call SelectUnit(u, true)
endif
else
call RemoveUnit(u)
endif
endfunction
function YDWETimerPatternMove takes nothing returns nothing
local operate k
local integer i = 1
local real x =0
local real y =0
local boolexpr b=null
local rect r =null
local location stupid=null
local string osfx =null
local string wsfx =null
local string part =null
if Total == 0 then
//debug call BJDebugMsg("Timer paused.")
call PauseTimer(t)
set paused = true
endif
loop
exitwhen i > Total
set k = Structs
if k.i != null and k.i != 0 then
if (GetLocalPlayer() == GetOwningPlayer(k.u)) then
call SelectUnit(k.u, false)
endif
if k.volume then
//debug call BJDebugMsg("Pathable without terrain.")
if (IsTerrainPathable(GetUnitX(k.u), GetUnitY(k.u), PATHING_TYPE_WALKABILITY) == true) then
//call DestroyEffect(AddSpecialEffectLoc(TimerPattern_osfx, GetUnitLoc(k.u)))
set osfx=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_osfx")
if osfx!=null then
set part=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_part")
call DestroyEffect(AddSpecialEffectTarget(osfx,k.u,part))
endif
set Structs = Structs[Total]
set Total = Total - 1
set i = i - 1
set k.i = 0
set k.step = 0.
call YDWETimerPatternRetrieve(k.u, k.perish)
call k.destroy()
set k.u = null
endif
endif
set x = GetUnitX(k.u) + k.xvel
set y = GetUnitY(k.u) + k.yvel
if k.aviate then
set stupid = Location(x, y)
set k.z = k.z - GetLocationZ(stupid)
call SetUnitFlyHeight(k.u, k.z, 0.)
set k.z = k.z - k.zred
if k.z > GetUnitDefaultFlyHeight(k.u) then
set k.zred = k.zred + (grav / (1. / k.gap)) * 2.
else
set k.zred = 0.
call SetUnitFlyHeight(k.u, GetUnitDefaultFlyHeight(k.u), 500.)
endif
if k.z < 0. then
set k.z = 0.
set k.zred = 0.
endif
set k.z = k.z + GetLocationZ(stupid)
call RemoveLocation(stupid)
set stupid = null
endif
call SetUnitX(k.u, x)
call SetUnitY(k.u, y)
set k.sfx = k.sfx + 1
if k.follow then
if k.u != null and k.sfx == 1 and GetUnitFlyHeight(k.u) < 5. then
if IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) then
call DestroyEffect(AddSpecialEffect(TimerPattern_gsfx, x, y))
else
set wsfx=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_wsfx")
if wsfx!=null then
set part=YDWEGetStringByString(I2S(YDWEH2I(k.u)),"TimerPattern_part")
call DestroyEffect(AddSpecialEffectTarget(wsfx,k.u,part))
endif
//call DestroyEffect(AddSpecialEffect(TimerPattern_wsfx, x, y))
endif
endif
endif
if k.sfx == 5 then
set k.sfx = 0
endif
if k.xvel * k.xvel + k.yvel * k.yvel < 2. then
if (GetUnitFlyHeight(k.u) - GetUnitDefaultFlyHeight(k.u)) * (GetUnitFlyHeight(k.u) - GetUnitDefaultFlyHeight(k.u)) < 5. then
set Structs = Structs[Total]
set Total = Total - 1
set i = i - 1
set k.i = 0
set k.step = 0.
call YDWETimerPatternRetrieve(k.u, k.perish)
call k.destroy()
set k.u = null
endif
else
set k.xvel = k.xvel - k.xvelred
set k.yvel = k.yvel - k.yvelred
endif
if k.killtrees then
set b = Condition(function YDWETimerPatternTreeFilter)
set r = Rect(x - coll, y - coll, x + coll, y + coll)
call EnumDestructablesInRect(r, b, function YDWETimerPatternTreeKill)
call DestroyBoolExpr(b)
set b = null
call RemoveRect(r)
set r = null
endif
if k.hostility then
set Temp_Struct = k
call YDWETimerPatternDamage(x, y)
endif
if k.parabola then
set k.step = k.step + seg
set k.height = k.apex * k.step - (k.apex / bot) * (k.step * k.step)
call SetUnitFlyHeight(k.u, k.sheight+k.height, 0.)
endif
if x > TimerPattern_MAX_X or x < TimerPattern_MIN_X or y > TimerPattern_MAX_Y or y < TimerPattern_MIN_Y then
set Structs = Structs[Total]
set Total = Total - 1
set i = i - 1
set k.i = 0
set k.step = 0.
call YDWETimerPatternRetrieve(k.u, k.perish)
call k.destroy()
set k.u = null
endif
set i = i + 1
endif
endloop
endfunction
function YDWETimerPatternSustain takes unit u, string id, integer pair, integer allah, real dist, real a, real time, real interval, real damage, real h, boolean killtrees, boolean injure, boolean cycle, boolean path, boolean ruin, boolean capriole, boolean sequel returns nothing
local operate k = operate.create()
local location stupid = Location(GetUnitX(u), GetUnitY(u))
set k.g = CreateGroup()
set k.u = u
set k.order = id
set k.dep = pair
set k.lord = allah
set k.gap = interval
set k.data = damage
set k.apex = h
set k.xvel = 2 * (dist * Cos(a * .01745)) / (time / interval + 1)
set k.yvel = 2 * (dist * Sin(a * .01745)) / (time / interval + 1)
set k.xvelred = k.xvel / (time / interval)
set k.yvelred = k.yvel / (time / interval)
set k.zred = 0.
set k.z = GetUnitFlyHeight(u) + GetLocationZ(stupid)
set k.killtrees = killtrees
set k.hostility = injure
set k.recyclable = cycle
set k.volume = path
set k.perish = ruin
set k.parabola = capriole
set k.aviate = true // canfly
set k.follow = sequel
set k.i = 1
set k.sfx = 0
set k.sheight = GetUnitFlyHeight(u)
set Total = Total + 1
set Structs[Total] = k
call SetUnitTimeScale(u, 1.)
//call SetUnitTimeScale(u, rate)
if capriole then
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
endif
if paused then
//debug call BJDebugMsg("Timer resumed.")
call TimerStart(t, interval, true, function YDWETimerPatternMove)
set paused = false
endif
call RemoveLocation(stupid)
set stupid = null
//debug call BJDebugMsg("Knockback started!")
endfunction
function YDWETimerPatternJumpAttack takes unit u,real face,real dis,real lasttime,real timeout,real high,real damage,string part,string dsfx returns nothing
local boolean injure=false
call YDWESaveStringByString(I2S(YDWEH2I(u)),"TimerPattern_part",part) //两个存储函数,我就不拆了,你自己理解
call YDWESaveStringByString(I2S(YDWEH2I(u)),"TimerPattern_dsfx",dsfx)
if damage>0 then
set injure=true
endif
call YDWETimerPatternSustain(u,null,0,0,dis,face,lasttime,timeout,damage,high,false,injure,true,false, false,true,false)
endfunction
[/jass]
函数我只能给你拆到这里,不然的话恐怕会把他的整个系统都挖出来,其余的你自己看着办吧 |
|