Exemplo n.º 1
0
 public void BattlePet(Pet pet, Creature enemy)
 {
     Tools.Print("RAWR LET'S GO FIGHTING\n");
 }
        /// <summary>
        /// Is the main initialization of the game
        /// </summary>
        public static void GameMain(CurrentSession session)
        {
            //debugging stuff

            //end debugging

            //Intro to the app
            Console.Title = Meta.name_ver;

            Console.BackgroundColor = defaultBG;
            Console.ForegroundColor = defaultFG;

            //Print intro line
            string welcomeString = "Welcome to the PET GAME version: {0}\n\n";
            string welcomeArg = Meta.ver;
            Tools.Print(ConsoleColor.Black, ConsoleColor.White, welcomeString, welcomeArg);

            //Creates a session instance with a default user
            //CurrentSession session = new CurrentSession();

            //user.inventory.AddItem(new FoodApple());
            //user.inventory.AddItem(new FoodMeat());

            //Intro message
            Tools.Print(newFG: ConsoleColor.DarkBlue,
                        newBG: ConsoleColor.Cyan,
                        text: "\nThis is the main loop for the game. \n" +
                            "It is here that you'll feed or fight your" +
                            "\npet in order to train the shit out of it" +
                            "\n\n\n\t\tBEGIN!\n");

            //main loop
            while (true)
            {
                //give the user a choice of actions.
                string choices = "\t[f]eed, [b]attle, [t]hrow, [s]tats or [q]uit.";
                KeyValuePair<string, string> action = getUserAction(choices);

                //feed the pet
                if (action.Value == "feed")
                {
                    //this is  a real shitty way of doing this. There
                    // shouldn't be a class all on its own... :(
                    FeedAction feeding = new FeedAction(session.user);

                    session.user.inventory.ShowInventory();

                    string choice = Tools.Prompt("Choose a key from your items to feed");
                    char charChoice = (char)choice[0];

                    feeding.FeedPet(session.pet, session.user.inventory.items[charChoice] as FoodType);
                    //feeding.FeedPet(yourPet, new FoodMeat());
                }
                //check stats of the current pet
                else if (action.Value == "stats")
                {
                    StatAction stats = new StatAction(session.user);
                    stats.CheckPetStats(session.pet);
                }

                else if (action.Value == "throw")
                {
                    Tools.Print(newBG:ConsoleColor.DarkRed, text:"You throw your pet against the wall\n");

                    session.pet.battle.TakeDamage(10);
                }

                else if (action.Value == "battle")
                {
                    Creature enemy = new Creature();

                    BattleAction battle = new BattleAction(session.user);
                    battle.BattlePet(session.pet, enemy);
                }

                //quit the main loop
                else if (action.Value == "quit")
                {
                    break;
                }

                //Tools.Print(newFG: ConsoleColor.Yellow, text:"This was the action chosen: {0}\n", vals:action);

            }

            //Wait for Key on exit
            Tools.Print(ConsoleColor.DarkRed,
                    ConsoleColor.DarkYellow,
                    "Press any key to exit {0}",
                    Meta.name_ver);
            Console.ReadKey();
        }