I don't know why a magpie was going berzark this time of the night so I looked up the meaning.
"It may be time to be a bit of a daredevil, and face the fact that sometimes we have to put ourselves on the line around others in order to grow. We can't just take risks when no one's looking."
https://www.spirit-animals.com/magpie-symbolism/