public class Game
{
private Parser parser;
private Player player;
private int moveLimit;
private ArrayList<Room> rooms;
/**
* Create the game and initialise its internal map.
*/
public Game()
{
Room start = createRooms();
parser = new Parser();
player = new Player(start);
moveLimit = 30;
rooms = new ArrayList<Room>();
}
public static void main(String[] args)
{
Game game = new Game();
game.play();
}
/**
* Create all the rooms and link their exits together.
*/
private Room createRooms()
{
Room mainRoom, livingRoom, bedroom, playRoom, kitchen, diningRoom, hallway, tortureRoom,
cellar, dungeon, lobby, bathroom, library, chamberOfSecrets, garden, artRoom, trapdoor;
// create the rooms
mainRoom = new Room("in the main room, in the middle of the castle");
livingRoom = new Room("in the living room");
playRoom = new Room("teleport");
kitchen = new Room("in the kitchen");
garden = new Room("in the garden");
diningRoom = new Room("in the dining room");
hallway = new Room("in the hallway");
tortureRoom = new Room("in the torture room, the room is filled with scary objects");
cellar = new Room("in the cellar");
dungeon = new Room("in the dungeon");
library = new Room("you fell into a trapdoor, you can get out using the rope");
lobby = new Room("in the lobby");
bedroom = new Room("in the bedroom");
bathroom = new Room("in the bathroom");
chamberOfSecrets = new Room("in the CHAMBER OF SECRETS");
artRoom = new Room("in the art room");
trapdoor = new Room("You fell into a trapdoor");
// lock certain rooms
cellar.lockRoom();
chamberOfSecrets.lockRoom();
// initialise room exits
mainRoom.setExit("east", diningRoom);
mainRoom.setExit("south", kitchen);
mainRoom.setExit("west", livingRoom);
livingRoom.setExit("north", playRoom);
livingRoom.setExit("east", mainRoom);
playRoom.setExit("south", livingRoom);
kitchen.setExit("north", mainRoom);
kitchen.setExit("south", garden);
kitchen.setExit("down", cellar);
garden.setExit("north", kitchen);
diningRoom.setExit("east", hallway);
diningRoom.setExit("west", mainRoom);
hallway.setExit("west", diningRoom);
hallway.setExit("up", lobby);
cellar.setExit("north", dungeon);
cellar.setExit("east", library);
cellar.setExit("south", tortureRoom);
cellar.setExit("up", kitchen);
dungeon.setExit("south", cellar);
library.setExit("west", cellar);
tortureRoom.setExit("north", cellar);
lobby.setExit("north", bedroom);
lobby.setExit("south", bathroom);
lobby.setExit("west", artRoom);
lobby.setExit("down", hallway);
bedroom.setExit("south", lobby);
bathroom.setExit("north", lobby);
artRoom.setExit("east", lobby);
artRoom.setExit("west", chamberOfSecrets);
// add items to the room
chamberOfSecrets.addItem("GOLD", ", THERE IS GOLD EVERYWHERE", 1000000);
kitchen.addItem("chicken", ", a big roosted chicken", 20);
kitchen.addItem("cooky", ", this is a magic cooky that will increase your ability's when you eat it", 5);
bathroom.addItem("soap", ", a purple duck shaped soap", 6);
bathroom.addItem("silverkey", ", you can use this key to open a door!", 5);
dungeon.addItem("goldkey", ", you can use this key to open a door!", 10);
library.addItem("map", ", There is a map on the wall of the bottom floor \n to see the map type 'show'", 5000);
rooms.add(garden);
rooms.add(library);
rooms.add(bedroom);
// start game outside
return mainRoom;
}