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); } }
public void forceattack(Humanoid person) { if (strength > person.strength) { fight(person); } else { person.fight(this); } }
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; } }
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); } }
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; } }
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); } }
public void duel(Humanoid person) { System.Console.WriteLine("{0} strikes {1} with a lightsaber", this.name, person.name); fight(person); }
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); } }
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); } }
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); } }
public void duel(Humanoid person) { System.Console.WriteLine("{0} attacks {1} with a lightsaber", name, person.name); fight(person); }