-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDean.java
77 lines (64 loc) · 1.88 KB
/
Dean.java
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
66
67
68
69
70
71
72
73
74
75
76
import java.util.ArrayList;
import java.util.Random;
public class Dean extends Adventurer {
private int happiness, happinessMax;
public Dean(String name, int hp) {
super(name, hp);
happinessMax = 20;
happiness = happinessMax / 2;
}
@Override
public String getSpecialName() {
return "Steal Your Airpods";
}
public void addHomework(HW homework) {
// Dean does not assign homework, so this method can be empty or throw an exception
}
@Override
public int getSpecial() {
return happiness;
}
@Override
public void setSpecial(int n) {
happiness = Math.min(Math.max(n, 0), happinessMax);
}
@Override
public int getSpecialMax() {
return happinessMax;
}
@Override
public String attack(Adventurer other) {
int damage = (int) (Math.random() * 6) + 2;
other.applyDamage(damage);
restoreSpecial(2);
return "Hey! This isn't your free period! Get to class! Dealt " + damage + " damage.";
}
@Override
public String specialAttack(Adventurer other) {
if (happiness >= 8) {
int damage = (int) (Math.random() * 10) + 3;
other.applyDamage(damage);
happiness -= 8;
return "Are you listening to music and relaxing during your free period!? Give me those AirPods, " + other.getName() + "! Dealt " + damage + " damage.";
} else {
return "Not enough happiness to perform a special attack.";
}
}
@Override
public String support(Adventurer other) {
other.restoreSpecial(5);
return "Helping out " + other.getName() + "! Boosted their happiness by 5.";
}
@Override
public String support() {
restoreSpecial(6);
setHP(getHP() + 1);
return "I have a free period! Let me watch the Knicks game and restore my own happiness and HP.";
}
public String getHomeworkSummary(){
return "";
}
public String assignHomework(ArrayList<Adventurer> party) {
return "hello";
}
}