示例#1
0
        public void DebuggerFight(List <Monster> monsters, int playerHowFast)
        {
            Basic_Map.Build(monsters, player1, "~");
            for (int i = 0; i < monsters.Count; i++)
            {
                Render array = new Render();
                array.RenderMonsterStats(monsters[i]);
            }
            int howManyMonsterWent = 0;

            while (monsters.Count != 0)
            {
                Fight_Rounds code  = new Fight_Rounds();
                Player       code1 = new Player("", 0, 0, "");
                code.RoundStart(monsters, code1);
                for (int i = 0; i <= monsters.Count - 1; i++)
                {
                    if (monsters.Count == 1)
                    {
                        Console.WriteLine(monsters[i].Name + " wins!");
                        return;
                    }
                    if (monsters[i] != null)
                    {
                        if (monsters[i].Health > 0)
                        {
                            monsters[i].MonsterActions(monsters[i], player1, monsters, true);
                            Thread.Sleep(playerHowFast);
                            if (monsters.Count == 1)
                            {
                                Console.WriteLine(monsters[0].Name + " wins!");
                            }
                        }
                        if (monsters[i].Health <= 0)
                        {
                            Console.WriteLine(monsters[i].Name + " has been defeated...");
                            monsters.Remove(monsters[i]);
                        }
                    }
                }
                Console.WriteLine("How many monsters went: " + howManyMonsterWent);
                if (howManyMonsterWent == 1)
                {
                    if (monsters.Count == 1)
                    {
                        Console.WriteLine(monsters[0].Name + " wins!");
                        return;
                    }
                }
                else
                {
                    howManyMonsterWent = 0;
                }
                code.RoundEnd(monsters, player1, isDebuggerFight);
            }
        }
示例#2
0
 public void Fight(List <Monster> monsters, Player player1)
 {
     #region DeclareClassVariables
     Warrior      classActions  = new Warrior("", 0, 0, "");
     Mage         classActions2 = new Mage("", 0, 0, "");
     Rogue        classActions3 = new Rogue("", 0, 0, "");
     Fight_Rounds code          = new Fight_Rounds();
     #endregion
     while (player1.Health > 0 && monsters != null)
     {
         int whichMap = GetRandom(1, 3);
         if (whichMap == 1)
         {
             Basic_Map.Build(monsters, player1, "~");
         }
         else if (whichMap == 2)
         {
             Arena_Branches.Build(monsters, player1, "~");
         }
         if (player1.Health > 0)
         {
             code.RoundStart(monsters, player1);
             if (player1.classType == "Warrior")
             {
                 classActions.WarriorActions(player1, monsters);
             }
             if (player1.classType == "Mage")
             {
                 classActions2.MageActions(player1, monsters);
             }
             if (player1.classType == "Rogue")
             {
                 classActions3.RogueActions(player1, monsters);
             }
             if (monsters.Count == 0)
             {
                 Console.WriteLine("All monsters defeated!");
                 LootPhase(player1, monsters, GetRandom(1, 5) + monsters.Capacity + player1.level);
             }
         }
         for (int i = 0; i < monsters.Count - 1; i++)
         {
             if (monsters[i] != null)
             {
                 if (monsters[i].Health > 0)
                 {
                     monsters[i].MonsterActions(monsters[i], player1, monsters, false);
                 }
                 if (monsters[i].Health <= 0)
                 {
                     Console.WriteLine(monsters[i].Name + " has been defeated...");
                     monsters.Remove(monsters[i]);
                 }
             }
         }
         code.RoundEnd(monsters, player1, isDebuggerFight);
     }
     if (player1.Health <= 0)
     {
         Console.WriteLine("you lose");
         return;
     }
     else if (player1.Health > 0)
     {
         LootPhase(player1, monsters, GetRandom(1, 5));
     }
 }