|
写得比较烂,将就看吧~~~~·
本来想做上限制步数的,想想还是算了吧~~
[jass]function H2I takes handle H returns integer
return H
return 0
endfunction
function I2U takes integer I returns unit
return I
return null
endfunction
function I2Tr takes integer I returns trigger
return I
return null
endfunction
function I2Re takes integer I returns rect
return I
return null
endfunction
function getrandomn takes integer Mint,integer mint returns integer
local integer n=0
local integer b=0
loop
set n=GetRandomInt(Mint,mint)
set b=GetStoredInteger(udg_GC,"piont",I2S(n))
exitwhen b<4
endloop
return n
endfunction
function creatlost takes nothing returns nothing
local integer i=0
local integer j=0
local unit array waygateu
local rect array reg
call Cheat("iseedeadpeople")
set udg_GC = InitGameCache("gamecache.w3v")
call RegionAddRect( udg_rectout, gg_rct_lost )
call RegionAddRect( udg_rectout, gg_rct_out )
loop
exitwhen i>3
call StoreReal(udg_GC,I2S(i),"x",(-2050+1160*i))
call StoreReal(udg_GC,I2S(i),"y",(905-1160*i))
set i=i+1
endloop
set i=0
loop
exitwhen i>3
set j=0
loop
exitwhen j>3
set waygateu[i*16+j*4+0]=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',GetStoredReal(udg_GC,I2S(i),"x")+350,GetStoredReal(udg_GC,I2S(j),"y"),0)
set waygateu[i*16+j*4+1]=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',GetStoredReal(udg_GC,I2S(i),"x"),GetStoredReal(udg_GC,I2S(j),"y")+350,0)
set waygateu[i*16+j*4+2]=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',GetStoredReal(udg_GC,I2S(i),"x")-350,GetStoredReal(udg_GC,I2S(j),"y"),0)
set waygateu[i*16+j*4+3]=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',GetStoredReal(udg_GC,I2S(i),"x"),GetStoredReal(udg_GC,I2S(j),"y")-350,0)
set reg[i*4+j]=Rect((GetStoredReal(udg_GC,I2S(i),"x")-450),(GetStoredReal(udg_GC,I2S(j),"y")+450),(GetStoredReal(udg_GC,I2S(i),"x")+450),(GetStoredReal(udg_GC,I2S(j),"y")-450))
call StoreInteger(udg_GC,"rect",I2S(i*4+j),H2I(reg[i*4+j]))
set j=j+1
endloop
set i=i+1
endloop
set i=0
loop
exitwhen i>63
call StoreInteger(udg_GC,"Wg",I2S(i),H2I(waygateu))
set waygateu=null
set i=i+1
endloop
set i=0
endfunction
function Tri_Action takes nothing returns nothing
local unit array wg
local integer i=0
local integer j=0
loop
exitwhen i>3
set j=GetStoredInteger(udg_GC,I2S(H2I(GetTriggerUnit())),I2S(H2I(GetTriggeringTrigger())))
set wg=I2U(GetStoredInteger(udg_GC,"Wg",I2S(j*4+i)))
call WaygateActivate(wg,TRUE)
call WaygateSetDestination(wg,GetStoredReal(udg_GC,I2S(H2I(GetTriggeringTrigger())*10+i),"x"),GetStoredReal(udg_GC,I2S(H2I(GetTriggeringTrigger())*10+i),"y"))
set wg=null
set i=i+1
endloop
set i=0
endfunction
function tLev_Action takes nothing returns nothing
call StoreBoolean(udg_GC,I2S(H2I(GetTriggerUnit())),"out",false)
endfunction
function fLev_Action takes nothing returns nothing
local integer i=0
local trigger array trg
loop
exitwhen i>33
set trg=I2Tr(GetStoredInteger(udg_GC,I2S(H2I(GetTriggerUnit())),I2S(i)))
call TriggerClearActions(trg)
call DestroyTrigger(trg)
set trg=null
set i=i+1
endloop
set i=0
if GetStoredBoolean(udg_GC,I2S(H2I(GetTriggerUnit())),"out") then
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "以非正当方式逃离迷宫,请接受惩罚!" )
call TriggerExecute( gg_trg_t )
endif
endfunction
function Lev_Action takes nothing returns nothing
local unit array wg
local integer i=0
local integer j=0
loop
exitwhen i>3
set j=GetStoredInteger(udg_GC,I2S(H2I(GetTriggerUnit())),I2S(H2I(GetTriggeringTrigger())))
set wg=I2U(GetStoredInteger(udg_GC,"Wg",I2S(j*4+i)))
call WaygateActivate(wg,false)
set i=i+1
set wg=null
endloop
set i=0
endfunction
function initlost takes unit who,boolean b returns nothing
local location array pnt
local rect array reg
local trigger array trg
local integer i =0
local integer n=0
if b then
call DisplayTextToPlayer( GetOwningPlayer(who), 0, 0, "迷宫初始化开始!" )
else
call DisplayTextToPlayer( GetOwningPlayer(who), 0, 0, "迷宫正在被重置!" )
endif
call StoreBoolean(udg_GC,I2S(H2I(who)),"out",true)
loop
exitwhen i>15
set reg=I2Re(GetStoredInteger(udg_GC,"rect",I2S(i)))
set pnt = Location(GetStoredReal(udg_GC,I2S(i/4),"x"),GetStoredReal(udg_GC,I2S(ModuloInteger(i, 4)),"y"))
if i==0 then
call StoreInteger(udg_GC,"piont",I2S(i),1)
else
call StoreInteger(udg_GC,"piont",I2S(i),0)
endif
set trg = CreateTrigger()
call TriggerRegisterEnterRectSimple(trg, reg)
call TriggerAddAction( trg, function Tri_Action)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(H2I(trg)),i)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(i),H2I(trg))
set trg[i+16] = CreateTrigger()
call TriggerRegisterLeaveRectSimple(trg[i+16], reg)
call TriggerAddAction( trg[i+16], function Lev_Action)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(H2I(trg[i+16])),i)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(i+16),H2I(trg[i+16]))
set i=i+1
endloop
set i=0
set pnt[16]=Location(2700,2700)
call StoreInteger(udg_GC,"piont",I2S(16),3)
loop
exitwhen i>63
set n = getrandomn(0,16)
call StoreReal(udg_GC,I2S(H2I(trg[R2I(i/4)])*10+ModuloInteger(i, 4)),"x",GetLocationX(pnt[n]))
call StoreReal(udg_GC,I2S(H2I(trg[R2I(i/4)])*10+ModuloInteger(i, 4)),"y",GetLocationY(pnt[n]))
call StoreInteger(udg_GC,"piont",I2S(n),GetStoredInteger(udg_GC,"piont",I2S(n))+1)
set i=i+1
endloop
set i=0
set trg[32] = CreateTrigger()
call TriggerRegisterLeaveRegionSimple(trg[32], udg_rectout)
call TriggerAddAction( trg[32], function fLev_Action)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(32),H2I(trg[32]))
set trg[32] = CreateTrigger()
call TriggerRegisterEnterRectSimple(trg[33], gg_rct_out )
call TriggerAddAction( trg[33], function tLev_Action)
call StoreInteger(udg_GC,I2S(H2I(who)),I2S(33),H2I(trg[33]))
call SetUnitPositionLoc(who,pnt[GetRandomInt(0,15)])
if b then
call DisplayTextToPlayer( GetOwningPlayer(who), 0, 0, "迷宫初始化完成!" )
else
call DisplayTextToPlayer( GetOwningPlayer(who), 0, 0, "迷宫重置完成!" )
endif
loop
exitwhen i>16
call RemoveLocation( pnt )
set trg=null
set trg[i+16]=null
set pnt=null
set i=i+1
endloop
set trg[32]=null
set trg[33]=null
set i=0
endfunction
[/jass] |
评分
-
查看全部评分
|