コード例 #1
0
        static void Welcome(ref Player player)
        {
            Console.Clear();

            Program.PrintLine(100, "Welcome to the world of Radius");
            Program.PrintLine(100, "Storyline: You are a big fan of strawberries, your life goal is to eat as many stawberries as possible..");
            Program.PrintLine(100, "You heard that there is an temple in the middle of the \nRadius forest. In that temple is a box with magic stawberries");
            Program.PrintLine(100, "These magic strawberries are special.. if you eat one a new one will spawn back into the box.");
            Program.PrintLine(100, "That means.. YOU HAVE AN UNLIMITED SUPPLY OF STRAWBERRIES!");
            Program.PrintLine(100, "But first you have to find that box.. \ngood luck");
            Program.PrintLine(10, player.GetName());
            Console.WriteLine("Ready? press enter...");
            Console.ReadKey();
            Console.Clear();

            // Added newline to improve readability.


            player.ShowInventory();

            Program.PrintLine(100, "You're excited to go into the temple!");
            Program.PrintLine(100, "But scared too.. but you just want that magic box!");
            Program.PrintLine(100, "You prepaired yourself for the worst.. monsters.. traps.. You have no idea what too expect.");
            Program.PrintLine(100, "Press a key to continue..");

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Shop.cs プロジェクト: RoyWemmers/tba
 public void BuyHealthPotion(ref Player player, ref HealthPotion hp)
 {
     if (player.GetGold() > 10)
     {
         player.SetGold(-10);
         player.PickupItem(hp);
         player.ShowInventory();
     }
     else
     {
         Console.WriteLine("You don't have enough gold!");
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Justnuked/themaweek-radius
        static void Welcome(ref Player player)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the world of Flightwood");
            Console.WriteLine("You just woke up from a very long sleep.");
            Console.WriteLine("You can't really remember anything but your name.");
            Console.WriteLine("Which by the way is {0}", player.GetName());

            // Added newline to improve readability.
            Console.WriteLine();

            player.ShowInventory();
            Console.WriteLine("You look around you and realise that you are in a forest.");
            Console.WriteLine("In the distance you hear the howl of an animal.");
            Console.WriteLine("You slowly come to your senses and choose to go.");
            Console.WriteLine("Press a key to continue..");
            Console.ReadKey();
        }
コード例 #4
0
        static void Welcome(ref Player player)
        {
            Console.Clear();
            Console.WriteLine("Welcome to Simuli Control");
            Console.WriteLine("You are a student at the Kingston University of human communication.");
            Console.WriteLine("You understand very well how people feel and react.");
            Console.WriteLine("Your name is {0}", player.GetName());

            // Added newline to improve readability.
            Console.WriteLine();

            player.ShowInventory();
            Console.WriteLine("It is 8 AM you wake up to the alarm clock.");
            Console.WriteLine("You take a hot shower, and eat a nice breakfast..");
            Console.WriteLine("You slowly put your shoes on and choose to go to University.");
            Console.WriteLine("Press a key to continue..");
            Console.ReadKey();
        }
コード例 #5
0
        static void Welcome(ref Player player)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the world of Valenwood");
            Console.WriteLine("You are a graverobber named {0}.", player.GetName());
            Console.WriteLine("While staying in an Inn, you overheard a story about the grave of an old ");
            Console.WriteLine("Mountain Dwarf King, said to be riddled with gold and other treasures.");
            Console.WriteLine("You decide to go and search for his grave, located deep within the tomb");
            Console.WriteLine("of Dunbarrow.");

            // Added new line to improve readability.
            Console.WriteLine();

            player.ShowInventory();
            Console.WriteLine("You exit the Inn, located in the town of Mana");
            Console.WriteLine("After asking around a little, you decide to start going.");
            Console.WriteLine("Press a key to continue..");
            Console.ReadKey();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: Justnuked/themaweek-radius
        static void Start(ref Map map, ref Player player)
        {
            List <string> menuItems = new List <string>();
            int           choice;

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                map.GetLocation().Description();
                choice = ShowMenu(map, ref menuItems);

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        map.Move(menuItems[choice]);
                    }

                    switch (menuItems[choice])
                    {
                    case ACTION_STATS:
                        player.ShowStats(player);
                        Console.ReadKey();
                        break;

                    case ACTION_INV:

                        player.ShowInventory();
                        Console.ReadKey();
                        break;

                    case ACTION_SEARCH:
                        // Add code to perform an item pickup

                        Console.ReadKey();
                        break;

                    case ACTION_FIGHT:
                        // Add code for fighting here
                        break;

                    case ACTION_RUN:
                        // Add code for running here
                        break;

                    case ACTION_BOSS:
                        //add code for bossfight here
                        break;

                    case ACTION_INN:
                        player.SetHealth();
                        Console.WriteLine("You have been healed!");
                        Console.ReadKey();
                        break;
                    }
                }
            }
            // When the choice is equal to the total item it means exit has been chosen.
            while (choice < menuItems.Count() - 1);
        }
コード例 #7
0
        static void Start(ref Map map, ref Player player, ref Bandit bandit, ref Spider spider, ref Skeleton skeleton,
                          ref Skeleton1 skeleton1, ref Skeleton2 skeleton2, ref Kraken kraken, ref Bchief bchief, ref DwarfKing dking,
                          ref Zealot zealot, ref Troll troll, ref Snake snake)
        {
            List <string> menuItems = new List <string>();
            int           choice;

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                map.GetLocation().Description();
                choice = ShowMenu(map, ref menuItems, ref player);

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        map.Move(menuItems[choice]);
                    }

                    switch (menuItems[choice])
                    {
                    case ACTION_HEAL:

                        player.HealPlayer(player);
                        player.CheckHealth(player);

                        break;

                    case ACTION_TREASURE:
                        Console.WriteLine("You return to Mana with your spoils and live a happy life");
                        Console.WriteLine("The game is now technically over, but feel free to wander around.");
                        Console.WriteLine("");
                        Console.WriteLine("Thanks for playing!");
                        Console.WriteLine("Made by: Thom Martens, Kevin Rademacher and Bas Overvoorde");
                        Console.ReadKey();
                        break;

                    case ACTION_STATS:
                        player.ShowStats(player);
                        Console.ReadKey();
                        break;

                    case ACTION_INV:
                        player.ShowInventory();
                        Console.ReadKey();
                        break;

                    case ACTION_SEARCH:
                        Console.Clear();

                        Dictionary <string, Objects> list = map.GetLocation().GetItems();
                        Objects[] obj = list.Values.ToArray();
                        for (int i = 0; i < obj.Count(); i++)
                        {
                            if (obj[i].GetAcquirable())
                            {
                                player.PickupItem(obj[i]);
                            }
                            Console.ReadKey();
                        }
                        player.HasStrBuff(player);
                        player.HasArmBuff(player);
                        break;

                    case ACTION_FIGHT:

                        map.GetLocation().hasEnemy = true;

                        //church fight
                        if (map.GetLocation().GetName() == "Church of Stendarr")
                        {
                            Console.WriteLine("You encounter a {0}!", zealot.GetName());
                            Console.WriteLine("Health:{0}/{1}", zealot.health, zealot.maxhealth);
                            Console.WriteLine("Strenght:{0}", zealot.GetStr());
                            // Console.WriteLine("Thoughness: {0}", zealot.GetThough());
                            Console.WriteLine("Examine: {0}", zealot.Description());
                            Console.ReadKey();

                            if (zealot.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his sword!", zealot.GetName());
                                player.TakeHit(zealot.GetStr() - player.GetThough());
                                zealot.health = zealot.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", zealot.GetName());
                                Console.WriteLine("You deal {0} damage", player.GetStr());
                                if (zealot.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", zealot.GetName(), zealot.health);
                                }
                                else if (zealot.health <= 0)
                                {
                                    zealot.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", zealot.GetName(), zealot.health);
                                }
                                Console.ReadKey();
                            }

                            if (zealot.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", zealot.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }

                        if (map.GetLocation().GetName() == "Bog")
                        {
                            Console.WriteLine("You encounter a {0}!", snake.GetName());
                            Console.WriteLine("Health:{0}/{1}", snake.health, snake.maxhealth);
                            Console.WriteLine("Strenght:{0}", snake.GetStr());
                            // Console.WriteLine("Thoughness: {0}", zealot.GetThough());
                            Console.WriteLine("Examine: {0}", snake.Description());
                            Console.ReadKey();

                            if (snake.health > 0)
                            {
                                Console.WriteLine("The {0} tries to bite you!", snake.GetName());
                                player.TakeHit(snake.GetStr() - player.GetThough());
                                snake.health = snake.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", snake.GetName());
                                Console.WriteLine("You deal {0} damage", player.GetStr());
                                if (snake.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", snake.GetName(), snake.health);
                                }
                                else if (snake.health <= 0)
                                {
                                    snake.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", snake.GetName(), snake.health);
                                }
                                Console.ReadKey();
                            }

                            if (snake.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", snake.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }


                        if (map.GetLocation().GetName() == "Dragonstar")
                        {
                            Console.WriteLine("You encounter a {0}!", bandit.GetName());
                            Console.WriteLine("Health:{0}/{1}", bandit.health, bandit.maxhealth);
                            Console.WriteLine("Strenght:{0}", bandit.GetStr());
                            //Console.WriteLine("Thoughness: {0}", bandit.GetThough());
                            Console.WriteLine("Examine: {0}", bandit.Description());
                            Console.ReadKey();

                            if (bandit.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his sword!", bandit.GetName());
                                player.TakeHit(bandit.GetStr() - player.GetThough());
                                bandit.health = bandit.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", bandit.GetName());
                                if (bandit.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", bandit.GetName(), bandit.health);
                                }
                                else if (bandit.health <= 0)
                                {
                                    bandit.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", bandit.GetName(), bandit.health);
                                }
                                Console.ReadKey();
                            }

                            if (bandit.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", bandit.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //forest fight
                        if (map.GetLocation().GetName() == "Woodhearth")
                        {
                            Console.WriteLine("You encounter a {0}!", spider.GetName());
                            Console.WriteLine("Health:{0}/{1}", spider.health, spider.maxhealth);
                            Console.WriteLine("Strenght:{0}", spider.GetStr());
                            //Console.WriteLine("Thoughness: {0}", spider.GetThough());
                            Console.WriteLine("Examine: {0}", spider.Description());
                            Console.ReadKey();

                            if (spider.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his huge fangs!", spider.GetName());
                                player.TakeHit(spider.GetStr() - player.GetThough());
                                spider.health = spider.health - player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", spider.GetName());
                                if (spider.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", spider.GetName(), spider.health);
                                }
                                else if (spider.health <= 0)
                                {
                                    spider.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", spider.GetName(), spider.health);
                                }

                                Console.ReadKey();
                            }

                            if (spider.health <= 0)
                            {
                                spider.health = 0;
                                Console.WriteLine("The {0} is dead.", spider.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //tombroom fight

                        if (map.GetLocation().GetName() == "Tombroom1")
                        {
                            Console.WriteLine("You encounter a {0}!", skeleton.GetName());
                            Console.WriteLine("Health:{0}/{1}", skeleton.health, skeleton.maxhealth);
                            Console.WriteLine("Strenght:{0}", skeleton.GetStr());
                            //Console.WriteLine("Thoughness: {0}", skeleton.GetThough());
                            Console.WriteLine("Examine: {0}", skeleton.Description());
                            Console.ReadKey();

                            if (skeleton.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his Giant Axe!", skeleton.GetName());
                                player.TakeHit(skeleton.GetStr() - player.GetThough());
                                skeleton.health = skeleton.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", skeleton.GetName());
                                if (skeleton.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", skeleton.GetName(), skeleton.health);
                                }
                                else if (skeleton.health <= 0)
                                {
                                    skeleton.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", skeleton.GetName(), skeleton.health);
                                }
                                Console.ReadKey();
                            }

                            if (skeleton.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", skeleton.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //tombroom1 fight

                        if (map.GetLocation().GetName() == "Tombroom2")
                        {
                            Console.WriteLine("You encounter a {0}!", skeleton1.GetName());
                            Console.WriteLine("Health:{0}/{1}", skeleton1.health, skeleton1.maxhealth);
                            Console.WriteLine("Strenght:{0}", skeleton1.GetStr());
                            //Console.WriteLine("Thoughness: {0}", skeleton1.GetThough());
                            Console.WriteLine("Examine: {0}", skeleton1.Description());
                            Console.ReadKey();
                            if (skeleton1.health > 0)
                            {
                                Console.WriteLine("The {0} shoots at you with his bow!", skeleton1.GetName());
                                player.TakeHit(skeleton1.GetStr() - player.GetThough());
                                skeleton1.health = skeleton1.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", skeleton1.GetName());
                                if (skeleton1.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", skeleton1.GetName(), skeleton1.health);
                                }
                                else if (skeleton1.health <= 0)
                                {
                                    skeleton1.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", skeleton1.GetName(), skeleton1.health);
                                }
                                Console.ReadKey();
                            }
                            if (skeleton1.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", skeleton1.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //tombroom2 fight
                        if (map.GetLocation().GetName() == "Tombroom3")
                        {
                            Console.WriteLine("You encounter a {0}!", skeleton2.GetName());
                            Console.WriteLine("Health:{0}/{1}", skeleton2.health, skeleton2.maxhealth);
                            Console.WriteLine("Strenght:{0}", skeleton2.GetStr());
                            //Console.WriteLine("Thoughness: {0}", skeleton2.GetThough());
                            Console.WriteLine("Examine: {0}", skeleton2.Description());
                            Console.ReadKey();
                            if (skeleton2.health > 0)
                            {
                                Console.WriteLine("The {0} strikes you with his sword!", skeleton2.GetName());
                                player.TakeHit(skeleton2.GetStr() - player.GetThough());
                                skeleton2.health = skeleton2.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", skeleton2.GetName());
                                if (skeleton2.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", skeleton2.GetName(), skeleton2.health);
                                }
                                else if (skeleton2.health <= 0)
                                {
                                    skeleton2.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", skeleton2.GetName(), skeleton2.health);
                                }
                                Console.ReadKey();
                            }
                            if (skeleton2.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", skeleton2.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //tombroom 3 fight
                        if (map.GetLocation().GetName() == "Tombroom4")
                        {
                            Console.WriteLine("You encounter a {0}!", skeleton.GetName());
                            Console.WriteLine("Health:{0}/{1}", skeleton.health, skeleton.maxhealth);
                            Console.WriteLine("Strenght:{0}", skeleton.GetStr());
                            //Console.WriteLine("Thoughness: {0}", skeleton.GetThough());
                            Console.WriteLine("Examine: {0}", skeleton.Description());
                            Console.ReadKey();

                            if (skeleton.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his Giant Axe!", skeleton.GetName());
                                player.TakeHit(skeleton.GetStr() - player.GetThough());
                                skeleton.health = skeleton.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", skeleton.GetName());
                                if (skeleton.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", skeleton.GetName(), skeleton.health);
                                }
                                else if (skeleton.health <= 0)
                                {
                                    skeleton.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", skeleton.GetName(), skeleton.health);
                                }
                                Console.ReadKey();
                            }

                            if (skeleton.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", skeleton.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //troll fight
                        if (map.GetLocation().GetName() == "The Hanger")
                        {
                            Console.WriteLine("You encounter a {0}!", troll.GetName());
                            Console.WriteLine("Health:{0}/{1}", troll.health, troll.maxhealth);
                            Console.WriteLine("Strenght:{0}", troll.GetStr());
                            //Console.WriteLine("Thoughness: {0}", spider.GetThough());
                            Console.WriteLine("Examine: {0}", troll.Description());
                            Console.ReadKey();

                            if (troll.health > 0)
                            {
                                Console.WriteLine("The {0} hits you with his giant club!", troll.GetName());
                                player.TakeHit(troll.GetStr() - player.GetThough());
                                troll.health = troll.health - player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", troll.GetName());
                                if (troll.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", troll.GetName(), troll.health);
                                }
                                else if (troll.health <= 0)
                                {
                                    troll.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", troll.GetName(), troll.health);
                                }

                                Console.ReadKey();
                            }

                            if (troll.health <= 0)
                            {
                                troll.health = 0;
                                Console.WriteLine("The {0} is dead.", troll.GetName());
                                map.GetLocation().hasEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        break;

                    case ACTION_RUN:
                        map.Run();
                        Console.WriteLine("You run away to {0}", map.GetLocation().GetName());
                        Console.ReadKey();
                        break;

                    case ACTION_BOSS:

                        map.GetLocation().hasBossEnemy = true;
                        //kraken boss
                        if (map.GetLocation().GetName() == "Black Lake")
                        {
                            Console.WriteLine("You encounter a {0}!", kraken.GetName());
                            Console.WriteLine("Health:{0}/{1}", kraken.health, kraken.maxhealth);
                            Console.WriteLine("Strenght:{0}", kraken.GetStr());
                            //Console.WriteLine("Thoughness: {0}", kraken.GetThough());
                            Console.WriteLine("Examine: {0}", kraken.Description());
                            Console.ReadKey();
                            if (kraken.health > 0)
                            {
                                Console.WriteLine("The {0} strikes you with his tentacles!", kraken.GetName());
                                player.TakeHit(kraken.GetStr() - player.GetThough());
                                kraken.health = kraken.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", kraken.GetName());
                                if (kraken.health > 0)
                                {
                                    Console.WriteLine("The {0} has {1} health left.", kraken.GetName(), kraken.health);
                                }
                                else if (kraken.health <= 0)
                                {
                                    kraken.health = 0;
                                    Console.WriteLine("The {0} has {1} health left", kraken.GetName(), kraken.health);
                                }
                                Console.ReadKey();
                            }
                            if (kraken.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", kraken.GetName());
                                map.GetLocation().hasBossEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //chief bandit
                        if (map.GetLocation().GetName() == "Dragonstar armory")
                        {
                            Console.WriteLine("You encounter the {0}!", bchief.GetName());
                            Console.WriteLine("Health:{0}/{1}", bchief.health, bchief.maxhealth);
                            Console.WriteLine("Strenght:{0}", bchief.GetStr());
                            //Console.WriteLine("Thoughness: {0}", bchief.GetThough());
                            Console.WriteLine("Examine: {0}", bchief.Description());
                            Console.ReadKey();
                            if (bchief.health > 0)
                            {
                                Console.WriteLine("The {0} strikes you with his basterdsword!", bchief.GetName());
                                player.TakeHit(bchief.GetStr() - player.GetThough());
                                bchief.health = bchief.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", bchief.GetName());
                                Console.WriteLine("The {0} has {1} health left.", bchief.GetName(), bchief.health);
                                Console.ReadKey();
                            }
                            if (bchief.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", bchief.GetName());
                                map.GetLocation().hasBossEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        //dwarf king fight
                        if (map.GetLocation().GetName() == "TombTreasureRoom")
                        {
                            Console.WriteLine("You encounter {0}!", dking.GetName());
                            Console.WriteLine("Health:{0}/{1}", dking.health, dking.maxhealth);
                            Console.WriteLine("Strenght:{0}", dking.GetStr());
                            //Console.WriteLine("Thoughness: {0}", dking.GetThough());
                            Console.WriteLine("Examine: {0}", dking.Description());
                            Console.ReadKey();
                            if (dking.health > 0)
                            {
                                Console.WriteLine("The {0} strikes you with his Axe!", dking.GetName());
                                player.TakeHit(dking.GetStr() - player.GetThough());
                                dking.health = dking.health -= player.GetStr();
                                Console.WriteLine("You strike the {0} with your weapon.", dking.GetName());
                                Console.WriteLine("The {0} has {1} health left.", dking.GetName(), dking.health);
                                Console.ReadKey();
                            }
                            if (dking.health <= 0)
                            {
                                Console.WriteLine("The {0} is dead.", dking.GetName());
                                map.GetLocation().hasBossEnemy = false;
                                Console.ReadKey();
                            }
                        }
                        break;

                    case ACTION_INN:
                        player.SetHealth();
                        Console.WriteLine("You have been healed!");
                        Console.ReadKey();
                        break;
                    }
                }
            }
            // When the choice is equal to the total item it means exit has been chosen.
            while (choice < menuItems.Count() - 1);
        }
コード例 #8
0
        static void Start(ref Map map, ref Player player)
        {
            List <string> menuItems = new List <string>();
            int           choice;

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                map.GetLocation().Description();
                choice = ShowMenu(map, ref menuItems);

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        map.Move(menuItems[choice]);
                    }

                    switch (menuItems[choice])
                    {
                    case ACTION_TREASURE:
                        Console.WriteLine("You return to Mana with your spoils and live a happy life");
                        Console.WriteLine("");
                        Console.WriteLine("Thanks for playing!");
                        Console.WriteLine("Made by: Thom Martens, Kevin Rademacher and Bas Overvoorde");
                        Console.ReadKey();
                        break;

                    case ACTION_STATS:
                        player.ShowStats(player);
                        Console.ReadKey();
                        break;

                    case ACTION_INV:
                        player.ShowInventory();
                        Console.ReadKey();
                        break;

                    case ACTION_SEARCH:
                        Console.Clear();

                        Dictionary <string, Objects> list = map.GetLocation().GetItems();
                        Objects[] obj = list.Values.ToArray();
                        for (int i = 0; i < obj.Count(); i++)
                        {
                            if (obj[i].GetAcquirable())
                            {
                                Console.WriteLine("{0}", obj[i].GetName());
                                player.PickupItem(obj[i]);
                            }
                            Console.ReadKey();
                        }
                        break;

                    case ACTION_FIGHT:
                        // Add code for fighting here

                        break;

                    case ACTION_RUN:
                        map.Run();
                        Console.WriteLine("You run away to {0}", map.GetLocation().GetName());
                        Console.ReadKey();
                        break;

                    case ACTION_BOSS:
                        //add code for bossfight here
                        break;

                    case ACTION_INN:

                        player.SetHealth();
                        Console.WriteLine("You have been healed!");
                        Console.ReadKey();
                        break;
                    }
                }
            }
            // When the choice is equal to the total item it means exit has been chosen.
            while (choice < menuItems.Count() - 1);
        }
コード例 #9
0
        static void Start(ref Map map, ref Player player)
        {
            List<string> menuItems = new List<string>();
            int choice;

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                if (Game.JustDied) break;
                map.GetLocation().Description();
                if (Game.JustDied) break;
                choice = ShowMenu(map, ref menuItems);

                if ( choice != menuItems.Count() )
                {
                    if ( validDirections.Contains( menuItems[choice] ) )
                    {
                        map.Move( menuItems[choice] );
                    }

                    switch ( menuItems[choice] )
                    {
                        case ACTION_SEARCH:
                            Console.Clear();
                            foreach (var item in map.GetLocation().GetItems())
                            {
                                item.Value.Description();
                                player.PickupItem(item.Value);
                            }
                            player.ShowInventory();
                            Console.WriteLine("Press any key to continue...");
                            Console.ReadKey();
                            // Add code to perform an item pickup
                        break;

                        case ACTION_FIGHT:
                            map.GetLocation().Fight();
                        break;

                        case ACTION_RUN:
                            // Add code for running here
                        break;

                        default:
                            if(map.GetLocation().quiz)
                            {
                                if (map.GetLocation().quizQuestions.Contains(menuItems[choice]))
                                {
                                    if(choice == map.GetLocation().quizAnswer)
                                    {
                                        map.GetLocation().OnQuizGoodAnswer();
                                    }
                                    else
                                    {
                                        map.GetLocation().OnQuizBadAnswer();
                                    }
                                }
                            }
                        break;
                    }
                }
            } 
            // When the choice is equal to the total item it means exit has been chosen.
            while ( choice < menuItems.Count() - 1);
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: RoyWemmers/tba
        static void Start(ref Map map, ref Player player)
        {
            Rik           rik        = new Rik("Rik", 10000, 10000);
            BloodDrake    blooddrake = new BloodDrake("Blood Drake", 50, 10);
            AngryMan      angryman   = new AngryMan("Angry Man", 70, 10);
            CastleBoss    boss       = new CastleBoss("Castle Boss", 250, 10);
            List <string> menuItems  = new List <string>();
            int           choice;

            rik.EncounterRik();

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                map.GetLocation().Description();
                choice = ShowMenu(map, ref menuItems, ref player, ref blooddrake, ref angryman);

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        map.Move(menuItems[choice]);
                    }

                    switch (menuItems[choice])
                    {
                    case ACTION_SEARCH:
                        // Add code to perform an item pickup
                        break;

                    case ACTION_FIGHT:
                        // Add code for fighting here
                        break;

                    case ACTION_RUN:
                        // Add code for running here
                        break;

                    case ACTION_SHOWINVENTORY:
                        player.ShowInventory();
                        Console.ReadLine();
                        choice = 0;
                        break;

                    case ACTION_SHOP:
                        Shop shop = new Shop();
                        shop.ShowShop(ref player);
                        choice = 0;
                        Console.ReadLine();
                        break;

                    case "Fight the Blood Drake":
                        Console.Clear();
                        blooddrake.StartEncouter(ref player, ref map);
                        Console.ReadLine();
                        map.Move("Go North");
                        break;

                    case "Go via the side of the bridge":
                        Console.Clear();
                        player.ClimbBridge(ref player);
                        Console.ReadLine();
                        map.Move("Go North");
                        break;

                    case ACTION_USEHEALTHPOTION:
                        HealthPotion hp = new HealthPotion("Health Potion", true);
                        hp.UsePotion(ref player);
                        choice = 0;
                        break;

                    case "Fight the man":
                        Console.Clear();
                        angryman.StartEncounter(ref player, ref map);
                        Console.ReadLine();
                        break;

                    case "Leave the man":
                        Console.Clear();
                        map.Move("Go West");
                        Console.ReadLine();
                        break;

                    case "Climb over the wall":
                        map.Move("Go North");
                        break;

                    case "Fight the Boss":
                        Console.Clear();
                        boss.StartEncounter(ref player);
                        Console.ReadLine();
                        break;
                    }
                }
            }
            // When the choice is equal to the total item it means exit has been chosen.
            while (choice < menuItems.Count() - 1);
        }
コード例 #11
0
        static void Welcome(ref Player player)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the world of Flightwood");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("----------------------------------");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Around half a year ago someone obtained a certain power that brought darkness upon this land.");
            Console.WriteLine("Once he infected someone with these powers it strengthened their worst traits,");
            Console.WriteLine("causing most of them to cause death and destruction everywhere they go.");
            Console.WriteLine("They have grouped up and are working together to infect as many people as possible.");
            Console.WriteLine("If this continues, the whole world will come to an end.");
            Console.WriteLine();
            Console.WriteLine("But there is a group of knights that stayed strong in these times of darkness,");
            Console.WriteLine("that are protecting the vulnerable citizens against the darkness of this infection: The Ravens.");
            Console.WriteLine("And you decided to join them!");
            Console.WriteLine();
            Console.WriteLine("After a long travel you see it, the legendary Raven base.");
            Console.WriteLine("You are standing in front of the gates of the big castle that you’ve heard so much stories of.");
            Console.WriteLine();
            Console.WriteLine("You’re about to be one of the Ravens.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Slowly the tall gates open up in front of you, and you enter the entrance hall of the Raven base.");
            Console.WriteLine("The hall is gigantic, and everything looks very neat. You stand there in silence, waiting for something to happen.");
            Console.WriteLine();
            Console.WriteLine("A few minutes later you heard footsteps coming closer,");
            Console.WriteLine("the person walked towards you from the end of the hall, revealing himself as he walked up to you.");
            Console.WriteLine("The man was wearing shining armor with the logo of the Ravens printed on top of the chestplate,");
            Console.WriteLine("as well as on the cape that flows behind him.");
            Console.WriteLine("His piercing gaze looking right through you as he stuck out his hand waiting for you to shake it.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“You are the new recruit, aren’t you? I am Avalon, and I will be your commander.");
            Console.WriteLine("It is nice to meet you {0}.”", player.GetName());
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("Both of you started to slowly walk to the big doors at the end of the halls as the conversation continued.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("”As you know, you’re here to fight against the people who got infected.”");
            Console.WriteLine("As of now most of them have gathered in the abandoned town were the source is, they’re protecting it.");
            Console.WriteLine("And we are trying to infiltrate into the town.");
            Console.WriteLine("We are hoping that when the source is destroyed the infection will disappear, and everyone will be saved.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Your new commander explained.");
            Console.WriteLine("As you walked through the door you got into a smaller hall that had a lot of doors going to the dorms of the knights.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“It is late, you should rest and prepare yourself for tomorrow. This is your room.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon pointed to one of the doors and then left.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("You entered your room.");
            Console.WriteLine();
            Console.WriteLine("Not much later you fell asleep.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("The next day you woke up from the sound of multiple footsteps marching in the halls outside of your door.");
            Console.WriteLine();
            Console.WriteLine("You put on the typical Raven armor that was neatly put in your room before quickly exiting through the door.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Outside commander Avalon was waiting for you, ready to explain to you what you are going to do.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Alright {0}. In the mornings you will gather with your division,", player.GetName());
            Console.WriteLine("have a quick breakfast and then go out on your assigned mission. Your division is division 8");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon called one of the knights that was walking past them in the hall. The knight was already wearing his helmet,");
            Console.WriteLine("seeming like he has already prepared for whatever he is assigned to do today.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Ah Lewis, this is the newest member of your division, {0}. Will you show {0} how everything works?”", player.GetName());
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon introduced you to the knight before rushing off to continue with more important business.");
            Console.WriteLine();
            Console.WriteLine("The man called Lewis then turned to you.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“It’s nice to meet you. Our division has to go on a mission today,");
            Console.WriteLine("so this is a great opportunity to get introduced with the job.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("He then took you to the room where the rest of division 8 was having breakfast,");
            Console.WriteLine("and he explained what we were going to do today.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Our Division is assigned to go to a church not far from here, we heard from an anonymous source");
            Console.WriteLine("that there is some sort of artifact there that will be essential to defeating our enemies.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("After everything got explained the Division left the Raven base, up to the church.");
            Console.WriteLine("You were told that you needed to head south to find the church.");
            Console.ReadLine();
            Console.Clear();
            Console.WriteLine("There are some tough enemies up ahead.");
            Console.WriteLine("Maybe it is a smart idea for you to train a bit before attempting to fight the strongest");
            Console.WriteLine("enemy in this world!");
            Console.ReadLine();
            Console.Clear();

            player.ShowInventory();

            Console.WriteLine("Press a key to continue..");
            Console.ReadKey();
        }