-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonster.java
More file actions
52 lines (42 loc) · 1.51 KB
/
Monster.java
File metadata and controls
52 lines (42 loc) · 1.51 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
/*=============================================
class Monster -- Represents random incarnations of
the adventurer's natural enemy in Ye Olde RPG
=============================================*/
public class Monster extends Character {
// ~~~~~~~~~~~ INSTANCE VARIABLES ~~~~~~~~~~~
// inherited from superclass
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*=============================================
default constructor
pre: instance vars are declared
post: initializes instance vars.
=============================================*/
public Monster() {
super();
_hitPts = 150;
_strength = 20 + (int)( Math.random() * 45 ); // [20,65)
_defense = 20;
_attack = 1;
_name = "Monster";
}
// Does nothing for Monsters
public void specialize() { }
public void normalize() { }
/*=============================================
String about() -- returns descriptions character type
pre:
post: Info is returned
=============================================*/
public String about() {
return "The antagnoists of the game, Monsters are out to kill you!";
}
/*==========================
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 Monster