-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTroll.java
More file actions
57 lines (32 loc) · 1023 Bytes
/
Copy pathTroll.java
File metadata and controls
57 lines (32 loc) · 1023 Bytes
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
public class Troll extends Thing{
private final String state ;
private final Boolean killed = false;
public Troll(){
this.state = "Troll lurks in the shadows.";
}
public Troll(String state){
this.state = state;
}
public Troll tick(){
if(state == "Troll lurks in the shadows."){
return new Troll("Troll is getting hungry.");
}
else if(state == "Troll is getting hungry."){
return new Troll("Troll is VERY hungry.");
}
else if(state == "Troll is VERY hungry."){
return new Troll("Troll is SUPER HUNGRY and is about to ATTACK!");
}
else if(state == "Troll is SUPER HUNGRY and is about to ATTACK!"){
return new Troll("Troll attacks!");
}
else if(state == "Troll attacks!"){
return new Troll("Troll attacks!");
}
return null;
}
@Override
public String toString(){
return this.state;
}
}