-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSword.java
More file actions
31 lines (30 loc) · 890 Bytes
/
Copy pathSword.java
File metadata and controls
31 lines (30 loc) · 890 Bytes
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
/**
* Repräsentiert die Waffe Schwert
* Das Schwert hat deutlich mehr ATK als der Bogen
* trifft dafür aber auch nur in unmittelbarer Nähe zum Drachen
*/
public class Sword extends Weapon {
/**
* Erstellt ein neues Schwert
*/
public Sword() {
this.atk = 3;
this.offset = 0;
}
/**
* Berechnet den Offset der Waffe
* Also die Wahrscheinlichkeit zu treffen
*
* @param distance Abstand zum Ziel muss genau 1 sein
* @return Trifft das Schwert
*/
@Override
public int calculateOffset(int distance) {
if (distance == 1) this.offset = 0; //Trifft immer
else { //Zu weit entfernt
System.out.println("Für den Einsatz des Schwertes ist der Held zu weit vom Drachen entfernt.");
this.offset = 100; //Attacke geht immer daneben
}
return this.offset;
}
}