function WereWell takes unit well, boolean b returns nothing
if b then
call UnitAddAbility(well, 'A00K')
call UnitRemoveAbility(well, 'A00K')
else
call UnitAddAbility(well, 'A02R')
call UnitRemoveAbility(well, 'A02R')
endif
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl", GetUnitX(well), GetUnitY(well)))
call SetUnitAnimation( well , "stand" )
endfunction
function Moon_Wells_Night takes nothing returns boolean
local group g = CreateGroup()
local unit FoG
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
if GetPlayerTechCount(GetOwningPlayer(FoG), 'R00R', true) == 1 and GetUnitTypeId(FoG) == 'e005' and GetUnitAbilityLevel(FoG, 'Abds') == 0 then
call WereWell(FoG, true)
endif
call GroupRemoveUnit(g, FoG)
endloop
call DestroyGroup(g)
set g = null
return false
endfunction
function Moon_Wells_Day takes nothing returns boolean
local group g = CreateGroup()
local unit FoG
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
if GetUnitTypeId(FoG) == 'e00L' then
call WereWell(FoG, false)
endif
call GroupRemoveUnit(g, FoG)
endloop
call DestroyGroup(g)
set g = null
return false
endfunction
function Moon_Wells_Upg takes nothing returns boolean
local group g
local unit FoG
if GetResearched() == 'R00R' and not bj_dncIsDaytime then
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, GetTriggerPlayer(), null)
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
if GetUnitTypeId(FoG) == 'e005' and GetUnitAbilityLevel(FoG, 'Abds') == 0 then
call WereWell(FoG, true)
endif
call GroupRemoveUnit(g, FoG)
endloop
call DestroyGroup(g)
set g = null
endif
return false
endfunction
function Moon_Wells_Constr takes nothing returns boolean
if GetPlayerTechCount(GetTriggerPlayer(), 'R00R', true) == 1 and GetUnitTypeId(GetTriggerUnit()) == 'e005' and not bj_dncIsDaytime then
call WereWell(GetTriggerUnit(), true)
endif
return false
endfunction
//===========================================================================
function InitTrig_Moon_Wells takes nothing returns nothing
local trigger day = CreateTrigger()
local trigger upg = CreateTrigger()
local trigger constr = CreateTrigger()
set gg_trg_Moon_Wells = CreateTrigger( )
call TriggerRegisterGameStateEventTimeOfDay( gg_trg_Moon_Wells, GREATER_THAN_OR_EQUAL, bj_TOD_DUSK )
call TriggerRegisterGameStateEventTimeOfDay( gg_trg_Moon_Wells, LESS_THAN, bj_TOD_DAWN )
call TriggerAddCondition( gg_trg_Moon_Wells, Condition(function Moon_Wells_Night) )
call TriggerRegisterGameStateEventTimeOfDay( day , LESS_THAN, bj_TOD_DUSK )
call TriggerRegisterGameStateEventTimeOfDay( day , GREATER_THAN_OR_EQUAL, bj_TOD_DAWN )
call TriggerAddCondition( day , Condition(function Moon_Wells_Day) )
call TriggerRegisterAnyUnitEventBJ( upg , EVENT_PLAYER_UNIT_RESEARCH_FINISH )
call TriggerAddCondition( upg , Condition(function Moon_Wells_Upg) )
call TriggerRegisterAnyUnitEventBJ( constr , EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
call TriggerAddCondition( constr , Condition( function Moon_Wells_Constr ) )
set day = null
set upg = null
set constr = null
endfunction