MV Yanfly CTB - add fucntionality: extra turn

Hi

I'm using CTB in my project and I want to add an extra mechanic.
When a battler does a specific thing, like hitting an enemy weakness, he emediatly should gain an extra action, like if he used a skill with Instant Cast.
This effect can't trigger twice in a row, to prevent a battler from gettin infinite turns.
Also, during this extra turn, the CTB icon for that battler should have a different color to clarify the information that it is an extra turn.
I'm tryng to do a plugin that does this but it's not working as intended?
Can someone hlep me finish it?

Here is the link: https://codefile.io/f/PZSuvy2M9G

Thanks for the help

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-ctb-add-fucntionality-extra-turn.176152/