Example #1
0
        private void IsGuessCorrect()
        {
            string guess = (Guess1stSymbol + Guess2ndSymbol + Guess3rdSymbol + Guess4thSymbol).ToString();

            if (IsAnyGuessNullOrEmpty())
            {
                Error = "Fill in all the boxes.";
                TextBoxBorderColor = "Red";
                GuessesLeft--;

                if (IsGameOver())
                {
                    ChangePage();
                }
            }

            else if (IsAnyGuessNotLetter(guess))
            {
                Error = "Only letters allowed.";
                TextBoxBorderColor = "Red";
                GuessesLeft--;

                if (IsGameOver())
                {
                    ChangePage();
                }
            }

            else if (IsAnyGuessNotLetter(guess) == false && IsAnyGuessNullOrEmpty() == false)
            {
                if (guess.ToLower() == KillerName.ToLower())
                {
                    TextBoxBorderColor = "Green";
                    ChangePage();
                }
                else
                {
                    GuessesLeft--;
                    if (IsGameOver())
                    {
                        ChangePage();
                    }
                    else
                    {
                        Error = "Your guess was wrong";
                    }
                }
            }
        }
Example #2
0
        public Killer(int killerRank, int saltiness, KillerName name, KillerPower powers) : this()
        {
            Rank      = killerRank;
            Saltiness = saltiness;
            Name      = name;
            Powers    = powers;

            bool extraPerk = Utils.RANDOM.NextDouble() >= 0.25;

            if (powers == KillerPower.None)
            {
                switch (name)
                {
                case KillerName.Trapper:
                    Powers &= KillerPower.BrutalStrength;
                    if (extraPerk)
                    {
                        Powers &= KillerPower.Agitation;
                    }
                    break;

                case KillerName.Cannibal:
                    Powers &= KillerPower.BBQ;
                    if (extraPerk)
                    {
                        Powers &= KillerPower.FranklinsDemise;
                    }
                    break;

                case KillerName.Doctor:
                    Powers &= KillerPower.Overcharge;
                    break;

                case KillerName.Hag:
                    Powers &= KillerPower.Ruin;
                    break;

                case KillerName.Hillbilly:
                    Powers &= KillerPower.Enduring;
                    break;

                case KillerName.Nurse:
                    Powers &= KillerPower.NursesCalling;
                    break;
                }
            }
        }