Exemple #1
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(140, 45);

            CharacterList characterList = new CharacterList();

            do
            {
                Console.Clear();
                characterList.ReturnList().Clear();
                string name          = EnterName();
                int    charSelection = SelectCharacter();

                characterList.ChooseJob(charSelection, name);
                Console.WriteLine($"Hello, {characterList.ReturnList()[0].CharacterName}. You have selected a {characterList.ReturnList()[0].Job}. \n");
                characterList.RandomMonster();
                Console.WriteLine($"A {characterList.ReturnList()[1].Job} approaches for a fight!\n\nPress enter to start the fight!");
                Console.ReadLine();
                Console.Clear();
                BattleDisplay.UI(characterList.ReturnList());


                while (characterList.ReturnList()[0].IsAlive)
                {
                    int attackSelection;
                    Console.Clear();

                    BattleDisplay.UI(characterList.ReturnList());
                    Console.WriteLine("Please Select your attack 1-2 \n1: Light Attack \n2: Heavy Attack");
                    attackSelection = ValidateInput(0, 2);
                    BattleField.PlayerCombat(characterList.ReturnList(), attackSelection);
                    Console.WriteLine("Press enter to continue");
                    Console.ReadLine();
                    Console.Clear();
                    BattleDisplay.UI(characterList.ReturnList());
                    if (characterList.ReturnList()[characterList.ReturnList().Count - 1].IsAlive)
                    {
                        BattleField.EnemyCombat(characterList.ReturnList());
                        Console.WriteLine("Press enter to continue");
                        Console.ReadLine();
                    }
                    else
                    {
                        characterList.RandomMonster();
                        Console.WriteLine($"A new {characterList.ReturnList()[characterList.ReturnList().Count - 1].Job} has joined the fray!\n");
                        BattleField.AddHealth(characterList.ReturnList());
                    }
                }
                Console.WriteLine($"YOU DIED! GAME OVER!\nYou have defeated {characterList.ReturnList().Count - 2} monters!\n\n");
                BattleDisplay.DisplayDead(characterList.ReturnList());
            } while (Continue());
        }
Exemple #2
0
        public static void PlayerCombat(List <Character> characters, int attackSelection)
        {
            if (Hit(characters[0].AttackMod, characters[characters.Count - 1].Armor, attackSelection, out hitRoll) == true)
            {
                bool isCrit = false;
                dmgDealt = Damage(characters[0].Weapon, characters[characters.Count - 1].WeaknessMod, characters[0].AttackMod, out attackDice);
                if (attackSelection == 2)
                {
                    dmgDealt = Math.Round(dmgDealt * 1.25, 2);
                }
                if (hitRoll == 20)
                {
                    dmgDealt *= 2;
                    isCrit    = true;
                }

                characters[characters.Count - 1].HitPoints -= dmgDealt;
                if (characters[characters.Count - 1].HitPoints < 0)
                {
                    characters[characters.Count - 1].HitPoints = 0;
                }
                Console.Clear();
                BattleDisplay.UI(characters);
                if (isCrit == true)
                {
                    Console.WriteLine("\nCritical Hit! You have done double damage!\n");
                }
                Console.WriteLine($"{characters[0].CharacterName} rolled a {hitRoll} breaking through enemy defense.\n" +
                                  $"Damage dice roll is {attackDice} using a {characters[0].Weapon} and hit {characters[characters.Count - 1].Job} dealing {dmgDealt} damage!\n");

                characters[characters.Count - 1].IsAlive = Death(characters[characters.Count - 1].HitPoints);
            }
            else
            {
                Console.WriteLine($"{characters[0].CharacterName} rolled a {hitRoll} and missed with their {characters[0].Weapon}\n");
            }
        }
Exemple #3
0
        public static void EnemyCombat(List <Character> characters)
        {
            double dmgDealt;

            if (Hit(characters[characters.Count - 1].AttackMod, characters[0].Armor, 1, out hitRoll) == true)
            {
                bool isCrit = false;
                dmgDealt = Damage(characters[characters.Count - 1].Weapon, characters[0].WeaknessMod, characters[characters.Count - 1].AttackMod, out attackDice);
                if (hitRoll == 20)
                {
                    dmgDealt *= 2;
                    isCrit    = true;
                }

                characters[0].HitPoints -= dmgDealt;
                if (characters[0].HitPoints < 0)
                {
                    characters[0].HitPoints = 0;
                }

                Console.Clear();
                BattleDisplay.UI(characters);
                if (isCrit == true)
                {
                    Console.WriteLine("\nCritical Hit! Monster does double damage!\n");
                }
                Console.WriteLine($"{characters[characters.Count - 1].Job} rolled a {hitRoll} breaking through your defenses.\n" +
                                  $"Damage dice roll is {attackDice} using a {characters[characters.Count - 1].Weapon} and hit {characters[0].CharacterName} dealing {dmgDealt} damage!\n");

                characters[0].IsAlive = Death(characters[0].HitPoints);
            }
            else
            {
                Console.WriteLine($"{characters[characters.Count - 1].Job} rolled a {hitRoll} and missed with their {characters[characters.Count - 1].Weapon}\n");
            }
        }