74 lines
3.0 KiB
C#
Raw Normal View History

2022-10-13 22:03:05 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class PokemonFighting : Pokemon {
public PokemonFighting(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) : base(Name, PV, ATKPhys, ATKSpe, DEFPhys, DEFSpe, Speed) {
base.setPC(102);
this.setType(Type.FIGHTING);
}
public override void PhysAttack(Pokemon cible) {
2022-10-16 11:14:06 +02:00
this.setPC(this.getPC() - 4);
int damage = this.getATKPhys() - cible.getDEFPhys();
if (cible.getType().Equals(Type.GHOST)) {
2022-10-13 22:03:05 +02:00
damage = 0;
2022-10-15 18:39:27 +02:00
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
2022-10-13 22:03:05 +02:00
}
2022-10-15 18:39:27 +02:00
if (damage > 0) {
2022-10-13 22:03:05 +02:00
if(cible.getType().Equals(Type.PSYCHIC) ||
cible.getType().Equals(Type.FLYING) ||
cible.getType().Equals(Type.BUG) ||
cible.getType().Equals(Type.FAIRY)) {
damage /= 2;
2022-10-15 18:39:27 +02:00
Console.WriteLine("Ce n'est pas très efficace");
2022-10-13 22:03:05 +02:00
}
2022-10-15 18:39:27 +02:00
if (cible.getType().Equals(Type.STEEL) ||
2022-10-13 22:03:05 +02:00
cible.getType().Equals(Type.NORMAL) ||
cible.getType().Equals(Type.DARK) ||
cible.getType().Equals(Type.ICE) ||
cible.getType().Equals(Type.ROCK)) {
damage *= 2;
2022-10-15 18:39:27 +02:00
Console.WriteLine("C'est super efficace");
2022-10-13 22:03:05 +02:00
}
cible.getDamage(damage);
2022-10-15 18:39:27 +02:00
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
2022-10-13 22:03:05 +02:00
}
}
public override void SpeAttack(Pokemon cible) {
this.setPC(this.getPC() - 1);
2022-10-16 11:16:53 +02:00
int damage = this.getATKSpe() - cible.getDEFSpe();
2022-10-13 22:03:05 +02:00
if (cible.getType().Equals(Type.GHOST)) {
damage = 0;
2022-10-15 18:39:27 +02:00
Console.WriteLine("Ca n'affecte pas le " + cible.getName() + "ennemi");
2022-10-13 22:03:05 +02:00
}
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;
2022-10-15 18:39:27 +02:00
Console.WriteLine("Ce n'est pas très efficace");
2022-10-13 22:03:05 +02:00
}
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;
2022-10-15 18:39:27 +02:00
Console.WriteLine("C'est super efficace");
2022-10-13 22:03:05 +02:00
}
cible.getDamage(damage);
2022-10-15 18:39:27 +02:00
} else {
Console.WriteLine("L'attaque n'a eu aucun effet");
2022-10-13 22:03:05 +02:00
}
}
}
}