Esempio n. 1
0
        static void PlayerRetreat(ref Player player, ref Monster monster, string[,,] theMap)
        {
            if ((rand.Next(0, 101) - player.dexterity) > 50)
            {
                Battle.MonsterAttack(ref player, ref monster);
            }
            if (player.strength > 0)
            {
                YWMenu battleMenu = new YWMenu();
                string question   = $"Retreat which way";
                Dictionary <char, string> choicesDict = new Dictionary <char, string>
                {
                    { 'N', "North" },
                    { 'S', "South" },
                    { 'E', "East" },
                    { 'W', "West" }
                };
                string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                switch (choice[1])
                {
                case "North":
                    player.North(theMap);
                    Console.WriteLine("\nYou retreat to the North!");
                    SharedMethods.WaitForKey();
                    break;

                case "South":
                    player.South(theMap);
                    Console.WriteLine("\nYou retreat to the South!");
                    SharedMethods.WaitForKey();
                    break;

                case "East":
                    player.East(theMap);
                    Console.WriteLine("\nYou retreat to the East!");
                    SharedMethods.WaitForKey();
                    break;

                case "West":
                    player.West(theMap);
                    Console.WriteLine("\nYou retreat to the West!");
                    SharedMethods.WaitForKey();
                    break;
                }
            }
        }
Esempio n. 2
0
        public static void BattleSequence(ref Player player, ref Monster monster, string[,,] theMap)
        {
            YWMenu battleMenu = new YWMenu();
            string question;
            bool   firstAttackRound = true;
            Dictionary <char, string> choicesDict = new Dictionary <char, string>
            {
                { 'A', "Attack" },
                { 'R', "Retreat" }
            };

            do
            {
                Console.WriteLine($"\nYou are facing a {monster.race}!");
                question = "What would you like to do";
                if ((((rand.Next(0, 101) + monster.dexterity) > 75) || player.lethargy) && firstAttackRound)
                {
                    Battle.MonsterAttack(ref player, ref monster);
                }
                else if (firstAttackRound)
                {
                    choicesDict.Add('B', "Bribe");
                }
                if (player.intelligence > 14)
                {
                    choicesDict.Add('C', "Cast");
                }
                if (player.strength > 0)
                {
                    string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                    switch (choice[1])
                    {
                    case "Attack":
                        Battle.PlayerAttack(ref player, ref monster);
                        break;

                    case "Bribe":
                        Battle.PlayerBribe(ref player, ref monster);
                        break;

                    case "Cast":
                        Battle.PlayerCast(ref player, ref monster);
                        break;

                    case "Retreat":
                        Battle.PlayerRetreat(ref player, ref monster, theMap);
                        break;
                    }
                    if (monster.strength > 0 && monster.mad && player.location.SequenceEqual(monster.location))
                    {
                        Battle.MonsterAttack(ref player, ref monster);
                    }
                }
                if (choicesDict.ContainsKey('B'))
                {
                    choicesDict.Remove('B');
                }
                if (choicesDict.ContainsKey('C'))
                {
                    choicesDict.Remove('C');
                }
                firstAttackRound = false;
            } while (monster.mad && monster.strength > 0 && player.strength > 0 && monster.location.SequenceEqual(player.location));
            if (monster.strength < 1)
            {
                monster.gold = rand.Next(1, 1001);
                Console.WriteLine($"\nYou killed the evil {monster.race}");
                Console.WriteLine($"You get his hoard of {monster.gold} Gold Pieces");
                player.gold += monster.gold;
                if (monster.runeStaff)
                {
                    Console.WriteLine("You've found the RuneStaff!");
                    player.runeStaff = true;
                }
                if (monster.treasures.Count > 0)
                {
                    Console.WriteLine($"You've recoverd the {monster.treasures[0]}");
                    player.treasures.Add(monster.treasures[0]);
                }
                Console.WriteLine();
            }
        }