Player actions
This commit is contained in:
parent
0379650f32
commit
6b2427c3a1
1 changed files with 11 additions and 0 deletions
11
mtg.py
11
mtg.py
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue