-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGod.java
More file actions
93 lines (79 loc) · 2.7 KB
/
God.java
File metadata and controls
93 lines (79 loc) · 2.7 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
/*=============================================
class God -- cuz why not
_______ ______ ______
/ _____| / ____ \ | ___ \
/ / ___ | | | | | | | |
| | |_ | | | | | | | / |
\ \___| | | |____| | | |__/ /
\_____|_| \______/ |_____/
=============================================*/
public class God extends Character {
// ~~~~~~~~~~~ INSTANCE VARIABLES ~~~~~~~~~~~
// inherited from superclass
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*=============================================
default constructor
pre: instance vars are declared
post: initializes instance vars.
=============================================*/
public God() {
super();
_hitPts = 9000;
_strength = 9000;
_defense = 9000;
_attack = 9.0;
}
/*=============================================
overloaded constructor
pre: instance vars are declared
post: initializes instance vars. _name is set to input String.
=============================================*/
public God( String name ) {
this();
if (!name.equals("")) {
_name = name;
}
}
/*=============================================
void specialize() -- prepares character for special attack
pre:
post: Attack of character is increased, defense is decreased
=============================================*/
public void specialize() {
_attack = 9.9;
_defense = 9999;
}
/*=============================================
void normalize() -- revert stats back to normal
pre:
post: Attack and defense of character is de-specialized
=============================================*/
public void normalize() {
_attack = 9.0;
_defense = 9000;
}
/*=============================================
String about() -- returns descriptions character type
pre:
post: Info is returned
=============================================*/
public String about() {
return "Gods are immortal. Therefore, you will always win.";
}
/*==========================
String heroSpecial()
pre:
post: executes a character's special move, for example, a priest would heal itself, and
returns a string summarizing what happened.
========================*/
public String heroSpecial(){
if (((int) Math.random()*100) >= 1){
this._hitPts+=1000;
this._strength+=1000;
return "your character's HP and strength have increased to " + this._hitPts + " " + this._strength;
}
else {
return "your special move has failed";
}
}
}//end class God