CORPSE_D.C

LIB3/D/HOME/CITY/MONSTERS/CORPSE_D.C · 2.0 KB

From the archive nm4dos.zip

Download the archive   « Back to the archive contents

#include "path.h"
inherit "/obj/monster";

setup()
{
   set_name("dog");
   set_short("hungry-looking dog");
   add_adjective( ({"hungry", "looking", "hungry-looking"}) );
   set_race("dog");
   set_long("A dog with exceptionally large and dangerous-"
            +"looking dog. It glares balefully at you before "
            +"wandering off to sniff at some interesting "
            +"vegetation.\n");
   set_level(5+random(5));
   add_attack("bite", 0, 100, ({10, 2, 10}), ({ }), ({ }), "pierce");
   add_attack("pounce", 0, 50, ({10, 2, 20}), ({ }), ({ }), "blunt");
   set_gender(0);
   set_move_after(50);
  load_chat(20, ({
     1, "'Woof!.\n",
     1, ":sniffs the ground.\n",
     1, ":sniffs your feet and whimpers.\n",
     1, ":barks at a passerby.\n",
     1, "'Grrrrr!\n",
    }));
   load_a_chat(50, ({
     1, ":growls viciously at you.\n",
     1, ":tries to bite your jugular.\n",
     1, "'Grrrr!\n",
    }));
}

int write_message(int dam,object him,object me,string type,string attack)
{
   switch (attack)
   {
      case "bite" :
      say(me->query_cap_name()+" bites "+
         him->query_name()+".\n",him);
      tell_object(him,me->query_cap_name()+" bites you.\n");
      break;
      case "pounce" :
      say(me->query_cap_name()+" pounces on "+
         him->query_name()+".\n",him);
      tell_object(him,me->query_cap_name()+" pounces on you.\n");
      break;
      default :
      ::write_message(dam, him, me, type, attack);
      break;
   }
}

void init()
{
::init();
}

void eat_corpses()
{

object *corpses;
int i,j;

corpses = all_inventory(environment(this_object()));

if(!sizeof(corpses)) return;
j=1;
set_move_after(0, 0);

for(i=0;i<sizeof(corpses);i++)
if (corpses[i]->id("corpse"))
     {
     call_out("my_eat", j*10, corpses[i]);
     j++;
     }
j++;
call_out("set_move_after", j*10, 50);
}

my_eat(object corpse)
{
    say(this_object()->query_short()+" sniffs at "
       +corpse->query_short() +" before devouring it quickly.\n");
corpse->dest_me();
}

Site Stats

Snippets: 1791
Codebases: 571