Currently it seems that Tera is bugged with transformation pokemon (and I tacked on a stuggle issue). The two which I have primarily tested are Aegi and Palafin. Both do slightly different things, but it seems to trigger on switch in. There are plenty of replays down below to reproduce the issue to help explain what is happening.
Essentially, the wrong tera type is assigned to Palafin, and Aegislash is... well... as buggy as ever.
## Original Incident:
Replay of source of bug:
https://replay.pokemonshowdown.com/gen9ou-1717773470
## Notable turns:
Turn 16 - Palafin teras into Psychic Type
Turn 23 - Palafin switches back in and is now Water type
## Steps to reproduce
1. Have a Palafin with a tera type which isn't water.
2. Tera Palafin into said tera type (in the replay example, this is psychic)
3. Switch out Palafin (this works with both flip turn, and just switching)
4. Palafin transforms
5. Palafin switches back in and tera type will now be water
Isolated reproduction:
https://replay.pokemonshowdown.com/gen9ou-1717782638
## More incidents:
### Aegislash
Replay:
https://replay.pokemonshowdown.com/gen9nationaldexag-1717789017
Explanation: Aegislash will switch in as the form that it was tera'd as. In this case it was sword. It only retains its tera type if it is in sword form. It will switch in as sword form despite how it was switched out.
Replay:
https://replay.pokemonshowdown.com/gen9nationaldexag-1717794701
This ones shows how Aegi works when you tera as shield form. You never get to get your tera back until you switch out and back in.
### Struggle
Replay:
https://replay.pokemonshowdown.com/gen9nationaldexag-1717797002
In this replay I was testing Ditto, but it seems to work as intended(?) where you get the tera of the mon that you transform into (I cannot confirm if this is the in game behavior).
However, I was then struggling after getting taunted. I could not tera my ditto at that point. It was struggle or do nothing. Tera wasn't an option. I'm not sure if that is an intended mechanic, but I figured I'd report it anyways to check.
This seems to be an issue with how transformation pokemon are handled, and/or when tera is checked when you switch back in a pokemon? I didn't see this on the bug roadmap. Sorry for the Markdown formatting, I originally was going to submit this as a github issue but found this thread instead.
BUG STATUS: FIXED by pyuk