示例#1
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                player.goRoom(command);
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "look":
                Console.WriteLine(player.CurrentRoom.getLongDescription());
                break;
            }

            return(wantToQuit);
        }
示例#2
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                line();
                printHelp();
                line();
                break;

            case "go":
                line();
                player.goRoom(command);
                line();
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "look":
                line();
                Console.WriteLine(player.currentRoom.getLongDescription());
                inRoomInv();
                line();
                break;

            case "inv":
            case "inventory":
                line();
                inInv();
                line();
                break;

            case "take":
                line();
                takeItem(command);
                line();
                break;

            //temp
            case "health":
                line();
                Console.WriteLine(player.Health);
                line();
                break;
            }

            return(wantToQuit);
        }
示例#3
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                goRoom(command);
                if (player.Health <= 0)
                {
                    wantToQuit = true;
                }
                break;

            case "ragequit":
                wantToQuit = true;
                break;

            case "look":
                Console.WriteLine(player.Currentroom.getLongDescription());
                player.Currentroom.Inventory.GetItemsRoom();
                break;

            case "take":
                player.Currentroom.Inventory.Take(player.Inventory, command.getSecondWord());
                break;

            case "drop":
                player.Inventory.Drop(player.Currentroom.Inventory, command.getSecondWord());
                break;

            case "use":
                use(command);
                if (player.Health <= 0)
                {
                    wantToQuit = true;
                }
                break;

            case "inventory":
                player.Inventory.GetItemsPlayer();
                break;
            }

            return(wantToQuit);
        }
示例#4
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("Try something else, " + "type 'help' for help");
                Console.WriteLine("----------------------------------------------------");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                goRoom(command);
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "look":
                looked();
                break;

            case "inventory":
                CheckInventory();
                break;

            case "health":
                CheckHealth();
                break;

            case "grab":

                break;

            case "use":
                UseItem();
                break;

            case "exit":
                ExitGame();
                break;
            }

            return(wantToQuit);
        }
示例#5
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                player.goRoom(command);
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "look":
                Console.WriteLine(player.CurrentRoom.getLongDescription());
                ReturnInv();
                break;

            case "health":
                Console.WriteLine("Your health: " + player.getPlayerHealth());
                break;

            case "inventory":
                RetPlayerInv();
                break;

            case "take":
                TakeItems();
                break;

            case "drop":
                DropItems();
                break;

            case "use":
                UseItem();
                break;
            }

            return(wantToQuit);
        }
示例#6
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                goRoom(command);
                break;

            case "look":
                Console.WriteLine(player.currentRoom.getLongDescription());
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "health":
                player.isAlive();
                break;

            case "take":
                takeItem(command);
                break;

            case "drop":
                dropItem(command);
                break;

            case "inventory":
                Console.WriteLine(player.getInventory().printContents());
                break;

            case "use":
                useItem(command);
                break;
            }

            return(wantToQuit);
        }
示例#7
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (player.isAlive() == false)
            {
                Console.ReadLine();
                return(true);
            }

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "look":
                Console.WriteLine(player.getCurrentRoom().getLongDescription());
                break;

            case "go":
                player.goRoom(command);
                break;

            //case "heal" && command.hasSecondWord:
            //    player.heal(command.getSecondWord());
            //b     break;
            case "quit":
                wantToQuit = true;
                break;

            case "take":
                takeItem(command);
                break;
            }

            return(wantToQuit);
        }
示例#8
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("");
                Console.WriteLine("11010010 11000011 11101010 00101101 10010001 10101000");
                Console.WriteLine("");
                Console.WriteLine(" # I don't know what you mean...");
                Console.WriteLine("");
                Console.WriteLine("00100111 00100011 11111101 01011011 10011011 11111000 ");
                Console.WriteLine("");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "look":
                printLongDiscription();
                break;

            case "go":
                goRoom(command);
                break;

            case "quit":
                wantToQuit = true;
                break;

            case "pickup":
                //Player.setItem();
                break;
            }

            return(wantToQuit);
        }
示例#9
0
文件: Game.cs 项目: Rubiniuz/ZUUL
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            string commandWord = command.getCommandWord();

            switch (commandWord)
            {
            case "help":
                printHelp();
                break;

            case "go":
                player.IsAlive();
                goRoom(command);
                break;

            case "look":
                Console.WriteLine(player.GetCurrentRoom().getLongDescription());
                //Console.WriteLine(player.GetCurrentRoom().GetResourceNode()); not correctly implemented yet               W.I.P
                Console.WriteLine(player.GetCurrentRoom().GetInventory().GetItems());
                break;

            case "status":
                Console.WriteLine(player.Status());
                Console.WriteLine(player.GetInventory().GetItems());
                break;

            case "take":
                if (player.GetInventory().GetWeight() <= player.GetInventory().GetCarryLimit())
                {
                    Take(command);
                }
                break;

            case "drop":
                Drop(command);
                break;

            case "use":
                Use(command);
                break;

            case "mine":
                Console.WriteLine("W.I.P");
                break;

            case "map":
                ShowMap();
                break;

            case "unlock":
                Unlock(command);
                break;

            case "quit":
                wantToQuit = true;
                break;
            }

            return(wantToQuit);
        }
示例#10
0
        /* public InventoryItem usable(string name)
         * {
         *    foreach(InventoryItem item in player.PlayerItems)
         *    {
         *        if(item.name == name && item.healing == true)
         *        {
         *            return item;
         *        }
         *    }
         *    return null;
         * }*/


        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine("I don't know what you mean...");
                return(false);
            }

            if (player.isAlive() == true)
            {
                //inv.lookAtItmes();
                string commandWord = command.getCommandWord();
                switch (commandWord)
                {
                case "help":
                    printHelp();
                    break;

                case "go":
                    goRoom(command);

                    break;

                case "quit":
                    wantToQuit = true;
                    break;

                case "look":
                    Console.WriteLine(player.CurrentRoom.getLongDescription());
                    player.CurrentRoom.RoomInventory.GetItemsRoom();
                    break;

                case "take":
                    player.CurrentRoom.RoomInventory.Take(player.PlayerInventory, command.getSecondWord());
                    break;

                case "drop":
                    player.PlayerInventory.Drop(player.CurrentRoom.RoomInventory, command.getSecondWord());
                    break;

                case "inventory":
                    foreach (Item item in player.PlayerInventory.Items)
                    {
                        Console.WriteLine(item.name);
                    }
                    break;

                case "use":
                    useItem(command);
                    //Item itemToUse = player.PlayerInventory.GetFirstPlayerItem(command.getSecondWord());
                    //itemToUse.use(player);


                    // Item keyToUse = player.PlayerInventory.GetKey(command.getThirdWord());
                    // keyToUse.use(player);


                    // player.PlayerInventory.Drop(itemToUse);
                    break;
                }
            }
            else
            {
                Console.WriteLine("you are dead");

                wantToQuit = true;
            }


            return(wantToQuit);
        }
示例#11
0
        /**
         * Given a command, process (that is: execute) the command.
         * If this command ends the game, true is returned, otherwise false is
         * returned.
         */
        private bool processCommand(Command command)
        {
            bool wantToQuit = false;

            if (command.isUnknown())
            {
                Console.WriteLine(GeneralDataLibrary.I() + "I don't know what you mean...");
                Console.WriteLine(GeneralDataLibrary.I() + "Type: 'help' if you need help.");
                return(false);
            }

            string commandWord = command.getCommandWord();

            GeneralDataLibrary.Break();

            switch (commandWord)
            {
            case "help":

                printHelp(command);

                break;

            case "go":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                goRoom(command);

                break;

            case "quit":

                wantToQuit = true;

                break;

            case "look":

                lookAround(command);

                break;

            case "clear":

                ClearConsole(command);

                break;

            case "take":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                takeItem(command);

                break;

            case "drop":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                dropItem(command);

                break;

            case "bag":

                displayBag();

                break;

            case "use":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                useItem(command);

                break;

            case "equip":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                equipItem(command);

                break;

            case "unequip":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                unequipItem(command);

                break;

            case "attack":

                triggerCharacterAI();
                GeneralDataLibrary.Break();
                GeneralDataLibrary.LongLine();
                GeneralDataLibrary.Break();
                attackEnemy(command);

                break;
            }

            GeneralDataLibrary.Break();
            GeneralDataLibrary.LongLine();
            GeneralDataLibrary.Break();

            return(wantToQuit);
        }