Fill in most of the luma logic.

Still missing a mystery condition.