|
发表于 2009-10-15 18:22:49
|
显示全部楼层
[jass]
//方法一
globals
player SYS_TempDataP = null
endglobals
function Cond takes nothing returns boolean
local unit u = GetFilterUnit()
if GetUnitState(u, UNIT_STATE_LIFE) > 0. and IsUnitEnemy(u, SYS_TempDataP) then
call DestroyEffect(AddSpecialEffect("Abilities\\\\Spells\\\\Undead\\\\FrostNova\\\\FrostNovaTarget.mdl", GetUnitX(u), GetUnitY(u)))
endif
return false
endfunction
function Start takes nothing returns nothing
local group g = CreateGroup()
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
set SYS_TempDataP = GetOwningPlayer(u)
call GroupEnumUnitsInRange(g, x, y, 150., Filter(function Cond))
call DestroyGroup(g)
set u = null
set g = null
endfunction
// 方法二
function Filt takes nothing returns boolean
local unit u = GetFilterUnit()
if GetUnitState(u, UNIT_STATE_LIFE) <= 0. then
set u = null
return false
endif
if IsUnitType(u, UNIT_TYPE_STRUCTURE) then
set u = null
return false
endif
set u = null
return true
endfunction
function Start takes nothing returns nothing
local group g = CreateGroup()
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 150., Filter(function Filt))
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitEnemy(u, p) then
call DestroyEffect(AddSpecialEffect("Abilities\\\\Spells\\\\Undead\\\\FrostNova\\\\FrostNovaTarget.mdl", GetUnitX(u), GetUnitY(u)))
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
set u = null
set g = null
endfunction
[/jass] |
|