That’s a bigger topic. At some point, I’ll write a tutorial on it. I can give you the rough notes…
First, you need a tag for Offense, or Defense. Then you need a Condition, the times when this would be a valid choice. For example: You might have Heal with a Condition of HealthUnder(50%), or an Attack where Player’s Health is under 50%.
You’ll then have a Preservation Instinct score for the AI between 1 and 100… Health Percentage determines whether the npc prefers Offense or Defense. We then put each filtered skill that the AI has enough mana for into a pool… if preference is Offense, then the offensive skills get 2 entries in the pool. If the preference is defense, then the defensive skills get 2 entries in the pool. Finally we draw a skill from the pool and cast it.
Targeting can require some special attention, for example DelayedClickTargeting doesn’t work for AI, but Delayed Click Targeting could simply return the player when the AI is casting.