Exemplo n.º 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);
            }
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 3
0
        public void Move(Entity entity, Map map, List <Monster> monsters, Player player1, Monster monster)
        {
            Basic_Map code       = new Basic_Map("Base_Map");
            int       originPosX = entity.posX;
            int       originPosY = entity.posY;

            if (entity == player1)
            {
                Console.Write("Enter PosX: ");
                int    actualInput  = 0;
                int    actualInput1 = 0;
                string input        = Console.ReadLine();
                try
                {
                    actualInput = Int32.Parse(input);
                }
                catch
                {
                    Move(entity, map, monsters, player1, monster);
                }
                Console.Write("Enter PosY: ");
                string input1 = Console.ReadLine();
                try
                {
                    actualInput1 = Int32.Parse(input1);
                }
                catch
                {
                    Move(entity, map, monsters, player1, monster);
                }
                if (actualInput1 == entity.posY + 1 || actualInput1 == entity.posY - 1 || actualInput1 == entity.posY && actualInput == entity.posX + 1 || actualInput == entity.posX - 1 || actualInput == entity.posX)
                {
                    for (int i = 0; i < monsters.Count; i++)
                    {
                        if (monsters[i] != null)
                        {
                            if (entity.posX == monsters[i].posX && entity.posY == monsters[i].posY)
                            {
                                Console.Write("Are you sure you want to attack " + monsters[i].Name + "?");
                                string input2 = Console.ReadLine();
                                if (input2 == "y" || input2 == "yes")
                                {
                                    Console.WriteLine("Which Weapon do you want to use?\n");
                                    Console.WriteLine("1) Slot 1: " + player1.EntityWeapon.name + " weapon level: " + player1.EntityWeapon.weaponlevel + " weapon damage: " + player1.EntityWeapon.weaponDamage);
                                    Console.WriteLine("2) Slot 2: " + player1.PlayerWeapon2.name + " weapon level: " + player1.PlayerWeapon2.weaponlevel + " weapon damage: " + player1.PlayerWeapon2.weaponDamage);
                                    int    playerAnswer = 0;
                                    string playerInput  = Console.ReadLine();
                                    try
                                    {
                                        playerAnswer = Int32.Parse(playerInput);
                                    }
                                    catch
                                    {
                                        Move(entity, map, monsters, player1, monster);
                                    }
                                    if (playerAnswer == 1)
                                    {
                                        monsters[i].Health = player1.PlayerAttack(monsters[i], player1, player1.EntityWeapon);
                                        entity.posY        = originPosY;
                                        entity.posX        = originPosX;
                                    }
                                    else if (playerAnswer == 2)
                                    {
                                        monsters[i].Health = player1.PlayerAttack(monsters[i], player1, player1.PlayerWeapon2);
                                        entity.posY        = originPosY;
                                        entity.posX        = originPosX;
                                    }
                                }
                                else
                                {
                                    Move(entity, map, monsters, player1, monster);
                                }
                            }
                        }
                    }
                    entity.posY = actualInput1;
                    entity.posX = actualInput;
                }
                else
                {
                    Console.WriteLine("Invalid Coordiantes!");
                    Move(entity, map, monsters, player1, monster);
                }
            }
            else
            {
                int actualInput  = GetRandom(entity.posX - 1, entity.posX + 2);
                int actualInput1 = GetRandom(entity.posY - 1, entity.posY + 2);
                if (player1 != null)
                {
                    if (actualInput == player1.posX && actualInput1 == player1.posY)
                    {
                        player1.Health = monster.MonsterAttack(player1, monster, monsters);
                        entity.posY    = originPosY;
                        entity.posX    = originPosX;
                    }
                }
                else
                {
                    for (int i = 0; i < monsters.Count; i++)
                    {
                        if (entity.posX == monsters[i].posX && entity.posY == monsters[i].posY)
                        {
                            entity.Health = monster.MonsterAttack(entity, monster, monsters);
                            entity.posY   = originPosY;
                            entity.posX   = originPosX;
                        }
                    }
                }
                entity.posX = actualInput;
                entity.posY = actualInput1;
            }
            if (map.mapName == "Base_Map")
            {
                int tries = 3;
                while (entity.posX <= 0 || entity.posY <= 0 || entity.posX > code.lengthX || entity.posY > code.lengthY && tries > 0)
                {
                    Move(entity, map, monsters, player1, monster);
                    tries -= 1;
                    if (tries == 0)
                    {
                        return;
                    }
                }
                Basic_Map.Build(monsters, player1, "~");
            }
            else if (map.mapName == "Arena_Branches")
            {
                int tries = 3;
                while (entity.posX <= 0 || entity.posY <= 0 || entity.posX > code.lengthX || entity.posY > code.lengthY && tries > 0)
                {
                    Move(entity, map, monsters, player1, monster);
                    tries -= 1;
                    if (tries == 0)
                    {
                        return;
                    }
                }
                Arena_Branches.Build(monsters, player1, "~");
            }
        }