[求助](技能)绝命三连击,制作完毕,但是存在BUG,求解决。
技能名称:绝命三连击技能效果:对下一个攻击目标造成三次致命伤害,分别为2,4,8倍伤害,无视防御和闪避
(攻击中期间如果转移目标或者攻击间隔超过一秒则被打断,效果可以被净化)
目前技能BUG
少放几次没有什么明显的错误,但是如果放多了就会出现错误。
经过测试,以下代码存在问题,它可能会造成缓存储存的混乱,大家给看看,到底哪里存在问题。
代码奉上:
function H2I takes handle h returns integer
return h
return 0
endfunction
function SH takes handle h,string s,handle v returns nothing
if v==null then
call FlushStoredInteger(udg_GC,I2S(H2I(h)),s)
else
call StoreInteger(udg_GC,I2S(H2I(h)),s,H2I(v))
endif
endfunction
function SI takes handle h,string s,integer v returns nothing
if v==0 then
call FlushStoredInteger(udg_GC,I2S(H2I(h)),s)
else
call StoreInteger(udg_GC,I2S(H2I(h)),s,v)
endif
endfunction
function SB takes handle h,string s,boolean v returns nothing
if v==false then
call FlushStoredBoolean(udg_GC,I2S(H2I(h)),s)
else
call StoreBoolean(udg_GC,I2S(H2I(h)),s,v)
endif
endfunction
function GI takes handle h,string s returns integer
return GetStoredInteger(udg_GC,I2S(H2I(h)),s)
endfunction
function GBO takes handle h,string s returns boolean
return GetStoredBoolean(udg_GC,I2S(H2I(h)),s)
endfunction
function GU takes handle h,string s returns unit
return GetStoredInteger(udg_GC,I2S(H2I(h)),s)
return null
endfunction
function GTR takes handle h,string s returns trigger
return GetStoredInteger(udg_GC,I2S(H2I(h)),s)
return null
endfunction
function GTA takes handle h,string s returns triggeraction
return GetStoredInteger(udg_GC,I2S(H2I(h)),s)
return null
endfunction
function DeleteTrigger takes trigger trgr returns nothing
call TriggerRemoveAction(trgr,GTA(trgr,"action"))
call FlushStoredMission(udg_GC,I2S(H2I(trgr)))
call DestroyTrigger(trgr)
endfunction
function UnitRemoveSanlian takes unit u returns nothing
call SB(u,"sanlian",false)
call UnitRemoveAbility(u,'A001')
call UnitRemoveAbility(u,'A002')
call UnitRemoveAbility(u,'Bfzy')
endfunction
function UnitDamaged takes nothing returns nothing
local trigger trgr2=GetTriggeringTrigger()
local trigger trgr=GTR(trgr2,"trigger")
local unit u=GU(trgr,"unit")
local unit u2=GetTriggerUnit()
if GetTriggerEventId()==EVENT_UNIT_DAMAGED and GetEventDamageSource()==u and GBO(trgr2,"damaged")==false then
call SB(trgr2,"damaged",true)
if GI(trgr,"times")<2 then
call SI(trgr,"times",GI(trgr,"times")+1)
call SetUnitAbilityLevel(u,'A001',GI(trgr,"times")+1)
else
if GBO(u,"sanlian") then
call UnitRemoveSanlian(u)
call DeleteTrigger(trgr)
endif
endif
else
if GI(trgr2,"times")>=GI(trgr,"attacked") then
if GBO(u,"sanlian") then
call UnitRemoveSanlian(u)
call DeleteTrigger(trgr)
endif
endif
call DeleteTrigger(trgr2)
endif
set trgr=null
set trgr2=null
set u=null
set u2=null
endfunction
function sanlian takes nothing returns nothing
local trigger trgr=GetTriggeringTrigger()
local trigger trgr2
local unit u=GU(trgr,"unit")
local unit u2=GetTriggerUnit()
local integer i=GI(trgr,"times")
if u==GetAttacker() then
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"单位被攻击")
if i==0 then
if GU(trgr,"target")==null and GetUnitAbilityLevel(u,'Bfzy')>0 then
call SH(trgr,"target",u2)
call SI(trgr,"attacked",1)
set trgr2=CreateTrigger()
call TriggerRegisterUnitEvent(trgr2,u2,EVENT_UNIT_DAMAGED)
call TriggerRegisterTimerEvent(trgr2,1,false)
call SH(trgr2,"action",TriggerAddAction(trgr2,function UnitDamaged))
call SH(trgr2,"trigger",trgr)
call SI(trgr2,"times",1)
else
call UnitRemoveSanlian(u)
call DeleteTrigger(trgr)
endif
elseif i==1 then
if GU(trgr,"target")==u2 and GetUnitAbilityLevel(u,'Bfzy')>0 then
call SI(trgr,"attacked",2)
set trgr2=CreateTrigger()
call TriggerRegisterUnitEvent(trgr2,u2,EVENT_UNIT_DAMAGED)
call TriggerRegisterTimerEvent(trgr2,1,false)
call SH(trgr2,"action",TriggerAddAction(trgr2,function UnitDamaged))
call SH(trgr2,"trigger",trgr)
call SI(trgr2,"times",2)
else
call UnitRemoveSanlian(u)
call DeleteTrigger(trgr)
endif
elseif i==2 then
if GU(trgr,"target")==u2 and GetUnitAbilityLevel(u,'Bfzy')>0 then
call SI(trgr,"attacked",3)
set trgr2=CreateTrigger()
call TriggerRegisterUnitEvent(trgr2,u2,EVENT_UNIT_DAMAGED)
call TriggerRegisterTimerEvent(trgr2,1,false)
call SH(trgr2,"action",TriggerAddAction(trgr2,function UnitDamaged))
call SH(trgr2,"trigger",trgr)
call SI(trgr2,"times",3)
else
call UnitRemoveSanlian(u)
call DeleteTrigger(trgr)
endif
endif
set trgr2=null
endif
set trgr=null
set u=null
set u2=null
endfunction
function Trig_duomingsandao_Conditions takes nothing returns boolean
local trigger trgr
local integer plyr=0
if GetSpellAbilityId() == 'A000' and GBO(GetTriggerUnit(),"sanlian")==false then
set trgr=CreateTrigger()
call SB(GetTriggerUnit(),"sanlian",true)
call UnitAddAbility(GetTriggerUnit(),'A001')
call UnitAddAbility(GetTriggerUnit(),'A002')
loop
if IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),Player(plyr)) then
call TriggerRegisterPlayerUnitEvent(trgr,Player(plyr),EVENT_PLAYER_UNIT_ATTACKED,null)
endif
set plyr=plyr+1
exitwhen plyr==16
endloop
call SH(trgr,"action",TriggerAddAction(trgr,function sanlian))
call SH(trgr,"unit",GetTriggerUnit())
set trgr=null
endif
return false
endfunction
//===========================================================================
function InitTrig_duomingsandao takes nothing returns nothing
set gg_trg_duomingsandao = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_duomingsandao, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_duomingsandao, Condition( function Trig_duomingsandao_Conditions ) )
endfunction
用缓存肯定会出问题的啦。
flush是有问题的
页:
[1]