|
[codes=jass]
function M_4D_con takes nothing returns boolean
if ( GetSpellAbilityId() == 'A04G' ) then
return true
endif
return false
endfunction
function M4_D_Choose takes nothing returns boolean
return ( GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_USER )
endfunction
function M4_D_done takes nothing returns nothing
call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) - udg_R_M1A ) )
endfunction
function M_4D_act takes nothing returns nothing
local real x = GetUnitState(udg_Master4, UNIT_STATE_LIFE)
local real y
local group g
local integer i
local location p
loop
set p = GetUnitLoc(udg_Master4)
set y = GetUnitState(udg_Master4, UNIT_STATE_LIFE)
set g = GetUnitsInRangeOfLocMatching(700.00, p, Condition(function M4_D_Choose))
call SetUnitState( udg_Master4, UNIT_STATE_LIFE, x )
call ForGroupBJ( g, function M4_D_done )
call RemoveLocation ( p )
call DestroyGroup( g )
set p = null
set g = null
set i = i + 1
call PolledWait( 1.20 )
exitwhen i > 30
endloop
endfunction
//===========================================================================
function InitTrig_Master4D takes nothing returns nothing
set gg_trg_Master4D = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Master4D, Player(11), EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Master4D, Condition( function M_4D_con ) )
call TriggerAddAction( gg_trg_Master4D, function M_4D_act )
endfunction
[/codes] |
|