- Joined
- May 11, 2008
- Messages
- 1,198
so i've been working on a couple of heroes, day and night.
well...i've got a day trigger a lot like this one...anyway i was looking to turn the trigger into jass and while doing so i'm wondering how i'm doing at getting rid of the leaks and at efficiency...
well...i've got a day trigger a lot like this one...anyway i was looking to turn the trigger into jass and while doing so i'm wondering how i'm doing at getting rid of the leaks and at efficiency...
JASS:
scope Night initializer I
private function agilnfilter takes nothing returns boolean
return ( GetUnitAbilityLevel( GetFilterUnit(), 'A00E') > 0 )
endfunction
private function agilnact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A005')
call UnitAddAbility(GetEnumUnit(), 'A002')
call SetUnitAbilityLevel(GetEnumUnit(), 'A002', GetUnitAbilityLevel(GetEnumUnit(),'A00E') )
call UnitAddAbility(GetEnumUnit(), 'A00I')
call SetUnitAbilityLevel(GetEnumUnit(), 'A00I', GetUnitAbilityLevel(GetEnumUnit(),'A00E') )
endfunction
private function nsfilter takes nothing returns boolean
return ( GetUnitAbilityLevel(GetFilterUnit(),'A00B') > 0 )
endfunction
private function nsact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A007' )
call UnitAddAbility(GetEnumUnit(), 'A008' )
call SetUnitAbilityLevel(GetEnumUnit(), 'A008', GetUnitAbilityLevel(GetEnumUnit(),'A00B') )
endfunction
private function agildfilter takes nothing returns boolean
return ( GetUnitAbilityLevel(GetFilterUnit(),'A00D') > 0 )
endfunction
private function agildact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A004' )
call UnitAddAbility(GetEnumUnit(), 'A006' )
call SetUnitAbilityLevel(GetEnumUnit(), 'A006', GetUnitAbilityLevel(GetEnumUnit(),'A00D') )
call UnitRemoveAbility(GetEnumUnit(), 'A00I' )
endfunction
private function dsfilter takes nothing returns boolean
return ( GetUnitAbilityLevel(GetFilterUnit(),'A00F') > 0 )
endfunction
private function dsact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A00A' )
call UnitAddAbility(GetEnumUnit(), 'A009' )
call SetUnitAbilityLevel(GetEnumUnit(), 'A009', GetUnitAbilityLevel(GetEnumUnit(),'A00F') )
endfunction
private function dmfilter takes nothing returns boolean
return ( GetUnitAbilityLevel(GetFilterUnit(),'A00P') > 0 )
endfunction
private function dmact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A00N' )
call UnitAddAbility(GetEnumUnit(), 'A00O' )
call SetUnitAbilityLevel(GetEnumUnit(), 'A00O', GetUnitAbilityLevel(GetEnumUnit(),'A00P') )
endfunction
private function defilter takes nothing returns boolean
return ( GetUnitAbilityLevel(GetFilterUnit(),'A00Q') > 0 )
endfunction
private function deact takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(), 'A00O' )
call UnitAddAbility(GetEnumUnit(), 'A00S' )
call SetUnitAbilityLevel(GetEnumUnit(), 'A00S', GetUnitAbilityLevel(GetEnumUnit(),'A00Q') )
endfunction
private function A takes nothing returns nothing
local group g
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function agilnfilter))
call ForGroup(g, function agilnact )
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function agildfilter))
call ForGroup(g, function agildact )
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function nsfilter))
call ForGroup(g, function nsact )
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function dsfilter))
call ForGroup(g, function dsact )
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function dmfilter))
call ForGroup(g, function dmact )
set g = GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function defilter))
call ForGroup(g, function deact )
set g = null
endfunction
//===========================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterGameStateEventTimeOfDay( t, GREATER_THAN_OR_EQUAL, 18.00 )
call TriggerRegisterGameStateEventTimeOfDay( t, LESS_THAN, 6.00 )
call TriggerAddAction( t, function A )
endfunction
endscope