I am an international student who is thinking of applying to a Ph.D program in economics at some top 30 economics departments in the U.S. I have a bachelor's and a master's degree in economics. My GRE, both verbal and quant, puts me well above the 90th percentile. My TOEFL is very high. I have three outstanding recommendations, probably placing me at the top of my master's class and comparing me favorably with former coleagues that were accepted to top universities. My master's disertation will make for a very good writing sample (the paper that grew out of it is serious research, publishable in the best theory journals) and I have two years' work experience at a prestigious job at the public sector. My master's transcripts are almost impeccable, even though I completed a LOT more coursework than what was required to graduate. I have plenty of maths coursework under my belt.
The only "small" wrinkle is: I was the archetype of a wayward student as an undergrad. My undergraduate transcripts are a disaster, as in I flunked 12 of the 70 courses that I enrolled in, simply because I had the terrible habit of abandoning classes when there was something more interesting going on. What I want to know is if this problem destroys my chances of acceptance.