#include "x0_i0_corpses"
#include "inc_misc_tools"
//::///////////////////////////////////////////////
//:: Stink Beetle OnDeath Event
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Releases the Stink Beetle's Stinking Cloud
    special ability OnDeath.
*/
//:://////////////////////////////////////////////
//:: Created By: Andrew
//:: Created On: Jan 2002
//:://////////////////////////////////////////////
#include "x0_i0_spawncond"
void main()
{
    //Declare major variables
    effect eAOE = EffectAreaOfEffect(AOE_MOB_TYRANT_FOG,"NW_S1_Stink_A");
    location lTarget = GetLocation(OBJECT_SELF);

    //Create the AOE object at the selected location
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, RoundsToSeconds(2));
    if (GetLocalInt(OBJECT_SELF,"MirrorOfOppositionCopy"))
            {
            SetIsDestroyable(TRUE,FALSE,FALSE);
            DestroyObject(OBJECT_SELF);
            return;
            }
    else if (GetIsObjectValid(GetLocalObject(OBJECT_SELF,"MirrorOfOpposition")))
            {
            ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(),GetLocalObject(OBJECT_SELF,"MirrorOfOpposition"));
            }
    object oKiller = GetLastKiller();
    int iBoss = GetLocalInt(OBJECT_SELF,"Boss");
    if (!GetLocalInt(OBJECT_SELF,"Dead"))
            {
            if (SLOW_XP && iBoss)
                AwardXPs(oKiller);
            else
                AwardXPs(oKiller);
            SetLocalInt(OBJECT_SELF,"Dead",TRUE);
            if (iBoss)
                KillAndReplaceLootable(OBJECT_SELF,FALSE);
            else
                KillAndReplaceDecorative(OBJECT_SELF);
            }
}



