-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWarrior.java
More file actions
42 lines (27 loc) · 1.12 KB
/
Copy pathWarrior.java
File metadata and controls
42 lines (27 loc) · 1.12 KB
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
// class for the Paladin object
// extends the HeroEntity abstract class
public class Warrior extends HeroEntity {
// constructor for the Warrior class
public Warrior(String name, int level, int experience, int strength, int dexterity, int agility,
int mana, int money) {
super(name, level, experience, strength, dexterity, agility, mana, money);
}
// implementation of the abstract method for leveling up
public void levelup() {
setLevel(getLevel() + 1);
setHealth(100*getLevel());
MANA_CAP = (int) Math.round(MANA_CAP + MANA_CAP*0.1);
setMana((int) Math.round(MANA_CAP + MANA_CAP*0.1));
setAgility((int) Math.round(getAgility() * 1.10));
setStrength((int) Math.round(getStrength() * 1.10));
setDexterity((int) Math.round(getDexterity() * 1.05));
resetExperience();
}
// additional overriden method
public String showDetailed() {
return super.showDetailed() + " WARRIOR";
}
public String showListDetailed() {
return super.showListDetailed() + "\n Class: WARRIOR\n";
}
}