Consolidations are done immediately after the unit has fought, not at the end of the phase, so your Leviathan would have been a valid unit to choose to attack with, since it is within 1" of an enemy, and has not already fought this turn.
The 1" is not checked at the start of the Fight Phase, but instead when the unit is chosen to fight.
Also note that if the dreadnought fails to kill the Warlocks (invulnerable saves etc.), it can still Fall Back in the movement phase, it is not "locked in combat" like previous editions.
|