How to create a boss that changes weaknesses?

I have the VisuStellla ElementStates core plugin and I'd like to be able to set up a boss that will change its weakness each time its current weakness is exploited. What would be the best way to set something like that up?
It's not quite the same thing, but I did create a states that change every four turns that make the enemy weak to one element and immune to the other.

So states are at least part of it.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-a-boss-that-changes-weaknesses.138561/