|
function Dmg takes nothing returns nothing
    call DestroyTrigger(GetTriggeringTrigger())
    if ( UnitHasBuffBJ(GetTriggerUnit(), 'BPSE') == true ) then
    call UnitDamageTarget( GetEventDamageSource(), GetTriggerUnit(), 150.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
    call UnitRemoveBuffBJ( 'BPSE', GetTriggerUnit() )
    endif
endfunction
function RegisterUnitAmortEvent takes unit tarUnit returns nothing
    local trigger tHam = CreateTrigger()                                           
    call TriggerRegisterUnitEvent( tHam , tarUnit, EVENT_UNIT_DAMAGED )
    call TriggerAddAction( tHam, function Dmg )
endfunction
=======================================================
注册触发器
function Trig_Green_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AHtb' ) ) then
        return false
    endif
    return true
endfunction
function Trig_Green_Actions takes nothing returns nothing
    call RegisterUnitAmortEvent(GetSpellTargetUnit())
endfunction
//===========================================================================
function InitTrig_Green takes nothing returns nothing
    set gg_trg_Green = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Green, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Green, Condition( function Trig_Green_Conditions ) )
    call TriggerAddAction( gg_trg_Green, function Trig_Green_Actions )
endfunction
BPSE是BUFF效果名,这个本来是想做成弹道法术命中目标才造成伤害,但是结果发生了一个问题,就是如果不停的施放这个法术,那么会注册好多次事件,然后第一个投射物打到的时候就把后面所有的投射物的伤害全部打上去了……
请问有什么处理办法,刚刚学习不久,不甚懂 |
|