|
function Trig_DR_Action takes nothing returns nothing
local real Damage=GetEventDamage()
local unit Attacker = GetEventDamageSource()
local unit Damager =GetTriggerUnit()
call DestroyTrigger(gg_trg_Damage_Action)
call DestroyTrigger(gg_trg_InitDamage)
if((Attacker==udg_UNIT)and(IsUnitAliveBJ(Attacker)))then
if(GetRandomInt(1,100)<=30)then
call SetUnitState(Attacker,UNIT_STATE_LIFE,GetUnitState(Attacker,UNIT_STATE_LIFE)+(Damage*0.05)+(GetUnitStateSwap(UNIT_STATE_MAX_LIFE,Attacker)*0.03 ))
call DestroyEffect(AddSpecialEffectTargetUnitBJ( "overhead",Attacker, "Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl" ))
endif
endif
if( (Damager==udg_UNIT)and(IsUnitAliveBJ(Damager)) )then
if(GetRandomInt(1,100)<=20)then
call SetUnitState(Damager,UNIT_STATE_LIFE,GetUnitState(Damager,UNIT_STATE_LIFE)+Damage)
endif
endif
endfunction
function Trig_Init_Damage_Func002A takes nothing returns nothing
set gg_trg_Damage_Action = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Damage_Action, GetEnumUnit(), EVENT_UNIT_DAMAGED )
call TriggerAddAction(gg_trg_Damage_Action,function Trig_DR_Action)
endfunction
function Trig_Init_Damage_Actions takes nothing returns nothing
call ForGroupBJ(GetUnitsInRectAll(GetEntireMapRect()), function Trig_Init_Damage_Func002A )
endfunction
function InitTrig_Init_Damage_Actions takes nothing returns nothing
set gg_trg_InitDamage = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_InitDamage, GetEntireMapRect() )
call TriggerAddAction( gg_trg_InitDamage, function Trig_Init_Damage_Actions )
endfunction
就是捕捉任意单位受伤害,对某个单位做到模拟吸血和模拟闪避的效果
但是不加标红那两句的话图会很卡,加了之后感觉技能效果有时出不来,没有吸血的动画效果
半模仿半实践写出来的,不是很懂JASS,求指导 |
|