//::///////////////////////////////////////////////
//:: Magic Cirle Against Good
//:: NW_S0_CircGoodA
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Add basic protection from good effects to
    entering allies.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 20, 2001
//:://////////////////////////////////////////////
#include "NW_I0_SPELLS"

#include "x2_inc_spellhook"

void main()
{




    object oTarget = GetEnteringObject();
//    if(GetIsFriend(oTarget, JXGetAOERealCreator()))
    if(spellsIsTarget(oTarget, SPELL_TARGET_ALLALLIES, JXGetAOERealCreator()))
    {
        //Declare major variables
        int nDuration = JXGetCasterLevel(OBJECT_SELF);
        //effect eVis = EffectVisualEffect( VFX_DUR_SPELL_GOOD_CIRCLE );	// handled by CreateProtectionFromAlignmentLink()
        effect eLink = CreateProtectionFromAlignmentLink(ALIGNMENT_GOOD);

        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MAGIC_CIRCLE_AGAINST_GOOD, FALSE));

        //Apply the VFX impact and effects
        //JXApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);	// handled by CreateProtectionFromAlignmentLink()
        JXApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
     }
}