Player actions

This commit is contained in:
Correl Roush 2010-06-16 13:46:29 -04:00
parent 0379650f32
commit 6b2427c3a1

11
mtg.py
View file

@ -12,6 +12,9 @@ class Player:
self.name = name
self.deck = None
self.setDeck(deck)
self.hand = CardList()
self.graveyard = CardList()
self.battlefield = CardList()
def __repr__(self):
return 'Player: {0} [Deck:{1}]'.format(self.name, len(self.deck))
def setDeck(self, deck):
@ -20,6 +23,14 @@ class Player:
self.deck = copy.copy(deck)
for card in deck:
card.owner = self
def draw(self):
card = self.deck.pop()
self.hand.append(card)
card.moved.emit('deck', 'hand')
def cast(self, card):
hand.remove(card)
self.battlefield.append(card)
card.moved.emit('hand', 'battlefield')
class Card:
def __init__(self, name, attributes, cost, power, toughness, owner=None):