This commit is contained in:
2022-10-15 18:39:27 +02:00
parent 34b6e157c8
commit 36786a0f85
25 changed files with 936 additions and 366 deletions

39
projet/Character.cs Normal file
View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class Character {
private string Name;
private string Description;
private int level;
private List<Pokemon> PC;
#pragma warning disable CS8618 // Un champ non-nullable doit contenir une valeur non-null lors de la fermeture du constructeur. Envisagez de déclarer le champ comme nullable.
public Character(string Name, string Description, List<Pokemon> PC) {
this.Name = Name;
this.Description = Description;
this.PC = PC;
this.level = PC.Count;
}
public override string ToString() {
String sb = this.Name + " est level " + this.level + "." + " " + this.Description + ". Ses pokemon sont :\n";
foreach (Pokemon p in this.PC) {
sb += p.getName() + ". ";
}
return sb + "\n";
}
public String getName() {
return this.Name;
}
public List<Pokemon> getPC() {
return this.PC;
}
}
}

View File

@ -1,26 +1,355 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Programmation_objet_TLESIO21.projet {
public class GameManager {
private string Path;
private List<Pokemon> pkm = new List<Pokemon>();
private List<Player> players = new List<Player>();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Programmation_objet_TLESIO21.projet {
public class GameManager {
private string Path;
private List<Pokemon> Pkm = new List<Pokemon>();
private List<Character> Characters = new List<Character>();
private Player p1;
private Player p2;
private int p1CharacterChoosen;
private int p2CharacterChoosen;
public GameManager() {
this.p1CharacterChoosen = 0;
this.p2CharacterChoosen = 0;
this.Path = "../../../csv/";
}
}
private static bool StringIsValidInt(String s) {
foreach (char c in s) {
if (c < '0' || c > '9')
return false;
}
return true;
}
private static bool StringIsValidIntFight(String s) {
foreach (char c in s) {
if (c < '0' || c > '7')
return false;
}
return true;
}
private static bool TabStringIsValidInt(String[] tab) {
foreach(String s in tab) {
foreach (char c in s) {
if (c < '0' || c > '9') {
return false;
}
}
}
return true;
}
private static bool StringIsValidIntCharacters(String s) {
foreach(char c in s) {
if (c < '1' || c > '9') {
return false;
}
}
return true;
}
private static String DisplayTeam(Player p) {
String sb = "";
int i = 0;
foreach(Pokemon pkm in p.getTeam()) {
if(pkm.isAlive()) {
sb += "["+(i+1)+"]" + pkm.getName() + ". ";
} else {
sb += "[OUT]" + pkm.getName() + ". ";
}
++i;
}
return sb;
}
public void InitializeGame() {
StreamReader strm = new StreamReader(this.Path + "Title.txt");
String strmL;
//Read the first line of text
strmL = strm.ReadLine();
//Continue to read until you reach end of file
while (strmL != null) {
if (strmL[0] == '/') {
strmL = strm.ReadLine();
}
//write the line to console window
Console.WriteLine(strmL);
//Read the next line
strmL = strm.ReadLine();
}
//close the file
strm.Close();
Console.WriteLine(" ");
String entreeStandard;
bool p1 = false;
bool p2 = false;
while(!p1) {
Console.WriteLine("Merci d'entrer le nom du joueur 1 :");
entreeStandard = Console.ReadLine();
if(entreeStandard == "") {
Console.WriteLine("Veuillez resaisir. Nom incorrect.");
} else {
this.p1 = new Player(entreeStandard);
p1 = true;
}
}
while (!p2) {
Console.WriteLine("Merci d'entrer le nom du joueur 2 :");
entreeStandard = Console.ReadLine();
if (entreeStandard == "") {
Console.WriteLine("Veuillez resaisir. Nom incorrect.");
} else {
this.p2 = new Player(entreeStandard);
p2 = true;
}
}
this.InitializePokemons();
this.ChooseTeams();
this.Combat();
}
private void ChooseTeams() {
String entreeStandard = "";
Console.WriteLine("Vous avez devant vous plusieurs dresseuses pokémon. Vous allez devoir choisir 6 pokémon parmis ceux de la dresseuse que vous allez choisir :\n");
int i = 0;
foreach(Character c in Characters) {
Console.WriteLine("[" + (i+1) + "] " + c.ToString());
++i;
}
Console.WriteLine("Choissez la dresseuse que vous pensez être la plus apte à vous prêter des pokémon pour combattre.\n" +
"Pour cela, rentrez le numéro affiché devant le nom de la dresseuse.");
bool correctChoice = false;
while (!correctChoice) {
entreeStandard = Console.ReadLine();
if(entreeStandard != "" && StringIsValidIntCharacters(entreeStandard)) {
correctChoice = true;
p1CharacterChoosen = int.Parse(entreeStandard.Substring(0,1))-1;
} else {
Console.WriteLine("Veuillez resaisir. Entrée incorrecte.");
}
}
p2CharacterChoosen = getRandom(9);
if (p2CharacterChoosen == 9) {
p2CharacterChoosen = 8;
}
Console.WriteLine("Vous avez choisi de faire confiance à " + Characters[p1CharacterChoosen].getName() + ".");
Console.WriteLine("Votre adversaire a choisis de faire confiance à " + Characters[p2CharacterChoosen].getName() + ".");
Console.WriteLine("Maintenant, vous allez devoir choisir 6 pokémons parmis ceux de " + Characters[p1CharacterChoosen].getName() + "\n" +
"Il vous suffit de rentrer le numéro précédant le nom du pokémon.\n");
i = 0;
foreach(Pokemon pkm in Characters[p1CharacterChoosen].getPC()) {
Console.WriteLine("[" + (i+1) + "] " + pkm.getStats());
++i;
}
Console.WriteLine("Entrez les 6 numéros des pokémons que vous souhaitez utiliser. Exemple : 1-12-5-6-10-2");
bool isTeamValid = false;
while(!isTeamValid) {
entreeStandard = Console.ReadLine();
String[] tab = entreeStandard.Split("-");
if (tab.Length == 6 && TabStringIsValidInt(tab)) {
foreach (String s in tab) {
p1.choosePokemon(Characters[p1CharacterChoosen].getPC()[int.Parse(s)-1]);
}
isTeamValid = true;
} else {
Console.WriteLine("Veuillez resaisir. Entrée incorrecte (Format attendu : 1-12-5-6-10-2).");
}
}
Console.Write("Votre équipe est constituée de : ");
foreach (Pokemon pkm in p1.getTeam()) {
Console.Write(pkm.getName() + ". ");
}
Console.WriteLine("");
for(int j = 0; j < 6; ++j) {
p2.choosePokemon(Characters[p2CharacterChoosen].getPC()[getRandom(Characters[p2CharacterChoosen].getPC().Count)]);
}
Console.Write("L'équipe de votre adversaire est constituée de : ");
foreach (Pokemon pkm in p2.getTeam()) {
Console.Write(pkm.getName() + ". ");
}
Console.WriteLine("\n\n Préparez vous, le combat va commencer. Vous allez envoyer " + p1.getTeam()[0].getName() +
"et votre adversaire va envoyer " + p2.getTeam()[0].getName() + ".");
p1.setCurrentPokemonIndex(0);
p2.setCurrentPokemonIndex(0);
}
private void Combat() {
bool isFighting = true;
bool currentTurnisValid = false;
String entreeStandard;
int p2Choice = getRandom(3);
while (isFighting) {
Console.WriteLine("\n\n\n");
while(!currentTurnisValid) {
displayCurrentPlayerTurn(p1);
Console.WriteLine("Pokemon adverse : " + p2.getCurrentPokemon() + " - Type : " + p2.getCurrentPokemon().getType());
entreeStandard = Console.ReadLine();
switch (entreeStandard) {
case "1":
Console.WriteLine(p1.getNom() + " décide que " + p1.getCurrentPokemon().getName() + " doit attaquer en physique.");
p1.getCurrentPokemon().PhysAttack(p2.getCurrentPokemon());
currentTurnisValid = true;
break;
case "2":
Console.WriteLine(p1.getNom() + " décide que " + p1.getCurrentPokemon().getName() + " doit attaquer en spécial.");
p1.getCurrentPokemon().SpeAttack(p2.getCurrentPokemon());
currentTurnisValid = true;
break;
case "3":
Console.WriteLine(p1.getNom() + " décide que " + p1.getCurrentPokemon().getName() + " revenir.");
displayTeamChange(p1);
entreeStandard = Console.ReadLine();
entreeStandard = entreeStandard.Substring(0, 1);
if(StringIsValidIntFight(entreeStandard)) {
p1.setCurrentPokemonIndex(int.Parse(entreeStandard)-1);
}
Console.WriteLine("À toi " + p2.getCurrentPokemon());
currentTurnisValid = true;
break;
default:
Console.WriteLine("Erreur de saisie. Veuillez recommencer.");
break;
}
}
currentTurnisValid = false;
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.Write("Reviens " + p2.getCurrentPokemon());
p2.setCurrentPokemonIndex(p2Choice);
correctSwitchChoice = true;
Console.WriteLine("À toi " + p2.getCurrentPokemon());
}
}
}
}
while (!currentTurnisValid) {
p2Choice = getRandom(3);
switch (p2Choice) {
case 0:
Console.WriteLine(p2.getNom() + " décide que " + p2.getCurrentPokemon().getName() + " doit attaquer en physique.");
p2.getCurrentPokemon().PhysAttack(p1.getCurrentPokemon());
currentTurnisValid = true;
break;
case 1:
Console.WriteLine(p2.getNom() + " décide que " + p2.getCurrentPokemon().getName() + " doit attaquer en spécial.");
p2.getCurrentPokemon().SpeAttack(p1.getCurrentPokemon());
currentTurnisValid = true;
break;
case 2:
Console.WriteLine(p2.getNom() + " décide que " + p2.getCurrentPokemon().getName() + " revenir.");
displayTeamChange(p2);
p2.setCurrentPokemonIndex(getRandom(6));
currentTurnisValid = true;
Console.WriteLine("À toi " + p2.getCurrentPokemon());
break;
default:
Console.WriteLine("Erreur de saisie. Veuillez recommencer.");
break;
}
}
currentTurnisValid = false;
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.Write("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.");
}
}
}
}
}
}
private static void displayCurrentPlayerTurn(Player p) {
Console.WriteLine("C'est au tour de " + p.getNom() + " de combattre avec " + p.getCurrentPokemon().ToString() + " Type : " + p.getCurrentPokemon().getType() + ".");
Console.WriteLine("Que souhaitez vous faire : ");
Console.WriteLine("[1] Effectuer une attaque physique (ATK Physique "+ p.getCurrentPokemon().getATKPhys() +")");
Console.WriteLine("[2] Effectuer une attaque spéciale (ATK Spéciale "+ p.getCurrentPokemon().getATKSpe() +")");
Console.WriteLine("[3] Changer de pokémon");
}
private void displayTeamChange(Player p) {
Console.WriteLine("Avec quel Pokémon switch ?");
Console.WriteLine(DisplayTeam(p));
}
private int RandomMove() {
return getRandom(3);
}
private static int getRandom(int max) {
Random r = new Random();
return r.Next(max);
}
}
private Nature GenerateNature() {
switch (getRandom(25)) {
case 0:
@ -76,8 +405,8 @@ namespace Programmation_objet_TLESIO21.projet {
default:
return Nature.NULL;
}
}
}
private Pokemon? CreatePokemon(String s) {
String[] tab = s.Split(";");
switch (tab[1]) {
@ -120,13 +449,13 @@ namespace Programmation_objet_TLESIO21.projet {
default:
return null;
}
}
private Player createPlayer(String s) {
}
private Character createCharacter(String s) {
String[] tab = s.Split(";");
List<Pokemon> pokemons = new List<Pokemon>();
for(int i = 0; i < getRandom(30)+7; ++i) {
pokemons.Add(pkm.ElementAt(getRandom(1072)));
pokemons.Add(Pkm.ElementAt(getRandom(1072)));
}
foreach (Pokemon pkm in pokemons) {
@ -136,10 +465,10 @@ namespace Programmation_objet_TLESIO21.projet {
this.ApplyPlayerEffect(tab[0], pkm);
}
return new Player(tab[0], tab[1], pokemons);
}
public void initializeGame() {
return new Character(tab[0], tab[1] + ". " + tab[2], pokemons);
}
private void InitializePokemons() {
String line;
try {
//Pass the file path and file name to the StreamReader constructor
@ -154,7 +483,7 @@ namespace Programmation_objet_TLESIO21.projet {
line = srPkm.ReadLine();
}
//write the line to console window
pkm.Add(CreatePokemon(line));
Pkm.Add(CreatePokemon(line));
//Read the next line
line = srPkm.ReadLine();
}
@ -169,7 +498,7 @@ namespace Programmation_objet_TLESIO21.projet {
line = srPerso.ReadLine();
}
//write the line to console window
players.Add(createPlayer(line));
Characters.Add(createCharacter(line));
//Read the next line
line = srPerso.ReadLine();
}
@ -180,148 +509,148 @@ namespace Programmation_objet_TLESIO21.projet {
} catch (Exception e) {
Console.WriteLine("Exception: " + e.Message);
}
}
public void AlterPokemonStat(String stat, double value, Pokemon p) {
switch(stat) {
case "PV":
p.setPV((int)Math.Floor(p.getPV() * value));
break;
case "ATKPhys":
p.setATKPhys(((int)Math.Floor(p.getATKPhys() * value)));
break;
case "ATKSpe":
p.setATKSpe(((int)Math.Floor(p.getATKSpe() * value)));
break;
case "DEFPhys":
p.setDefPhys(((int)Math.Floor(p.getDEFPhys() * value)));
break;
case "DEFSpe":
p.setDefSpe(((int)Math.Floor(p.getDEFSpe() * value)));
break;
case "Speed":
p.setSpeed(((int)Math.Floor(p.getSpeed() * value)));
break;
default:
break;
}
}
public void ApplyNatureEffect(Enum nature, Pokemon p) {
switch(nature) { //malus
case Nature.BOLD:
case Nature.CALM:
case Nature.MODEST:
case Nature.TIMID:
AlterPokemonStat("ATKPhys", 0.9, p);
break;
case Nature.MILD:
case Nature.GENTLE:
case Nature.HASTY:
case Nature.LONELY:
AlterPokemonStat("DEFPhys", 0.9, p);
break;
case Nature.JOLLY:
case Nature.IMPISH:
case Nature.CAREFUL:
case Nature.ADAMANT:
AlterPokemonStat("ATKSpe", 0.9, p);
break;
case Nature.RASH:
case Nature.LAX:
case Nature.NAUGHTY:
case Nature.NAIVE:
AlterPokemonStat("DEFSpe", 0.9, p);
break;
case Nature.BRAVE:
case Nature.QUIET:
case Nature.SASSY:
case Nature.RELAXED:
AlterPokemonStat("Speed", 0.9, p);
break;
default:
break;
}
switch(nature) { //bonus
case Nature.BRAVE:
case Nature.NAUGHTY:
case Nature.ADAMANT:
case Nature.LONELY:
AlterPokemonStat("ATKPhys", 1.1, p);
break;
case Nature.BOLD:
case Nature.LAX:
case Nature.IMPISH:
case Nature.RELAXED:
AlterPokemonStat("DEFPhys", 1.1, p);
break;
case Nature.QUIET:
case Nature.MILD:
case Nature.RASH:
case Nature.MODEST:
AlterPokemonStat("ATKSpe", 1.1, p);
break;
case Nature.CALM:
case Nature.GENTLE:
case Nature.SASSY:
case Nature.CAREFUL:
AlterPokemonStat("DEFSpe", 1.1, p);
break;
case Nature.JOLLY:
case Nature.NAIVE:
case Nature.HASTY:
case Nature.TIMID:
AlterPokemonStat("Speed", 1.1, p);
break;
default:
break;
}
}
public void ApplyPlayerEffect(String playerName, Pokemon p) {
switch(playerName) {
case "Applejack":
AlterPokemonStat("PV", 1.05, p);
break;
case "Rainbow Dash":
AlterPokemonStat("ATKPhys", 1.03, p);
break;
case "Twilight Sparkle":
AlterPokemonStat("Speed", 1.07, p);
break;
case "Pinkie Pie":
AlterPokemonStat("DEFPhys", 1.04, p);
break;
case "Fluttershy":
AlterPokemonStat("DEFPhys", 0.96, p);
break;
case "Izzy Moonbow":
AlterPokemonStat("PV", 1.05, p);
AlterPokemonStat("Speed", 0.95, p);
break;
case "Zipp Storm":
AlterPokemonStat("PV", 0.95, p);
AlterPokemonStat("Speed", 1.05, p);
break;
case "Sunny Starscout":
AlterPokemonStat("ATKSpe", 1.03, p);
break;
case "Derpy Hooves":
AlterPokemonStat("PV", 0.95, p);
break;
default:
break;
}
}
public List<Pokemon> GetPokemons() {
return this.pkm;
}
public List<Player> GetPlayers() {
return this.players;
}
}
}
}
private void AlterPokemonStat(String stat, double value, Pokemon p) {
switch(stat) {
case "PV":
p.setPV((int)Math.Floor(p.getPV() * value));
break;
case "ATKPhys":
p.setATKPhys(((int)Math.Floor(p.getATKPhys() * value)));
break;
case "ATKSpe":
p.setATKSpe(((int)Math.Floor(p.getATKSpe() * value)));
break;
case "DEFPhys":
p.setDefPhys(((int)Math.Floor(p.getDEFPhys() * value)));
break;
case "DEFSpe":
p.setDefSpe(((int)Math.Floor(p.getDEFSpe() * value)));
break;
case "Speed":
p.setSpeed(((int)Math.Floor(p.getSpeed() * value)));
break;
default:
break;
}
}
private void ApplyNatureEffect(Enum nature, Pokemon p) {
switch(nature) { //malus
case Nature.BOLD:
case Nature.CALM:
case Nature.MODEST:
case Nature.TIMID:
AlterPokemonStat("ATKPhys", 0.9, p);
break;
case Nature.MILD:
case Nature.GENTLE:
case Nature.HASTY:
case Nature.LONELY:
AlterPokemonStat("DEFPhys", 0.9, p);
break;
case Nature.JOLLY:
case Nature.IMPISH:
case Nature.CAREFUL:
case Nature.ADAMANT:
AlterPokemonStat("ATKSpe", 0.9, p);
break;
case Nature.RASH:
case Nature.LAX:
case Nature.NAUGHTY:
case Nature.NAIVE:
AlterPokemonStat("DEFSpe", 0.9, p);
break;
case Nature.BRAVE:
case Nature.QUIET:
case Nature.SASSY:
case Nature.RELAXED:
AlterPokemonStat("Speed", 0.9, p);
break;
default:
break;
}
switch(nature) { //bonus
case Nature.BRAVE:
case Nature.NAUGHTY:
case Nature.ADAMANT:
case Nature.LONELY:
AlterPokemonStat("ATKPhys", 1.1, p);
break;
case Nature.BOLD:
case Nature.LAX:
case Nature.IMPISH:
case Nature.RELAXED:
AlterPokemonStat("DEFPhys", 1.1, p);
break;
case Nature.QUIET:
case Nature.MILD:
case Nature.RASH:
case Nature.MODEST:
AlterPokemonStat("ATKSpe", 1.1, p);
break;
case Nature.CALM:
case Nature.GENTLE:
case Nature.SASSY:
case Nature.CAREFUL:
AlterPokemonStat("DEFSpe", 1.1, p);
break;
case Nature.JOLLY:
case Nature.NAIVE:
case Nature.HASTY:
case Nature.TIMID:
AlterPokemonStat("Speed", 1.1, p);
break;
default:
break;
}
}
private void ApplyPlayerEffect(String playerName, Pokemon p) {
switch(playerName) {
case "Applejack":
AlterPokemonStat("PV", 1.05, p);
break;
case "Rainbow Dash":
AlterPokemonStat("ATKPhys", 1.03, p);
break;
case "Twilight Sparkle":
AlterPokemonStat("Speed", 1.07, p);
break;
case "Pinkie Pie":
AlterPokemonStat("DEFPhys", 1.04, p);
break;
case "Fluttershy":
AlterPokemonStat("DEFPhys", 0.96, p);
break;
case "Izzy Moonbow":
AlterPokemonStat("PV", 1.05, p);
AlterPokemonStat("Speed", 0.95, p);
break;
case "Zipp Storm":
AlterPokemonStat("PV", 0.95, p);
AlterPokemonStat("Speed", 1.05, p);
break;
case "Sunny Starscout":
AlterPokemonStat("ATKSpe", 1.03, p);
break;
case "Derpy Hooves":
AlterPokemonStat("PV", 0.95, p);
break;
default:
break;
}
}
private List<Pokemon> GetPokemons() {
return this.Pkm;
}
private List<Character> GetCharacters() {
return this.Characters;
}
}
}

View File

@ -1,29 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class Player {
private string Name;
private string Description;
private int level;
private List<Pokemon> PC;
private List<Pokemon> Team;
#pragma warning disable CS8618 // Un champ non-nullable doit contenir une valeur non-null lors de la fermeture du constructeur. Envisagez de déclarer le champ comme nullable.
public Player(string Name, string Description, List<Pokemon> PC) {
this.Name = Name;
this.Description = Description;
this.PC = PC;
this.level = PC.Count;
this.Team = new List<Pokemon>(6);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class Player {
private String Nom;
private List<Pokemon> Team;
private int currentPokemonIndex;
public Player(string nom) {
this.Nom = nom;
this.Team = new List<Pokemon>();
}
public void choosePokemon(Pokemon pkm) {
this.Team.Add(pkm);
}
public String getNom() {
return this.Nom;
}
public List<Pokemon> getTeam() {
return this.Team;
}
public void setCurrentPokemonIndex(int i) {
this.currentPokemonIndex = i;
}
public Pokemon getCurrentPokemon() {
return this.getTeam()[currentPokemonIndex];
}
public bool canStillFight() {
int pkmCount = this.Team.Count;
foreach(Pokemon pkm in Team) {
if(!pkm.isAlive()) {
pkmCount--;
}
}
return pkmCount == 0;
}
public override string ToString() {
return this.Name + " est level " + this.level + ". Ses pokemon sont : " + this.PC.ToString();
}
}
}
String sb = "";
sb += this.Nom + " a pour pokémons : ";
foreach (Pokemon p in this.Team) {
sb += p.getName() + ". ";
}
return sb;
}
}
}

View File

@ -1,128 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public abstract class Pokemon {
private readonly string Name;
private Type Type;
private Nature Nature;
private int PV;
private int PC;
private int ATKPhys;
private int ATKSpe;
private int DEFPhys;
private int DEFSpe;
private int Speed;
public Pokemon(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) {
this.Name = Name;
this.PV = PV;
this.ATKPhys = ATKPhys;
this.ATKSpe = ATKSpe;
this.DEFPhys = DEFPhys;
this.DEFSpe = DEFSpe;
this.Speed = Speed;
}
public virtual void PhysAttack(Pokemon cible) {
}
public virtual void SpeAttack(Pokemon cible) {
}
public void getDamage(int d) {
this.PV -= d;
}
public Boolean hasEnoughtPC() {
return (this.getPC() > 0);
}
public Boolean isAlive() {
return (this.getPV() > 0);
}
public override string ToString() {
return this.getName() + " - PV : " + getPV() + ", PC = " + getPC();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public abstract class Pokemon {
private readonly string Name;
private Type Type;
private Nature Nature;
private int PV;
private int PC;
private int ATKPhys;
private int ATKSpe;
private int DEFPhys;
private int DEFSpe;
private int Speed;
public Pokemon(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) {
this.Name = Name;
this.PV = PV;
this.ATKPhys = ATKPhys;
this.ATKSpe = ATKSpe;
this.DEFPhys = DEFPhys;
this.DEFSpe = DEFSpe;
this.Speed = Speed;
}
public virtual void PhysAttack(Pokemon cible) {
}
public virtual void SpeAttack(Pokemon cible) {
}
public void getDamage(int d) {
this.PV -= d;
Console.WriteLine(this.getName() + " a subbi " + d + " dégats");
}
public Boolean hasEnoughtPC() {
return (this.getPC() > 0);
}
public Boolean isAlive() {
return (this.getPV() > 0);
}
public String getStats() {
return this.getName() + " - PV : " + getPV() +
" - PC = " + getPC() +
" - ATK Physique = " + getATKPhys() +
" - ATK Spéciale = " + getATKSpe() +
" - DEF Physique = " + getDEFPhys() +
" - DEF Spéciale = " + getDEFSpe() +
" - Vitesse = " + getSpeed() ;
}
public override string ToString() {
return this.Name + " - PV : " + this.PV + " - PC : " + this.PC;
}
public void SetNature(Nature n) {
this.Nature = n;
}
public void setPV(int pv) {
this.PV = pv;
}
internal void setPC(int pc) {
this.PC = pc;
}
internal void setType(Type t) {
this.Type = t;
}
public void setATKPhys(int atk) {
this.ATKPhys = atk;
}
public void setATKSpe(int atk) {
this.ATKSpe = atk;
}
public void setDefPhys(int def) {
this.DEFPhys = def;
}
public void setDefSpe(int def) {
this.DEFSpe = def;
}
public void setSpeed(int speed) {
this.Speed = speed;
}
public String getName() {
return this.Name;
}
public Type getType() {
return this.Type;
}
public Nature GetNature() {
return this.Nature;
}
public int getPV() {
return this.PV;
}
public int getPC() {
return this.PC;
}
public int getATKPhys() {
return this.ATKPhys;
}
public int getATKSpe() {
return this.ATKSpe;
}
public int getDEFPhys() {
return this.DEFPhys;
}
public int getDEFSpe() {
return this.DEFSpe;
}
public int getSpeed() {
return this.Speed;
}
}
}
}
public void setPV(int pv) {
this.PV = pv;
}
internal void setPC(int pc) {
this.PC = pc;
}
internal void setType(Type t) {
this.Type = t;
}
public void setATKPhys(int atk) {
this.ATKPhys = atk;
}
public void setATKSpe(int atk) {
this.ATKSpe = atk;
}
public void setDefPhys(int def) {
this.DEFPhys = def;
}
public void setDefSpe(int def) {
this.DEFSpe = def;
}
public void setSpeed(int speed) {
this.Speed = speed;
}
public String getName() {
return this.Name;
}
public Type getType() {
return this.Type;
}
public Nature GetNature() {
return this.Nature;
}
public int getPV() {
return this.PV;
}
public int getPC() {
return this.PC;
}
public int getATKPhys() {
return this.ATKPhys;
}
public int getATKSpe() {
return this.ATKSpe;
}
public int getDEFPhys() {
return this.DEFPhys;
}
public int getDEFSpe() {
return this.DEFSpe;
}
public int getSpeed() {
return this.Speed;
}
}
}

View File

@ -24,13 +24,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.GHOST) ||
cible.getType().Equals(Type.FLYING)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.DARK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -46,13 +50,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.GHOST) ||
cible.getType().Equals(Type.FLYING)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.DARK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -20,12 +20,16 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.DARK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.PSYCHIC) ||
if (cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.GHOST)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -37,12 +41,16 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.DARK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.GHOST)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,15 +17,20 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.FAIRY)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if(cible.getType().Equals(Type.STEEL)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.DRAGON)) {
if (cible.getType().Equals(Type.DRAGON)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -34,15 +39,20 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFSpe() - this.getATKSpe();
if (cible.getType().Equals(Type.FAIRY)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if (damage > 0) {
if (cible.getType().Equals(Type.STEEL)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.DRAGON)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,18 +17,23 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.GROUND)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.STEEL) ||
if (cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.WATER)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -37,16 +42,19 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFSpe() - this.getATKSpe();
if(cible.getType().Equals(Type.GROUND)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FLYING) ||
if (cible.getType().Equals(Type.FLYING) ||
cible.getType().Equals(Type.WATER)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
}

View File

@ -20,13 +20,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.POISON)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIGHTING) ||
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.DARK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -38,13 +42,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.POISON)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.DARK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,22 +17,27 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.GHOST)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.FLYING) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.FAIRY)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.STEEL) ||
if (cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.NORMAL) ||
cible.getType().Equals(Type.DARK) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.ROCK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -41,6 +46,7 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFSpe() - this.getATKSpe();
if (cible.getType().Equals(Type.GHOST)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if (damage > 0) {
if (cible.getType().Equals(Type.PSYCHIC) ||
@ -48,6 +54,7 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.FAIRY)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.NORMAL) ||
@ -55,8 +62,11 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.ROCK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -20,14 +20,18 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ROCK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.GRASS) ||
if (cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.STEEL)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -40,14 +44,18 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ROCK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.GRASS) ||
if (cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.STEEL)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -20,13 +20,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIGHTING) ||
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.GRASS)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -38,13 +42,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.GRASS)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,16 +17,21 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.NORMAL)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.DARK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.PSYCHIC) ||
if (cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.GHOST)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -35,16 +40,21 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFSpe() - this.getATKSpe();
if (cible.getType().Equals(Type.NORMAL)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if (damage > 0) {
if (cible.getType().Equals(Type.DARK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.GHOST)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -23,13 +23,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.POISON) ||
cible.getType().Equals(Type.FLYING)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.WATER) ||
if (cible.getType().Equals(Type.WATER) ||
cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.GROUND)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -45,13 +49,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.POISON) ||
cible.getType().Equals(Type.FLYING)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.WATER) ||
if (cible.getType().Equals(Type.WATER) ||
cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.GROUND)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,20 +17,25 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.FLYING)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.GRASS)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.ROCK) ||
if (cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.POISON) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -38,6 +43,7 @@ namespace Programmation_objet_TLESIO21.projet {
this.setPC(this.getPC() - 4);
int damage = cible.getDEFSpe() - this.getATKSpe();
if(cible.getType().Equals(Type.FLYING)) {
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
damage = 0;
}
if(damage > 0) {
@ -45,12 +51,16 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FLYING) ||
if (cible.getType().Equals(Type.FLYING) ||
cible.getType().Equals(Type.WATER)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -21,14 +21,18 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ICE)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.DRAGON) ||
if (cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.GROUND) ||
cible.getType().Equals(Type.FLYING)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -41,14 +45,18 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ICE)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.GROUND) ||
cible.getType().Equals(Type.FLYING)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,12 +17,16 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.GHOST)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.ROCK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -35,8 +39,11 @@ namespace Programmation_objet_TLESIO21.projet {
if(damage > 0) {
if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.ROCK)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,19 +17,24 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.STEEL)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.POISON) ||
cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.GROUND) ||
cible.getType().Equals(Type.GHOST)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FAIRY) ||
if (cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.GRASS)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -38,6 +43,7 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFSpe() - this.getATKSpe();
if (cible.getType().Equals(Type.STEEL)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if (damage > 0) {
if (cible.getType().Equals(Type.POISON) ||
@ -45,12 +51,16 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.GROUND) ||
cible.getType().Equals(Type.GHOST)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.GRASS)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -17,17 +17,22 @@ namespace Programmation_objet_TLESIO21.projet {
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.DARK)) {
damage = 0;
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
}
if(damage > 0) {
if (damage > 0) {
if(cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.PSYCHIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIGHTING) ||
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.POISON)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -35,18 +40,23 @@ namespace Programmation_objet_TLESIO21.projet {
this.setPC(this.getPC() - 3);
int damage = cible.getDEFSpe() - this.getATKSpe();
if (cible.getType().Equals(Type.DARK)) {
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
damage = 0;
}
if (damage > 0) {
if (cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.PSYCHIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.POISON)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -20,13 +20,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.GROUND)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIRE) ||
if (cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.BUG)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -38,13 +42,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIGHTING) ||
cible.getType().Equals(Type.GROUND)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIRE) ||
if (cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.BUG)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -21,13 +21,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FAIRY) ||
if (cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.ROCK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -40,13 +44,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if (cible.getType().Equals(Type.FAIRY) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.ROCK)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}

View File

@ -19,13 +19,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.WATER) ||
cible.getType().Equals(Type.GRASS)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIRE) ||
if (cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.GROUND)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
@ -37,13 +41,17 @@ namespace Programmation_objet_TLESIO21.projet {
cible.getType().Equals(Type.WATER) ||
cible.getType().Equals(Type.GRASS)) {
damage /= 2;
Console.WriteLine("Ce n'est pas très efficace");
}
if(cible.getType().Equals(Type.FIRE) ||
if (cible.getType().Equals(Type.FIRE) ||
cible.getType().Equals(Type.ROCK) ||
cible.getType().Equals(Type.GROUND)) {
damage *= 2;
Console.WriteLine("C'est super efficace");
}
cible.getDamage(damage);
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
}
}
}