Refonte du repo
This commit is contained in:
41
src/TD9/pokemon/PokemonPLANTE.java
Normal file
41
src/TD9/pokemon/PokemonPLANTE.java
Normal file
@ -0,0 +1,41 @@
|
||||
package pokemon;
|
||||
|
||||
public class PokemonPLANTE extends Pokemon{
|
||||
|
||||
public PokemonPLANTE(String n, double t, double p, int pv, int pc) {
|
||||
super.setNom(n);
|
||||
super.setTaille(t);
|
||||
super.setPoids(p);
|
||||
super.setPv(pv);
|
||||
super.setPc(pc);
|
||||
this.type = Type.PLANTE;
|
||||
}
|
||||
|
||||
public void changePv(int modif) {
|
||||
this.setPv(Math.max(0, this.getPv() - modif));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double calculerVitesse() {
|
||||
return 10.0 / (this.getPoids() * this.getTaille());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.getNom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double attack(Pokemon p2) {
|
||||
if(p2.type == Type.EAU) {
|
||||
p2.setPv(p2.getPv()-this.getPc());
|
||||
}
|
||||
else if(p2.type == Type.ELECTRIK) {
|
||||
p2.setPv((p2.getPv()-this.getPc()*2));
|
||||
}
|
||||
else {
|
||||
p2.setPv((p2.getPv()-this.getPc()/2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user