fixed lack of ability to draw a card, added Decks collapsing into cards
This commit is contained in:
14
src/Deck.lua
14
src/Deck.lua
@@ -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
|
||||
|
Reference in New Issue
Block a user