What happens when a Ditto battles against his second opponent after transformed to first one in GYM?

What is happening after a Ditto transformed to his first opponent in a gym battle and defeat it?

What is happening if I withdraw my Ditto after it transformed to his opponent and choose it against another opponent in the same gym battle period?

Will Ditto transform to his new opponent or will fight as his first transformed form?


Solution 1:

Here is the relevant portion of Niantic's Ditto announcement:

Ditto is also a unique Pokémon when you interact with Gyms. When training or battling at a Gym, Ditto will copy the appearance, types, and moves of the first Pokémon it sees, and it will stay that way through the remainder of those Gym battles.

Solution 2:

Ditto will not transform anymore after it uses the "transform" attack unless it transformed into another ditto, which still have the "transform" attack. Defending dittos can use the "struggle" special attack with 5 special attack meters, but not for the attackers. The attacking struggle was changed and it costs no energy.