//::///////////////////////////////////////////////
//:: Tyrant Fog Zombie Mist Heartbeat
//:: NW_S1_TyrantFgA.nss
/*
    PROJECT Q IV v4.00
    (c) 2022 by Pstemarie

    Mustard Jelly Stench OnEnter Event Script

       Entering creature is slowed

    Version: 1.0
    Created: 1 July 2022
    Author:  Pstemarie

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

void main()
{
    //Declare major variables
    object oTarget = GetEnteringObject();
    effect eSlow   = EffectSlow();
           eSlow   = ExtraordinaryEffect(eSlow);
    effect eDur    = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
    effect eLink   = EffectLinkEffects(eSlow, eDur);
           eLink   = TagEffect(eLink, "SPELLABILITY_MUSTARD_JELLY_FOG");
    effect eVis    = EffectVisualEffect(VFX_IMP_SLOW);

    if(!GetHasTaggedEffect(oTarget, "SPELLABILITY_MUSTARD_JELLY_FOG"))
    {
        if(GetIsEnemy(oTarget, GetAreaOfEffectCreator()))
        {
            //Make a saving throw check
            if(!PRCMySavingThrow(SAVING_THROW_FORT, oTarget, 13, SAVING_THROW_TYPE_POISON))
            {
                //Apply the VFX impact and effects
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(2));
            }
        }
    }
}
