/// <summary> /// Attaque fusil laser /// </summary> /// <param name="target">Cible de l'attaque</param> public void ShootlaserRifle(IBaseTroop target) { int range = 20; string log = String.Empty; log += "Droide B1 utilise son fusil laser sur " + target.GetType().Name + " en " + target.Position.Txtpos + "Et lui inflige 5 points de dégats ! "; target.Remaining_HP -= 5; if (target.Remaining_HP > 0) { log += "( PV " + target.GetType().Name + " restants: " + target.Remaining_HP + ") "; } }
public void MakashiiStrike(IBaseTroop target) { string log = String.Empty; log += "Dooku tranche " + target.GetType().Name + " en " + target.Position.Txtpos + " et lui inflige 12 points de dégats ! (PV " + target.GetType().Name + " restants : " + target.MaxHP + ")"; target.Remaining_HP -= 12; }
public void Flammethrower(IBaseTroop target) { string log = String.Empty; log += "Jango_Fett brule " + target.GetType().Name + " en " + target.Position.Txtpos + " et lui inflige 12 points de dégats ! (PV " + target.GetType().Name + " restants : " + target.MaxHP + ")"; target.Remaining_HP -= 12; }
public void SoresuStrike(IBaseTroop target) { string log = String.Empty; log += "ObiWan attaque " + target.GetType().Name + " en " + target.Position.Txtpos + " et lui inflige 12 points de dégats ! (PV " + target.GetType().Name + " restants : " + target.MaxHP + ")"; target.Remaining_HP -= 12; }
/// <summary> /// Attaque DjemSo /// </summary> /// <param name="target">Cible de l'attaque</param> public void AttaqueDjemSo(IBaseTroop target) { string log = String.Empty; log += "Anakin bondit sur " + target.GetType().Name + " en " + target.Position.Txtpos + " et lui inflige 12 points de dégats ! (PV " + target.GetType().Name + " restants : " + target.MaxHP + ")"; target.Remaining_HP -= 12; }
public void LightningStrike(IBaseTroop target) { string log = String.Empty; log += "Dark_Sidious lance des éclairs sur " + target.GetType().Name + " en " + target.Position.Txtpos + " et lui inflige 15 points de dégats ! (PV " + target.GetType().Name + " restants : " + target.MaxHP + ")"; target.Remaining_HP -= 15; }
/// <summary> /// Attaque blaster /// </summary> /// <param name="target">Cible de l'attaque</param> public void ShootBlasterRifle(IBaseTroop target) { int range = 20; string log = String.Empty; log += "CloneTrooper en " + this.Position.Txtpos + " utilise son blaster sur " + target.GetType().Name + " en " + target.Position.Txtpos; target.Remaining_HP -= 5; if (target.Remaining_HP > 0) { log += "( PV " + target.GetType().Name + " restants: " + target.Remaining_HP + ") "; } }
/// <summary> /// Attaque lance-roquettes /// </summary> /// <param name="target">Cible de l'attaque</param> public void ShootRocketLauncher(IBaseTroop target) { int range = 20; string log = String.Empty; log += "Serge nt Trooper en " + this.Position.Txtpos + " utilise son lance-roquette sur " + target.GetType().Name + " en " + target.Position.Txtpos + "Et lui inflige 10 points de dégats ! ";; target.Remaining_HP -= 10; if (target.Remaining_HP > 0) { log += "( PV " + target.GetType().Name + " restants: " + target.Remaining_HP + ") "; } }
/// <summary> /// Choix du personnage jouable /// </summary> /// <returns>Classe de PJ sélectionnée par l'utilisateur</returns> private IBaseTroop ChooseCharacter() { CustomConsole.RightOffsetWriteLine("Personnages jouables disponibles ..."); int cpt = 1; foreach (Tuple <string, string> playable in EntitiesManager.Playablesstats) { CustomConsole.RightOffsetWriteLine(cpt + "-" + playable.Item1 + " : " + playable.Item2); cpt++; } CustomConsole.RightOffsetWriteLine("Veuillez saisir le numéro du personnage choisi ..."); var input = Console.ReadLine(); int rslt; int.TryParse(input, out rslt); if (rslt < EntitiesManager.Playablesstats.Count + 1 && rslt > 0) { string name = EntitiesManager.Playablesstats[rslt - 1].Item1; IBaseTroop selectedchar = (IBaseTroop)Activator.CreateInstance(EntitiesManager.Playables.Where((e) => e.Name.Equals(name)).FirstOrDefault()); CustomConsole.RightOffsetWriteLine("Caractéristiques " + selectedchar.GetType().Name + " : PV:" + (selectedchar as IBaseTroop).MaxHP + ", Vitesse:" + (selectedchar as IBaseTroop).Speed + ", attaques spéciales:"); if (selectedchar.GetType().GetTypeInfo().DeclaredMethods.Count() > 0) { selectedchar.GetType().GetTypeInfo().DeclaredMethods.ToList().ForEach((e) => CustomConsole.RightOffsetWriteLine("-" + e.Name)); } selectedchar.color = ConsoleColor.Green; return(selectedchar); } else { CustomConsole.RightOffsetWriteLine("La valeur saisie ne correspond pas..."); return(null); } }
/// <summary> /// Method pour afficher la grille générée /// </summary> public Grid DisplayGrid(List <IBaseTroop> listOfTroops, IBaseTroop player, int index) { Console.Clear(); List <string> lines = new List <string>(); if (player != null) { CustomConsole.RightOffsetWriteLine(" PERSONNAGE : "+ player.GetType().Name + " || PV : "+ player.Remaining_HP + "/" + player.MaxHP + "\r\n"); listOfTroops.Add(player); } Grid grid = GenerateGrid(listOfTroops, index, lines); string testPlayer = "ASDJWY"; string testTrooper = "8O"; string testDroid = "#§"; for (int x = 0; x < lines.Count; x++) { for (int y = 0; y < lines[x].Length; y++) { if (x == 0 || y == 0 || y == 1) { Console.ForegroundColor = ConsoleColor.Blue; } else if (testPlayer.Contains(lines[x][y])) { IBaseTroop PJ = listOfTroops.Where(s => s.Icon == lines[x][y]).First(); if (PJ.Remaining_HP == PJ.MaxHP) { PJ.color = ConsoleColor.Green; } else { PJ.color = ConsoleColor.Red; } Console.ForegroundColor = PJ.color; } else if (testTrooper.Contains(lines[x][y])) { IBaseTroop trooper = listOfTroops.Where(s => s.Icon == lines[x][y]).First(); Console.ForegroundColor = trooper.color; } else if (testDroid.Contains(lines[x][y])) { IBaseTroop droid = listOfTroops.Where(s => s.Icon == lines[x][y]).First(); Console.ForegroundColor = droid.color; } else { Console.ForegroundColor = ConsoleColor.White; } Console.Write(lines[x][y]); } Console.Write("\r\n"); } string legend = "légende : "; listOfTroops.DistinctBy((i) => i.Icon).ToList().ForEach((e) => legend += e.Icon + " = " + e.GetType().Name + " | "); legend = legend.Remove(legend.Length - 2); Console.WriteLine(legend); Console.WriteLine("\r\n"); listOfTroops.Remove(player); return(grid); }