//::///////////////////////////////////////////////
//:: Default: End of Combat Round
//:: NW_C2_DEFAULT3
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////

#include "NW_I0_GENERIC"
void main()
{
    ExecuteScript("prc_npc_combat", OBJECT_SELF);
	
	object oMe=OBJECT_SELF;
    object oTarget;
    float fF;
    int nN;
    int nN2;
    string sType;
    if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
    {
        DetermineSpecialBehavior();
    }
    else if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
    {
       DetermineCombatRound();
    }
    // CUSTOM AI for Harvest of Souls
    if (GetLocalInt(GetModule(),"bCOMBAT_AI_OFF")!=TRUE)
    { // Combat AI is turned on for the module
      if (GetLocalInt(oMe,"bCOMBAT_AI_ON")==TRUE)
      { // This unit has been assigned combat AI
        sType=GetLocalString(oMe,"sCOMBAT_AI_TYPE");
        sType=GetStringLowerCase(sType);
        if (sType=="melee")
        { // melee combat
          ExecuteScript("cai_melee",oMe);
        } // melee combat
        else if (sType=="ranged")
        { // ranged combat
          ExecuteScript("cai_ranged",oMe);
        } // ranged combat
        else if (sType=="stealth")
        { // stealth combat
          ExecuteScript("cai_stealth",oMe);
        } // stealth combat
        else if (sType=="support")
        { // support role such as healing and buffing
          ExecuteScript("cai_support",oMe);
        } // support role such as healing and buffing
        else if (sType=="summon")
        { // summoner type caster
          ExecuteScript("cai_summon",oMe);
        } // summoner type caster
        else if (sType=="caster")
        { // spell caster
          ExecuteScript("cai_caster",oMe);
        } // spell caster
        else if (sType=="flee")
        { // try not to get hurt under any circumstance
          ExecuteScript("cai_flee",oMe);
        } // try not to get hurt under any circumstance
        else if (sType=="hold")
        { // hold where you are
          ExecuteScript("cai_hold",oMe);
        } // hold where you are
      } // This unit has been assigned combat AI
    } // Combat AI is turned on for the module
    // CUSTOM AI for Harvest of Souls
    if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
    {
        SignalEvent(OBJECT_SELF, EventUserDefined(1003));
    }
    ExecuteScript("cai_lanternarcho",OBJECT_SELF);
}