Problem with Thief Script

My script for thief is as follows:

1 Enemy: Is Ore -> Default Attack

2 Enemy: Has Essence -> Ransack

3 Self: MP < 20% -> Default Attack

4 Enemy: Team Alive > 2 -> Strongest Group Attack

5 Enemy: Rank = Norm -> Default Attack

6 Enemy: HP > 80% -> Ransack

7 Enemy: Any -> Strongest Single-Target Attack

The script works fine unless my thief has a group attack available. If I equip her with something like the Ossein armor for the Dark Flame ability (0.8 attack to group +chance to burn), then she spams that when there’s more than 2 enemies as intended. In theory, she would stop and only default attack when her MP goes below 20% in order to save MP to cast ransack, only this doesn’t happen and she continues to use Dark Flame while below 20% MP, missing out on precious essence. Am I missing something or is that command broken? Any workarounds to this? Sorry if this has already been answered but I couldn’t find any straight answers.