Card games and rules handling is asked about quite alot . This may seem stupid at first but, let the players handle the rules. If something happens when a card comes into play, make the player have to do it.

I suggest having a look at MagicWorkstation. It's a program that lets players build Magic The Gathering decks and play them against other people online. The game part is set up just like in real life. Players play cards, handle there own life totals, tap there lands, attack with creatures, etc. The prgram it'self doesn't have rules coded in like, when the player attacks the program lowers the other players life total. Instead when one player attacks, the other player clicks is life and lowers it accordingly. Just like if they were playing face to face in real life.
You might think whats to stop someone changing there life to 100, well nothing. If in real life someone just decided to grab a hand full a tokens and give themselves 100 life, you'd just walk away.
So instead of killing yourself with writing code to automatically handle every single thing thats going on in the game, make options that allow the players to handle the rules.

Well unless you're trying to make something like MagicOnline, where you have tournaments,etc and play for real money, and real cards, where you absolutly cannot have someone cheating. but that's hell on the MagicOnline programmers, because they have to recode in all the 200+ new cards with every new block (every 4 months), and then try to fix up all the loose ends with wierd combos and stupid cards. With a new patch getting release all the time.
Hope all that makes sense.