// This script handles the area of effect for the Helm of Brilliance.

void main()
    {
    object oUndead = GetFirstInPersistentObject();
    object oCreator = GetAreaOfEffectCreator();
    if (!GetIsPC(oCreator))
        oCreator = GetItemPossessor(oCreator);
    object oHelm = GetItemPossessedBy(oCreator,"miscc097");
    if (GetItemInSlot(INVENTORY_SLOT_HEAD,oCreator) != oHelm)
        {
        DestroyObject(OBJECT_SELF);
        return;
        }
    effect eVis = EffectBeam(VFX_BEAM_FIRE,oCreator,BODY_NODE_CHEST);
    while (GetIsObjectValid(oUndead))
        {
        if (GetRacialType(oUndead) == RACIAL_TYPE_UNDEAD)
            {
            AssignCommand(oCreator,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(),DAMAGE_TYPE_POSITIVE),oUndead));
            AssignCommand(oCreator,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVis,oUndead,3.0));
            }
        oUndead = GetNextInPersistentObject();
        }
    }
