Actually, I think it's a bit different than the people above me said. Lolita and Silver_Rain answered that the reason you get negative cards such as the devil is becuase your mindset is more negative. However, I believe the purpose of tarot cards is not to show us "our reality" - in my opinion, their purpose is to show us *the* reality. To give us warnings, and show us how things are...usually from a more objective or round viewpoint than we can take for ourselves, which is why they can be so helpful.
Why, then, do the cards say negative things if you are depressed, and positive things when you are happy?
I think it's that...as a depressed person, you are more likely to give into temptations, more likely to shy away from taking opportunities, less likely to put in a lot of effort to achieve your goals, etc...
Depression can cause people to stop going outside, stop seeing their friends, stop showing up to work, start doing drugs, and a whole array of things. Even just sleeping all the time can seriously interfere with your life. That right there explains the devil , the 9 of swords, the 8 of swords, or other negative cards you might be thinking of.
Meanwhile, when people are in a state of euphoria, they are more likely to be confident about what they can achieve, more likely to be going out and seizing opportunities, etc. The cards would, of course, reflect this.
Therefore, the cards are not showing us a reflection of our mindset by showing us "happy" or "sad" cards. Instead, they are showing us how our mindset affects our goals. If we are depressed, they show us cards that relate to depression and failure becuase while depressed, you may be setting yourself up for failure. That doesn't mean you *will* fail, or that the cards are only reflecting your thoughts, and it definately doesn't mean that the cards think you're as worthless as you feel.
...It's more that they're showing us, as Lolita said, what will happen if we continue down whatever paths we are going down OR what will happen if we give into temptations that lead us away from the path we are going down (like, if, let's say, you are trying to get a job, but you are depressed and there is a chance you could give into temptation and go back to a former drug habit, the cards might show you the devil as a warning that if you give into the drugs, you won't find/get the job you want).
I'm not sure if I'm making complete sense.
Anyway, I don't know what your experiences have been with this, Alexev, but I for one, have been through states of both euphoria and periods of depression with my tarot cards. Often enough, they would tell me, very truthfully, all of the problems I was setting up for myself, and the likelihood of failure becuase of them, during my depressive periods. However, my depression never stopped the cards from telling things like "You have lots of potential, and you ware wasting it all!" or things like that. They often pointed out my strengths as well as my weaknesses.
In my happier states of mind, when I was being more productive, the cards stopped telling me I was wasting my potential and started telling me that I was on the right track and I should keep doing what I was doing.