// v2.0.0 -
//::////////////////////////////////////////////////////////////////////////////
//:: FileName:  hark_d_buff_all
//::////////////////////////////////////////////////////////////////////////////
/*
   This will cause the henchman to use all of her spells to buff up the entire
  party.
*/
//::////////////////////////////////////////////////////////////////////////////
#include "hark_i0_enhance"
//::////////////////////////////////////////////////////////////////////////////
void main()
{
  int i;
  int nBuff = 0;
  object oTarget;
  object oHench = GetRealMaster();

  ActionPauseConversation();
  SetAssociateState(NW_ASC_IS_BUSY, TRUE);
  SetLocalInt(OBJECT_SELF, "nBuff", 0);
  ClearActions(CLEAR_D_BUFF_ALL_Main);

  for (i = 1; i <= 4; ++i)
    {
     while (GetIsObjectValid(oHench))
       {
        if (i == 1) oTarget = oHench;
        if (i == 2) oTarget = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oHench);
        if (i == 3) oTarget = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oHench);
        if (i == 4) oTarget = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oHench);
        if (GetIsObjectValid(oTarget))
          {
           int iBuffed = TRUE;
           while (iBuffed)
             {
              iBuffed = HenchTalentUseProtectionOthers(oTarget, FALSE);
              if (!iBuffed) iBuffed = HenchTalentEnhanceOthers(oTarget, TRUE, FALSE);
              if (iBuffed) ++nBuff;
             }
           SetLocalInt(oTarget, "nCast", 0);
          }
        oHench = GetHenchman(oHench);
       }
    }

  if (nBuff > 0)
    {
     SetLocalInt(GetRealMaster(), "BuffedUp", TRUE);
     ActionDoCommand(PersistentConversationAttempt(GetRealMaster()));
    }
  else
    { SetLocalInt(GetRealMaster(), "BuffedUp", FALSE); }
}
//::////////////////////////////////////////////////////////////////////////////
