Exemple #1
0
        private static bool ResetNeeded(BonusPoint bonuspoint)
        {
            try
            {
                switch (bonuspoint.Type)
                {
                case BonusPoints.core0:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(0);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.core1:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(1);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.core2:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(2);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                        {
                            return(true);
                        }
                    }
                    else if (bonuspoint.Value == -1)
                    {
                        var curValue     = GetSpentPoints_OnGivenBonus(2);
                        var pointsneeded = GetPointsNeeded_ToMaxMovement();
                        if (pointsneeded < 0 || (pointsneeded > 0 && Get_UnspentPoints_Core() < pointsneeded))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.core3:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(3);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.offense0:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(0);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.offense1:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(1);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.offense2:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(2);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.offense3:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(3);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.defense0:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(0);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.defense1:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(1);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.defense2:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(2);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.defense3:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(3);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.utility0:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(0);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.utility1:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(1);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.utility2:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(2);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                case BonusPoints.utility3:
                    if (bonuspoint.Value != -1)
                    {
                        var curValue = GetSpentPoints_OnGivenBonus(3);
                        if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                        {
                            return(true);
                        }
                    }
                    return(false);

                default:
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
        private static bool ResetNeeded(BonusPoint bonuspoint)
        {
            try
            {
                switch (bonuspoint.Type)
                {
                        case BonusPoints.core0:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(0);
                            if(curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.core1:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(1);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.core2:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(2);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                                return true;
                        }
                        else if (bonuspoint.Value == -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(2);
                            var pointsneeded = GetPointsNeeded_ToMaxMovement();
                            if (pointsneeded < 0 || (pointsneeded > 0 && Get_UnspentPoints_Core() < pointsneeded))
                                return true;
                        }
                        return false;

                    case BonusPoints.core3:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(3);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Core() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.offense0:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(0);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.offense1:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(1);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.offense2:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(2);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.offense3:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(3);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Offense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.defense0:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(0);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.defense1:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(1);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.defense2:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(2);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.defense3:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(3);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Defense() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.utility0:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(0);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.utility1:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(1);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.utility2:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(2);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                                return true;
                        }
                        return false;

                    case BonusPoints.utility3:
                        if (bonuspoint.Value != -1)
                        {
                            var curValue = GetSpentPoints_OnGivenBonus(3);
                            if (curValue > bonuspoint.Value || (curValue < bonuspoint.Value && Get_UnspentPoints_Utility() == 0))
                                return true;
                        }
                        return false;

                    default:
                        return false;
                }
            }
            catch (Exception)
            {
                return false;
            }
        }