auto_attack.c

final_realms_fluffos_v1/lib/d/newbie/dwarf/npcs/auto_attack.c · 844 B

From the archive final_realms_fluffos_v1.zip

Download the archive   « Back to the archive contents

int npc_attack(object victim)
{
   int i;
   object *olist;
   olist = all_inventory(this_object());
   for(i = 0; i < sizeof(olist); i++)
   {
      if(!interactive(olist[i]) && olist[i]->query_aggressive() )
      {
         olist[i]->attack_by(victim);
      }
   }
}
nomask int test_add(object victim,int flag)
{
   int i;
   object *olist;
   /* see if it's an NPC loaded, if so scan for players and mug them */
   if(!interactive(victim))
   {
      /* but only if the beast IS aggressive */
      if(victim->query_aggressive())
      {
         olist = all_inventory(this_object());
         for(i = 0; i < sizeof(olist); i++)
         {
            if(interactive(olist[i]) )
            {
               olist[i]->attack_by(victim);
            }
         }
      }
   }
   /* else just mug it */
   npc_attack(victim);
   return 1;
}

Site Stats

Snippets: 1791
Codebases: 571