-
Notifications
You must be signed in to change notification settings - Fork 0
/
Character.java
50 lines (40 loc) · 1.27 KB
/
Character.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
import javax.print.attribute.standard.Sides;
import java.util.Set;
public class Character {
private String name;
private CharacterClass dndClass;
private Stats attributes;
private int hp;
public Character(String name, CharacterClass dndClass){
this.name = name;
this.dndClass = dndClass;
this.hp = dndClass.getDice();
}
public String getName(){
return name;
}
public void setName(String name) {
this.name = name;
}
public Stats getAttributes() {
return attributes;
}
public void setAttributes(Stats attributes) {
this.attributes = attributes;
}
public void addRaceBonuses(){
Set <String> key = this.attributes.getStats().keySet();
for(String title : key){
int val = this.attributes.getStats().get(title);
this.attributes.getStats().put(title, val);
}
this.hp += Math.floor(this.attributes.getStats().get("Constitution")/2) - 5;
}
public void printSheet(){
System.out.println("Name of character: " + name + "\n"
+ dndClass.toString() + "\n"
+ "HP: " + hp);
dndClass.printMagika();
attributes.print();
}
}