Exemplo n.º 1
0
        private void BtnTakeOut_Click(object sender, EventArgs e)
        {
            var player = (sender as Button).Tag as CircularlyLinkedNode <IPlayer>;

            if (this.pnlCurrent.SelectedCardBoxes.Count == 0)
            {
                MessageBox.Show("Plz select cards");
                return;
            }
            var selectedCards = this.pnlCurrent.SelectedCardBoxes.Select(p => CardCarton.Get(p.CardCode)).ToList();

            selectedCards.Sort((p1, p2) => p1.WeightValue - p2.WeightValue);
            var formation = FormParser.Parse(selectedCards);

            if (formation == null)
            {
                MessageBox.Show("invalid formation");
                return;
            }

            if (_currentRound != null)
            {
                if (formation.Signature != _currentRound.Formation.Signature || formation.Cards.Length != _currentRound.Formation.Cards.Length || formation.Weight < _currentRound.Formation.Weight)
                {
                    MessageBox.Show("violate rules");
                    return;
                }
            }

            OnUserTakeoutFormation(formation);
        }
Exemplo n.º 2
0
        public static void Shuffle(Card[] cards)
        {
            var rnd = Miscellanea.GetUnrepeatableRandom(54);

            for (int i = 0; i < 54; i++)
            {
                cards[i] = CardCarton.Get(rnd[i]);
            }
        }
Exemplo n.º 3
0
        private void BtnTakeOut_Click(object sender, EventArgs e)
        {
            var player = (sender as Button).Tag as CircularlyLinkedNode <IPlayer>;

            if (_playerControls[player].CardBoxContainer.SelectedCardBoxes.Count == 0)
            {
                MessageBox.Show("Plz select cards");
                return;
            }
            var selectedCards = _playerControls[player].CardBoxContainer.SelectedCardBoxes.Select(p => CardCarton.Get(p.CardCode)).ToList();

            selectedCards.Sort((p1, p2) => p1.WeightValue - p2.WeightValue);
            var formation = FormParser.Parse(selectedCards);

            if (formation == null)
            {
                MessageBox.Show("invalid formation");
                return;
            }
            EndCountDown(player);
            ThrowSelectedFormationAction(player, formation);
        }
Exemplo n.º 4
0
 public FormationBomb()
 {
     _weight = (int)CardWeights.Queen;
     _cards  = new Card[] { CardCarton.Get(52), CardCarton.Get(53) };
 }