/// <summary> /// Starts turn by adding a card from the main deck to the player's board. /// If the player has stood, instead they skip they're turn /// also sets IsActive to true /// </summary> public void BeginTurn() { if (HasStood) { EndTurn(); } else { //MessageBox.Show("Click OK when you are ready to start your turn", "Next Turn", MessageBoxButton.OK); TurnTransitionControl ttc = new TurnTransitionControl(); ttc.StartCountDown(2); ttc.ShowDialog(); IsActive = true; Board.AddCard(MainDeck.DrawNextCard()); if (Board.Sum == 20) { HasStood = true; EndTurn(); } } }
public void Clear() { switch (CurrentZone) { case Zone.SampleHand: SampleHand.Clear(); break; case Zone.Side: SideDeck.Clear(); break; case Zone.Main: MainDeck.Clear(); SideDeck.Clear(); break; default: return; } lock (DataSource) DataSource.Clear(); DeckChanged?.Invoke( listChanged: true, countChanged: true, card: null, touchedChanged: false, changedZone: CurrentZone, changeTerminatesBatch: true); }
public void Generate() { maindeck_CS = GetComponent <MainDeck>(); deckList = new List <CardTemplate> (maindeck_CS.mainDeckList); DrawStartCards(); }
private Card TakeTopOfMainDeck() { Card c = MainDeck[0]; MainDeck.RemoveAt(0); return(c); }
public void Sort(SortField[] sortFields) { MainDeck.Sort(sortFields); SideDeck.Sort(sortFields); ExtraDeck.Sort(sortFields); TempDeck.Sort(sortFields); }
public void DealAllCard() { MainDeck.Clear(); SubPrimaryDeck.Clear(); Console.WriteLine("No cards left any more"); Console.WriteLine("You may quit the app now"); }
public void DealACard(IPlayer PlayerBeingDealtTo) { IPlayer _player = PlayerBeingDealtTo; //deal card to player ICard _card = MainDeck.First(); _player.Hand.CardsInHand.Add(_card); //add card dealt to the player's cards MainDeck.Remove(_card); //remove the card dealt from the deck }
/// <summary> /// Called at the start of the game to make each player's hand 5 cards. /// </summary> internal void draw5Cards() { for (int i = 0; i < 5; i++) { Cards.Card cardOnTopOfDeck = MainDeck.drawTopCard(); Hand.Add(cardOnTopOfDeck); MeReadOnly.NumberOfCardsInHand = MeReadOnly.NumberOfCardsInHand + 1; } }
public void ShuffleCards() { if (CounterForShuffle == 0) { CounterForShuffle++; SubPrimaryDeck = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }; } else { MainDeck.ForEach(p => SubPrimaryDeck.Add(p)); MainDeck.Clear(); SubMediumDeck.Clear(); } while (SubPrimaryDeck.Count != 0) { Picker = RdmPicker.Next(0, SubPrimaryDeck.Count); OneBefore = Picker - 1; OneAfter = Picker + 1; if (OneBefore >= 0) { SubMediumDeck.Add(SubPrimaryDeck[OneBefore]); SubPrimaryDeck.RemoveAt(OneBefore); } else { SinglePicker(); } if (OneAfter < SubPrimaryDeck.Count) { SubMediumDeck.Add(SubPrimaryDeck[OneAfter]); SubPrimaryDeck.RemoveAt(OneAfter); } else { SinglePicker(); } ShuffleAgain(); } Console.WriteLine($"**** Shuffled *******"); }
// Use this for initialization void Start() { mDeck = GameObject.FindGameObjectWithTag("MainDeck").GetComponent <MainDeck>(); fightButton = GameObject.FindGameObjectWithTag("FightButton"); deckButton = GameObject.FindGameObjectWithTag("DeckButton"); fightButton.SetActive(false); deckButton.SetActive(false); }
public void SetDeck(Deck deck, CardRepository repo) { lock (DataSource) DataSource.Clear(); MainDeck.SetDeck(deck.MainDeck); SideDeck.SetDeck(deck.Sideboard); LoadDeck(repo); }
private void CreateDeck() { for (int i = 0; i < Enum.GetNames(typeof(Ranks)).Length; i++) { for (int j = 0; j < Enum.GetNames(typeof(Suits)).Length; j++) { MainDeck.Push(new Card((Suits)j, (Ranks)i)); } } }
public void DealCards(IEnumerable <Player> allPlayers) { var splittedDeck = _mainDeck.SplitCards(allPlayers.Count()); _mainDeck = null; foreach (Player player in allPlayers) { player.AddCardsToHand(splittedDeck[0]); splittedDeck.RemoveAt(0); } }
public void DealCards() { for (int i = 0; i < 2; i++) { foreach (var player in Players) { player.AddCard(MainDeck.PopCard()); } } AddShowedCards(); }
public void DealOneCard() { if (CounterForShuffle != 0) { Console.WriteLine($"You dealt: {MainDeck[0]}"); MainDeck.RemoveAt(0); } else { Console.WriteLine($"Firstly, you have to shuffle the deck!"); } }
private void ShuffleAgain() { while (SubMediumDeck.Count != 0) { Picker = RdmPicker.Next(0, SubMediumDeck.Count); if (Picker < SubMediumDeck.Count) { MainDeck.Add(SubMediumDeck[Picker]); SubMediumDeck.RemoveAt(Picker); } } }
private void Shuffle() // перемешивает карты в MainDeck { Random rnd = new Random(); List <Card> list = new List <Card>(); list = MainDeck.OrderBy(item => rnd.Next()).ToList(); MainDeck.Clear(); foreach (var card in list) { MainDeck.Push(card); } }
public void SetupMainDeck() { MainDeck.Clear(); //create decks to be used and adds them to main Deck for (int counter = NumberOfDecksInPlay; counter > 0; counter = counter - 1) { IDeck _deck = new Deck(); _deck.Shuffle(7); //shuffle enough times to ensure random order foreach (ICard card in _deck.Cards) { MainDeck.Add(card); } } }
private void DealCards() { foreach (Player p in Players) { foreach (string key in new List <string>(p.CardDict.Keys)) { p.CardDict[key] = MainDeck.Take(1).First(); if (key.Contains("V")) { p.CardDict[key].Visibility = CardVisibilityState.Public; } MainDeck.RemoveAt(0); } } }
public void ShowAllCards() { if (CounterForShow == 0) { CounterForShow++; Console.WriteLine($"***** Welcome! You have *******"); SubPrimaryDeck.ForEach(p => Console.WriteLine($"{p}")); Console.WriteLine($"***** The End *******"); } else { Console.WriteLine($"***** You Still have *******"); MainDeck.ForEach(f => Console.WriteLine($"{f}")); Console.WriteLine($"***** The End *******"); } }
public void AddShowedCards() { MainDeck.PopCard(); if (OpenDeck.Length < 3) { for (int i = 0; i < 3; i++) { OpenDeck.AddCard(MainDeck.PopCard()); } } else { OpenDeck.AddCard(MainDeck.PopCard()); } }
void Start() { Instance = this; mainDeck.Callback = OnDeckListChanged; if (!isServer) { return; } mainDeck.Add(Factory.shootSpringMD); // 1 mainDeck.Add(Factory.shootSpringMD); // 2 mainDeck.Add(Factory.shootSpringMD); // 3 mainDeck.Add(Factory.shootSpringMD); // 4 mainDeck.Add(Factory.shootSpringMD); // 5 mainDeck.Add(Factory.shootSpringMD); // 6 mainDeck.Add(Factory.shootSpringMD); // 7 mainDeck.Add(Factory.shootSpringMD); // 8 mainDeck.Add(Factory.shootSpringMD); // 9 mainDeck.Add(Factory.shootSpringMD); // 10 mainDeck.Add(Factory.shootSpringMD); // 11 mainDeck.Add(Factory.shootSpringMD); // 12 mainDeck.Add(Factory.shootSpringMD); // 13 mainDeck.Add(Factory.shootSpringMD); // 14 mainDeck.Add(Factory.shootSpringMD); // 15 mainDeck.Add(Factory.shootSpringMD); // 16 mainDeck.Add(Factory.grazeSpringMD); // 1 mainDeck.Add(Factory.grazeSpringMD); // 2 mainDeck.Add(Factory.grazeSpringMD); // 3 mainDeck.Add(Factory.grazeSpringMD); // 4 mainDeck.Add(Factory.grazeSpringMD); // 5 mainDeck.Add(Factory.grazeSpringMD); // 6 mainDeck.Add(Factory.grazeSpringMD); // 7 mainDeck.Add(Factory.grazeSpringMD); // 8 mainDeck.Add(Factory.grazeSpringMD); // 9 mainDeck.Add(Factory.grazeSpringMD); // 10 mainDeck.Add(Factory.grazeSpringMD); // 11 mainDeck.Add(Factory.grazeSpringMD); // 12 mainDeck.Add(Factory.grazeSpringMD); // 13 mainDeck.Add(Factory.grazeSpringMD); // 14 mainDeck.Add(Factory.grazeSpringMD); // 15 mainDeck.Add(Factory.grazeSpringMD); // 16 mainDeck.Shuffle(); }
public void StartGame() { MainDeck.Mix(); h_GetCards(); Card pMainCard = GetNextCard(); if (pMainCard == null) { throw new GameOverException(); } MainCard = pMainCard; MainDeck.CardList.Insert(0, pMainCard); Master = 0; Slave = h_GetNextSide(Master); h_SetDefaultRights(); }
public void Deal() { //Deal two cards to each player for (int counter = 2; counter > 0; counter = counter - 1) { foreach (IPlayer _player in PlayersInGame) { //Deal card to player ICard _card = MainDeck.First(); _player.Hand.CardsInHand.Add(_card); //add card dealt, to the player's cards MainDeck.Remove(_card); //remove the card dealt from the deck } //Deal card to Dealer ICard _dearlersCard = MainDeck.First(); DealerPlayer.Hand.CardsInHand.Add(_dearlersCard); //add card dealt, to the dealer's cards MainDeck.Remove(_dearlersCard); //remove the card dealt from the deck } }
protected void StartupPhase() { if (this.IsTurn == false) { return; } if (this.Hand.IsAction == true) { return; } if (Hand.Count == 5) { Phase = ePhase.END; } else { MainDeck.DrawCard(); } }
/// <summary> /// Сбрасывает одну карту из основной колоды в сброшенную. Если основная колода пуста перекладывает все карты из сброшенной калоды в основную. /// </summary> public void FoldCard() { if (MainDeck.Count > 0) // если в колоде есть карты, то сбрасываем одну { Card temp = MainDeck.Pop(); temp.FaceUp = true; DumpedDeck.Push(temp); } else // иначе(колода пуста) перемещаем все сброшенные карты назад в колоду { Card temp; while (DumpedDeck.Count > 0) { temp = DumpedDeck.Pop(); temp.FaceUp = false; MainDeck.Push(temp); } } }
public void NewCards() // to display new cards in hand { noOfPlayers = 2; if (noOfPlayers > 5) { noOfDecks = 3; } else { noOfDecks = 2; } deck = new MainDeck(); gameHand = new RummyHand(deck); gameHand.pullCards(); gameHand.AssignHands(); showCards(); gameHand.AssignClosedDeck(); WrittingIntoTextFile(); }
// Use this for initialization void Start() { noOfPlayers = 2; if (noOfPlayers > 5) { noOfDecks = 3; } else { noOfDecks = 2; } deck = new MainDeck(); gameHand = new RummyHand(deck); gameHand.pullCards(); gameHand.AssignHands(); showCards(); gameHand.AssignClosedDeck(); WrittingIntoTextFile(); }
/// <summary> /// Logic for when a new round begins /// </summary> void BeginRound() { MainDeck.Shuffle(); playerOne.SideDeck.Shuffle(); playerTwo.SideDeck.Shuffle(); playerOne.HasStood = false; playerOne.Board.Cards.Clear(); playerOne.Board.UpdateSum(); playerTwo.HasStood = false; playerTwo.Board.Cards.Clear(); playerTwo.Board.UpdateSum(); if (playerOneGoesFirst) { playerOne.BeginTurn(); } else { playerTwo.BeginTurn(); } }
public RummyHand(MainDeck deck) { RummyHand.deck = deck; //RummyHand.gameDeck = new Card[noOfCards]; //RummyHand.hand1 = new Card[handSize]; //RummyHand.hand2 = new Card[handSize]; //RummyHand.hand3 = new Card[handSize]; //RummyHand.hand4 = new Card[handSize]; //RummyHand.hand5 = new Card[handSize]; //RummyHand.hand6 = new Card[handSize]; RummyHand.gameDeck = new List <Card>();//[noOfCards]; RummyHand.hand1 = new List <Card>(); RummyHand.hand2 = new List <Card>(); RummyHand.hand3 = new List <Card>(); RummyHand.hand4 = new List <Card>(); RummyHand.hand5 = new List <Card>(); RummyHand.hand6 = new List <Card>(); RummyHand.closedDeck = new List <Card>(); RummyHand.openDeck = new List <Card>(); randomvalues = new int[noOfCards]; }