//::///////////////////////////////////////////////
//:: Default On Percieve
//:: NW_C2_DEFAULT2
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Checks to see if the perceived target is an
    enemy and if so fires the Determine Combat
    Round function
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////

#include "NW_I0_GENERIC"
#include "nw_i0_plot"
object oToJumpTo = GetObjectByTag("InvisibleObject3");
int nCalledBy=GetUserDefinedEventNumber();
object oSeen = GetFirstPC();
void main()
{
switch(nCalledBy)
{
case 1002: // Called by OnPerception
if (GetIsPC(oSeen))
{
if (GetLocalInt(oSeen, "SUMMONEDSS") == 0)
{
SpeakString("So you made it this far? No matter. I shall rend your soul!");
object oMalauntyr = CreateObject(OBJECT_TYPE_CREATURE, "shadowself", GetLocation(GetObjectByTag("InvisibleObject1")));
object oMalauntyr2 = CreateObject(OBJECT_TYPE_CREATURE, "shadowself001", GetLocation(GetObjectByTag("InvisibleObject2")));
ActionJumpToObject(oToJumpTo);
SetLocalInt(GetFirstPC(), "SUMMONEDSS", 1);
}
break;

case 1006: // Called by OnDamaged
int nMaxHP = GetMaxHitPoints();
        int nCurrHP = GetCurrentHitPoints();
         // * generic surrender should only fire once
          // * generic surrender should only fire once
        if (GetLocalInt(OBJECT_SELF,"NW_L_DOTHISONCE") == 0)
        if (GetLocalInt(GetFirstPC(), "MalVanquished") <1)
        if((nCurrHP * 3) <= nMaxHP && GetLocalInt(OBJECT_SELF,"Generic_Surrender") == 0)
        {
        SpeakString("Enough. I tire of these games.");

        object oMalauntyr3 = CreateObject(OBJECT_TYPE_CREATURE, "Malauntyr002", GetLocation(GetObjectByTag("InvisibleObject5")));
        SetLocalInt (GetFirstPC(), "MalVanquished", 1);

        effect eVFX;
        object oSelf = OBJECT_SELF;

     eVFX = EffectVisualEffect(472);
     ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSelf);

     DestroyObject(GetObjectByTag("Q_TROLL2HEAD"));
     DestroyObject(GetObjectByTag("ShadowSelf1"));
     DestroyObject(GetObjectByTag("ShadowSelf2"));
     DestroyObject(oSelf, 1.5);

}

break;

        }
        }
        }





