
void () Queen_JumpTouch;

void (float side) Queen_Melee;

void () queen_stand1 = [ 0.000, queen_stand2 ] {

   ai_stand ();

};

void () queen_stand2 = [ 1.000, queen_stand3 ] {

   ai_stand ();

};

void () queen_stand3 = [ 2.000, queen_stand4 ] {

   ai_stand ();

};

void () queen_stand4 = [ 3.000, queen_stand5 ] {

   ai_stand ();

};

void () queen_stand5 = [ 4.000, queen_stand6 ] {

   ai_stand ();

};

void () queen_stand6 = [ 5.000, queen_stand1 ] {

   ai_stand ();

};

void () queen_walk1 = [ 6.000, queen_walk2 ] {

   if ( (random () < 0.200) ) {

      sound (self,CHAN_VOICE,"queen/sight1.wav",TRUE,ATTN_IDLE);

   }
   ai_walk (FL_CLIENT);

};

void () queen_walk2 = [ 7.000, queen_walk3 ] {

   ai_walk (20.000);

};

void () queen_walk3 = [ 8.000, queen_walk4 ] {

   ai_walk (24);

};

void () queen_walk4 = [ 9.000, queen_walk5 ] {

   ai_walk (26.000);

};

void () queen_walk5 = [ 10.000, queen_walk6 ] {

   ai_walk (25.000);

};

void () queen_walk6 = [ 11.000, queen_walk1 ] {

   ai_walk (24);

};

void () queen_run1 = [ 6.000, queen_run2 ] {

   if ( (random () < 0.200) ) {

      sound (self,CHAN_VOICE,"queen/sight1.wav",TRUE,ATTN_IDLE);

   }
   ai_run (20.000);

};

void () queen_run2 = [ 7.000, queen_run3 ] {

   ai_run (25.000);

};

void () queen_run3 = [ 8.000, queen_run4 ] {

   ai_run (36.000);

};

void () queen_run4 = [ 9.000, queen_run5 ] {

   ai_run (20.000);

};

void () queen_run5 = [ 10.000, queen_run6 ] {

   ai_run (25.000);

};

void () queen_run6 = [ 11.000, queen_run1 ] {

   ai_run (36.000);

};

void () queen_jump1 = [ 6.000, queen_jump2 ] {

   ai_face ();

};

void () queen_jump2 = [ 7.000, queen_jump3 ] {

   ai_face ();

};

void () queen_jump3 = [ 8.000, queen_jump4 ] {

   ai_face ();

};

void () queen_jump4 = [ 9.000, queen_jump5 ] {

   ai_face ();
   self.touch = Queen_JumpTouch;
   makevectors (self.angles);
   self.origin_z = (self.origin_z + TRUE);
   self.velocity = ((v_forward * MOVETYPE_FLY) + '0.000 0.000 24.000');
   if ( (self.flags & FL_ONGROUND) ) {

      self.flags = (self.flags - FL_ONGROUND);

   }

};

void () queen_jump5 = [ 10.000, queen_jump6 ] {


};

void () queen_jump6 = [ 11.000, queen_jump7 ] {


};

void () queen_jump7 = [ 6.000, queen_jump8 ] {


};

void () queen_jump8 = [ 7.000, queen_jump9 ] {


};

void () queen_jump9 = [ 8.000, queen_jump10 ] {


};

void () queen_jump10 = [ 9.000, queen_jump1 ] {

   self.nextthink = (time + MOVETYPE_WALK);

};

void () queen_jump11 = [ 10.000, queen_jump12 ] {


};

void () queen_jump12 = [ 11.000, queen_run1 ] {


};

void () queen_atta1 = [ 12.000, queen_atta2 ] {

   ai_charge (MOVETYPE_STEP);

};

void () queen_atta2 = [ 13.000, queen_atta3 ] {

   ai_charge (FALSE);

};

void () queen_atta3 = [ 14.000, queen_atta4 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () queen_atta4 = [ 15.000, queen_atta5 ] {

   ai_charge (TRUE);
   Queen_Melee (200.000);

};

void () queen_atta5 = [ 16.000, queen_atta6 ] {

   ai_charge (FL_SWIM);

};

void () queen_atta6 = [ 17.000, queen_atta1 ] {

   ai_charge (TRUE);

};

void () queen_pain1 = [ 6.000, queen_pain2 ] {


};

void () queen_pain2 = [ 7.000, queen_pain3 ] {


};

void () queen_pain3 = [ 8.000, queen_pain4 ] {


};

void () queen_pain4 = [ 9.000, queen_pain5 ] {


};

void () queen_pain5 = [ 10.000, queen_pain6 ] {


};

void () queen_pain6 = [ 11.000, queen_run1 ] {


};

void (entity attacker, float damage) queen_pain = {

   if ( (self.touch == Queen_JumpTouch) ) {

      return ;

   }
   if ( (self.pain_finished > time) ) {

      return ;

   }
   self.pain_finished = (time + TRUE);
   sound (self,CHAN_VOICE,"demon/dpain1.wav",TRUE,ATTN_NORM);
   if ( ((random () * 200.000) > damage) ) {

      return ;

   }
   queen_pain1 ();

};

void () queen_die = {

   if ( (self.health < TRUE) ) {

      sound (self,CHAN_VOICE,"demon/ddeath.wav",TRUE,ATTN_NORM);
      ThrowGib ("progs/thigh.mdl",self.health);
      ThrowGib ("progs/thigh.mdl",self.health);
      ThrowGib ("progs/thigh.mdl",self.health);
      ThrowGib ("progs/qhead.mdl",self.health);
      ThrowGib ("progs/tail2.mdl",self.health);
      ThrowGib ("progs/forearm.mdl",self.health);
      ThrowGib ("progs/forearm.mdl",self.health);
      ThrowGib ("progs/qbody.mdl",self.health);
      ThrowGib ("progs/hand.mdl",self.health);
      ThrowGib ("progs/hand.mdl",self.health);
      ThrowGib ("progs/tail2.mdl",self.health);
      ThrowGib ("progs/thigh.mdl",self.health);
      T_RadiusDamage (self,self,200.000,world);
      self.origin = (self.origin - (FL_CLIENT * normalize (self.velocity)));
      AcidExplosion ();
/*
      setmodel (self,"progs/b_g_key.mdl");
      self.netname = "gold keycard";
      self.touch = key_touch;
      self.items = IT_KEY2;
      self.noise = "misc/basekey.wav";
      setsize (self,VEC_HULL_MIN,VEC_HULL_MAX);
      StartItem ();
      */
      return ;

   }

};

void () Queen_MeleeAttack = {

   queen_atta1 ();

};

void () monster_boss = {

   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_STEP;
   setmodel (self,"progs/queen.mdl");
   setsize (self,'-32.000 -32.000 -40.000','32.000 32.000 48.000');
   self.health = 4000.000;
   self.th_stand = queen_stand1;
   self.th_walk = queen_walk1;
   self.th_run = queen_run1;
   self.th_die = queen_die;
   self.th_melee = Queen_MeleeAttack;
   self.th_missile = queen_jump1;
   self.th_pain = queen_pain;
   self.origin = (self.origin + '0.000 0.000 16.000');
   walkmonster_start ();

};
float () CheckQueenMelee = {

   if ( (enemy_range == RANGE_MELEE) ) {

      self.attack_state = AS_MELEE;
      return ( TRUE );

   }
   return ( FALSE );

};
float () CheckQueenJump = {

   local vector dist;
   local float d;

   return ( FALSE );

};
float () QueenCheckAttack = {

   local vector vec;

   if ( CheckQueenMelee () ) {

      self.attack_state = AS_MELEE;
      return ( TRUE );

   }
   return ( FALSE );

};

void (float side) Queen_Melee = {

   local float ldmg;
   local vector delta;

   ai_face ();
   walkmove (self.ideal_yaw,12.000);
   delta = (self.enemy.origin - self.origin);
   if ( (vlen (delta) > 100.000) ) {

      return ;

   }
   if ( !CanDamage (self.enemy,self) ) {

      return ;

   }
   sound (self,CHAN_WEAPON,"demon/dhit2.wav",TRUE,ATTN_NORM);
   ldmg = (100.000 + (MOVETYPE_FLY * random ()));
   T_Damage (self.enemy,self,self,ldmg);
   makevectors (self.angles);
   SpawnMeatSpray ((self.origin + (v_forward * FL_INWATER)),(side * v_right));

};

void () Queen_JumpTouch = {

   local float ldmg;

   if ( (self.health <= FALSE) ) {

      return ;

   }
   if ( other.takedamage ) {

      if ( (vlen (self.velocity) > 400.000) ) {

         ldmg = (100.000 + (MOVETYPE_BOUNCE * random ()));
         T_Damage (other,self,self,ldmg);

      }

   }
   self.touch = SUB_Null;
   self.think = queen_run1;
   self.nextthink = (time + 0.100);

};

void () Queen_LayEgg = {

   ai_run (TRUE);
   self.classname = "monster_knight";
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_STEP;
   setmodel (self,"progs/egg.mdl");
   setsize (self,VEC_HULL_MIN,VEC_HULL_MAX);
   self.health = 20.000;
   self.velocity = '0.000 50.000 0.000';
   self.avelocity = VEC_ORIGIN;
   self.th_stand = egg_stand1;
   self.th_walk = egg_walk1;
   self.th_run = egg_run1;
   self.th_die = egg_die;
   self.th_melee = egg_jump1;
   self.th_missile = egg_jump1;
   self.origin = (self.origin + '0.000 50.000 32.000');
   if ( (self.flags & FL_ONGROUND) ) {

      self.flags = (self.flags - FL_ONGROUND);

   }
   self.attack_state = AS_MISSILE;
   self.enemy = world;
   self.touch = SUB_Null;
   self.think = egg_walk1;
   self.nextthink = (time + 0.100);
   walkmonster_start ();

};
