|
本帖最后由 Simonade 于 2013-7-21 23:07 编辑
在查看“jass已知的bug”中也没有看到类似的bug存在。。。
globals
hashtable h=InitHashtable()
endglobals
//========================================================================
function Scale takes integer T returns nothing
local unit dummy=LoadUnitHandle(h,0,0)
call SetUnitScale(dummy,3.0+T*0.0075,3.0+T*0.0075,3.0+T*0.0075)
set dummy=null
endfunction
//=========================================================================
function IsDrop takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(h,0,0))) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)
endfunction
//=========================================================================
function Grow takes nothing returns nothing
local timer t=GetExpiredTimer()
local location point=LoadLocationHandle(h,GetHandleId(t),0)
local unit dummy=LoadUnitHandle(h,0,0)
local integer T=LoadInteger(h,GetHandleId(t),10)
local integer n=LoadInteger(h,GetHandleId(t),11)
local group g=CreateGroup()
local unit u
local location loc
local real dist
local real ang
set T=T+1
call SaveInteger(h,GetHandleId(t),10,T)
call Scale(T)
call GroupEnumUnitsInRangeOfLoc(g,point,800.0+2.0*T+150.0*n,Condition(function IsDrop))//主要帮瞧瞧这个地方为啥会失效呢
set n=0
loop
set u=FirstOfGroup(g)
exitwhen u==null
set loc=GetUnitLoc(u)
set dist=SquareRoot(Pow(GetLocationX(point)-GetLocationX(loc),2.0)+Pow(GetLocationY(point)-GetLocationY(loc),2.0))
set ang=Atan2(GetLocationY(point)-GetLocationY(loc),GetLocationX(point)-GetLocationX(loc))
if dist>50 then
call SetUnitX(u,GetLocationX(loc)+(5.0+0.0375*T+200.0/(dist+1.0))*Cos(ang+(80.0-T*0.125)*bj_DEGTORAD))//(15.0+n/1000.0)
call SetUnitY(u,GetLocationY(loc)+(5.0+0.0375*T+200.0/(dist+1.0))*Sin(ang+(80.0-T*0.125)*bj_DEGTORAD))//(15.0+n/1000.0)
else
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)*0.5)
call SetUnitPosition(u,-22115.6,-23597.5)
endif
call RemoveLocation(loc)
call GroupRemoveUnit(g,u)
if GetUnitAbilityLevel(u,'B004')>0 then
call UnitDamageTarget(dummy,u,0.5+n*0.5+500.0/(dist+0.01),false,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)//没有使用ForGroup的正常版
endif
set u=null
set loc=null
set n=n+1
endloop
call SaveInteger(h,GetHandleId(t),11,n)
if T==400 then
call PauseTimer(t)
call DestroyTimer(t)
call RemoveLocation(point)
call DestroyEffect(LoadEffectHandle(h,GetHandleId(point),0))
call FlushChildHashtable(h,GetHandleId(point))
call FlushChildHashtable(h,GetHandleId(t))
call RemoveUnit(dummy) //LoadUnitHandle(h,0,0)
endif
call BJDebugMsg("单位组单位数量"+I2S(n))
set t=null
set point=null
set dummy=null
set g=null
endfunction
//=======================================================
function Start takes nothing returns nothing
local timer t
local location point
local unit dummy
local effect eff1
if GetSpellAbilityId()!='A006' then
return
endif
set point=GetSpellTargetLoc()
set eff1=AddSpecialEffect("war3mapImported\\Black.mdl",GetLocationX(point),GetLocationY(point))
set dummy=CreateUnit(GetOwningPlayer(GetTriggerUnit()),'e002',GetLocationX(point),GetLocationY(point),0.0)
call SaveEffectHandle(h,GetHandleId(point),0,eff1)
call SaveUnitHandle(h,0,0,dummy)
set t=CreateTimer()
call SaveLocationHandle(h,GetHandleId(t),0,point)
call TimerStart(t,0.05,true,function Grow)
set t=null
set point=null
set dummy=null
set eff1=null
endfunction
//===========================================================================
function InitTrig_blackhole takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function Start)
set t=null
endfunction
//====================================================超级分割线
//====================================================超级分割线 上面的可以用;下面的不能用(进入游戏执行无效)
//====================================================超级分割线
globals
hashtable h=InitHashtable()
endglobals
//========================================================================
function Ct takes nothing returns nothing
local integer n=LoadInteger(h,0,1)
set n=n+1
call SaveInteger(h,0,1,n)
endfunction
//========================================================================
function Scale takes integer n returns nothing
local unit dummy=LoadUnitHandle(h,0,0)
call SetUnitScale(dummy,3.0+n*0.15,3.0+n*0.15,3.0+n*0.15)
set dummy=null
endfunction
//=========================================================================
function IsDrop takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(h,0,0))) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)
endfunction
//=========================================================================
function Grow takes nothing returns nothing
local timer t=GetExpiredTimer()
local location point=LoadLocationHandle(h,GetHandleId(t),0)
local unit dummy=LoadUnitHandle(h,0,0)
local integer n
local real dist
local integer T=LoadInteger(h,GetHandleId(t),10)
local group g=CreateGroup()
local unit u
local location loc
local real ang
set T=T+1
call SaveInteger(h,GetHandleId(t),10,T)
call BJDebugMsg("位置一一一一"+I2S(n)) //使用ForGroup后只能显示这里的Debug信息了。。。后面的语句都直接返回了
call GroupEnumUnitsInRange(g,GetLocationX(point),GetLocationY(point),800.0+50.0*n,Condition(function IsDrop))
call BJDebugMsg("位置二二二二二二二二二二"+I2S(n))
call ForGroup(g,function Ct)
set n=LoadInteger(h,0,1)
call BJDebugMsg("位置三三三三三三三三三三三三三三三三三三三三"+I2S(n))
call Scale(n)
loop
set u=FirstOfGroup(g)
exitwhen u==null
set loc=GetUnitLoc(u)
set dist=SquareRoot(Pow(GetLocationX(point)-GetLocationX(loc),2.0)+Pow(GetLocationY(point)-GetLocationY(loc),2.0))
set ang=Atan2(GetLocationY(point)-GetLocationY(loc),GetLocationX(point)-GetLocationX(loc))
call SetUnitX(u,GetLocationX(loc)+(8.0+n*2.0+600.0/(dist+1.0))*Cos(ang+1.0833-T*0.0025))//(15.0+n/1000.0)
call SetUnitY(u,GetLocationY(loc)+(8.0+n*2.0+600.0/(dist+1.0))*Sin(ang+1.0833-T*0.0025))//(15.0+n/1000.0)
call RemoveLocation(loc)
call GroupRemoveUnit(g,u)
if GetUnitAbilityLevel(u,'B004')>0 then
call UnitDamageTarget(dummy,u,0.5+n*0.05+500.0/(dist+1.0),false,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set u=null
set loc=null
endloop
call SaveInteger(h,0,1,0)
if T==420 then
call PauseTimer(t)
call DestroyTimer(t)
call RemoveLocation(point)
call DestroyEffect(LoadEffectHandle(h,GetHandleId(point),0))//call DestroyEffect(LoadEffectHandle(h,GetHandleId(point),1))
call FlushChildHashtable(h,GetHandleId(point))
call FlushChildHashtable(h,GetHandleId(t))
call RemoveUnit(dummy)
endif
call BJDebugMsg("单位组单位数量"+I2S(n))
set t=null
set point=null
set dummy=null
set g=null
endfunction
//=======================================================
function Start takes nothing returns nothing
local timer t
local location point
local unit dummy
local effect eff1
if GetSpellAbilityId()!='A006' then
return
endif
set point=GetSpellTargetLoc()
set eff1=AddSpecialEffect("war3mapImported\\Black.mdl",GetLocationX(point),GetLocationY(point))
set dummy=CreateUnit(GetOwningPlayer(GetTriggerUnit()),'e002',GetLocationX(point),GetLocationY(point),0.0)
call SaveEffectHandle(h,GetHandleId(point),0,eff1)
call SaveUnitHandle(h,0,0,dummy)
set t=CreateTimer()
call SaveLocationHandle(h,GetHandleId(t),0,point)
call TimerStart(t,0.05,true,function Grow)
set t=null
set point=null
set dummy=null
set eff1=null
endfunction
//===========================================================================
function InitTrig_blackholeII takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function Start)
set t=null
endfunction
|
|