-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTamato.java
More file actions
41 lines (30 loc) · 1006 Bytes
/
Tamato.java
File metadata and controls
41 lines (30 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class Tamato extends Berries {
public Tamato(){
super("Tamato Berries",5);
}
public void useBerry(Pokemon pokemon,Berries berrie){
int hp = pokemon.getHP();
int currentHp = 0;
if(hp < pokemon.getMaxHP() || hp > pokemon.getMaxHP() ){
reduceBerry(berrie);
}
hp = pokemon.getHP()+160;
if(hp >= pokemon.getMaxHP()){
currentHp = pokemon.getHP();
}
else {
currentHp = hp;
}
pokemon.setHp(currentHp);
System.out.println("HP : " + pokemon.getHP());
}
public void reduceBerry(Berries berrie){
System.out.println("Tamato BERRIES "+berrie.getNum());
int number = berrie.getNum()-1;
if(number <= 0){
number = 0;
berrie.setNum(0);
}
berrie.setNum(number);
}
}