/*
    PROJECT Q IV v4.00
    (c) 2022 by Pstemarie

    Miscellaneous Useful Functions Library

    Version: 1.0
    Created: 1 July 2022
    Author:  Pstemarie

*/

//***** FUNCTION DECLARATIONS *****//

// Returns TRUE if oTarget has any effect with the tag sEffectTag
int GetHasTaggedEffect(object oTarget, string sEffectTag);

// Removes any effects with the tag sEffectTag from oTarget
void RemoveTaggedEffects(object oTarget, string sEffectTag);



//***** FUNCTION PROTOTYPES *****//

int GetHasTaggedEffect(object oTarget, string sEffectTag)
{
    effect eEffect = GetFirstEffect(oTarget);
    while (GetIsEffectValid(eEffect))
    {
        if (GetEffectTag(eEffect) == sEffectTag)
        {
            return TRUE;
        }
        eEffect = GetNextEffect(oTarget);
    }
    return FALSE;
}

void RemoveTaggedEffects(object oTarget, string sEffectTag)
{
    effect eEffect = GetFirstEffect(oTarget);
    while (GetIsEffectValid(eEffect))
    {
        if (GetEffectTag(eEffect) == sEffectTag)
        {
            RemoveEffect(oTarget, eEffect);
        }
        eEffect = GetNextEffect(oTarget);
    }
}

