|
是在做一个技能的时候发现的,希望高人们帮帮忙
技能说明:将元素能量从身体中爆发,对周围单位造成伤害,伤害受到当前元素能量点数的影响。同时受到元素脉冲的单位将受到特殊效果的影响。每点元素能量增加10/20/30...(以此类推,共10级)点伤害
元素能量是通过使用技能获得的,使用一次技能加1,这个我写在另一个被动技能里了,也是10级,1级最多6点,2级7点。。。(以此类推)
然后问题是,当英雄身边只有一个单位的时候,伤害值是正确的
下面是代码
function Trig_ElementPulse_Find takes nothing returns boolean
return IsUnitDeadBJ(GetFilterUnit())==false and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()),GetOwningPlayer(GetTriggerUnit()))==true and GetTriggerUnit()!=GetFilterUnit()
endfunction
function Trig_ElementPulse_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A008' ) ) then
return false
endif
return true
endfunction
function Trig_ElementPulse_Func takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit u1=null
local location p=GetUnitLoc(GetEnumUnit())
local integer i=GetUnitAbilityLevel(u, 'A008')
local integer i1=0
if GetUnitAbilityLevel(u, 'A000') != 0 then
call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" ))
set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A000'))
set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
call UnitAddAbility( u1, 'A009')
call SetUnitAbilityLevel( u1, 'A009', i)
call IssueTargetOrder( u1, "shadowstrike", GetEnumUnit() )
if i1<5+GetUnitAbilityLevel(u, 'A007') then
set i1=i1+1
call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A000'), i1 )
endif
endif
if GetUnitAbilityLevel(u, 'A001') != 0 then
call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" ))
set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A001'))
set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
call UnitAddAbility( u1, 'A00B')
call SetUnitAbilityLevel( u1, 'A00B', i)
call IssueTargetOrder( u1, "purge", GetEnumUnit() )
if i1<5+GetUnitAbilityLevel(u, 'A007') then
set i1=i1+1
call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A001'), i1 )
endif
endif
if GetUnitAbilityLevel(u, 'A002') != 0 then
call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl" ))
set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A002'))
set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
call UnitAddAbility( u1, 'A00A')
call SetUnitAbilityLevel( u1, 'A00A', i)
call IssueTargetOrder( u1, "shadowstrike", GetEnumUnit() )
if i1<5+GetUnitAbilityLevel(u, 'A007') then
set i1=i1+1
call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A002'), i1 )
endif
endif
call UnitDamageTarget( u, GetEnumUnit(), 10*i*i1, false, false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
call RemoveLocation(p)
set u1=null
set u=null
endfunction
function Trig_ElementPulse_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local location p=GetUnitLoc(u)
local unit u1=CreateUnitAtLoc( GetOwningPlayer(u) , 'e000' , p , 270 )
call GroupEnumUnitsInRange(udg_Group,GetUnitX(u),GetUnitY(u),350,Condition(function Trig_ElementPulse_Find))
call ForGroup( udg_Group, function Trig_ElementPulse_Func)
call RemoveLocation(p)
set u=null
set u1=null
set p=null
endfunction
//===========================================================================
function InitTrig_ElementPulse takes nothing returns nothing
set gg_trg_ElementPulse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ElementPulse, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ElementPulse, Condition( function Trig_ElementPulse_Conditions ) )
call TriggerAddAction( gg_trg_ElementPulse, function Trig_ElementPulse_Actions )
endfunction
。。。不知道怎么截图好,只好上传文件了。。。 |
|