2022-10-13 22:03:05 +02:00

56 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class PokemonElectric : Pokemon {
public PokemonElectric(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) : base(Name, PV, ATKPhys, ATKSpe, DEFPhys, DEFSpe, Speed) {
base.setPC(80);
this.setType(Type.ELECTRIC);
}
public override void PhysAttack(Pokemon cible) {
this.setPC(this.getPC() - 1);
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.GROUND)) {
damage = 0;
}
if(damage > 0) {
if(cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
}
if(cible.getType().Equals(Type.STEEL) ||
cible.getType().Equals(Type.WATER)) {
damage *= 2;
}
cible.getDamage(damage);
}
}
public override void SpeAttack(Pokemon cible) {
this.setPC(this.getPC() - 1);
int damage = cible.getDEFSpe() - this.getATKSpe();
if(cible.getType().Equals(Type.GROUND)) {
damage = 0;
}
if(damage > 0) {
if(cible.getType().Equals(Type.DRAGON) ||
cible.getType().Equals(Type.GRASS) ||
cible.getType().Equals(Type.ELECTRIC)) {
damage /= 2;
}
if(cible.getType().Equals(Type.FLYING) ||
cible.getType().Equals(Type.WATER)) {
damage *= 2;
}
cible.getDamage(damage);
}
}
}
}