From f6fd8f68303287e251f914ae8e32568476740b0f Mon Sep 17 00:00:00 2001 From: OMGiTzPomPom Date: Sun, 16 Oct 2022 11:14:06 +0200 Subject: [PATCH] changer methode attaque --- Program.cs | 2 - projet/Character.cs | 2 +- projet/GameManager.cs | 10 ++- projet/Pokemon.cs | 3 +- projet/Types/PokemonBug.cs | 126 ++++++++++++++++---------------- projet/Types/PokemonDark.cs | 6 +- projet/Types/PokemonDragon.cs | 6 +- projet/Types/PokemonElectric.cs | 2 +- projet/Types/PokemonFairy.cs | 6 +- projet/Types/PokemonFighting.cs | 6 +- projet/Types/PokemonFire.cs | 6 +- projet/Types/PokemonFlying.cs | 7 +- projet/Types/PokemonGhost.cs | 6 +- projet/Types/PokemonGrass.cs | 6 +- projet/Types/PokemonGround.cs | 4 +- projet/Types/PokemonIce.cs | 6 +- projet/Types/PokemonNormal.cs | 6 +- projet/Types/PokemonPoison.cs | 6 +- projet/Types/PokemonPsychic.cs | 6 +- projet/Types/PokemonRock.cs | 6 +- projet/Types/PokemonSteel.cs | 4 +- projet/Types/PokemonWater.cs | 4 +- 22 files changed, 119 insertions(+), 117 deletions(-) diff --git a/Program.cs b/Program.cs index 7cf85d3..2526d7b 100644 --- a/Program.cs +++ b/Program.cs @@ -4,7 +4,5 @@ public class Program { public static void Main(string[] args) { GameManager gm = new GameManager(); gm.InitializeGame(); - - Console.WriteLine(""); } } \ No newline at end of file diff --git a/projet/Character.cs b/projet/Character.cs index e280267..c06a28e 100644 --- a/projet/Character.cs +++ b/projet/Character.cs @@ -20,7 +20,7 @@ namespace Programmation_objet_TLESIO21.projet { } public override string ToString() { - String sb = this.Name + " est level " + this.level + "." + " " + this.Description + ". Ses pokemon sont :\n"; + String sb = this.Name + " est level " + this.level + ". " + this.Description.Replace(". ", ".\n") + ".\nSes pokemon sont :\n"; foreach (Pokemon p in this.PC) { sb += p.getName() + ". "; } diff --git a/projet/GameManager.cs b/projet/GameManager.cs index 0364861..ec85b92 100644 --- a/projet/GameManager.cs +++ b/projet/GameManager.cs @@ -20,6 +20,7 @@ namespace Programmation_objet_TLESIO21.projet { this.p1CharacterChoosen = 0; this.p2CharacterChoosen = 0; this.Path = "../../../csv/"; + //this.Path = "./"; } private static bool StringIsValidInt(String s) { @@ -123,6 +124,8 @@ namespace Programmation_objet_TLESIO21.projet { } } + Console.WriteLine("\n====================================================================================\n"); + this.InitializePokemons(); this.ChooseTeams(); this.Combat(); @@ -159,11 +162,10 @@ namespace Programmation_objet_TLESIO21.projet { 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("Vous avez choisi de faire confiance à " + Characters[p1CharacterChoosen].getName() + ".\n"); + Console.WriteLine("Votre adversaire a choisis de faire confiance à " + Characters[p2CharacterChoosen].getName() + ".\n"); - 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"); + Console.WriteLine("Maintenant, vous allez devoir choisir 6 pokémons parmis ceux de " + Characters[p1CharacterChoosen].getName() + "\n"); i = 0; diff --git a/projet/Pokemon.cs b/projet/Pokemon.cs index 39c2ffb..30df1c8 100644 --- a/projet/Pokemon.cs +++ b/projet/Pokemon.cs @@ -47,7 +47,8 @@ namespace Programmation_objet_TLESIO21.projet { } public String getStats() { - return this.getName() + " - PV : " + getPV() + + return this.getName() + " - Type = " + getType() + + " - PV = " + getPV() + " - PC = " + getPC() + " - ATK Physique = " + getATKPhys() + " - ATK Spéciale = " + getATKSpe() + diff --git a/projet/Types/PokemonBug.cs b/projet/Types/PokemonBug.cs index 9e8cf1b..39c6e2e 100644 --- a/projet/Types/PokemonBug.cs +++ b/projet/Types/PokemonBug.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Programmation_objet_TLESIO21.projet { - public class PokemonBug : Pokemon { - - public PokemonBug(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) : base(Name, PV, ATKPhys, ATKSpe, DEFPhys, DEFSpe, Speed) { - base.setPC(92); - this.setType(Type.BUG); - } - - public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { - if(cible.getType().Equals(Type.STEEL) || - cible.getType().Equals(Type.FIGHTING) || - cible.getType().Equals(Type.FAIRY) || - cible.getType().Equals(Type.FIRE) || - cible.getType().Equals(Type.POISON) || - 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); +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Programmation_objet_TLESIO21.projet { + public class PokemonBug : Pokemon { + + public PokemonBug(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) : base(Name, PV, ATKPhys, ATKSpe, DEFPhys, DEFSpe, Speed) { + base.setPC(92); + this.setType(Type.BUG); + } + + public override void PhysAttack(Pokemon cible) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { + if(cible.getType().Equals(Type.STEEL) || + cible.getType().Equals(Type.FIGHTING) || + cible.getType().Equals(Type.FAIRY) || + cible.getType().Equals(Type.FIRE) || + cible.getType().Equals(Type.POISON) || + 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"); - } - } - - public override void SpeAttack(Pokemon cible) { - this.setPC(this.getPC() - 3); - int damage = cible.getDEFSpe() - this.getATKSpe(); - if(damage > 0) { - if (cible.getType().Equals(Type.STEEL) || - cible.getType().Equals(Type.FIGHTING) || - cible.getType().Equals(Type.FAIRY) || - cible.getType().Equals(Type.FIRE) || - cible.getType().Equals(Type.POISON) || - 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); + } + } + + public override void SpeAttack(Pokemon cible) { + this.setPC(this.getPC() - 3); + int damage = cible.getDEFSpe() - this.getATKSpe(); + if(damage > 0) { + if (cible.getType().Equals(Type.STEEL) || + cible.getType().Equals(Type.FIGHTING) || + cible.getType().Equals(Type.FAIRY) || + cible.getType().Equals(Type.FIRE) || + cible.getType().Equals(Type.POISON) || + 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"); - } - } - } -} + } + } + } +} diff --git a/projet/Types/PokemonDark.cs b/projet/Types/PokemonDark.cs index 8b44d01..f2370fb 100644 --- a/projet/Types/PokemonDark.cs +++ b/projet/Types/PokemonDark.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 4); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 4); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.FIGHTING) || cible.getType().Equals(Type.FAIRY) || cible.getType().Equals(Type.DARK)) { diff --git a/projet/Types/PokemonDragon.cs b/projet/Types/PokemonDragon.cs index 94d2e5e..75fdb97 100644 --- a/projet/Types/PokemonDragon.cs +++ b/projet/Types/PokemonDragon.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 1); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.FAIRY)) { + this.setPC(this.getPC() - 1); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.FAIRY)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonElectric.cs b/projet/Types/PokemonElectric.cs index 321d65e..1f1ea17 100644 --- a/projet/Types/PokemonElectric.cs +++ b/projet/Types/PokemonElectric.cs @@ -14,7 +14,7 @@ namespace Programmation_objet_TLESIO21.projet { public override void PhysAttack(Pokemon cible) { this.setPC(this.getPC() - 1); - int damage = cible.getDEFPhys() - this.getATKPhys(); + int damage = this.getATKPhys() - cible.getDEFPhys(); if(cible.getType().Equals(Type.GROUND)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); diff --git a/projet/Types/PokemonFairy.cs b/projet/Types/PokemonFairy.cs index e53ce6a..e0651eb 100644 --- a/projet/Types/PokemonFairy.cs +++ b/projet/Types/PokemonFairy.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.FIRE) || cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.POISON)) { diff --git a/projet/Types/PokemonFighting.cs b/projet/Types/PokemonFighting.cs index dd4affb..23cf8a1 100644 --- a/projet/Types/PokemonFighting.cs +++ b/projet/Types/PokemonFighting.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 4); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.GHOST)) { + this.setPC(this.getPC() - 4); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.GHOST)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonFire.cs b/projet/Types/PokemonFire.cs index 23d53e2..fb0bf78 100644 --- a/projet/Types/PokemonFire.cs +++ b/projet/Types/PokemonFire.cs @@ -12,9 +12,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.DRAGON) || cible.getType().Equals(Type.WATER) || cible.getType().Equals(Type.FIRE) || diff --git a/projet/Types/PokemonFlying.cs b/projet/Types/PokemonFlying.cs index 3289f81..97d5121 100644 --- a/projet/Types/PokemonFlying.cs +++ b/projet/Types/PokemonFlying.cs @@ -13,9 +13,10 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 4); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 4); + int damage = this.getATKPhys() - cible.getDEFPhys(); + + if (damage > 0) { if(cible.getType().Equals(Type.ROCK) || cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.ELECTRIC)) { diff --git a/projet/Types/PokemonGhost.cs b/projet/Types/PokemonGhost.cs index 0a69de8..6fd8b34 100644 --- a/projet/Types/PokemonGhost.cs +++ b/projet/Types/PokemonGhost.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 3); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.NORMAL)) { + this.setPC(this.getPC() - 3); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.NORMAL)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonGrass.cs b/projet/Types/PokemonGrass.cs index b429010..7352a3c 100644 --- a/projet/Types/PokemonGrass.cs +++ b/projet/Types/PokemonGrass.cs @@ -12,9 +12,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.DRAGON) || cible.getType().Equals(Type.FIRE) || diff --git a/projet/Types/PokemonGround.cs b/projet/Types/PokemonGround.cs index 11a5aee..8132055 100644 --- a/projet/Types/PokemonGround.cs +++ b/projet/Types/PokemonGround.cs @@ -14,8 +14,8 @@ namespace Programmation_objet_TLESIO21.projet { public override void PhysAttack(Pokemon cible) { this.setPC(this.getPC() - 3); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.FLYING)) { + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.FLYING)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonIce.cs b/projet/Types/PokemonIce.cs index 474abe2..27fcc7d 100644 --- a/projet/Types/PokemonIce.cs +++ b/projet/Types/PokemonIce.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.WATER) || cible.getType().Equals(Type.FIRE) || diff --git a/projet/Types/PokemonNormal.cs b/projet/Types/PokemonNormal.cs index a2fd744..c328ec7 100644 --- a/projet/Types/PokemonNormal.cs +++ b/projet/Types/PokemonNormal.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.GHOST)) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.GHOST)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonPoison.cs b/projet/Types/PokemonPoison.cs index 5da584e..f12ed6e 100644 --- a/projet/Types/PokemonPoison.cs +++ b/projet/Types/PokemonPoison.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 2); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.STEEL)) { + this.setPC(this.getPC() - 2); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.STEEL)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonPsychic.cs b/projet/Types/PokemonPsychic.cs index b1c139d..63783cd 100644 --- a/projet/Types/PokemonPsychic.cs +++ b/projet/Types/PokemonPsychic.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 1); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(cible.getType().Equals(Type.DARK)) { + this.setPC(this.getPC() - 1); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (cible.getType().Equals(Type.DARK)) { damage = 0; Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi"); } diff --git a/projet/Types/PokemonRock.cs b/projet/Types/PokemonRock.cs index a08ce80..ae20839 100644 --- a/projet/Types/PokemonRock.cs +++ b/projet/Types/PokemonRock.cs @@ -13,9 +13,9 @@ namespace Programmation_objet_TLESIO21.projet { } public override void PhysAttack(Pokemon cible) { - this.setPC(this.getPC() - 4); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + this.setPC(this.getPC() - 4); + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.FIGHTING) || cible.getType().Equals(Type.GROUND)) { diff --git a/projet/Types/PokemonSteel.cs b/projet/Types/PokemonSteel.cs index 7f95a95..75d0fb4 100644 --- a/projet/Types/PokemonSteel.cs +++ b/projet/Types/PokemonSteel.cs @@ -14,8 +14,8 @@ namespace Programmation_objet_TLESIO21.projet { public override void PhysAttack(Pokemon cible) { this.setPC(this.getPC() - 3); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.WATER) || cible.getType().Equals(Type.FIRE) || diff --git a/projet/Types/PokemonWater.cs b/projet/Types/PokemonWater.cs index c6d47d1..a256c2c 100644 --- a/projet/Types/PokemonWater.cs +++ b/projet/Types/PokemonWater.cs @@ -13,8 +13,8 @@ namespace Programmation_objet_TLESIO21.projet { public override void PhysAttack(Pokemon cible) { this.setPC(this.getPC() - 3); - int damage = cible.getDEFPhys() - this.getATKPhys(); - if(damage > 0) { + int damage = this.getATKPhys() - cible.getDEFPhys(); + if (damage > 0) { if(cible.getType().Equals(Type.DRAGON) || cible.getType().Equals(Type.WATER) || cible.getType().Equals(Type.GRASS)) {