Ok, that clinches it then.
Yes, the AI will target enemy units with a bless. The targeting AI doesn't know what the spell does. It simulates casting the spell at a variety of targets, evaluates the results and chooses the target with the best score.
The code doesn't think. It can't look at the situation and decide that there is only one sacred unit and therefore it should be targeted. It just tries a bunch of locations and uses the one that seems to work best. In some situations that might legitimately be an enemy unit. If he'd been surrounded by your sacred troops, targeting the center enemy unit might actually get more.
In this case the debug log shows us he targeted the pair of Caelum's troops at 7,19 while your priest was at 6,18:
Code:
best Blessing this far, 6 17 (136 pnts)
best Blessing this far, 7 19 (140 pnts)
spellscore, Blessing score 146 (boost 106 scorat 0)
Eval: Blessing score 162 (fat 0)
comp_castspell: eval Blessing result 162
best spell so far Blessing (score100162)
...
castspell: cnr83 spl754 (Blessing) vis0 x7 y19 spldmg1
vis 0 xvis 0
blastsqr: unr2241 x7 y19 aoe1 dmg1 eff10 spc1086373888 as10217 al9
affectvic vic6186 hv1
hitunit 2241 6186 dmg1 spec1086373888 ba-1
affectvic vic6188 hv1
hitunit 2241 6188 dmg1 spec1086373888 ba-1
blastsqr: unr2241 x6 y19 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x8 y19 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x8 y18 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x9 y18 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x7 y18 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x9 y19 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x6 y20 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr2241 x7 y17 aoe1 dmg1 eff10 spc1086373888 as10217 al9
affectvic vic6184 hv0
hitunit 2241 6184 dmg1 spec1086373888 ba-1
blastsqr: unr2241 x8 y20 aoe1 dmg1 eff10 spc1086373888 as10217 al9
What isn't clear to me is how the evaluation is done. It may be that only 2 tries are made, at 6,17 and 7,19. More likely, I think, the log only shows those tries that produce the best results so far. If only one test is done per target, the results should be binary, either the priest was blessed or he wasn't. But they're not, 7,19 gets 4 more points than 6,17. If multiple tries are made, then self-targeting would have the advantage, since it would always hit. It's possible that multiple, but too few tries are made. It's also possible that something is wrong with the scoring algorithm.
chris: I don't know how the actual squares hit by a given AoE are selected, but it isn't as simple as a single template. If you check the patterns for a couple of casts of the same spell they are different. Just looking at the H2 blessings in Squirreloid's turn I saw 5 different patterns, no repetition. Either it's actually generating random squares by some algorithm or picking from a decent number of templates.