
Anymidlocation = { (CPos.New(65,60)),  (CPos.New(60,64)),  (CPos.New(65,69)),  (CPos.New(70,65)) }
Anyorelocation = { { (CPos.New(55,55)),  (CPos.New(74,55)),  (CPos.New(55,74)),  (CPos.New(74,74)) }, { (CPos.New(74,74)),  (CPos.New(55,74)),  (CPos.New(74,55)),  (CPos.New(55,55)) } }
PinkyMaker = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(45, 90)), function()
		pStartLocation = Utils.Random(Anymidlocation)
		pPatrolLocations = Utils.Random(Anyorelocation)
		Flare = Actor.Create("bigflare", true, { Location = pStartLocation, Owner = Neutral })
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(7, 12)), function()
			Pinky = Actor.Create("pinky", true, { Location = pStartLocation, Owner = Creeps })
			Pinky.Patrol(pPatrolLocations, true, Utils.RandomInteger(66, 90))
			Trigger.OnKilled(Pinky,PinkyMaker)
			Media.PlaySound("PinkyKill" .. Utils.RandomInteger(1, 4) .. ".aud")
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(7, 12)), function()
				Flare.Destroy()
			end)
		end)
	end)
end

MancubusMaker = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(60, 120)), function()
		mStartLocation = Utils.Random(Anymidlocation)
		mPatrolLocations = Utils.Random(Anyorelocation)
		Flare2 = Actor.Create("bigflare", true, { Location = mStartLocation, Owner = Neutral })
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(7, 12)), function()
			Mancubus = Actor.Create("manc", true, { Location = mStartLocation, Owner = Creeps })
			Mancubus.Patrol(mPatrolLocations, true, Utils.RandomInteger(66, 666))
			Trigger.OnKilled(Mancubus,MancubusMaker)
			Media.PlaySound("MancKill" .. Utils.RandomInteger(1, 3) .. ".aud")
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(7, 12)), function()
				Flare2.Destroy()
			end)
		end)
	end)
end

BlueLight = 0.73
GreenLight = 0.76
turnOn = function()
	Lighting.Blue = BlueLight
	Lighting.Green = GreenLight
	if BlueLight < 0.9 then
		BlueLight = BlueLight + 0.001
		GreenLight = GreenLight + 0.001
		Trigger.AfterDelay(16, function()
			turnOn()
		end)
	else
		Trigger.AfterDelay(2000, function()
			turnOff()
		end)
	end	
end

turnOff = function()
	Lighting.Blue = BlueLight
	Lighting.Green = GreenLight
	if BlueLight > 0.66 then
		BlueLight = BlueLight - 0.001
		GreenLight = GreenLight - 0.001
		Trigger.AfterDelay(9, function()
			turnOff()
		end)	
	else
		Trigger.AfterDelay(1000, function()
			turnOn()
		end)
	end
end

WorldLoaded = function()
	Neutral = Player.GetPlayer("Neutral")
	Creeps = Player.GetPlayer("Creeps")
	turnOn()
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		PinkyMaker()
		Trigger.AfterDelay(DateTime.Minutes(2), function()
			MancubusMaker()
		end)
	end)
end