-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokemon.java
More file actions
65 lines (54 loc) · 1013 Bytes
/
Pokemon.java
File metadata and controls
65 lines (54 loc) · 1013 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
abstract class Pokemon{
protected String name;
protected int weight;
protected int mood;
protected int health;
public Pokemon(String name, int weight, int mood, int health){
this.name = name;
this.weight = weight;
this.mood = mood;
this.health = health;
}
public String getName(){
return this.name;
}
public int getWeight(){
return this.weight;
}
public int getMood(){
return this.mood;
}
public int getHealth(){
return this.health;
}
public void eat(){
this.weight += 2;
}
public void recovery(){
this.health = 100;
}
public void battle(){
this.health -= 25;
this.mood -= 25;
if(this.health <= 0){
this.health = 0;
this.mood = 0;
}
if(this.mood <= 0)
this.mood =0;
}
public void happy(){
this.mood += 20;
if(this.mood >= 100)
this.mood = 100;
if(this.health <= 0)
this.mood = 0;
}
public void reducedWeight(int value){
this.weight -= value;
if(this.weight < 15){
this.weight = 15;
}
}
abstract public void move();
}