優化前的指令碼:
//衝鋒技能
function trig_chongfengb_conditions takes nothing returns boolean
if(not(getspellabilityid()=='a06b'))then
return false
endif
return true
endfunction
function trig_chongfengb_actions takes nothing returns nothing
set udg_chongfeng_unit[3]=gettriggerunit()
set udg_chongfeng_jiaodu[3]=anglebetweenpoints(getunitloc(udg_chongfeng_unit[3]),getspelltargetloc())
call createnunitsatloc(1,'o00w',player(3),getunitloc(udg_chongfeng_unit[3]),bj_unit_facing)
call issuepointorderloc(getlastcreatedunit(),"impale",getspelltargetloc())
call setunitpathing(udg_chongfeng_unit[3],false)
call showunithide(udg_chongfeng_unit[3])
call polledwait(0.90)
call setunitpositionloc(udg_chongfeng_unit[3],polarprojectionbj(getunitloc(udg_chongfeng_unit[3]),900.00,udg_chongfeng_jiaodu[3]))
call setunitpathing(udg_chongfeng_unit[3],true)
call showunitshow(udg_chongfeng_unit[3])
call selectunitforplayersingle(udg_chongfeng_unit[3],player(3))
endfunction
function inittrig_chongfengb takes nothing returns nothing
set gg_trg_chongfengb=createtrigger()
call triggerregisterplayerunitevent******(gg_trg_chongfengb,player(3),event_player_unit_spell_effect)
call triggeraddcondition(gg_trg_chongfengb,condition(function trig_chongfengb_conditions))
call triggeraddaction(gg_trg_chongfengb,function trig_chongfengb_actions)
endfunction
優化前對每個玩家都要寫一遍上面的**,而且容易出錯。
優化後的指令碼:
//衝鋒技能觸發器
function chongfeng_actions takes nothing returns nothing
//發動技能的玩家
local player fadong_player = gettriggerplayer()
//施法單位,也就是發動衝鋒技能的武將
local unit fadong_unit = gettriggerunit()
//施法目標座標
local location mubiao_loc = getspelltargetloc()
local real jiaodu = anglebetweenpoints(getunitloc(fadong_unit),mubiao_loc)
call createnunitsatloc(1,'o00w',fadong_player,getunitloc(fadong_unit),bj_unit_facing)
//給單位傳送命令到 點 impale命令
call issuepointorderloc(getlastcreatedunit(),"impale", mubiao_loc)
//設定單位生命計時器
//關閉施法單位碰撞效果,即可以穿人效果
call setunitpathing(fadong_unit,false)
//隱藏施法單位
call showunithide(fadong_unit)
//等待0.9秒
call polledwait(0.90)
//移動單位 到指定座標(立刻)。polarprojectionbj向指定方向位移900
call setunitpositionloc(fadong_unit,polarprojectionbj(getunitloc(fadong_unit),900.00,jiaodu))
//開啟施法單位碰撞效果,即不能穿人
call setunitpathing(fadong_unit,true)
//顯示單位
call showunitshow(fadong_unit)
//玩家選定指定單位
call selectunitforplayersingle(fadong_unit,fadong_player)
endfunction
//判斷是否是發動了衝鋒技能
function chongfeng_conditions takes nothing returns boolean
if(getspellabilityid()=='a06b')then
return true
endif
return false
endfunction
//衝鋒技能觸發器
set gg_jn_chongfeng = createtrigger()
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(1),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(2),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(3),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(4),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(5),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(7),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(8),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(9),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(10),event_player_unit_spell_effect)
call triggerregisterplayerunitevent******(gg_jn_chongfeng,player(11),event_player_unit_spell_effect)
call triggeraddcondition(gg_jn_chongfeng,condition(function chongfeng_conditions))
call triggeraddaction(gg_jn_chongfeng,function chongfeng_actions)
Jass 技能模型定義( ) 半人馬酋長的反擊光環
jass是什麼?語法結構 jass語法結構 function trig functions conditions takes nothing returns boolean if not getunittypeid gettrainedunit n000 then return false endi...
用golang重寫SS帳號獲取指令碼
golang有個很酷的特性可以跨平台編譯生成該平台的二進位制可執行檔案,雖然python也能通過其他工具生成相應平台的二進位制檔案,但是還是覺得太彆扭了,通過golang寫一次,然後生成相應平台的二進位制檔案而且沒有依賴,多酷的事情。這個ss帳號獲取指令碼幹啥滴?參考 還在不斷學習中,可能 寫得不夠...
測試開發必備技能之shell指令碼程式設計二 多測師
shell指令碼練習 1,啟動 關閉 重啟 檢視狀態nginx指令碼 root localhost xiaoshu5 vim xiaoshu5.sh bin bash if 1 start then service nginx start echo start elif 1 stop then se...