//:://////////////////////////////////////////////////
//:: prc_pwondeath
/*
    Catch-all OnDeath event handler for NPCs.

	Handles everything the default PRC8 event script 
	doesn't.
	
 */
//:://////////////////////////////////////////////////
#include "prc_inc_clsfunc"
#include "x0_i0_corpses"
#include "inc_misc_tools"
#include "x2_inc_compon"
#include "x0_i0_spawncond"

string sHenchSummonedFamiliar = "HenchSummonedFamiliar";
string sHenchSummonedAniComp  = "HenchSummonedAniComp";
string sHenchLastHeardOrSeen  = "LastSeenOrHeard";

// Clears the last unheard, unseen enemy location
void ClearEnemyLocation2();

void ReplaceEquip(object oItem);

void main()
{
    int i;
    object oItem;
    string sTag;

}

void ClearEnemyLocation2()
{
    object oKiller = GetLastKiller();
	
	DeleteLocalInt(OBJECT_SELF, sHenchLastHeardOrSeen);
    DeleteLocalLocation(OBJECT_SELF, sHenchLastHeardOrSeen);
	object oInvisTarget = GetLocalObject(OBJECT_SELF, sHenchLastHeardOrSeen);
    if (GetIsObjectValid(oInvisTarget))
    {
        DestroyObject(oInvisTarget);
        DeleteLocalObject(OBJECT_SELF, sHenchLastHeardOrSeen);
    }
    //Begin CustomDeath

    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"));
            }
    int iBoss = GetLocalInt(OBJECT_SELF,"Boss");
    if (!GetLocalInt(OBJECT_SELF,"Dead"))
		{
		if (SLOW_XP && iBoss)
		{
			if(oKiller != OBJECT_SELF)
				ExecuteScript("no_c2_default7", OBJECT_SELF);
			//AwardXPs(oKiller);
		}
		else
		{
			if(oKiller != OBJECT_SELF)
				ExecuteScript("no_c2_default7", OBJECT_SELF);
			//AwardXPs(oKiller);
		}
		SetLocalInt(OBJECT_SELF,"Dead",TRUE);
		if (iBoss)
			KillAndReplaceLootable(OBJECT_SELF,FALSE);
		else
			KillAndReplaceDecorative(OBJECT_SELF);
		}
}