-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFigur.java
More file actions
82 lines (63 loc) · 1.64 KB
/
Figur.java
File metadata and controls
82 lines (63 loc) · 1.64 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
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
import crawlergame.*;
public class Figur extends ModelSender implements Kaempfend
{
Gegenstand [] rucksack;
Waffe waffe;
Schild schild;
Ring ring1;
Ring ring2;
Kopfbedeckung kopf;
Schuhe schuhe;
Kleidung koerper;
int staerke;
int geschicklichkeit;
public Figur() {
rucksack = new Gegenstand[10];
//hier kein setzeWaffe ( new Waffe() ); - weil View noch nicht aktiv
}
public Gegenstand gibAusRucksack(int i) {
return rucksack[i];
}
public void entferneAusRucksack(int i) {
rucksack[i] = null;
}
public int gibRucksackLaenge() {
return rucksack.length;
}
public int nimmGegenstandAuf(Gegenstand g) {
for (int i=0; i< rucksack.length; i++) {
if (rucksack[i]==null) {
rucksack[i] = g;
return i;
}
}
return -1;
}
public void setzeWaffe(Waffe w) {
waffe = w;
// gibAnsicht().zeigeFigur(0, "sword.png");
gibAnsicht().zeigeFigur(0, w.gibBildname());
gibAnsicht().zeigeFigur(4, w.gibBildname());
}
public Waffe gibWaffe() {
return waffe;
}
public void entferneWaffe() {
waffe = null;
gibAnsicht().zeigeFigur(3, "nichts.png");
}
public int berechneAngriff() {
return staerke;
}
public int berechneVerteidigung() {
return geschicklichkeit;
}
public String gibName() {
return "Langweilige Figur";
}
public void nimmSchaden(int i) {
}
public int berechneSchaden() {
return 5;
}
}