// ------------------------------------------------------------------------
//   Example for a monster using spells
//   see /doc/magik/monsters for more info
// ------------------------------------------------------------------------


inherit "obj/monster";

reset(arg)
{
   object pot;
   int    i;

   ::reset( arg );
   
   if ( arg )
      return;

   set_race( "humanoid" ) ;
   set_name( "tintifax" );
   set_level( 15 );
   set_size( 3 );
   set_short( "tinfifax" );
   set_long( "This is Tintifax, the crazy mage.\n" );
   set_gender( 1 );
   set_al( -150 );
   
   set_language_skill(2,100);

   change_spell( "magic missile", 80, 95, 0 );
   change_spell( "fireball", 50, 95, 1 );
}

int concentrate( object vic )
{
   int rnd;

   // ----- do i have a victim or am i already casting ???
   if ( vic && !query_concentrating() ) { 

      rnd = random( 100 );
      if ( rnd < 30 )                              // cast a magic missile
         npc_process_spell( "magic missile", vic->query_real_name() );
      else if ( rnd < 50 )                         // cast a fireball
         npc_process_spell( "fireball", vic->query_real_name() );
      else                                         // do nothing
         return( 0 );

      return( 1 );
   }

   return( 0 );
}
