-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCow.java
More file actions
41 lines (36 loc) · 1017 Bytes
/
Cow.java
File metadata and controls
41 lines (36 loc) · 1017 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 Cow extends Animal{
public Cow(String name){
super(name);
sethp(20);
setSpeed(5);
setAttack(2);
}
public Cow(){
this("Cow");
}
//fart
@Override
public String moveOne(Animal other){
int damage = (15 - other.getSpeed());
other.applyDamage(damage, other);
return this + " stinked up the field, dealing " + damage + " damage to " + other;
}
//horn
@Override
public String moveTwo(Animal other){
int damage = (getSpeed() * randomRoll(2, getSpeed()));
damage *= getAttack();
other.applyDamage(damage, this);
return this + " rammed into " + other + " with their horns dealing " + damage + " damage.";
}
//moo
@Override
public String moveThree(Animal other){
sethp(gethp() + 2);
return this + " moo'd and ate some grass. gained 2 hp";
}
@Override
public String moveList(){
return "1. fart / 2. horn / 3. moo";
}
}