onFight1.c

grendel-1.0.0a7/progs/examples/onFight1.c · 548 B

From the archive grendel-1.0.0a7.zip

Download the archive   « Back to the archive contents

require "glib.c"

void onGreet(external ch, external target)
{
   if(target.alignment == -1000)
   {
     do("say We don't want you people here!");
     do("kill " + target.name);
   }
   else
   {
     do("Welcome traveller, can I offer you my services?"); 
   }
}

void onFight(external ch, external target)
{
   int x;
   x = random(100);

   if(x =< 75)
   {
      do("cast 'magic missile' " + target.name);

      sleep(1);

      if(x =< 15)
      {
         do("cast 'vortex' " + target.name);
      }
   }
}

Site Stats

Snippets: 1791
Codebases: 571