Right now, I make use of AI values in the XML as a base plus I look at the class of spells.
New variables I'm looking at is how many turns the unit has taken, the number of ranged units on each side, the overall disposition of each side, which tiles I can move into without the other team being able to hit me, which spells the other side has, how effective my spell is likely to be compared to their spell resistances, how much mana I have, how much health they have (no point in wasting spells on wimpy units), how wounded I am, how close the nearest unit is, what shards I have firmly under control, what units are coming up in the move list, what spells are currently queued up to be cast, the range of my particular spell, how much mana the other player has (so I can try to roll the dice on whether the other player is likely to cast a spell).
Like I said, it's complicated.
In YOUR build it is:
for i = 1 to num of spells
should I cast spell = rand()%;