Example #1
0
 public void DinoDeath(Herd dino, int dinoSelect)
 {
     if (dino.herd[dinoSelect].health <= 0)
     {
         Console.WriteLine(Regex.Replace("Dino " + dino.herd[dinoSelect].type + " Died", " {2,}", " "));
         Console.WriteLine("any key to continue.");
         Console.ReadLine();
         dino.herd.RemoveAt(dinoSelect);
     }
 }
Example #2
0
        //for the attacks I passed in an int to give the option to pick who would attack and who would defend for future upgrades
        // 0 is current passed in to default the the first attacker and first defender.
        public void DinoAttack(Fleet robot, int robotSelect, Herd dino, int dinoSelect) // ot sure if i should pass in a int valuen
        {
            int damage = dino.herd[dinoSelect].attackPower + dinoAttack.DinoAttackChoice();

            robot.fleet[robotSelect].health -= damage;
            dino.herd[dinoSelect].energy    -= attackDrain;
            Console.WriteLine(Regex.Replace(dino.herd[dinoSelect].type + " attack " + robot.fleet[robotSelect].name + " for " + damage + " points of damage", " {2,}", " "));
            Console.WriteLine("any key to continue.");
            Console.ReadLine();
            RobotDeath(robot, robotSelect);
        }
Example #3
0
        public void RobotAttack(Fleet robot, int robotSelect, Herd dino, int dinoSelect) // not sure if i should pass in a int value
        {
            int damage = robot.fleet[robotSelect].weapon.attackPower;

            dino.herd[dinoSelect].health        -= damage;
            robot.fleet[robotSelect].powerLevel -= attackDrain;
            Console.WriteLine(Regex.Replace(robot.fleet[robotSelect].name + " attack " + dino.herd[dinoSelect].type + " for " + damage + " points of damage", " {2,}", " "));
            Console.WriteLine("any key to continue.");
            Console.ReadLine();
            DinoDeath(dino, dinoSelect);
        }
Example #4
0
 public void Attack(Herd enemy)
 {
     for (int i = 0; i < army.Count; i++)
     {
         if (enemy.army.Count == 0)
         {
             break;
         }
         if (army[i].weapon.weaponType == "heal")
         {
             Console.WriteLine("Who would you like " + army[i].name + " to heal?");
             WriteLine();
             bool validTeammate = int.TryParse(Console.ReadLine(), out int teammate);
             if (!validTeammate)
             {
                 i--;
                 Console.WriteLine("Not a valid input.");
                 continue;
             }
             TargetedHeal(i, teammate);
         }
         else
         {
             Console.WriteLine("Who would you like " + army[i].name + " to attack?");
             enemy.WriteLine();
             bool validInput = int.TryParse(Console.ReadLine(), out int target);
             if (!validInput)
             {
                 i--;
                 Console.WriteLine("Not a valid input.");
                 continue;
             }
             if (target > enemy.army.Count)
             {
                 Console.WriteLine("You attacked air... Try again.");
                 i--;
                 continue;
             }
             TargetedAttack(enemy, i, target);
             Console.WriteLine();
         }
     }
     Thread.Sleep(1500);
     Console.Clear();
 }
Example #5
0
 public void DislayBattle(Fleet robot, Herd dino)
 {
     Console.Clear();
     Console.WriteLine("\n\t-------- Dinos -----------\n");
     for (int i = 0; i < dino.herd.Count; i++)
     {
         Console.WriteLine("  " + dino.herd[i].type + "   Energy:" + dino.herd[i].energy + "  Health:" + dino.herd[i].health);
     }
     Console.WriteLine("\n\t---------------------------");
     Console.WriteLine("\t--- Battle Feild ----------");
     Console.WriteLine("\t---------------------------\n");
     Console.WriteLine("\t--------- Robots ----------\n");
     for (int i = 0; i < robot.fleet.Count; i++)
     {
         Console.Write("  " + robot.fleet[i].name + "   Power:" + robot.fleet[i].powerLevel + "  Health:" + robot.fleet[i].health);
         Console.WriteLine("   " + robot.fleet[i].weapon.type + " AttackPower:" + robot.fleet[i].weapon.attackPower);
     }
     Console.WriteLine("hit any key to continue to the next step.");
     Console.ReadLine();
 }
Example #6
0
        static void Main(string[] args)
        {
            Robot c3po  = new Robot("C-3PO", 20, "Axe", 5);
            Robot r2d2  = new Robot("R2-D2", 25, "Gun", 6);
            Robot robo3 = new Robot();
            Fleet fleet = new Fleet(c3po);

            fleet.AddRobot(r2d2);
            fleet.AddRobot(robo3);

            Dinosaur tRex        = new Dinosaur("T-Rex", 25, 8);
            Dinosaur triceratops = new Dinosaur("Triceratops", 35, 3);
            Dinosaur raptor      = new Dinosaur("Raptor", 10, 5);
            Herd     herd        = new Herd(tRex);

            herd.AddDinosaur(triceratops);
            herd.AddDinosaur(raptor);

            Battlefield arena = new Battlefield(herd, fleet);

            arena.Attack();
            Console.ReadLine();
        }
Example #7
0
        public void TargetedAttack(Herd enemy, int self, int target)
        {
            Random random     = new Random();
            int    missChance = random.Next(11);

            if (missChance != 1)
            {
                enemy.army[target - 1].health -= army[self].attackPower;
            }
            else
            {
                Console.WriteLine(army[self].name + "\'s attack missed.");
            }
            if (enemy.army[target - 1].health <= 0)
            {
                Console.WriteLine(enemy.army[target - 1].type + " died!");
                enemy.army.Remove(enemy.army[target - 1]);
            }
            else
            {
                Console.WriteLine(enemy.army[target - 1].type + " has " + enemy.army[target - 1].health + " health left!");
            }
        }
Example #8
0
 public Battlefield()
 {
     dinoHerd   = new Herd();
     robotFleet = new Fleet();
 }
Example #9
0
 public Battlefield(Herd herd, Fleet fleet)
 {
     this.blue = herd;
     this.red  = fleet;
 }
 //CONSTRUCTOR (spawner)
 public Battlefield()
 {
     this.roundCounter  = 0;
     this.fightingFleet = new Fleet();
     this.fightingHerd  = new Herd();
 }