Observed behavior: Often Sunfire ends up inflicting damage to the caster without damaging the target when the AI attempts to use it by walking up to the target.
Expected behavior: Sunfire should not inflict any damage onto the caster regardless of use.
How to reproduce this: Either move to area AR5011 or CLUA 25SPELL.cre and then attack him. Eventually he will walk up to one of the party members and attempt a Sunfire. The Sunfire will then damage him and not the target.
Explanation: The projectile of sunfire is set to FIREBLNS.pro (Fireball Ignore Center). This means the target center of the explosion is not affected. This works fine when the target is self (when the player casts it), however the AI usually casts it on a hostile creature to make sure they get close enough to deal damage. Because of the nature of the projectile, what happens is that the target becomes the center of the explosion which is ignored while the caster suffers the effects of the spell.
Possible solution1: Change or create a new projectile that uses a 360 degree cone shape explosion guaranteeing that the caster is never hit, but the center of explosion is always at the caster (may or may not be intended depending on the AI). Attached is a modified version of FIREBLNS.pro, simply place it into the override folder. However it will not work like a fireball ignore center anymore if other .spl files use this .pro differently so I suggest making a new .pro file and have SPWI523 call that .pro file. The only weakness here is that smart players can easily outrun and move away from the caster as (s)he starts the spell, giving several seconds before the explosion goes off.
Possible solution2: introduce a new flag in the .pro file format, preferrably at 0x0000c (because it already has a "do not affect direct target") called "do not affect source" and use that bit in the .pro file to exclude the caster. I prefer this solution because it cannot be abused.