How do towers (and pheonixes and titans etc) decide when to attack minions vs gods when both are in range?
I've personally seen several scenarios where towers ignore minions in favor of gods, when the minions are closer to the tower and attacking it. Other times, I've seen towers attack archers while 4 or 5 gods melee the tower.
I've also been targeted by a tower while I fought another god in the tower circle, even though friendly gods and minions were attacking that tower at the same time, at a much closer range.
I previously thought towers preferred minions before gods. Then I thought it attacked the most healthy enemy within range. Then I thought it attacked maybe the enemy with the highest damage potential, or highest kills, but these all seem to be proven wrong in one situation or another.
Is there a solid rule for their behavior? I'm on console but i assume this isn't platform-specific.