fixed lack of ability to draw a card, added Decks collapsing into cards

This commit is contained in:
Paul Liverman
2015-12-05 23:31:02 -08:00
parent ca487ecba1
commit 345bd58b3b
2 changed files with 20 additions and 5 deletions

View File

@@ -78,9 +78,15 @@ function Deck:drawCards(count)
insert(new, remove(self.cards))
end
self:update()
return Deck(new)
else
return remove(self.cards)
local card = remove(self.cards)
self:update()
return card
end
end
@@ -110,4 +116,10 @@ function Deck:getCards()
return self.cards
end
function Deck:update()
if #self.cards < 2 then
self = self.cards[1] --turn into a Card (no idea if this will break anything Oo)
end
end
return Deck