-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnemy_BarbGoblin.java
90 lines (79 loc) · 2.31 KB
/
Enemy_BarbGoblin.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
public class Enemy_BarbGoblin extends Adventurer {
int roastMeat, rMMax;
public Enemy_BarbGoblin(String name, int hp){
super(name,hp);
rMMax = 4;
roastMeat = rMMax;
}
public Enemy_BarbGoblin(String name){
this(name,15);
}
public Enemy_BarbGoblin(){
this("Barbarian Goblin");
}
public String getSpecialName(){
return "Roast Meat";
}
public int getSpecial(){
return roastMeat;
}
public void setSpecial(int n){
roastMeat = n;
}
public int getSpecialMax(){
return rMMax;
}
public String attack(Adventurer other) {
String result;
if (rageMode && (int)(Math.random() * 2) == 1) {
result = "Enraged, " + this + " swings a wooden club at " + other + " with fury, dealing 6 dmg!";
result += other.applyStatusEffects(6, this);
rageMode = false;
return result;
}
else {
result = this + " attacks " + other + " with a wooden club, dealing 4 dmg!";
result += other.applyStatusEffects(4, this);
return result;
}
}
public String specialAttack(Adventurer other){
if (getSpecial() == 0) {
rageMode = true;
return this + " realizes that they are out of roast meat, enraging them, taking 30% less damage and now having a 50% chance to deal 1.5x damage on next turn.";
}
else {
return this + " checks their supply of roast meat and is satisfied to find it not empty, failing to enter an enraged state.";
}
}
public String support(Adventurer other){
if (getSpecial() >= 1) {
setSpecial(getSpecial() - 1);
if (other.getHP() + 2 >= other.getmaxHP()) {
other.setHP(other.getmaxHP());
}
else {
other.setHP(other.getHP() + 2);
}
return this + " shares a herbal roast with " + other + ", allowing them to gain 2 hp!";
}
else {
return this + " attempted to share some herbal roast with " + other + " but is out of roast meat!";
}
}
public String support(){
if (getSpecial() >= 1) {
setSpecial(getSpecial() - 1);
if (getHP() + 2 >= getmaxHP()) {
setHP(getmaxHP());
}
else {
setHP(getHP() + 2);
}
return this + " eats a piece herbal roast with delight, gaining 2 hp!";
}
else {
return this + " attempted to eat some herbal roast but is out of roast meat!";
}
}
}