Пример #1
0
        public int GetBidValue(MatadorsJackStraight jackStraight, bool schneider = false, bool schwarz = false)
        {
            if (Type == GameType.Null)
            {
                return(GetNullBaseValue());
            }
            int mult = jackStraight.Play;

            if (Option.HasFlag(GameOption.Hand))
            {
                mult++;
            }
            if (Option.HasFlag(GameOption.Ouvert))
            {
                mult++;
            }
            if (Option.HasFlag(GameOption.Schneider))
            {
                mult++;
            }
            if (Option.HasFlag(GameOption.Schwarz))
            {
                mult++;
            }
            if (schneider)
            {
                mult++;
            }
            if (schwarz)
            {
                mult++;
            }
            return(mult * GetGrandOrColorBaseValue());
        }
Пример #2
0
        public List <string> GetBidValueTooptipLabels(MatadorsJackStraight jacks)
        {
            var labels = new List <string>();

            if (Type == GameType.Null)
            {
                labels.AddRange(GetGameAndOptionTextLabels());
                labels.Add($"INFO_GAME_CALC_1:{GetNullBaseValue()}");
                return(labels);
            }
            labels.Add(jacks.With ? "TEXT_WITH" : "TEXT_WITHOUT");
            labels.Add($"INFO_PLAY_1_2:{jacks.Count}:{jacks.Play}");
            var factor = jacks.Play;

            if (Option.HasFlag(GameOption.Hand))
            {
                factor++;
                labels.Add($"INFO_HAND_FACTOR_1:{factor}");
            }
            if (Option.HasFlag(GameOption.Ouvert))
            {
                factor++;
                labels.Add($"INFO_OUVERT_FACTOR_1:{factor}");
            }
            if (Option.HasFlag(GameOption.Schneider))
            {
                factor++;
                labels.Add($"INFO_SCHNEIDER_SAID_FACTOR_1:{factor}");
            }
            if (Option.HasFlag(GameOption.Schwarz))
            {
                factor++;
                labels.Add($"INFO_SCHWARZ_SAID_FACTOR_1:{factor}");
            }
            labels.Add(GetGameTextLabel());
            labels.Add($"INFO_GAME_CALC_1_2_3:{factor}:{GetGrandOrColorBaseValue()}:{factor * GetGrandOrColorBaseValue()}");
            return(labels);
        }
Пример #3
0
        public GameValue GetGameValue(MatadorsJackStraight spitzen, List <Card> stitches, List <Card> skat, int bidValue, bool giveUp)
        {
            bool schneider           = false;
            bool schwarz             = false;
            bool gamePlayerSchneider = false;
            bool gamePlayerSchwarz   = false;

            if (Type != GameType.Null)
            {
                var score = Card.GetScore(stitches, skat);
                schneider = score >= 90;
                schwarz   = stitches.Count == 30;
                if (!giveUp)
                {
                    if (stitches.Count == 0)
                    {
                        gamePlayerSchwarz = true;
                    }
                    gamePlayerSchneider = score <= 30;
                }
            }
            var gameValue = new GameValue();
            // check if bid value is exceeded considering schneider and schwarz
            var gameBidValue = GetBidValue(spitzen, schneider, schwarz);

            if (gameBidValue < bidValue)
            {
                int baseValue;
                if (Type == GameType.Null)
                {
                    baseValue = GetNullBaseValue();
                }
                else
                {
                    baseValue = GetGrandOrColorBaseValue();
                }
                gameValue.Score = baseValue;
                int factor = 1;
                while (gameValue.Score < bidValue)
                {
                    gameValue.Score += baseValue;
                    factor++;
                }
                var calc = factor == 1 ? $"{baseValue}" : $"{factor} x {baseValue}";
                gameValue.BidExceeded = true;
                gameValue.IsWinner    = false;
                gameValue.Score      *= -2;
                gameValue.DescriptionLabels.Add($"INFO_GAME_OVER_BID_1:{bidValue}");
                gameValue.DescriptionLabels.AddRange(GetGameAndOptionTextLabels());
                gameValue.DescriptionLabels.Add($"INFO_GAME_LOST_CALC_1_2:{calc}:{gameValue.Score}");
            }
            else
            {
                var isWinner = IsWinner(stitches, skat);
                if (!isWinner)
                {
                    schneider = false;
                    schwarz   = false;
                }
                string calc;
                var    gameLabels = new List <string>();
                int    baseValue;
                int    factor = 1;
                if (Type == GameType.Null)
                {
                    baseValue       = GetNullBaseValue();
                    gameValue.Score = baseValue;
                    gameLabels.AddRange(GetGameAndOptionTextLabels());
                }
                else
                {
                    gameLabels.Add(spitzen.With ? "TEXT_WITH" : "TEXT_WITHOUT");
                    gameLabels.Add($"INFO_PLAY_1_2:{spitzen.Count}:{spitzen.Play}");
                    factor = spitzen.Play;
                    if (Option.HasFlag(GameOption.Hand))
                    {
                        factor++;
                        gameLabels.Add($"INFO_HAND_FACTOR_1:{factor}");
                    }
                    if (Option.HasFlag(GameOption.Ouvert))
                    {
                        factor++;
                        gameLabels.Add($"INFO_OUVERT_FACTOR_1:{factor}");
                    }
                    if (schneider || gamePlayerSchneider)
                    {
                        factor++;
                        gameLabels.Add($"INFO_SCHNEIDER_FACTOR_1:{factor}");
                    }
                    if (Option.HasFlag(GameOption.Schneider))
                    {
                        factor++;
                        if (!schneider && !gamePlayerSchneider)
                        {
                            gameLabels.Add($"TEXT_SCHNEIDER");
                        }
                        gameLabels.Add($"INFO_SAID_FACTOR_1:{factor}");
                    }
                    if (schwarz || gamePlayerSchwarz)
                    {
                        factor++;
                        gameLabels.Add($"INFO_SCHWARZ_FACTOR_1:{factor}");
                    }
                    if (Option.HasFlag(GameOption.Schwarz))
                    {
                        factor++;
                        if (!schwarz && !gamePlayerSchwarz)
                        {
                            gameLabels.Add("TEXT_SCHWARZ");
                        }
                        gameLabels.Add($"INFO_SAID_FACTOR_1:{factor}");
                    }
                    gameLabels.Add(GetGameTextLabel());
                    baseValue = GetGrandOrColorBaseValue();
                }
                gameValue.Score = factor * baseValue;
                calc            = $"{factor} x {baseValue}";
                if (!isWinner)
                {
                    gameValue.Score   *= -2;
                    gameValue.IsWinner = false;
                    gameValue.DescriptionLabels.AddRange(gameLabels);
                    gameValue.DescriptionLabels.Add($"INFO_GAME_LOST_CALC_1_2:{calc}:{gameValue.Score}");
                }
                else
                {
                    gameValue.DescriptionLabels.AddRange(gameLabels);
                    gameValue.DescriptionLabels.Add($"INFO_GAME_WON_CALC_1_2:{calc}:{gameValue.Score}");
                }
            }
            return(gameValue);
        }