import java.awt.Color;

public class TeleportTank extends ComputerTank{
	public TeleportTank(){
		//public ComputerTank(int speed,int hp,Direction or,int pts, int xps, int iq){
		super(100,2,Direction.SOUTH,30,20,10);
	}
	
	public void teleport(){
		int newx = rd.nextInt(7);
		int newy = rd.nextInt(7);
		if ((getGrid().validLocation(newx, newy))){
			if (getGrid().isSquareEmpty(newx, newy)){
				setLocation(newx, newy);
			}
		}
	}
	
	
	public Color getColor() {
		return Color.pink;
	}
	
	
	public void executeTurn() throws RuntimeException {
		if (rd.nextInt(20) == 5) {
			super.executeTurn();
			teleport();
		} else {
			super.executeTurn();
		}
	}
	

}