string Name	= "½£Èå¡¤¸ßÎÄ²Å";
int Model =	35;
int Weapon = 47;
int Weapon2 = 0;
int Team = 2;
int View = 300;
int Think = 90;
int Attack1 = 10;
int Attack2 = 0;
int Attack3 = 0;
int Guard = 90;
int Dodge = 10;
int Jump = 5;
int Look = 10;
int Burst = 80;
int Aim = 90;
int GetItem = 0;
int Spawn = 500;
int HP = 15000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int trg3 = 0;
int trg4 = 0;
int trg5 = 0;
int px = 0;

int timer0 = 0;
int timer1 = 0;
int timer2 = 0;

int tx = 0;
int tq = 0;
int ds = 0;
int g_self;
int g_selfAddr;
OnInit(int this)
{
	g_selfAddr = this;
}

OnStart()
{
	g_self = GetSelf(g_selfAddr);
	ChangeBehavior(g_self, "wait");
}
OnUpdate()
{
	int player = GetAnyChar("player");
	int now = GetGameTime();
	if (trg1==0)
	{
		SetTarget(9, "waypoint", 1);
		SetTarget(0, "char", player);		
		if (player>=0 && now>=timer0)
		{
			ds = Distance(0, 9);
			timer0 = now + 2;
		}
	}
	if (trg0==0 && now>timer1)
	{
		SetTarget(9, "waypoint", 1);
		SetTarget(1, "char", g_self);
		SetTarget(0, "char", player);
		if (Distance(0, 1) < 50 && ds!=Distance(0, 9))
		{
			Attack1 = 90;
			Attack2 = 10;
			Attack3 = 0;
			Guard = 0;
			Burst = 0;
			Jump = 0;
			
			UpdateAIAttrib(g_self);
			trg0 = 1;
			timer1 = now + 2;
		}
		if (Distance(0, 1) >= 50 && Distance(0, 1) < 85 && ds!=Distance(0, 9))
		{
			Attack1 = 15;
			Attack2 = 80;
			Attack3 = 5;
			Guard = 0;
			Burst = 10;
			Jump = 0;
			
			UpdateAIAttrib(g_self);			
			trg0 = 1;
			timer1 = now + 2;
		}
	}
	if (trg0==1)
	{
		SetTarget(1, "char", g_self);
		SetTarget(0, "char", player);
		if (Distance(0, 1) >= 85 || now>timer1)
		{
			Attack1 = 0;
			Attack2 = 2;
			Attack3 = 0;
			Guard = 98;
			Burst = 100;
			Jump = 5;
			
			UpdateAIAttrib(g_self);			
			trg0 = 0;
			timer1 = now + 2;
		}
	}
	if (px==0)
	{
		if (GetAnger(player)>=60)
		{
			px = 1;
		}
	}
	if (px==1)
	{
		if ((GetWeaponType(player)==0||GetWeaponType(player)==7||GetWeaponType(player)==4) && GetAnger(player)<60)
		{
			Perform(g_self, "jump");
			Perform(g_self, "jump");
			px = 2;
			tx = now + 2;
		}
		if ((GetWeaponType(player)==1||GetWeaponType(player)==9||GetWeaponType(player)==11) && GetAnger(player)<60)
		{
			Perform(g_self, "guard",3);
			px = 2;
			tx = now + 2;
		}
		if ((GetWeaponType(player)==10||GetWeaponType(player)==5) && GetAnger(player)<60)
		{
			Attack1 = 0;
			Attack2 = 100;
			Attack3 = 0;
		
			UpdateAIAttrib(g_self);
			px = 2;
			tx = now + 2;
		}
	}
	if (px==2 && now>=tx)
	{
		StopPerform(g_self);
		px = 0;
	}

	if (trg5==1)
	{
		SetTarget(1, "char", g_self);
		SetTarget(0, "char", player);
                 	if (trg4==1 && now>=timer2 && GetAnger(player)>=15)
		{
			trg4 = 2;
			timer2 = now + 5;
		}
                	if (trg4==2 && now>=timer2 && GetAnger(player)>=25 && Distance(0, 1) >= 50)
		{
			View = 300;
			Attack1 = 0;
			Attack2 = 1;
			Attack3 = 0;
			Guard = 99;
			Jump = 45;
			Burst = 100;
			trg4 = 3;
			timer2 = now + 3;
			UpdateAIAttrib(g_self);
		}
             	   	if (trg4==3 && now>timer2 && Distance(0, 1) < 50)
		{
			View = 150;
			Attack1 = 30;
			Attack2 = 35;
			Attack3 = 25;
			Guard = 10;
			Jump = 0;
			Burst = 5;
			trg4 = 1;
			timer2 = now + 6;
			UpdateAIAttrib(g_self);
		}
		if (trg3==1 && GetAnger(player)<15 && Distance(0, 1) < 50)
		{
			View = 150;
			Attack1 = 30;
			Attack2 = 30;
			Attack3 = 25;
			Guard = 15;
			Jump = 0;
			Burst = 30;
			UpdateAIAttrib(g_self);
		}
	}


	if (trg2==0)
	{
		if (GetHP(g_self)<14000)
		{
			Think = 2000;
			View = 150;
			Attack1 = 0;
			Attack2 = 1;
			Attack3 = 0;
			Guard = 20;
			Burst = 100;
			Jump = 45;
			
			UpdateAIAttrib(g_self);	

			trg0 = 9;
			trg1 = 9;
			trg2++;
			trg3 = 1;
			trg4 = 1;
			trg5 = 1;
			timer2 = now + 1;
		}
	}
	if (trg2==1)
	{
		if (GetHP(g_self)<13000)
		{
			View = 300;
			
			UpdateAIAttrib(g_self);	
			trg0 = 0;
			trg1 = 0;
			trg2++;
			trg3 = 9;
			trg4 = 9;
			trg5 = 9;
			timer0 = now + 2;
			timer1 = now + 2;
		}
	}
	if (trg2==2)
	{
		if (GetHP(g_self)<11000)
		{
			View = 200;
			Attack1 = 0;
			Attack2 = 1;
			Attack3 = 0;
			Guard = 20;
			Burst = 100;
			Jump = 45;
			
			UpdateAIAttrib(g_self);	

			trg0 = 9;
			trg1 = 9;
			trg2++;
			trg3 = 1;
			trg4 = 1;
			trg5 = 1;
			timer2 = now + 1;
		}
	}
	if (trg2==3)
	{
		if (GetHP(g_self)<9000)
		{
			View = 300;
			
			UpdateAIAttrib(g_self);	
			trg0 = 0;
			trg1 = 0;
			trg2++;
			trg3 = 9;
			trg4 = 9;
			trg5 = 9;
			timer0 = now + 2;
			timer1 = now + 2;
		}
	}
	if (trg2==4)
	{
		if (GetHP(g_self)<7000)
		{
			View = 200;
			Attack1 = 0;
			Attack2 = 1;
			Attack3 = 0;
			Guard = 20;
			Burst = 100;
			Jump = 45;
			
			UpdateAIAttrib(g_self);	

			trg0 = 9;
			trg1 = 9;
			trg2++;
			trg3 = 1;
			trg4 = 1;
			trg5 = 1;
			timer2 = now + 1;
		}
	}
	if (trg2==5)
	{
		if (GetHP(g_self)<5000)
		{
			View = 300;
			
			UpdateAIAttrib(g_self);	
			trg0 = 0;
			trg1 = 0;
			trg2++;
			trg3 = 9;
			trg4 = 9;
			trg5 = 9;
			timer0 = now + 2;
			timer1 = now + 2;
		}
	}
	if (trg2==6)
	{
		if (GetHP(g_self)<3000)
		{
			View = 200;
			
			UpdateAIAttrib(g_self);	
			trg0 = 9;
			trg1 = 9;
			trg2++;
			trg3 = 1;
			trg4 = 1;
			trg5 = 1;
			timer2 = now + 1;
		}
	}
	if (trg2==7)
	{
		if (GetHP(g_self)<1000)
		{
			View = 300;
			
			UpdateAIAttrib(g_self);	
			trg0 = 0;
			trg1 = 0;
			trg2++;
			trg3 = 9;
			trg4 = 9;
			trg5 = 9;
			timer0 = now + 2;
			timer1 = now + 2;
		}
	}
}