示例#1
0
        public void buildMonsters()
        {
            /*
              Dragon Shep
              id=1
              type=fire
              health=815
              size=80
              strength=80
              speed=85
              agility=50
              fire=85
              ice=0
              plant=0
              rock=0
              lighting=0
              stamina=100
              level=56

              */

            Builder monsterBuilder = new Builder();

            Monster dragonShep = new Monster("Dragon Sheppard", 1, 815, 400, 11, 85, 50, 90, 80, moveList, "lava");
            //List<Move> moveLister = dragonShep.getMoveList();
            //Move firstmove = moveLister.ElementAt(0);

            Monster triceritops = new Monster("Triceritops", 2, 800, 400, 13, 70, 50, 90, 80, moveList, "plant");
            Monster prettyMermaid = new Monster("Pretty Mermaid", 3, 875, 400, 13, 90, 90, 50, 40, moveList, "water");
            Monster snowDeamon = new Monster("Snow Deamon", 4, 850, 70, 13, 80, 65, 80, 70, moveList, "ice");
            Monster thunderCloud = new Monster("Thunder Cloud", 5, 900, 400, 14, 90, 90, 0, 30, moveList, "light");

            monsterDataBase.Add(dragonShep);
            monsterDataBase.Add(triceritops);
            monsterDataBase.Add(prettyMermaid);
            monsterDataBase.Add(snowDeamon);
            monsterDataBase.Add(thunderCloud);
            Monster tempMonster = monsterBuilder.buildMonsterFromConsole(moveList, monsterDataBase.Count - 1);
            monsterDataBase.Add(tempMonster);
            //   List<Move> moveListerT = dragonShep.getMoveList();
            // Move secondMove = moveListerT.ElementAt(0);

            /*
            Console.Write("triceritpos health= " + triceritops.getHealth() + "\n");
            Console.Write("max damage for bite is " + secondMove.getMaxDamage() + "\n");
            Console.Write("dragon shep health= " +dragonShep.getHealth() + "\n");
            Console.Write("max damage for bite is " + firstmove.getMaxDamage() + "\n");
            Console.ReadLine();
            */
        }
示例#2
0
        static void gameLoop(test gameLoopTest)
        {
            Builder buildRoster = new Builder();
            test loopTest = gameLoopTest;

              //  Console.Write("database count at start: " + loopTest.monsterDataBase.Count() + "\n");
            Console.Write("What would you like to do today? Enter 1 to play, 2 to develop or 3 to exit " + "\n");
            string tempString = Console.ReadLine();
            int tempInt = Convert.ToInt32(tempString);
            if (tempInt == 1)
            {
                Console.Write("Player One please select your roster;"+"\n");

                Roster playerOne = buildRoster.buildRosterFromConsole(loopTest.getDataBase());
                Console.Write("Player Two please selecet your roster:"+"\n");
                Roster playerTwo= buildRoster.buildRosterFromConsole(loopTest.getDataBase());
                BattleGround firstLoop = new BattleGround(playerOne,playerTwo,loopTest.getDataBase());
                firstLoop.iterator(playerOne, playerTwo);
                gameLoop(loopTest);

            }
            if (tempInt == 2)
            {
                Console.Write("Welcome to Developer Mode: " + "\n");
                Console.Write("Please Select a number from the following list: " + "\n");
                Console.Write("1: View Monster DataBase: " + "\n");
                Console.Write("2: Create new Monster" + "\n");
                Console.Write("3: Create new Move" + "\n");
                Console.Write("4: Create new Roster"+"\n");
                Console.Write("5: View moveList " + "\n");

                string tempStringTwo=Console.ReadLine();
                int tempIntTwo = Convert.ToInt32(tempStringTwo);
                if (tempIntTwo == 1)
                {
                    loopTest.printMonsterList(loopTest.monsterDataBase);
                    Console.Write("Press enter to continue"+"\n");
                    Console.ReadLine();
                    gameLoop(loopTest);
                }
                if (tempIntTwo == 2)
                {
                    Monster newMonster = buildRoster.buildMonsterFromConsole(loopTest.moveList,loopTest.monsterDataBase.Count());
                    loopTest.monsterDataBase.Add(newMonster);

                    Console.Write("Press enter to continue"+ "\n");
                    Console.ReadLine();
                    gameLoop(loopTest);

                }

                if (tempIntTwo == 3)
                {
                    List<Move> listForBuilder = loopTest.moveList;
                    Move newMove = buildRoster.buildMoveFromConsole(listForBuilder);
                    loopTest.moveList.Add(newMove);

                    Console.Write("Press enter to continue"+"\n");
                    Console.ReadLine();
                    gameLoop(loopTest);
                }
                if (tempIntTwo == 4)
                {
                    Roster newRoster = buildRoster.buildRosterFromConsole(loopTest.getDataBase());
                    //roster has not been stored anywhere
                    Console.Write("Press enter to continue" + "\n");
                    Console.ReadLine();
                    gameLoop(loopTest);
                }
                if (tempIntTwo == 5)
                {
                    loopTest.printMoveList(loopTest.moveList);
                    Console.Write("Press enter to continue" + "\n");
                    Console.ReadLine();
                    gameLoop(loopTest);
                }

            }
            if (tempInt == 3)
            {
                Console.Write("Thanks for playing"+"\n");
            //saves moves
            XmlSerializer serializer = new XmlSerializer(typeof(List<Move>));
            TextWriter writer = new StreamWriter("movelist.xml");
            serializer.Serialize(writer, loopTest.moveList);
            writer.Close();

            }

            else
            {

            }
        }