// Iron Jail
int Rule = 4;
int RoundTime = 30;
int PlayerSpawn = 38;
int PlayerSpawnDir = 100;
int PlayerWeapon = 31;
int PlayerWeapon2 = 33;
int PlayerHP = 3000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int trg3 = 0;
int trg4 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int reborn = -1;
string rebornName;

OnStart()
{
	AddNPC("npc10_01");
}

OnUpdate()
{
	int player = GetChar("player");
	if (player < 0)
	{
		return 0;
	}
	
	int c;
	int c2;
	int c3;
	int c4;
	int c5;
	int now = GetGameTime();
	
	if (trg0 == 0)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "faceto", player);			
			PlayerPerform("use", 14);
			trg0 = 1;
		}
	}
	
	if (trg0 == 1)
	{
		c = GetChar("T-Chan");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{	
			Perform(c, "use", 7);
			Perform(c, "use", 4);
			Perform(c, "aggress");
			Perform(c, "say", "Now I will take you and Ivy's life for Smith Fan £¡£¡");
			Perform(c, "pause", 2);
			Perform(c, "say", "You don't wanna follow me, you die£¡");
			Perform(c, "pause", 7);
			Perform(c, "say", "You killers are just dogs£¡");
			Perform(c, "pause", 5);
			Perform(c, "say", "There are so many things you don't know£¡");
			Perform(c, "pause", 5);
			Perform(c, "say", "It's more relaxing than your fucking Lively House£¡");
			Perform(c, "pause", 2);
			Perform(c, "say", "You help me, you get rich!");
			Perform(c, "pause", 2);
			Perform(c, "say", "You are not easy, I admire you£¡");
			Perform(c, "pause", 5);
			Perform(c, "say", "How is your feeling£¿£¿");
			Perform(c, "pause", 2);
			Perform(c, "say", "Never thought you still alive, shit!");
			Perform(c, "faceto", player);
			
			PlayerPerform("block", 0);
			PlayerPerform("pause", 10);			
			PlayerPerform("say", "£¨The all of the setup©q©q©q£©");
			PlayerPerform("pause", 4);			
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 7);			
			PlayerPerform("say", "£¡£¿©q©qHow do you know I am from Lively House£¡£¿");
			PlayerPerform("pause", 10);			
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 6);			
			PlayerPerform("block", 1);
		
			trg0 = 2; 
			timer1 = now + 80;			
		}		
	}
	
	if (trg0==2 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "It is not that easy to kill me£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 3;
			timer1 = now + 180;
		}				
	}
	if (trg0==3 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "Come on, I will play with you£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 4;
			timer1 = now + 180;
		}				
	}	
	if (trg0==4 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "Afraid£¿£¿");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 2;
			timer1 = now + 180;
		}				
	}		
	
	if (trg2 == 0)
	{
		c = GetChar("T-Chan");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/3)
		{
			Perform(c, "attack");
			Perform(c, "faceto", player);
			Perform(c, "say", "Somebody,get him£¡£¡");
			Perform(c, "pause", 3);
			Perform(c, "say", "You£¡Just let see how to deal with you£¡");
			Perform(c, "faceto", player);
					
			trg2 = 1;
			timer0 = now + 6;
		}	
	}
	
	if (trg2==1 && now>timer0)
	{
		AddNPC("npc10_02");
		AddNPC("npc10_03");
		AddNPC("npc10_04");
		AddNPC("npc10_05");
		
		trg2 = 2;
	}	
	if (trg2 == 2)
	{		
		c = GetAnyChar("T-Chan");
		if (c>=0 && GetHP(c)<=0)
		{
			Say(c, "©q©q©q©qNever thought I will be killed©q©q©q©q");		
			
			PlayerPerform(c, "©q©q©q©q©q©q");
			PlayerPerform(c, "pause", 3);
			
			ChangeBehavior(c2, "idle");
			Perform(c2, "faceto", c);
			ChangeBehavior(c3, "idle");
			Perform(c3, "faceto", c);
			ChangeBehavior(c4, "idle");
			Perform(c4, "faceto", c);
			ChangeBehavior(c5, "idle");
			Perform(c5, "faceto", c);

			trg2 = 3;			
		}
	}
	
	if (trg3==0 && trg2==2)
	{
		c2 = GetAnyChar("Maskedman A");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "npc10_02";
			trg3 = 1;
			timer4 = now + 25;
		}
		c3 = GetAnyChar("Maskedman B");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "npc10_03";
			trg3 = 1;
			timer4 = now + 25;
		}
		c4 = GetAnyChar("Maskedman C");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "npc10_04";
			trg3 = 1;
			timer4 = now + 25;
		}
		c5 = GetAnyChar("Maskedman D");
		if (c5>=0 && GetHP(c5)<=0)
		{
			reborn = c5;
			rebornName = "npc10_05";
			trg3 = 1;
			timer4 = now + 25;
		}
	}				
	if (trg3==1 && now>timer4)
	{
		RemoveNPC(reborn);
		timer4 = now + 5;
		trg3 = 2;
	}
	if (trg3==2 && now>timer4)
	{
		AddNPC(rebornName);
		trg3 = 0;
	}

	if (trg4==0 && trg2==2)
	{
		c = GetChar("T-Chan");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetHP(c)<GetMaxHP(c)/5 && GetHP(player)<GetMaxHP(player)/6 && Distance(0, 1)<150)
		{
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 19);
			Perform(c, "say", "Shit!You don't respect me, you die£¡");
			Perform(c, "pause", 6);
			Perform(c, "say", "£¡£¿");
			Perform(c, "pause", 13);
			Perform(c, "say", "©q©q©q©q©q");
			Perform(c, "pause", 10);
			Perform(c, "say", "You killers are dogs, not men£¡£¡");
			Perform(c, "pause", 6);
			Perform(c, "say", "£¡£¿");
			Perform(c, "pause", 5);
			Perform(c, "say", "You have that chance,you are lucky");
			Perform(c, "pause", 2);
			Perform(c, "say", "You killers only live in darkness");
			Perform(c, "pause", 6);
			Perform(c, "say", "I will be a boss soon, haha");
			Perform(c, "pause", 2);
			Perform(c, "say", "And I just need to take her head to see my boss Roc King£¡");
			Perform(c, "pause", 2);
			Perform(c, "say", "She is so poor in martial arts after all, we don't need her anymore");
			Perform(c, "pause", 7);
			Perform(c, "say", "I am so lenient that I still invite you to join us");
			Perform(c, "pause", 2);
			Perform(c, "say", "Maybe you don't need to die£¡");
			Perform(c, "pause", 2);
			Perform(c, "say", "I have already been the boss once Smith Fan died");
			Perform(c, "pause", 6);
			Perform(c, "say", "Afraid now?");
			Perform(c, "pause", 3);
			Perform(c, "say", "I will do it by myself©q©q");
			Perform(c, "pause", 2);
			Perform(c, "say", "But that girl was so poor, we found her already.");
			Perform(c, "pause", 2);
			Perform(c, "say", "I want her to kill Smith Fan from the back, and then you come from the front©q©q");
			Perform(c, "pause", 6);
			Perform(c, "say", "I tell you, I use you and that kill to kill Smith Fan¡«");
			Perform(c, "pause", 2);
			Perform(c, "say", "You killers are stupid, never ask who plans this");
			Perform(c, "pause", 6);
			Perform(c, "say", "Surprise£¿£¿£¿");
			Perform(c, "pause", 5);
			Perform(c, "say", "I find the right man£¡");
			Perform(c, "pause", 2);
			Perform(c, "say", "She is poorer than you. She can't ever get rid of Smith Fan ¡«");
			Perform(c, "pause", 2);
			Perform(c, "say", "She has no power anymore£¡");
			Perform(c, "pause", 5);
			Perform(c, "say", "You are a hero, actually I don't want you die©q©q");
			Perform(c, "pause", 6);
			Perform(c, "say", "You can get money and no matter how much you want, so why not joining us£¿");
			Perform(c, "pause", 2);
			Perform(c, "say", "I still have a bottle of antidote, but depends if you join us");
			Perform(c, "pause", 4);
			Perform(c, "say", "I told you before, it was great to be my hands£¡");
			Perform(c, "pause", 4);
			Perform(c, "say", "Does that poison hurt,uh£¡£¿");
			Perform(c, "pause", 2);
			Perform(c, "say", "Back-off£¡£¡");
			Perform(c, "pause", 3);
			Perform(c, "faceto", player);
			
			PlayerPerform("block", 0);
			PlayerPerform("pause", 6);
			PlayerPerform("use", 19);			
			PlayerPerform("say", "I will not let you feel any pain when you die£¡£¡");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "I am still kind, not like you©q©q");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "But you just play others' lives©q©q©q");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "I will never let my targets feel any pain when they die©q©q©q");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "I am always like the ghost©q©q");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "For living, I can only stay in darkness©q©q©q");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "©q©q©qKillers, are just like tools©q©q");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 5);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);
			PlayerPerform("say", "What do you think of a man£¡£¡");
			PlayerPerform("pause", 9);
			PlayerPerform("say", "You£¡£¡©q©q©q©q");
			PlayerPerform("pause", 11);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 10);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "You are so catty©q©q©q©q©q");
			PlayerPerform("pause", 13);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "Was Smith Fan killed by you?©q©q©q");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "What£¡£¿");
			PlayerPerform("pause", 10);
			PlayerPerform("say", "©q©q©q©q©q");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "I don't want your help£¡");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "©q©qYou£¡£¡");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "£¨Shit, I can no longer hold on like that©q©q£©");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "©q©q©qDawn©q©q©q©q");
			PlayerPerform("block", 1);
			
			c2 = GetChar("Maskedman A");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 145);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("Maskedman B");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 145);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("Maskedman C");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 145);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("Maskedman D");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 145);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			
			trg4 = 1;
			trg1 = 1;
			trg0 = 5;
			timer1 = now + 120;
			timer2 = now + 120;
		}	
	}

	if (trg4==1 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "say", "Hahaha! I am not that easy£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 2;
			timer1 = now + 180;
		}				
	}
	if (trg4==2 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "say", "Come on, I will play with you for a while£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 3;
			timer1 = now + 180;
		}				
	}	
	if (trg4==3 && now>timer1)
	{
		c = GetChar("T-Chan");
		if (c >= 0)
		{
			Perform(c, "say", "Afraid£¿£¿");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 1;
			timer1 = now + 180;
		}				
	}			
	
	if (trg1==1 && now>timer2)
	{
		c = GetChar("T-Chan");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "Shit! Let see how to deal with you£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 2;
			timer2 = now + 60;
		}
	}
	if (trg1==2 && now>timer2)
	{
		c = GetChar("T-Chan");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "Never thought you are that strong£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 3;
			timer2 = now + 60;
		}
	}	
	if (trg1==3 && now>timer2)
	{
		c = GetChar("T-Chan");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "©q©q©qShit! Go hell£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 4;
			timer2 = now + 60;
		}
	}	
	if (trg1==4 && now>timer2)
	{
		c = GetChar("T-Chan");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "©q©q©qShit! Dawn it£¡£¡");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 1;
			timer2 = now + 60;
		}
	}		
}