Пример #1
0
 /// <summary>
 /// Show a baloon tip.
 /// </summary>
 /// <param name="text"></param>
 private static void Notify(string text)
 {
     Wendigo.Notify(nameof(EventImitator), text);
 }
Пример #2
0
        static void Main(string[] args)
        {
            short killCount = 0;

            Console.Title = $"Kills: {killCount}";

            // Create a Player
            Console.Write("Enter your name: ");
            string name = Console.ReadLine();

            Console.Clear();
            Race playerRace = Race.Humans;

            Console.WriteLine("Choose your race:\nH) Human\nP) Pygmy Faun\nE) Elated Ghoul");
            ConsoleKey raceChoice = Console.ReadKey(true).Key;

            switch (raceChoice)
            {
            case ConsoleKey.H:
                playerRace = Race.Humans;
                break;

            case ConsoleKey.P:
                playerRace = Race.PygmyFaun;
                break;

            case ConsoleKey.E:
                playerRace = Race.ElatedGhouls;
                break;

            default:
                Console.WriteLine("That was not a valid choice! You will be a human!");
                playerRace = Race.Humans;
                break;
            }
            Console.Clear();
            Console.WriteLine($"Welcome, {name} the {playerRace}! Your journey begins...\n");
            Weapon EveningStar = new Weapon("Eveningstar", 5, 15, 5, false);
            Player player      = new Player(name, 30, 15, 50, 50, playerRace, EveningStar);

            Console.WriteLine(player);
            bool exit = false;

            do
            {
                // Get a room description
                Console.WriteLine(GetRoom());
                // Create a monster
                Dragon  d1  = new Dragon("Young Red Dragon", 20, 20, 50, 10, 3, 8, "Puff the magic dragon!", false);
                Dragon  d2  = new Dragon("Ancient Red Dragon", 40, 40, 70, 10, 2, 15, "You better hide!", true);
                Cyclops cy1 = new Cyclops("One Eyed Willy", 10, 10, 10, 10, 05, 15, "The Eye sees all!", false);
                Cyclops cy2 = new Cyclops("Blood Shot Arges", 20, 20, 10, 10, 05, 17, "The one eyed freak brings lightning!", true);
                Wendigo w1  = new Wendigo("Chained Wendigo", 30, 30, 2, 10, 10, 10, "A horrific creature formed by necessity driven hunger gone mad.", false);
                Wendigo w2  = new Wendigo("Unchained Wendigo", 30, 30, 5, 15, 10, 20, "There is a curse that dwells in these mountains… Should any resort to cannibalism in this realm, the spirit of the Wendigo shall be loosed unto them…", true);
                Mummies m1  = new Mummies("Web Mummy Tomb Spider", 10, 10, 30, 5, 5, 8, "These mummies are wrapped up tight!", false);
                Mummies m2  = new Mummies("Egyptian God Set", 25, 25, 10, 9, 10, 15, "You have awaken the powerful Egyptian God, Set!", true);
                //becuase all of our creatures will be of type monster, they can be put into a collection of Monsters.
                List <Monster> monsters = new List <Monster>()
                {
                    d1, cy1, cy1, cy1, cy1, cy1, cy2, w1, w2, d2, m1, m1, m1, m1, m2
                };
                Monster monster = monsters[new Random().Next(monsters.Count)];

                Console.WriteLine("In this room: " + monster.Name);

                bool reload = false;
                do
                {
                    Console.Title = $"Kills: {killCount}               Life: {player.Life}";
                    Console.WriteLine("\nPlease choose an action:\n" +
                                      "A) ATTACK\n" +
                                      "R) RUN AWAY\n" +
                                      "P) Player stats\n" +
                                      "M) Monster stats\n" +
                                      "X) Exit");
                    ConsoleKey userChoice = Console.ReadKey(true).Key;
                    Console.Clear();

                    switch (userChoice)
                    {
                    case ConsoleKey.A:
                        //Console.WriteLine("You attack the monster!");
                        Combat.DoBattle(player, monster);
                        if (monster.Life <= 0)
                        {
                            killCount++;
                            //future xp leveling logic goes here
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine($"You killed {monster.Name}!");
                            Console.ResetColor();
                            reload = true;
                        }    //end if

                        //TODO HANDLE IF PLAYER KILLS MONSTER & VICE VERSA
                        break;

                    case ConsoleKey.R:
                        Console.WriteLine("You attempt to run away!");
                        Combat.DoAttack(monster, player);

                        //TODO MONSTER GETS A FREE ATTACK
                        reload = true;
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine(player);

                        break;

                    case ConsoleKey.M:
                        Console.WriteLine(monster);
                        break;

                    case ConsoleKey.X:
                        exit = true;
                        break;

                    default:
                        Console.WriteLine("Press one of the available menu options");
                        break;
                    }//end switch
                    if (player.Life <= 0)
                    {
                        Console.WriteLine("You have perished!");
                        exit = true;
                    }//end if
                } while (!exit && !reload);
            } while (!exit);
            Console.Clear();
            Console.WriteLine($"GAME OVER\nYou killed {killCount} monsters");
            //Reverse logic, while Exit == false, or while exit != true;
        }//end Main()
Пример #3
0
        static void Main(string[] args)
        {
            Console.Title = "La Tumba";
            Console.WriteLine("You enter the dark cave. Only to have lost your sense of direction. Now you have to find a way out. Good luck!\n");

            //1 create a player
            //we need to learn about custom classes first
            Weapon sword = new Weapon(1, 20, "Espada", 10, false);

            Player player = new Player("Diablero", 70, 5, 40, 40, Race.Demon, sword);

            int score = 0;

            //2 create a loop for the room

            bool exit = false;

            do
            {
                //3 create a room - write a () to get a room description
                Console.WriteLine(GetRoom());

                //4 create a monster
                //we need to learn about creating objects and then probably randomly select one

                Wendigo r1 = new Wendigo(); //uses the default ctor which sets some default values

                Wendigo r2 = new Wendigo("Swift Wendigo", 25, 25, 50, 20, 2, 8, "That's no ordinary wendigo! Look how tall it is!", true);

                Nahual r3 = new Nahual();

                Jenglot r4 = new Jenglot();

                Kawuk r5 = new Kawuk();

                Kawuk r6 = new Kawuk("Young Kawuk", 25, 25, 50, 20, 2, 8, "It is alone and awaiting its mother.", true);


                //Since all children monsters are of type monster, we can store them in an array of monsters
                Monster[] monsters = { r1, r2, r3, r4, r5, r6 };

                //randomly select a monster from the array
                Random  rand      = new Random();
                int     randomNbr = rand.Next(monsters.Length);
                Monster monster   = monsters[randomNbr];

                //show monster in the room
                Console.WriteLine("\nIn this room: " + monster.Name);

                //5 create a loop for the menu
                bool reload = false;
                do
                {
                    //6 create a menu of options that tells the player what they can do
                    #region MENU
                    Console.WriteLine("\nPlease choose an action:\nA) Attack\nR) Run Away\nP) Player Info\nM) Monster Info\nX) Exit\n");

                    //7 Catch the users input
                    ConsoleKey userChoice = Console.ReadKey(true).Key;

                    //8 Clear the console after the user input to clean up the screen
                    Console.Clear();

                    //9 Build out a switch for userChoice
                    switch (userChoice)
                    {
                    case ConsoleKey.A:
                        //10 Engage battle sequence
                        //11 Handle if the player wins
                        Combat.DoBattle(player, monster);
                        if (monster.Life <= 0)
                        {
                            //it's dead!
                            //You could put some logic here to have the player get items, get life
                            //back, or something similar
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("\nYou killed {0}!\n", monster.Name);
                            Console.ResetColor();
                            reload = true;
                            score++;
                        }
                        break;

                    case ConsoleKey.R:
                        Console.WriteLine("Run Away!!!");
                        //12 Handle running away and getting a new room
                        //13 Monster gets a free attack
                        Console.WriteLine($"{monster.Name} attacks you as you flee!");
                        Combat.DoAttack(monster, player); //free attack
                        Console.WriteLine();
                        reload = true;                    //loads the new room with a new monster
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine("Player Info");
                        //14 Need to print out player info
                        Console.WriteLine(player);
                        break;

                    case ConsoleKey.M:
                        Console.WriteLine("Monster Info");
                        //15 Need to print out monster info
                        Console.WriteLine(monster);     //this will use polymorphism to get the correct
                        //ToString()
                        break;

                    case ConsoleKey.X:
                    case ConsoleKey.E:
                        Console.WriteLine("No one likes a quitter....");
                        exit = true;
                        break;

                    default:
                        Console.WriteLine("That wont work. Try another key.");
                        break;
                    }
                    #endregion

                    //check for the players life
                    if (player.Life <= 0)
                    {
                        Console.WriteLine("You see the light!\a");
                        exit = true;
                    }
                } while (!exit && !reload); //while exit is NOT TRUE AND reload is NOT TRUE keep looping
            } while (!exit);                //while exit is NOT TRUE keep looping

            Console.WriteLine($"You defeated {score} monster(s)");
        }//end Main()