Esempio n. 1
0
 public void Blast(Humanoid person)
 {
     if (rand.Next(0, 2) == 1)
     {
         fight(person);
     }
     else
     {
         System.Console.WriteLine("{0} fires a blaster at {1}, but misses", name, person.name);
     }
 }
Esempio n. 2
0
 public void forceattack(Humanoid person)
 {
     if (strength > person.strength)
     {
         fight(person);
     }
     else
     {
         person.fight(this);
     }
 }
Esempio n. 3
0
 public void SneakAttack(Humanoid person)
 {
     if (rand.Next(1, 30) > 28)
     {
         System.Console.WriteLine("{0} caught attempting to cross enemy lines.", name);
         health = 0;
     }
     else
     {
         person.health -= 10;
     }
 }
Esempio n. 4
0
 public void Blast(Humanoid person)
 {
     if (rand.Next(0, 10) < 8)
     {
         System.Console.WriteLine("{0} fires a blaster at {1} and hits", this.name, person.name);
         fight(person);
     }
     else
     {
         System.Console.WriteLine("{0} fires a blaster at {1}, but misses", this.name, person.name);
     }
 }
Esempio n. 5
0
 public void SneakAttack(Humanoid person)
 {
     if (rand.Next(1 - 30) > 28)
     {
         System.Console.WriteLine("{0} detected attempting to attack. Bounty Hunter successfully eliminated", name);
         health = 0;
     }
     else
     {
         person.health -= 10;
     }
 }
Esempio n. 6
0
 public static void turn(List <Humanoid> team, List <Humanoid> enemies, bool TurnInfo = true)
 {
     System.Console.WriteLine("Fight in progress");
     if (TurnInfo)
     {
         Humanoid active = team[0];
         team.RemoveAt(0);
         team.Add(active);
         int      select   = rand.Next(0, enemies.Count - 1);
         Humanoid selected = enemies[select];
         engagement(team, enemies, active, selected, TurnInfo);
     }
     else
     {
         Humanoid active = enemies[0];
         enemies.RemoveAt(0);
         enemies.Add(active);
         int      select   = rand.Next(0, team.Count - 1);
         Humanoid selected = team[select];
         engagement(enemies, team, active, selected, TurnInfo);
     }
 }
Esempio n. 7
0
 public void duel(Humanoid person)
 {
     System.Console.WriteLine("{0} strikes {1} with a lightsaber", this.name, person.name);
     fight(person);
 }
Esempio n. 8
0
        static void Main(string[] args)
        {
            int playCounter = 0;
            int lives       = 3;

            Console.WriteLine("Welcome to the galaxy! You have been conscripted to fight in the Resistance. It is time to choose your team.");
            System.Console.WriteLine("Are you a jedi, fighter, or smuggler?");
            string          InputLine = Console.ReadLine();
            List <Humanoid> team      = player(InputLine);
            Humanoid        primary   = team[0];

            Console.WriteLine("It is time for your first mission. You can infiltrate the enemy base or provide cover for the infiltration team. Which would you prefer? Infiltrate/Cover");
            string response = Console.ReadLine();

            if (response == "Cover" || response == "cover")
            {
                System.Console.WriteLine("Mission failed. You provided lousy cover. Ground team lost.");
            }
            else
            {
                System.Console.WriteLine("Entering enemy base...");
                List <Humanoid> enemies = enemyGen(playCounter++);
                while (enemies.Count > 0 && team.Count > 0)
                {
                    turn(team, enemies, true);
                }
                if (enemies.Count == 0 && team.Count == 3)
                {
                    System.Console.WriteLine("Mission successful. No casualties.");
                }
                else if (enemies.Count == 0)
                {
                    bool test      = false;
                    int  survivors = team.Count;
                    foreach (Humanoid person in team)
                    {
                        if (person == primary)
                        {
                            test = true;
                        }
                    }
                    if (test == false)
                    {
                        System.Console.WriteLine("The mission was a success. Only {0} people on your team survived. You were initially counted among the dead. However, your body was successfully recovered and resistance physicians have detected barely perceptable life signs. Rejoin the mission? Y/N", survivors);
                        string rebirth = Console.ReadLine();
                        if (rebirth == "Y")
                        {
                            team.Add(primary);
                        }
                    }
                    else
                    {
                        System.Console.WriteLine("The mission was a success, but only {0} people on your team survived.", survivors);
                    }
                    System.Console.WriteLine("Repopulating team...");
                    for (int i = survivors; i <= 3; i++)
                    {
                        team.Add(new Fighter());
                    }
                }
            }
            while (playCounter <= 20)
            {
                foreach (Humanoid player in team)
                {
                    Resistance guy = player as Resistance;
                    guy.regroup();
                }
                playCounter = gameplay(team, playCounter, primary);
            }
        }
Esempio n. 9
0
 public static void engagement(List <Humanoid> attackerTeam, List <Humanoid> attackedTeam, Humanoid attacker, Humanoid attacked, bool TurnInfo)
 {
     attacker.fight(attacked);
     if (attacked.health <= 0)
     {
         attackedTeam.Remove(attacked);
     }
 }
Esempio n. 10
0
        public static int gameplay(List <Humanoid> team, int level, Humanoid primary)
        {
            List <Humanoid> enemy = enemyGen(level);

            while (enemy.Count > 0 && team.Count > 0)
            {
                if (level % 2 == 0)
                {
                    turn(team, enemy, false);
                }
                else
                {
                    turn(team, enemy, true);
                }
            }
            if (enemy.Count == 0 && team.Count == 3)
            {
                System.Console.WriteLine("Mission success! No casualties! Level {0}", level);
                level++;
                return(level);
            }
            else if (enemy.Count == 0)
            {
                bool test      = false;
                int  survivors = team.Count;
                foreach (Humanoid person in team)
                {
                    if (person == primary)
                    {
                        test = true;
                    }
                }
                if (test == false)
                {
                    System.Console.WriteLine("The mission was a success. Only {0} people on your team survived. You were initially counted among the dead. However, your body was successfully recovered and resistance physicians have detected barely perceptable life signs. Rejoin the mission? Y/N", survivors);
                    string rebirth = Console.ReadLine();
                    if (rebirth == "Y" || rebirth == "y")
                    {
                        team.Add(primary);
                        return(level++);
                    }
                    else
                    {
                        return(1000);
                    }
                }
                else
                {
                    System.Console.WriteLine("The mission was a success, but only {0} people on your team survived. Level {1}!", survivors, level);
                    System.Console.WriteLine("Repopulating team...");
                    for (int i = survivors; i <= 3; i++)
                    {
                        team.Add(new Fighter());
                    }
                    return(level++);
                }
            }
            else if (team.Count == 0)
            {
                System.Console.WriteLine("Mission failed...");
                return(1000);
            }
            else
            {
                return(level);
            }
        }
Esempio n. 11
0
 public void duel(Humanoid person)
 {
     System.Console.WriteLine("{0} attacks {1} with a lightsaber", name, person.name);
     fight(person);
 }