If you are using pirated software or going to such websites or do something dodgy get ready to get infected.No AV is 100% and avast probably saved you more than just a hassle in comparison to what it let through. 
Also I am not sure how you got infected since Behaviour shield does throw up prompts when something is acting strange unless someone chose ignore.Its set on Fix automatically by default.