-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPC.java
More file actions
142 lines (107 loc) · 2.65 KB
/
PC.java
File metadata and controls
142 lines (107 loc) · 2.65 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package RoomGame;
import java.util.Scanner;
/**
*
* @author kleesans
*/
public class PC extends Creature{
String name;
String description;
Room room;
public int Respect = 40;
public PC(String name, String description) {
super(name, description);
this.Respect = 40;
}
public String toString(){
return name;
}
public void play(Scanner s) {
String line;
boolean keep_going = true;
while(keep_going == true) {
line = s.next();
if(s.equals("help")) {
System.out.println(" type look to look around the room");
System.out.println("type clean to clean the room");
System.out.println("type a direction north east west south to go somewhere");
System.out.println(" type exit or quit to quit game");
}
else if(s.equals("clean")) {
String state = room.state;
if(state.equals("dirty")) {
room.state = "half-dirty";
}
if(state.equals("half-dirty")) {
room.state = "clean";
}
if(state.equals("clean")) {
}
}
else if(s.equals("ditry")) {
String state = room.state;
if(state.equals("dirty")) {
}
if(state.equals("half-dirty")) {
room.state= "dirty";
}
if(state.equals("clean")) {
room.state = "half-dirty";
}
}
else if(s.equals("look")) {
room.toString();
}
else if(s.equals("north") || s.equals("west") || s.equals("east") || s.equals("south")) {
if(s.equals("north")) {
room = room.north;
}
if(s.equals("east")) {
room= room.east;
}
if(s.equals("west")) {
room = room.west;
}
if(s.equals("south")) {
room= room.south;
}
}
else if(s.equals(("exit")) || s.equals("quit")){
System.out.println("Goodbye");
System.exit(0);
}
else {
System.out.println("could not understand please try again");
}
}
}
{
public void raiseRespect() {
this.Respect++;
}
public void lowerRespect()
{
this.Respect--;
}
public int getRespect()
{
return this.Respect;
}
public void setRespect(int Respect)
{
this.Respect = Respect;
}
public void reactNewRoom(PC pc) {
}
public void reactGlad(PC pc) {
}
public void reactDiscontent(PC pc) {
}
}
}
}