changer methode attaque

This commit is contained in:
2022-10-16 11:14:06 +02:00
parent 36786a0f85
commit f6fd8f6830
22 changed files with 119 additions and 117 deletions

View File

@ -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");
}
}
}
}
}
}
}
}

View File

@ -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)) {

View File

@ -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");
}

View File

@ -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");

View File

@ -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)) {

View File

@ -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");
}

View File

@ -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) ||

View File

@ -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)) {

View File

@ -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");
}

View File

@ -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) ||

View File

@ -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");
}

View File

@ -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) ||

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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)) {

View File

@ -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) ||

View File

@ -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)) {