|
我在做那个连击的系统,不知道为什么只用普通攻击的时候很好,当加入技能时就乱套了
表现为:只有普通攻击:一切正常,别人的攻击也不会计入连击数
普通+技能:别人的攻击也算进连击数了
[codes=jass]
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2TM takes integer i returns timer
return i
return null
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function I2TG takes integer i returns trigger
return i
return null
endfunction
function I2TC takes integer i returns triggercondition
return i
return null
endfunction
function I2TA takes integer i returns triggeraction
return i
return null
endfunction
function I2TAG takes integer i returns texttag
return i
return null
endfunction
//************************************************
function ClearNum takes nothing returns nothing
local timer tm=GetExpiredTimer()
local unit hero=I2U(GetStoredInteger(udg_GC,I2S(H2I(tm)),"Hero"))
call StoreReal(udg_GC,I2S(H2I(hero)),"ComboNum",0)
call DestroyTimer(tm)
set tm=null
set hero=null
endfunction
function Show_Con takes nothing returns boolean
local trigger trg=GetTriggeringTrigger()
local unit hero=I2U(GetStoredInteger(udg_GC,I2S(H2I(trg)),"Hero"))
local texttag tag=I2TAG(GetStoredInteger(udg_GC,I2S(H2I(hero)),"TextTag"))
local timer tm=I2TM(GetStoredInteger(udg_GC,I2S(H2I(hero)),"Timer"))
local unit target=I2U(GetStoredInteger(udg_GC,I2S(H2I(hero)),"Target"))
local real n= GetStoredReal(udg_GC,I2S(H2I(hero)),"ComboNum")
if hero==GetAttacker() then
call DestroyTimer(tm)
set tm=CreateTimer()
call TimerStart(tm,3,false,function ClearNum)
if (n==0 or target!=GetAttackedUnitBJ()) then
set n=1
call StoreReal(udg_GC,I2S(H2I(hero)),"Damage",0)//用于最后统计分数
else
set n=n+1
if n>3 then
call DestroyTextTag(tag)
set tag=CreateTextTagUnitBJ( ( I2S(R2I(n)) + "击!" ), hero, 0,(10+n/10), 100, 0.00, 0.00, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 24, 90 )
call SetTextTagPermanent( GetLastCreatedTextTag(), false )
call SetTextTagLifespan( GetLastCreatedTextTag(), 3.00 )
call SetTextTagFadepoint( GetLastCreatedTextTag(), 2.60 )
endif
endif
else
set trg=null
set hero=null
set target=null
set tm=null
set tag=null
return false
endif
call StoreInteger(udg_GC,I2S(H2I(trg)),"Hero",H2I(hero))
call StoreInteger(udg_GC,I2S(H2I(tm)),"Hero",H2I(hero))
call StoreReal(udg_GC,I2S(H2I(hero)),"ComboNum",n)
call StoreInteger(udg_GC,I2S(H2I(hero)),"TextTag",H2I(tag))
call StoreInteger(udg_GC,I2S(H2I(hero)),"Target",H2I(GetAttackedUnitBJ()))
call StoreInteger(udg_GC,I2S(H2I(hero)),"Timer",H2I(tm))
set trg=null
set hero=null
set target=null
set tm=null
set tag=null
return false
endfunction
function Show1_Con takes nothing returns boolean
local trigger trg=GetTriggeringTrigger()
local unit hero=I2U(GetStoredInteger(udg_GC,I2S(H2I(trg)),"Hero"))
local texttag tag=I2TAG(GetStoredInteger(udg_GC,I2S(H2I(hero)),"TextTag"))
local timer tm=I2TM(GetStoredInteger(udg_GC,I2S(H2I(hero)),"Timer"))
local unit target=I2U(GetStoredInteger(udg_GC,I2S(H2I(hero)),"Target"))
local real n= GetStoredReal(udg_GC,I2S(H2I(hero)),"ComboNum")
call DestroyTimer(tm)
set tm=CreateTimer()
call TimerStart(tm,3,false,function ClearNum)
if n==0 or (target!=GetSpellTargetUnit() and GetSpellTargetUnit()!=null) then
set n=1
call StoreReal(udg_GC,I2S(H2I(hero)),"Damage",0)//用于最后统计分数
else
set n=n+1
if n>3 then
call DestroyTextTag(tag)
set tag=CreateTextTagUnitBJ( ( I2S(R2I(n)) + "击!" ), hero, 0,(10+n/10), 100, 0.00, 0.00, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 24, 90 )
call SetTextTagPermanent( GetLastCreatedTextTag(), false )
call SetTextTagLifespan( GetLastCreatedTextTag(), 3.00 )
call SetTextTagFadepoint( GetLastCreatedTextTag(), 2.60 )
endif
endif
if GetSpellTargetUnit()!=null then
call StoreInteger(udg_GC,I2S(H2I(hero)),"Target",H2I(GetSpellTargetUnit()))
endif
call StoreInteger(udg_GC,I2S(H2I(trg)),"Hero",H2I(hero))
call StoreInteger(udg_GC,I2S(H2I(tm)),"Hero",H2I(hero))
call StoreReal(udg_GC,I2S(H2I(hero)),"ComboNum",n)
call StoreInteger(udg_GC,I2S(H2I(hero)),"TextTag",H2I(tag))
call StoreInteger(udg_GC,I2S(H2I(hero)),"Timer",H2I(tm))
set trg=null
set hero=null
set target=null
set tm=null
set tag=null
return false
endfunction
function Show takes unit hero returns nothing
local trigger trg=CreateTrigger()
local trigger trg1=CreateTrigger()
//call StoreInteger(udg_GC,I2S(H2I(hero)),"Trigger",H2I(trg))
call StoreReal(udg_GC,I2S(H2I(hero)),"ComboNum",0)
call StoreInteger(udg_GC,I2S(H2I(trg)),"Hero",H2I(hero))
call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_ATTACKED)
call StoreInteger(udg_GC,I2S(H2I(trg)),"TriggerCondition",H2I(TriggerAddCondition(trg,Condition(function Show_Con))))
call StoreInteger(udg_GC,I2S(H2I(trg1)),"Hero",H2I(hero))
call TriggerRegisterUnitEvent(trg1,hero,EVENT_UNIT_SPELL_EFFECT)
call StoreInteger(udg_GC,I2S(H2I(trg1)),"TriggerCondition",H2I(TriggerAddCondition(trg,Condition(function Show1_Con))))
set trg1=null
set trg=null
endfunction
[/codes]
其中:trg为普通攻击计数;trg1为技能计数 |
|