-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCyborg.java
92 lines (76 loc) · 2.35 KB
/
Cyborg.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
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
public class Cyborg extends Adventurer{
int charge, maxCharge;
String elimQuote;
/*the other constructors ultimately call the constructor
*with all parameters.*/
public Cyborg(String name, int hp, String elimQuote){
super(name,hp);
maxCharge = 8;
charge = maxCharge/2;
elimQuote = elimQuote;
}
public Cyborg(String name, int hp){
this(name,hp,"Error: Opponent no longer exists. Your data has been deleted");
}
public Cyborg(String name){
this(name,8 + (int) (Math.random() * 5));
}
public Cyborg(){
this("Victor Stone");
}
/*The next 8 methods are all required because they are abstract:*/
public String getType(){
return "Cyborg";
}
public String getSpecialName(){
return "charge";
}
public int getSpecial(){
return charge;
}
public void setSpecial(int n){
charge = n;
}
public int getSpecialMax(){
return maxCharge;
}
public String attack(Adventurer other){
setHP(getHP() + 2);
int damage = (int) (((Math.random() * 3) + 3) * getAttackMultiplier());
other.applyDamage(damage);
other.killIfNecessary();
restoreSpecial(2);
if (other.isDead() == true) {
return this + " hard punched " + other + " killing them and saying.";
}
return this + " hard punched "+ other + " and dealt "+ damage +
" points of damage. They then clank their gauntlets together.";
}
public String specialAttack(Adventurer other) {
int damage = (int) (((Math.random() * 3) + 2) * getAttackMultiplier());
if (getSpecial() < 8) {
return "";
}
other.applyDamage(damage);
other.killIfNecessary();
if (other.isDead() == true) {
return this + " hard punched " + other + " killing then";
}
return this + " used their laser barrage dealing " + damage + " points of damage and singing their enemies";
}
/*Restores 5 special to other*/
public String support(Adventurer other){
setHP(getHP() + 2);
other.setAttackTick(getAttackTick() + 1);
return getName() + " says kill them for me "+other+" and buffs their attack substantially ";
}
/*Restores 6 special and 1 hp to self.*/
public String support(){
setHP(getHP() + 2);
setAttackTick(getAttackTick() + 1);
return getName() +" says fine I'll do it myself and significantly boosts their own attack power.";
}
public String toString() {
return "Cyborg " + super.toString();
}
}