LP21-Programmation-objet/projet/PokemonNormal.cs

44 lines
1.4 KiB
C#
Raw Normal View History

2022-10-13 13:53:26 +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 PokemonNormal : Pokemon {
public PokemonNormal(string Name, int PV, int ATKPhys, int ATKSpe, int DEFPhys, int DEFSpe, int Speed) : base(Name, PV, ATKPhys, ATKSpe, DEFPhys, DEFSpe, Speed) {
base.setPC(90);
this.setType(Type.NORMAL);
}
public override void PhysAttack(Pokemon cible) {
this.setPC(this.getPC() - 2);
int damage = cible.getDEFPhys() - this.getATKPhys();
if(cible.getType().Equals(Type.GHOST)) {
damage = 0;
}
if(damage > 0) {
if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.ROCK)) {
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.GHOST)) {
damage = 0;
}
if(damage > 0) {
if(cible.getType().Equals(Type.STEEL) || cible.getType().Equals(Type.ROCK)) {
damage /= 2;
}
cible.getDamage(damage);
}
}
}
}