-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dragon.java
60 lines (49 loc) · 1.67 KB
/
Dragon.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
/*=============================================
class Dragon -- a pet of the protagonist.
=============================================*/
public class Dragon extends Character {
// ~~~~~~~~~~~ INSTANCE VARIABLES ~~~~~~~~~~~
// inherited from superclass
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*=============================================
default constructor
pre: instance vars are declared
post: initializes instance vars.
=============================================*/
public Dragon() {
super();
_strength = 60 + (int)( Math.random() * 11 );
_attack = 0.5;
}
/*=============================================
overloaded constructor
pre: instance vars are declared
post: initializes instance vars. _name is set to input String.
=============================================*/
public Dragon( String name ) {
this();
if (!name.equals("")) {
_name = name;
}
}
// Does nothing for Pets
public void specialize() { }
public void normalize() { }
/*=============================================
String about() -- returns descriptions character type
pre:
post: Info is returned
=============================================*/
public String about() {
return "Although dargons can dish out high damage, it is very slow.";
}
/*==========================
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(){
return "test";
}
}//end class Dragon