|
[codes=jass]
function Trig_yzas_2_Conditions takes nothing returns boolean
if ( GetEventDamageSource() == udg_hawz[1] ) then //伤害来源是指定的单位
return true
endif
return false
endfunction
function Trig_yzas_2_GetBooleanAnd takes nothing returns boolean
return GetBooleanAnd( IsUnitAlly(GetFilterUnit(), GetOwningPlayer(udg_hawz[1])) == true, GetFilterUnit() != udg_hawz[1] ) //匹配单位是指定单位附近"不是指定单位"但是"是指定单位友军"的单位
endfunction
function Trig_yzas_2_YoN takes nothing returns boolean
local location Tpoint=GetUnitLoc(udg_hawz[1])
set bj_wantDestroyGroup=true
if(GetBooleanAnd( IsUnitGroupEmptyBJ(GetUnitsInRangeOfLocMatching(400.00, Tpoint, Condition(function Trig_yzas_2_GetBooleanAnd))),IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true )) then //判断选取的单位组为空并且受到伤害单位是英雄
call RemoveLocation(Tpoint)
return true
endif
call RemoveLocation(Tpoint)
return false
endfunction
function Trig_yzas_2_Actions takes nothing returns nothing
local unit Tunit=GetTriggerUnit()
local real X=GetUnitX(Tunit)
local real Y=GetUnitY(Tunit)
local effect Leffect
local unit Aunit=CreateUnit(GetOwningPlayer(udg_hawz[1]),'e000',X,Y,0)
//避免由指定单位攻击造成伤害,而导致死循环所以创建单位给予伤害
call UnitApplyTimedLife(Aunit,'BHwe',1.00)
if ( Trig_yzas_2_YoN() ) then
call UnitDamageTarget( Aunit, Tunit, ( 5.00 + ( 10.00 * I2R(GetUnitAbilityLevel(udg_hawz[1],'A00K')) ) ),true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE,WEAPON_TYPE_WHOKNOWS )
set Leffect= AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl",Tunit,"chest" )
call DestroyEffect(Leffect )
else
call DoNothing( )
endif
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function Trig_yzas_1_Conditions takes nothing returns boolean
if ( GetUnitAbilityLevelSwapped('A00K', GetAttacker()) >= 1 ) then
return true
endif
return false
endfunction
function Trig_yzas_1_Actions takes nothing returns nothing //发生攻击事件
local trigger gg_trg_yzas_2
local unit Tuit = GetTriggerUnit()
set udg_hawz[1] = GetAttacker()
set gg_trg_yzas_2=CreateTrigger()
call TriggerRegisterUnitEvent( gg_trg_yzas_2, Tuit, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( gg_trg_yzas_2, Condition( function Trig_yzas_2_Conditions ) )
call TriggerAddAction( gg_trg_yzas_2, function Trig_yzas_2_Actions )
endfunction
//===========================================================================
function InitTrig_yzas_1 takes nothing returns nothing
set gg_trg_yzas_1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_yzas_1, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_yzas_1, Condition( function Trig_yzas_1_Conditions ) )
call TriggerAddAction( gg_trg_yzas_1, function Trig_yzas_1_Actions )
endfunction
[/codes]
模仿DOTA幽鬼的荒芜做了一个技能 拥有技能单位周围400范围内没有除自己外的友军,并且攻击对象是英雄 在攻击时对攻击对象造成额外伤害 但是周围没有友军他也没效果 周围有友军也没效果 看了半天没看出来 望大家帮帮忙 |
|