
void main( void )
{
int &mcounter;
sp_brain(&current_sprite, 0);
sp_speed(&current_sprite, 1);
sp_distance(&current_sprite, 50);
sp_range(&current_sprite, 35);
sp_timing(&current_sprite, 0);
sp_frame_delay(&current_sprite, 55);
sp_exp(&current_sprite, 150);
sp_base_walk(&current_sprite, 800);
sp_base_attack(&current_sprite, 790);
sp_defense(&current_sprite, 6);
sp_strength(&current_sprite, 25);
sp_hitpoints(&current_sprite, 80);
preload_seq(792);
preload_seq(794);
preload_seq(796);
preload_seq(798);
preload_seq(805);

preload_seq(801);
preload_seq(803);
preload_seq(807);
preload_seq(809);
}


void hit( void )
{
sp_brain(&current_sprite, 9);
sp_target(&current_sprite, &enemy_sprite);
//lock on to the guy who just hit us
//playsound
playsound(28, 22050,0,&current_sprite, 0);
sp_touch_damage(&current_sprite, 10);

}

void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 
}
void attack( void )
{
playsound(27, 22050,0,&current_sprite, 0);
&mcounter = random(4000,0);
sp_attack_wait(&current_sprite, &mcounter);
}

void talk ( void )
{

int &temp;
&temp = sp_brain(&current_sprite, -1);
if (&temp == 9)
  {
  say("`6吾将沙尔。", &current_sprite);
  return; 
  }

freeze(1);
freeze(&current_sprite);
 choice_start()
(&gobpass == 0) "叫地精守卫放你进去"
 "引发‘事件‘"
 "离开"
 choice_end()

 if (&result == 1)
 {
  wait(400);
  say_stop("你好啊朋友！我能进去吗？", 1);
  wait(400);
  say_stop("`6哼", &current_sprite);
  wait(400);
  int &dumb = compare_weapon("item-b1");
debug("Dumb is &dumb");
  if (&dumb == 1)
    {
      if (&mayor != 3)
       {
        //if they have not talked to the mayor, let's not let them in.
  say_stop("`6额.. 尔奈是Joon? 碗歇莱！太早了。", &current_sprite);
  wait(400);
  unfreeze(1);
 unfreeze(&current_sprite);
  return;    

       }
     //they are holding the bow
   say_stop("`6尔有公，开门", &current_sprite);
playsound(43, 22050,0,0,0);

        &gobpass = 1;
        //remove gate
        &dumb = sp(3);
        sp_hard(&dumb, 1);
        draw_hard_sprite(&dumb);
        sp_active(&dumb, 0);
unfreeze(1);
unfreeze(&current_sprite);
  return;    
    }
  say_stop("`6尔人不得进，离！", &current_sprite);
  wait(400);
  say_stop("不要这样嘛，让偶进去吧！", 1);
  wait(400);
  say_stop("`6无弓？尔非Joon！离！", &current_sprite);
 }

 if (&result == 2)
 {
  wait(400);
  say_stop("啊哈，那场23年的战斗怎么样？你们的小屁屁被打坏了吧。", 1);
  wait(400);
  say_stop("`6尔怒我！", &current_sprite);
  wait(400);
  say_stop("我的意思是，Daniel 国王简直把你们当虫子一样耍。", 1);
  wait(400);
  say_stop("`6尔！现必要死！", &current_sprite);
  sp_brain(&current_sprite, 9);
  sp_target(&current_sprite, 1);
 }

unfreeze(1);
unfreeze(&current_sprite);

}
