(Note) This is in a double battle.
Let's say a Nidoking used Thrash. On the third turn, you swapped in Tapu Fini (for your ally), who activated Misty Terrain, and on that same turn, Nidoking used its final Thrash. What would happen? Would Nidoking get confused, or would Misty Terrain prevent that?