I'm sure piracy does affect ticket sales, but not as much as we think. People who download illegal copies of movies in theaters aren't likely to pay to see those movies anyway. General public who watches movies in theaters every once in awhile will continue to watch them in theaters. Also, general public with general computer skills don't even know how to find those pirated copies...
And let's not forget that gap between theatrical release and digital release is shorter than ever. More and more people are waiting to watch new movies on computers, tablets and phones.