This is so much win, but how much of these can we add before it starts slow the game down? I already have a ton of these I want to implement:
Check if enemy is poisoned, then cast haste enemy.
Check if ally is poisoned, then cast slow ally.
Check if enemy has 50+ armor, then prioritize target for elemental damage. (Staves too!)
Check if unit is powerful, then cast enchantments to make it invincible.
Check if unit is powerful, but wounded, then cast regeneration.
Check if hero has 4 or more injuries, then cast Restore Wounds. (Spell coming soon to Path of the Healer)
Check background stats for weapon types, then prioritize countering weapons to focus on that unit.
Check background stats for unit types, then prioritize weapons and spells to counter.
Check background stats for summons type, then have caster cast a counter-summons. (You cast Fire Elemental, I cast Greater Ice Elemental.)
Check power rating and level, then prioritize attacks on weakest units.
Check hp and armor, then avoid units with a high number.
There is so much that can be done here to let the modder fine tune the AI. We can also teach the AI how to use new spells, like my wider hastes and slow spells. The only question is where this new tag works and where it doesn't. I would even try it to teach the AI how to play basic parts of the game better, once a mod is added. Like choosing Tower over Town or Conclave with a nice little wrapper.