I actually started to do this when Magic was still a card game and not available online. The way that I aproached the game itself was nothing like the way that Wizards has. I'll attempt to outline it and hopefully it helps you a bit:

1) Players
a) Players have life
b) Players "Own" cards
c) Players recieve protection and vuln flags (dynamic)
d) When a player runs out of life they are removed from the game
*) If it was agreed upon, a player will loose a card to the winner of the game
e) By default players have a "No more then 7 cards in play" flag

2) Cards
a) A card can not affect on a player unless the player has the proper flag for the action
b) Cards can place and remove flags on a player (thus allowing modification of 2.a)
c) Once used cards are placed into the "Grave Yard"
d) Cards can modify the flags of the "Grave Yard"
e) Cards recieve a target set with each target set have actions and flags associated with them

3) Grave Yard
a) The Grave Yard contains a listing of the cards already used for each player
b) By default a Grave Yard has the "No removal of cards" flag
c) By default a Grave Yard has the "Cards can't be destroyied" flag

4) Game
a) Cards are drawn at random from the play stack
b) Players turns are rotated unless a free play flag appears
c) Players turns can be modified by free play, no play (skip x turns), and advanced play (allows player to play out of order) options
d) Players marked as dead are removed from the player pile

5) Computer Controlled Characters
a) Draw a randomly created "Deck" from the library
b) Evaluate cards on the table
c) Make appropriate play

Now all of this is at a very high level, and of course you asked specifically about 5.b and 5.c. So I'll try and explain;

I created a custom scripting language based solely on the game itself. With options for drawing, discarding, and other common actions. The AI was a dual association, first related to the player object selected and then on the deck selected.

So for example, if I chose a moron (play the top card on the deck no matter what) and Green Power (more land to generate stronger strikes), the AI would always play top cards unless there were a land card in the hand (rule of power from deck).

Now, believe it or not, the example above actually makes moron fairly hard to beat. To expand on this we have to go a bit further.

For a tougher AI; Deck tells AI that it is a Green Power deck (Land = Hit Hard) the AI scans the deck and sees that it needs at least 5 lands to play well and at most 20 lands. So the first rounds of play will simply be to place lands. Once the AI reaches land count it will then test to see what the best card it can play is (land value wise). If it can't play a card, then it will play a land. If it can't play a land or a card, then it chooses to discard the card that costs the least (yes, I said least).

This model actually functions even better. Again though we can expand on this model to give it more information about the cards, what cards its played, and what combination cards are worth playing.

Now days, I'd do this in Lua and FPC with SDL as the rendering engine. I wouldn't try to do it on the web (I'm not fond of Web based games), but I might make it multi-player over the web.

Hope that helps.