Ejemplo n.º 1
0
Archivo: Game.cs Proyecto: LwPol/Makao
 private void Players_CardsPushed(object sender, CardsPushedEventArgs e)
 {
     // update names table
     UpdatePlayersCardsCountOnNamesTable((Player)sender);
 }
Ejemplo n.º 2
0
Archivo: Game.cs Proyecto: LwPol/Makao
 private void User_CardsPushed(object sender, CardsPushedEventArgs e)
 {
     UpdateCardsDisplayControls();
 }
Ejemplo n.º 3
0
        public void Players_CardsPushed(object sender, CardsPushedEventArgs e)
        {
            // update game state
            Player whoPushed = (Player)sender;

            if (AceSuit.HasValue)
            {
                AceSuit = null;
            }

            if (MakaoFunctions.IsAggressiveCard(MakaoStack.TopCard))
            {
                uint totalAggressiveness = 0;
                for (int i = 0; i < e.PushedCount; ++i)
                {
                    totalAggressiveness += MakaoFunctions.GetCardAggressiveness(MakaoStack.Cards[MakaoStack.Cards.Count - 1 - i]);
                }

                if (CardsToTake == 1)
                {
                    CardsToTake = totalAggressiveness;
                }
                else
                {
                    CardsToTake += totalAggressiveness;
                }

                TopCardActive = true;
            }
            else if (MakaoStack.TopCard.Rank == CardRank.Four)
            {
                TurnsToWait += (uint)e.PushedCount;

                TopCardActive = true;
            }
            else if (MakaoStack.TopCard.Rank == CardRank.Jack)
            {
                var rankDemanded = whoPushed.GetJackDemand();
                if (rankDemanded.HasValue)
                {
                    JackDemand = new JackDemandInfo(rankDemanded.Value, (uint)PlayersInGame.Count);
                    if (whoPushed.Cards.Count == 0)
                    {
                        PassPlayerWithJackDemand();
                    }
                }
                else
                {
                    DeactivateJackDemand();
                }

                TopCardActive = JackDemand.Active;
            }
            else if (MakaoStack.TopCard.Rank == CardRank.Queen)
            {
                CardsToTake = 1;
                TurnsToWait = 0;
                DeactivateJackDemand();

                TopCardActive = true;
            }
            else if (makaoStack.TopCard.Rank == CardRank.Ace)
            {
                var suitDemanded = whoPushed.GetAceDemand();
                if (suitDemanded.HasValue && suitDemanded.Value != MakaoStack.TopCard.Suit)
                {
                    AceSuit = suitDemanded;
                }
                else
                {
                    AceSuit = null;
                }

                TopCardActive = true;
            }
            else
            {
                TopCardActive = false;
                if (JackDemand.Active)
                {
                    PassPlayerWithJackDemand();
                }
            }
        }