// Life-and-death Space
int Rule = 1;
int RoundTime = 5;
int PlayerSpawn = 20;
int PlayerSpawnDir = 90;
int PlayerWeapon = 5;
int PlayerWeapon2 = 1;
int PlayerHP = 3000;


int trg0 = 0;
int trg1 = 0;
int timer0 = 0;
int timer1 = 0;
int gameover = 0;

OnStart()
{
	AddNPC("npc09_01");
	AddNPC("npc09_02");
}

OnUpdate()
{	
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		return 0;
	}
	
	int c;
	int c2;
	int now = GetGameTime();
	
	
	if (trg0 == 0)
	{
		c = GetChar("Ivy");
		c2 = GetChar("T-Chan");
		
		if (c>=0 && c2>=0)
		{
			SetTarget(0, "waypoint", 15);
			ChangeBehavior(c2, "attacktarget", 0);
			Perform(c2, "pause", 2);
			Perform(c2, "say", "Relaxing to see this£¡£¡");
			Perform(c2, "pause", 2);
			Perform(c2, "say", "Only one bottle of antidote here, you two figure it out£¡");
			Perform(c2, "pause", 2);
			Perform(c2, "say", "A killer is played, not happy, right£¿");
			Perform(c2, "pause", 4);
			Perform(c2, "say", "You just wanna murder Smith Fan, and now he is absolutely dead,right?");
			Perform(c2, "pause", 2);
			Perform(c2, "say", "Aha, I am not really dead£¡");
			Perform(c2, "pause", 5);
			Perform(c2, "say", "Hahaha£¡");
			Perform(c2, "faceto", player);
			
			Perform(c, "attack");
			Perform(c, "faceto", player);
			Perform(c, "guard", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "This antidote is mine£¡£¡");
			Perform(c, "pause", 23);
			Perform(c, "faceto", player);
			Perform(c, "use", 14);
			
			PlayerPerform("block", 0);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 7);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 9);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "You? You have been alread©q©q©q£¡£¿");
			PlayerPerform("pause", 3);
			PlayerPerform("use", 14);
			PlayerPerform("block", 1);
			
			trg0 = 1;
			timer0 = now + 19;
		}
	}
	if (trg0==1 && now>timer0)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			RemoveNPC(c);
			trg0 = 2;
		}
	}
	
	if (trg0==2 && now>60)
	{
		c = GetChar("Ivy");
		if (c >= 0)
		{			
			Perform(c, "guard", 6);
			Perform(c, "say", "©q©q©q©q©q©q©q");
			Perform(c, "pause", 4);
			Perform(c, "say", "Afraid£¿£¿");
			Perform(c, "faceto", player);
			Perform(c, "pause", 4);
			Perform(c, "say", "Come on, are you just that easy£¿£¿");
			Perform(c, "faceto", player);
			
			PlayerPerform("say", "£¨Unexpectly, just little careless, I©q©q©q£©");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "©q©q©qI don't wanna vie with you£¡£¡");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 4);
			
			trg0 = 3;
		}				
	}
	
	if (trg0==3 && now>90)
	{
		c = GetChar("Ivy");
		if (c >= 0)
		{			
			Perform(c, "guard", 7);
			Perform(c, "say", "Don't look down on me just because I am a girl£¡£¡");
			Perform(c, "faceto", player);
			Perform(c, "pause", 5);
			Perform(c, "say", "Go! Only the winner can get the hell out of here£¡");
			Perform(c, "faceto", player);
			
			PlayerPerform("say", "£¨Is it a setup©q©q©q£©");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "©q©q©q©q©q£¨What is going on? Smith Fan's death©q©q£©");
			PlayerPerform("pause", 7);
		
			trg0 = 4;			
		}
	}
	
	if (trg0==4 && now>120)
	{
		c = GetChar("Ivy");
		if (c >= 0)
		{			
			Perform(c, "guard", 7);
			Perform(c, "say", "You obviously look down on me, and you insult me as a killer, I am gonna kill you£¡£¡");
			Perform(c, "faceto", player);
			Perform(c, "pause", 5);
			Perform(c, "say", "©q©q©q©q©qCome on! Be serious£¡£¡");
			Perform(c, "faceto", player);
			
			PlayerPerform("say", "£¨Killer£¡©q©q©qIs she a killer just as me who wants to murder Smith Fan£¿£©");
			PlayerPerform("say", "£¡£¡");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "©q©q©q©q©q£¨But why she is here©q©q£©");
			PlayerPerform("pause", 4);
			
			trg0 = 5;			
		}
	}
	
	if (trg0==5 && now>150)
	{
		c = GetChar("Ivy");
		if (c >= 0)
		{			
			Perform(c, "guard", 7);
			Perform(c, "say", "©q©q©q©qIf I am not poisoned, you are already©q©q©q©q");
			Perform(c, "faceto", player);
			Perform(c, "pause", 5);
			Perform(c, "say", "©q©q©q©q©q©q");
			Perform(c, "faceto", player);
			Perform(c, "pause", 5);
			Perform(c, "say", "Well, are you afraid of me because I am a killer£¿£¿");
			Perform(c, "faceto", player);
			
			PlayerPerform("say", "£¨She is poisoned by T-Chan too, I need to find a way to get out here©q©q£©");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "©q©qDawn©q©q£¨The poison has eroded my body©q©q£©");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "£¨©q©q©q©qSo who instigates her to murder Smith Fan£¿£¿£©");
			PlayerPerform("pause", 4);
			
			trg0 = 6;			
		}
	}	
	
	if (trg0==6 && now>180)
	{
		c = GetChar("Ivy");
		if (c >= 0)
		{			
			ChangeBehavior(c, "idle");
			Perform(c, "faceto", player);
			Perform(c, "crouch", 0);
			Perform(c, "pause", 10);
			Perform(c, "say", "©q©q©q©q©q©q");
			Perform(c, "faceto", player);
			Perform(c, "pause", 7);
			Perform(c, "say", "Go! Why don't you kill me? Don't you want this antidote£¡£¡");
			Perform(c, "faceto", player);
			Perform(c, "crouch", 1);
			
			PlayerPerform("say", "©q©q©q©q©q©q");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "©q©q©qYou take it first ©q©q©q");
			PlayerPerform("pause", 5);
			
			trg0 = 7;			
			timer1 = now + 17;
			gameover = 1;
		}
	}		

	if (gameover!=-1 && GetHP(player)<=0)
	{
		gameover = -1;
		timer1 = now + 2; 
	}
	c = GetAnyChar("Ivy");
	if (gameover!=-1 && c>=0 && GetHP(c)<=0)
	{			
		gameover = -1;
		timer1 = now + 2; 
	}	
	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}
}
