-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRogue.java
More file actions
110 lines (96 loc) · 2.58 KB
/
Rogue.java
File metadata and controls
110 lines (96 loc) · 2.58 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import java.util.Random;
public class Rogue extends Adventurer{
private int dex, stamina, intelligence, str;
Random rand = new Random();
public void setDex(int dex){
this.dex = dex;
}
public int getDex(){
return dex;
}
public void setInt(int intelligence){
this.intelligence = intelligence;
}
public int getInt(){
return intelligence;
}
public void setStr(int str){
this.str = str;
}
public int getStr(){
return str;
}
public void setStamina(int stamina){
this.stamina = stamina;
}
public int getStamina(){
return stamina;
}
public Rogue(){
setName("Bond");
setDex(15);
setStamina(20);
setInt(10);
setStr(5);
}
public Rogue(String name){
setName(name);
setDex(15);
setStamina(20);
setInt(10);
setStr(5);
}
public void attack(Adventurer other){
if(super.hit()){
if(getStamina() > 0){
int x = 1;
int damage = getDex()/5;
int total = 0;
while( x < 4){
int dmg = rand.nextInt(damage - 1) + 1;
other.setHP((other.getHP()) - dmg);
System.out.println(getName() + " stabs " + other.getName() + " for " + dmg + " damage!");
total += dmg;
x+=1;
}
System.out.println(getName() + " stabbed " + other.getName()+ " three times in total, dealing " + total + " damage!");
setStamina(getStamina()-1);
System.out.println(getName() + " has " + getStamina() + " stamina");
}
else{
System.out.println(getName() + " has no stamina! Instead, ");
super.attack(other);
}
}
else{
System.out.println(getName() + " misses, instead stabbing at air!");
}
}
public void specialAttack(Adventurer other){
if(super.hit()){
if(getStamina() > 10){
int dmg = rand.nextInt(10);
if(dmg > 8){
other.setHP((other.getHP()) - 10+(getDex()/2));
System.out.println(getName() + " sneaks behind " + other.getName() + " and backstabs " + other.getName() + " for " + dmg + " damage!");
}
else{
other.setHP((other.getHP()) - (getDex()/2));
System.out.println(getName() + " backstabs" + other.getName() + " for " + (getDex()/2) + " damage");
}
setStamina(getStamina()-10);
System.out.println(getName() + " has " + getStamina() + " stamina");
}
else{
System.out.println(getName() + " doesn't have enough stamina! Instead, ");
attack(other);
}
}
else{
System.out.println(getName() + " attempts to backstab " + other.getName() + " but misses!");
}
}
public String getStats(){
return super.getStats() + " " + getStr() + "STR " + getInt() +"INT " + getDex() + "DEX " + getStamina() + "Stamina " + "Rogue";
}
}