HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Card Drawing/Card Deck

01-11-2010, 04:14 AM#1
muse1988
Hey guys I am trying to get a basic trigger down for drawing from a card.

Atm each time a player uses the "Card Draw" ability, aslong as they have Draw Points (Lumber) they can draw a card.

I have a Rnd Integer that randomly picks a number between 1-60 (60 cards in deck), I also have a boolean checking if each card has been drawn before.

The problem is I do not know how to go about this, I have tried doing a Loop checking each Integer A 1-60 if the card has been drawn before, however I do not know how to make the loop run again if the card has been drawn before.

Can anyone help, there must be a simple way to do this, I basically just want a trigger picking a random card, if the card has been drawn before, it reruns the trigger until a card that hasn't been drawn before is drawn.
01-11-2010, 05:34 AM#2
ToukoAozaki
Quote:
Originally Posted by muse1988
Hey guys I am trying to get a basic trigger down for drawing from a card.

Atm each time a player uses the "Card Draw" ability, aslong as they have Draw Points (Lumber) they can draw a card.

I have a Rnd Integer that randomly picks a number between 1-60 (60 cards in deck), I also have a boolean checking if each card has been drawn before.

The problem is I do not know how to go about this, I have tried doing a Loop checking each Integer A 1-60 if the card has been drawn before, however I do not know how to make the loop run again if the card has been drawn before.

Can anyone help, there must be a simple way to do this, I basically just want a trigger picking a random card, if the card has been drawn before, it reruns the trigger until a card that hasn't been drawn before is drawn.

To facilitate "real" card drawing without shuffling, you would need a linked list to make things easier.
However, considering you only need a "random" card every time, I think the below is the best way to do it:
  1. Get i as a random number from 1 to [deck size]
  2. Draw ith card
  3. Put [deck size]th card to ith slot
  4. Decrement the total size of the deck by 1
01-12-2010, 01:48 AM#3
Fledermaus
Do you code in GUI or (v)Jass?