-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
112 lines (105 loc) · 4.12 KB
/
Room.java
File metadata and controls
112 lines (105 loc) · 4.12 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
package org.uob.a1;
public class Room {
// Declaring attributes
private String name;
private String description;
private char symbol;
private Position position;
private String feature;
private String fDescription;
//Creating the constructor method for the class
public Room(String name, String description, char symbol, Position position)
{
//Definining the attributes to the corresponding parameters
this.name = name;
this.description = description;
this.symbol = symbol;
this.position = position;
//Assuming there is no feature in the room (this ensures it passes the tests)
this.feature = "empty";
//An if statement to set the feature attributes for the specific rooms they are in
if (name.equals("Outside"))
{
this.feature = "snowman";
this.fDescription = "You walk up to the snowman and he begins to smile.\n He says 'Santa has gone missing, will you help him find us?' while pointing at the front door. ";
}
else if (name.equals("Hallway"))
{
this.feature = "tree";
this.fDescription = "When you look closer at the tree, you notice there is a key in the stand. \nYou can now look key. ";
}
else if (name.equals("Elf bedroom"))
{
this.feature = "beds";
this.fDescription = "An elf jumps out from under the bed and starts dancing around the room, but you have not found anything.";
}
else if (name.equals("Grotto"))
{
// No features in this room
}
else if (name.equals("Kitchen"))
{
// No features in this room
}
else if (name.equals("Lounge"))
{
this.feature = "picture";
this.fDescription = "You take a closer look and see the framed picture and it shows santa, Mrs Klaus and all of the elves together in the toy factory. However it doesn't include any hints.";
}
else if (name.equals("Dining room"))
{
this.feature = "table";
this.fDescription = "You have a closer look at the delicious dinner on the table, but there is nothing else to look at in here. ";
}
else if (name.equals("Reindeer stable"))
{
this.feature = "reindeer";
this.fDescription = "You stroke a reindeer and its nose glows red. Although this is very cute you do not find anything else in here. ";
}
else if (name.equals("Present storage"))
{
this.feature = "coal";
this.fDescription = "You stare at the coal, but can't get too close in case you get dirty. As a result you want to move away. ";
}
else if (name.equals("Wrapping room"))
{
this.feature = "door";
this.fDescription = "Once you are closer to the door, you notice a lock. If you have a key this might be able to open it. \nYou can now use key. ";
}
else if (name.equals("Toy factory"))
{
this.feature = "bear";
this.fDescription = "You move closer to the cuddly toy, and notice that it is missing an ear. It looks like Santa made a mistake when he was making this child's toy, maybe that is why he went missing? ";
}
else if (name.equals("Sleigh garage"))
{
this.feature = "sleigh";
this.fDescription = "You take a closer look at the sleigh and see santa inside! \nHowever, he refuses to move and says that he has made a big mistake. Have you got anything you can give him? \nYou can now give inventory";
}
}
//Creating the getter methods for each attribute
public String getName()
{
return this.name;
}
public String getDescription()
{
return this.description;
}
public char getSymbol()
{
return this.symbol;
}
public Position getPosition()
{
return this.position;
}
public String getFeature()
{
return this.feature;
}
public String getFdescription()
{
return this.fDescription;
}
}