@brightsole/bg-card-pile

bg-card-pile

Usage no npm install needed!

<script type="module">
  import brightsoleBgCardPile from 'https://cdn.skypack.dev/@brightsole/bg-card-pile';
</script>

README

bg-card-pile

What is it?

tl;dr: a deck! a graveyard! an exile field! WHATEVER!

It's just a big pile of cards, that might be anything.

It has a bunch of helpful ways to access these cards, and interact with the deck in a variety of human ways.


How to use it?

tl;dr: `npm i @brightsole/bg-card-pile`
Method Description return
shuffle() shuffle card order internally void
cardsRemainingCount() Get the count of the cards left in the deck number
draw(number) Draws x number of cards from the top of the pile [card]
drawFromBottom(number) Draws x number of cards from the bottom of the pile [card]
drawRandomly(number) Draws x number of cards randomly from the pile [card]
returnAndShuffle([card]) Returns cards to the deck and shuffles the order * void
returnToTop([card]) Returns cards onto the top of the deck in order * void
returnToBottom([card]) Returns cards onto the bottom of the deck in order * void
  • All return methods try to reset the card if the card is an object with a reset method

TODO:

nothing! It's a functional deck/graveyard/whatever pile of cards. Methods can be added as needed, but this will handle the next 3 games I have planned.


Buy Me A Coffee