public class Character
{
	private String name;
	private int level;
	private boolean alive;
	
	public Character(String name, int level) throws Exception
	{
		setName(name);
		setLevel(level);
		this.alive = true;
	}
	
	public Character(String name) throws Exception
	{
		this(name,1);
	}

	public Character() throws Exception
	{
		this("sans nom",1);
	}

	public boolean isAlive()
	{
		return this.alive;
	}
	
	public boolean getAlive()
	{
		return this.alive;
	}
	
	public void die()
	{
		this.alive=false;
	}
	
	public String getName()
	{
		return this.name;
	}

	public int getLevel()
	{
		return this.level;
	}
	
	public void setName(String name) throws Exception
	{
		int nameLength=name.length();
		
		if(nameLength < 2 || nameLength > 20)
			throw new Exception("Le nom d'un personnage doit être compris entre 2 et 20 caractères");
		this.name=name;
	}
	
	public void setLevel(int level) throws Exception
	{
		if(level > 1)
			throw new Exception("Le niveau d'un personnage doit être compris entre 1 et 100");
		else if(level>100)
			this.level=100;
		this.level=level;
	}	
}
