-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorcerer.java
More file actions
41 lines (27 loc) · 1.11 KB
/
Copy pathSorcerer.java
File metadata and controls
41 lines (27 loc) · 1.11 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
// class for the Sorcerer object
// extends the HeroEntity abstract class
public class Sorcerer extends HeroEntity {
// constructor for the Sorcerer class
public Sorcerer(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);
}
// implements abstract method to level up hero
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.05));
setDexterity((int) Math.round(getDexterity() * 1.10));
resetExperience();
}
// override some additional methods
public String showDetailed() {
return super.showDetailed() + " SORCERER";
}
public String showListDetailed() {
return super.showListDetailed() + "\n Class: SORCERER";
}
}