final commit

This commit is contained in:
OMGiTzPomPom 2022-10-16 12:17:59 +02:00
parent 020c6d0128
commit f87dd9f732
3 changed files with 55 additions and 2 deletions

2
ClassDiagram1.cd Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />

View File

@ -4,5 +4,7 @@ public class Program {
public static void Main(string[] args) {
GameManager gm = new GameManager();
gm.InitializeGame();
Console.ReadLine();
}
}

View File

@ -222,6 +222,7 @@ namespace Programmation_objet_TLESIO21.projet {
displayCurrentPlayerTurn(p1);
Console.WriteLine("Pokemon adverse : " + p2.getCurrentPokemon() + " - Type : " + p2.getCurrentPokemon().getType());
entreeStandard = Console.ReadLine();
Console.WriteLine(" ");
switch (entreeStandard) {
case "1":
Console.WriteLine(p1.getNom() + " décide que " + p1.getCurrentPokemon().getName() + " doit attaquer en physique.");
@ -264,7 +265,7 @@ namespace Programmation_objet_TLESIO21.projet {
displayTeamChange(p2);
p2Choice = getRandom(6);
if (p2.getTeam()[p2Choice].isAlive()) {
Console.Write("Reviens " + p2.getCurrentPokemon());
Console.WriteLine("Reviens " + p2.getCurrentPokemon());
p2.setCurrentPokemonIndex(p2Choice);
correctSwitchChoice = true;
Console.WriteLine("À toi " + p2.getCurrentPokemon());
@ -272,7 +273,34 @@ namespace Programmation_objet_TLESIO21.projet {
}
}
}
if (!p1.getCurrentPokemon().isAlive()) {
bool correctSwitchChoice = false;
if (p1.canStillFight()) {
isFighting = false;
Console.WriteLine("La partie est terminée. " + p2.getNom() + " a gagné !");
correctSwitchChoice = true;
} else {
while (!correctSwitchChoice) {
Console.WriteLine(p1.getNom() + ", votre pokémon " + p1.getCurrentPokemon().getName() + " n'est plus capable de se battre. Vous devez changer de Pokémon !");
displayTeamChange(p1);
entreeStandard = Console.ReadLine();
entreeStandard = entreeStandard.Substring(0, 1);
if (StringIsValidIntFight(entreeStandard) && p1.getTeam()[int.Parse(entreeStandard) - 1].isAlive()) {
Console.WriteLine("Reviens " + p1.getCurrentPokemon());
p1.setCurrentPokemonIndex(int.Parse(entreeStandard) - 1);
correctSwitchChoice = true;
Console.WriteLine("À toi " + p1.getCurrentPokemon());
} else {
Console.WriteLine("Vous ne pouvez pas switch avec ce pokémon. Merci d'entrer une valeur correcte.");
}
}
}
}
if (!p2.getCurrentPokemon().isAlive()) {
currentTurnisValid = false;
}
while (!currentTurnisValid) {
p2Choice = getRandom(3);
switch (p2Choice) {
@ -299,6 +327,7 @@ namespace Programmation_objet_TLESIO21.projet {
}
}
Console.WriteLine("\n");
currentTurnisValid = false;
if (!p1.getCurrentPokemon().isAlive()) {
@ -314,7 +343,7 @@ namespace Programmation_objet_TLESIO21.projet {
entreeStandard = Console.ReadLine();
entreeStandard = entreeStandard.Substring(0, 1);
if (StringIsValidIntFight(entreeStandard) && p1.getTeam()[int.Parse(entreeStandard)-1].isAlive()) {
Console.Write("Reviens " + p1.getCurrentPokemon());
Console.WriteLine("Reviens " + p1.getCurrentPokemon());
p1.setCurrentPokemonIndex(int.Parse(entreeStandard)-1);
correctSwitchChoice = true;
Console.WriteLine("À toi " + p1.getCurrentPokemon());
@ -325,6 +354,26 @@ namespace Programmation_objet_TLESIO21.projet {
}
}
}
if (!p2.getCurrentPokemon().isAlive()) {
bool correctSwitchChoice = false;
if (p2.canStillFight()) {
isFighting = false;
Console.WriteLine("La partie est terminée. " + p1.getNom() + " a gagné !");
correctSwitchChoice = true;
} else {
while (!correctSwitchChoice) {
Console.WriteLine(p2.getNom() + ", votre pokémon " + p2.getCurrentPokemon().getName() + " n'est plus capable de se battre. Vous devez changer de Pokémon !");
displayTeamChange(p2);
p2Choice = getRandom(6);
if (p2.getTeam()[p2Choice].isAlive()) {
Console.WriteLine("Reviens " + p2.getCurrentPokemon());
p2.setCurrentPokemonIndex(p2Choice);
correctSwitchChoice = true;
Console.WriteLine("À toi " + p2.getCurrentPokemon());
}
}
}
}
}
}