/*
    PROJECT Q IV
    (c) 2022 by Pstemarie

    Belker Smoke Claws AOE OnEnter Event Script

       Creatures entering the AOE must make a Fort save or suffer 3d4 damage.

       Note: Uses the "nw_" prefix for name continuity with the OC spellscript
       "nw_s1_smokeclaw".

    Version: 1.0
    Created: 7 June 2022
    Author:  Pstemarie

*/
#include "prc_inc_spells"
#include "NW_I0_SPELLS"

void main()
{
    //Declare major variables
    object oTarget = GetEnteringObject();
    effect eDamage;
    effect eHit = EffectVisualEffect(VFX_COM_BLOOD_REG_RED);

    if(GetIsEnemy(oTarget, GetAreaOfEffectCreator()))
    {
        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_SMOKE_CLAW));

        //Make a saving throw check
        if(!PRCMySavingThrow(SAVING_THROW_FORT, oTarget, 14, SAVING_THROW_TYPE_POISON))
        {
            eDamage = EffectDamage(d4(3));

            //Apply the VFX impact and effects
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eHit, oTarget);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
        }
    }
}
