diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..fb50116
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/.project b/.project
new file mode 100644
index 0000000..a7efbca
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ Maze-of-the-doomed-warrior
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/src/rex/Enemies.java b/src/rex/Enemies.java
new file mode 100644
index 0000000..bddc881
--- /dev/null
+++ b/src/rex/Enemies.java
@@ -0,0 +1,63 @@
+package rex;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class Enemies {
+ //maak een arraylist met mogelijke enemies
+ ArrayList enemies = new ArrayList();
+
+
+ Random random = new Random();
+ public Enemies(){
+// Name / description / hp / base dmg
+// orcs
+ enemies.add(new Enemy("Praak the almighthy", "A vicous orc", 60, 7, "Orc"));
+ enemies.add(new Enemy("Balo the brave", "A notoriously brave orc", 55, 6, "Orc"));
+ enemies.add(new Enemy("Erugor the funny", "A funny looking orc", 50, 5, "Orc"));
+// Dragons
+ enemies.add(new Enemy("Pronttikor the Fire Starter", "A truly powerful fire dragon", 85, 12, "Dragon"));
+ enemies.add(new Enemy("Matgar the Green Eyed", "The most beautiful dragon in existance", 65, 7, "Dragon"));
+ enemies.add(new Enemy("Bestore the Good Hearted", "A deceased dragon", 20, 5, "Dragon"));
+ enemies.add(new Enemy("Awkor the Peacefull one", "Creating peace wherever he goes", 60, 7, "Dragon"));
+ enemies.add(new Enemy("Lephisto the Dragon", "A simple one", 40, 3, "Dragon"));
+ enemies.add(new Enemy("Arbo the Great Flame", "Talks to much", 25, 1, "Dragon"));
+ enemies.add(new Enemy("Gretchen the Lightning Belower", "Hardstyle fan", 45, 2, "Dragon"));
+ enemies.add(new Enemy("Meceron the Acid Breather", "A very devious dragon, armed to the 'teeth' with poisonous fangs", 45, 2, "Dragon"));
+ enemies.add(new Enemy("Celtore the fire starter", "Always tries to start fires, never succeeds", 45, 6, "Dragon"));
+ enemies.add(new Enemy("Drake the good hearted", "Harmless really", 45, 2, "Dragon"));
+ enemies.add(new Enemy("Ashkoort the Good Hearted", "Harmless really", 45, 2, "Dragon"));
+
+// Skeletons
+ enemies.add(new Enemy("Hellthought The Enraged", "Watch out! he's mad! He is also VERY boney", 15, 50, "Skeleton"));
+ enemies.add(new Enemy("Killdemon The Smart", "A very smart, but weak skeleton", 80, 1, "Skeleton"));
+ enemies.add(new Enemy("Flamechain", "A skeleton mage wielding a fiery chain", 60, 6, "Skeleton"));
+ enemies.add(new Enemy("Skeleton warrior", "Will fight till he dies", 40, 8, "Skeleton"));
+ enemies.add(new Enemy("Skeleton water mage", "Hurls bursts of water at you", 60, 6, "Skeleton"));
+ enemies.add(new Enemy("Skeleton archer", "Lethal with a bow", 30, 10, "Skeleton"));
+ enemies.add(new Enemy("Skeleton Thief", "Protect your bag!", 30, 10, "Skeleton"));
+// Animals
+ enemies.add(new Enemy("Dog", "Domestic creature, but violent", 40, 3, "Animal"));
+ enemies.add(new Enemy("Cat", "Very silly animal", 20, 1, "Animal"));
+ enemies.add(new Enemy("Tiger", "A striped big motherfucking cat", 60, 6, "Animal"));
+ enemies.add(new Enemy("Lion", "King of the jungle", 60, 6, "Animal"));
+ enemies.add(new Enemy("Bear", "He looks very cute, but can kill you without breaking a sweat.", 70, 6, "Animal"));
+ enemies.add(new Enemy("Wolf", "A slightly larger, wetter, and smellier dog", 50, 4, "Animal"));
+ enemies.add(new Enemy("Hippo", "OMG! look at them teeth!", 120, 10, "Animal"));
+ enemies.add(new Enemy("Mouse", "A tiny little mouse", 20, 1, "Animal"));
+
+ }
+ public Enemy randomizeEnemy(){
+ Enemy e = null;
+ Random rnd = new Random();
+ e = enemies.get(rnd.nextInt(enemies.size()));
+ return e;
+
+ }
+
+
+
+
+
+
+}
diff --git a/src/rex/Enemy.java b/src/rex/Enemy.java
new file mode 100644
index 0000000..cacfa51
--- /dev/null
+++ b/src/rex/Enemy.java
@@ -0,0 +1,113 @@
+package rex;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class Enemy {
+ // variabelen aanmaken
+ private String name;
+ private String description;
+ private int hp;
+ private int base_dmg;
+ private boolean alive = true;
+ private String categorie;
+ private ArrayList- loot = new ArrayList
- ();
+ private Loot myloot = new Loot();
+
+ public Enemy(String name, String description, int hp, int base_dmg, String categorie) {
+ setName(name);
+ setDescription(description);
+ setHp(hp);
+ setBase_dmg(base_dmg);
+ setCategorie(categorie);
+ loot.add(myloot.randomizeLoot());
+ }
+
+ //print alle info van de enemy
+ public void printInfo() {
+ System.out.println();
+ System.out.println("************* Enemy Information****************");
+ System.out.println("* Name: " + getName());
+ System.out.println("* Description: " + getDescription());
+ System.out.println("* Category: " + getCategorie());
+ System.out.println("* Health: " + hp);
+ System.out.println("* Base_dmg: " + getBase_dmg());
+
+ if(isAlive()){System.out.println("* Status: Alive");}
+ else{System.out.println("* Status: Deceased");}
+ System.out.println("***********************************************");
+ }
+
+// return the loot item
+ public Item getloot(){
+ Item returnitem = null;
+ for(Item i: loot){
+ returnitem = i;
+ break;
+ }
+
+ return returnitem;
+ }
+
+
+
+ public int doDamage(){
+ int endDamage = 0;
+// Maak random getal op basis van de base_dmg, en val daarmee aan
+ Random rnd_dmg = new Random();
+ endDamage = rnd_dmg.nextInt(getBase_dmg() + 1);
+ return endDamage;
+ }
+ // getters and setters
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCategorie() {
+ return categorie;
+ }
+
+
+ public void setCategorie(String categorie) {
+ this.categorie = categorie;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getHp() {
+ return hp;
+ }
+
+ public void setHp(int hp) {
+ this.hp = hp;
+ }
+
+ public int getBase_dmg() {
+ return base_dmg;
+ }
+
+ public void setBase_dmg(int base_dmg) {
+ this.base_dmg = base_dmg;
+ }
+
+ public boolean isAlive() {
+ return alive;
+ }
+
+ public void setAlive(boolean alive) {
+ this.alive = alive;
+ }
+
+}
diff --git a/src/rex/Game.java b/src/rex/Game.java
new file mode 100644
index 0000000..93b606a
--- /dev/null
+++ b/src/rex/Game.java
@@ -0,0 +1,474 @@
+/*
+ * Auteur: Rick van Lieshout
+ *
+ *
+ * */
+
+package rex;
+//importeer de scanner
+import java.util.Scanner;
+import java.util.ArrayList;
+public class Game {
+
+// Declareer alle variabelen
+ private Player myPlayer;
+ private int roomCounter = 0;
+ private Scanner inputScanner = new Scanner(System.in);
+// Maak een array van 13 kamers
+ private Room[] myRooms = new Room[13];
+ private String visited = "1";
+
+// Constructor van Game class
+ public Game() {
+ //start de game
+ //maak de kamers en vul ze
+ createRooms();
+ fillRooms();
+
+ //Fancy ascii art :D
+ System.out.println("RRRRRRRRRRRRRRRRR ");
+ System.out.println("R::::::::::::::::R ");
+ System.out.println("R::::::RRRRRR:::::R ");
+ System.out.println("RR:::::R R:::::R ");
+ System.out.println(" R::::R R:::::R ooooooooooo ooooooooooo mmmmmmm mmmmmmm ");
+ System.out.println(" R::::R R:::::R oo:::::::::::oo oo:::::::::::oo mm:::::::m m:::::::mm ");
+ System.out.println(" R::::RRRRRR:::::R o:::::::::::::::oo:::::::::::::::om::::::::::mm::::::::::m ");
+ System.out.println(" R:::::::::::::RR o:::::ooooo:::::oo:::::ooooo:::::om::::::::::::::::::::::m ");
+ System.out.println(" R::::RRRRRR:::::R o::::o o::::oo::::o o::::om:::::mmm::::::mmm:::::m ");
+ System.out.println(" R::::R R:::::Ro::::o o::::oo::::o o::::om::::m m::::m m::::m");
+ System.out.println(" R::::R R:::::Ro::::o o::::oo::::o o::::om::::m m::::m m::::m");
+ System.out.println(" R::::R R:::::Ro::::o o::::oo::::o o::::om::::m m::::m m::::m");
+ System.out.println("RR:::::R R:::::Ro:::::ooooo:::::oo:::::ooooo:::::om::::m m::::m m::::m");
+ System.out.println("R::::::R R:::::Ro:::::::::::::::oo:::::::::::::::om::::m m::::m m::::m");
+ System.out.println("R::::::R R:::::R oo:::::::::::oo oo:::::::::::oo m::::m m::::m m::::m");
+ System.out.println("RRRRRRRR RRRRRRR ooooooooooo ooooooooooo mmmmmm mmmmmm mmmmmm");
+ System.out.println("");
+
+ System.out.println("EEEEEEEEEEEEEEEEEEEEEXXXXXXX XXXXXXX lllllll ");
+ System.out.println("E::::::::::::::::::::X:::::X X:::::X l:::::l ");
+ System.out.println("E::::::::::::::::::::X:::::X X:::::X l:::::l");
+ System.out.println("EE::::::EEEEEEEEE::::X::::::X X::::::X l:::::l ");
+ System.out.println(" E:::::E EEEEEXXX:::::X X:::::XXppppp ppppppppp l::::l ooooooooooo rrrrr rrrrrrrrr eeeeeeeeeeee rrrrr rrrrrrrrr ");
+ System.out.println(" E:::::E X:::::X X:::::X p::::ppp:::::::::p l::::l oo:::::::::::oor::::rrr:::::::::r ee::::::::::::ee r::::rrr:::::::::r ");
+ System.out.println(" E::::::EEEEEEEEEE X:::::X:::::X p:::::::::::::::::p l::::lo:::::::::::::::r:::::::::::::::::r e::::::eeeee:::::er:::::::::::::::::r");
+ System.out.println(" E:::::::::::::::E X:::::::::X pp::::::ppppp::::::pl::::lo:::::ooooo:::::rr::::::rrrrr::::::e::::::e e:::::rr::::::rrrrr::::::r");
+ System.out.println(" E:::::::::::::::E X:::::::::X p:::::p p:::::pl::::lo::::o o::::or:::::r r:::::e:::::::eeeee::::::er:::::r r:::::r");
+ System.out.println(" E::::::EEEEEEEEEE X:::::X:::::X p:::::p p:::::pl::::lo::::o o::::or:::::r rrrrrre:::::::::::::::::e r:::::r rrrrrrr");
+ System.out.println(" E:::::E X:::::X X:::::X p:::::p p:::::pl::::lo::::o o::::or:::::r e::::::eeeeeeeeeee r:::::r ");
+ System.out.println(" E:::::E EEEEEXXX:::::X X:::::XXXp:::::p p::::::pl::::lo::::o o::::or:::::r e:::::::e r:::::r");
+ System.out.println("EE::::::EEEEEEEE:::::X::::::X X::::::Xp:::::ppppp:::::::l::::::o:::::ooooo:::::or:::::r e::::::::e r:::::r ");
+ System.out.println("E::::::::::::::::::::X:::::X X:::::Xp::::::::::::::::pl::::::o:::::::::::::::or:::::r e::::::::eeeeeeee r:::::r");
+ System.out.println("E::::::::::::::::::::X:::::X X:::::Xp::::::::::::::pp l::::::loo:::::::::::oo r:::::r ee:::::::::::::e r:::::r");
+ System.out.println("EEEEEEEEEEEEEEEEEEEEEXXXXXXX XXXXXXXp::::::pppppppp llllllll ooooooooooo rrrrrrr eeeeeeeeeeeeee rrrrrrr ");
+ System.out.println(" p:::::p ");
+ System.out.println(" p:::::p");
+ System.out.println(" p:::::::p");
+ System.out.println(" p:::::::p");
+ System.out.println(" p:::::::p");
+ System.out.println(" ppppppppp");
+//Einde fancy ascii art
+
+ System.out.println("==================================================================================================");
+
+ //Begin dialog
+ System.out.println("Welcome to 'Room explorer', please enter your name:");
+ //Create a player, and give it a name.
+ myPlayer = new Player(inputScanner.nextLine());
+ //Greet the player and give them a starting point.
+ System.out.println("Nice to meet you, " + myPlayer.getName() + ". I am Goggan your AI helper(also a proud dwarf)" );
+ System.out.println();
+ System.out.println("It is time to begin your adventure!");
+ System.out.println("Some of the example commands are: 'go', 'get' and 'use'");
+ System.out.println("But you needn't worry, young traveler. Just type 'help' if you are stuck to get a full list of commands!");
+ System.out.println("==================================================================================================");
+ //end dialog
+
+ //Enter the first room, so print the info
+ System.out.println(myRooms[myPlayer.getCurrentroom()].getDescription());
+ System.out.println();
+ //run de run method
+ run();
+
+ }
+ private void run() {
+// Try catch loop om de error af te vangen
+ try {
+
+// Geef de ingevoerde waarde mee met handleCommand
+ System.out.println("Goggan: I am eagerly awaiting your command, oh great master.");
+ handleCommand(inputScanner.nextLine());
+
+// Vang de fout af.
+ } catch (Exception E) { //Print error information
+ System.out.println("Something went terribly wrong.");
+ }
+// Start de run method opnieuw.
+ run();
+ }
+
+ //void om alle commands te handelen
+ private void handleCommand(String userInput) {
+
+ try {
+// Array maken van de userinput
+ String[] words = userInput.split(" ");
+
+// Kijk wat het eerste woord is. (in kleine letters)
+ switch(words[0].toLowerCase()){
+
+// Handle use, geef het 2de woord mee
+ case "use": handleUseCommand(words[1]); break;
+
+// Handle go, geef het 2de woord mee
+ case "go":
+ if(words.length > 1){
+ handleGoCommand(words[1].toLowerCase());}
+ else{System.out.println("Goggan: You have to specify which way you want to go, o great master. (north,east,south,west).");}
+ break;
+ case "get":
+ if(words.length > 1){
+ handleGetCommand(words[1]); break;}
+ else{System.out.println("Get what? Please use either one of these: 'North' 'South' 'East' 'West' "); break;}
+ case "drop": handleDropCommand(words[1].toLowerCase());break;
+// handle all single word commands
+ case "pack": myPlayer.printBackpack();break;
+ case "look": handleLookCommand();break;
+ case "smack": System.out.println("OUCH! Master why did you hit me?"); break;
+ case "help": listCommands(); break;
+// print the gameover text and exit
+ case "quit":gameOver(); System.exit(0); break;
+
+
+ case "attack": handleAttackCommand(words[1].toLowerCase());break;
+// default message (als er iets anders wordt ingetypt.
+ default: System.out.println("Oh master, I didn't understand that command I'm afraid :( ");break;
+ }
+// print lege lijn om console netjes te houden
+ System.out.println();
+
+ }
+// vang de fout af
+ catch (Exception E){
+ System.out.println("Something has gone wrong, please try again");
+ }
+ }
+
+ private void handleAttackCommand(String name){
+// print een opmaak lijn
+ System.out.println("=======================================================================");
+// Vertel de speler in welke kamers hij al is geweest
+
+ myRooms[myPlayer.getCurrentroom()].hitEnemy(name, myPlayer.getBase_dmg());
+ myPlayer.setHP(myPlayer.getHP() - myRooms[myPlayer.getCurrentroom()].hitPlayer(name));
+ if(myRooms[myPlayer.getCurrentroom()].checkAlive(name)){
+ System.out.println(".....");
+ System.out.println("You are hit and have " + myPlayer.getHP() + " health left.");}
+ //myPlayer.TakeDamage(myRooms[myPlayer.getcurrentroom()].)
+ }
+
+ private void handleLookCommand(){
+// geef string mee aan kamer waar player in is
+ myRooms[myPlayer.getCurrentroom()].setVisited(visited);
+// print een opmaak lijn
+ System.out.println("=======================================================================");
+// Vertel de speler in welke kamers hij al is geweest
+ System.out.println("Goggan: We have visited the following rooms master:");
+ System.out.println(visited);
+// Laat de kamer de rest van de info printen
+ myRooms[myPlayer.getCurrentroom()].listRoomInfo();
+
+ }
+
+ private void handleDropCommand(String command){
+// Als player het item heeft
+ if (myPlayer.hasItem(command)){
+ System.out.println("Why are you throwing things away master?!");
+// Voeg het item toe aan de kamer waar je nu in bent
+ myRooms[myPlayer.getCurrentroom()].dropInRoom(myPlayer.transferItem(command));
+// Verwijder het item uit de backpack
+ myPlayer.removeItemFromBackpack(command);
+ }
+// Als speler het item niet heeft
+ else{System.out.println("You don't have '" + command + "'.");}
+ }
+ private void handleGetCommand(String command){
+
+
+// Als het item in de kamer ligt
+ if (myRooms[myPlayer.getCurrentroom()].hasItem(command)){
+ System.out.println("Ooooh, Master has gained an item! And it's shiny!");
+// Voeg het item toe aan de backpack
+ myPlayer.addTobackpack(myRooms[myPlayer.getCurrentroom()].transferItem(command));
+// Verwijder het item uit de kamer
+ myRooms[myPlayer.getCurrentroom()].removeItem(command);
+ }
+
+ }
+ private void handleUseCommand(String command){
+// Kijk of de kamer, of de speler, het item heeft.
+ if(myRooms[myPlayer.getCurrentroom()].hasItem(command) == true || myPlayer.hasItem(command) == true){
+ System.out.println("You used: '" + command + "'");
+// Doe de speciale conditie van de kamer.
+ myRooms[myPlayer.getCurrentroom()].doSpecial(command);
+ }
+ else{// Als zowel de kamer als de speler het item niet heeft
+ System.out.println("You don't have '" + command + "' in your backpack, and it's not in the room either");
+ }
+
+ }
+
+// Void om kamerinformatie te printen
+ private void goRoom(String command){
+ System.out.println("We are in room: " + myRooms[myPlayer.getCurrentroom()].getRoomnumber());
+ System.out.println(myRooms[myPlayer.getCurrentroom()].getDescription());
+// Geef string van bezochte kamers mee
+ myRooms[myPlayer.getCurrentroom()].setVisited(visited);
+ myRooms[myPlayer.getCurrentroom()].checkdoors();
+ myPlayer.DoRoomSpecial();
+// Kijk of de speler geteleporteerd heeft
+ if(myPlayer.isHasTeleported()){
+ myPlayer.setHasTeleported(false);
+ System.out.println("We are in room: " + myRooms[myPlayer.getCurrentroom()].getRoomnumber());
+ System.out.println(myRooms[myPlayer.getCurrentroom()].getDescription());
+// Geef string van bezochte kamers mee
+ myRooms[myPlayer.getCurrentroom()].setVisited(visited);
+ myRooms[myPlayer.getCurrentroom()].checkdoors();
+ }
+ }
+
+ private void handleGoCommand(String command){
+ System.out.println("=======================================================================");
+ //switch om te kijken of het noord oost zuid of west is
+ switch(command){
+ case "north":// Kijk of er in het noorden een deur is
+ if (myRooms[myPlayer.getCurrentroom()].getNorth() == 0){System.out.println("You can't go north");break;}
+ else{ // Verander de currentroom van de speler
+ setVisited(command);
+ myPlayer.setCurrentroom(myRooms[myPlayer.getCurrentroom()].getNorth());
+ goRoom(command);
+ break;
+ }
+ case "east":// Kijk of er in het oosten een deur is
+ if (myRooms[myPlayer.getCurrentroom()].getEast() == 0){System.out.println("You can't go East");break;}
+ else{// Verander de currentroom van de speler
+ setVisited(command);
+ myPlayer.setCurrentroom(myRooms[myPlayer.getCurrentroom()].getEast());
+ goRoom(command);
+ break;
+ }
+ case "south":// Kijk of er in het zuide een deur is
+ if (myRooms[myPlayer.getCurrentroom()].getSouth() == 0){System.out.println("You can't go South");break;}
+ else{// Verander de currentroom van de speler
+ setVisited(command);
+ myPlayer.setCurrentroom(myRooms[myPlayer.getCurrentroom()].getSouth());
+ goRoom(command);
+ break;
+ }
+ case "west": // Kijk of er in het westen een deur is
+ if (myRooms[myPlayer.getCurrentroom()].getWest() == 0){System.out.println("You can't go West");break;}
+ else{// Verander de currentroom van de speler
+ setVisited(command);
+ myPlayer.setCurrentroom(myRooms[myPlayer.getCurrentroom()].getWest());
+ goRoom(command);
+ break;
+ }
+// Command komt niet overeen met north, east, south, west.
+ default:System.out.println("Please enter one of the following options: North, East, South, West") ; break;
+ }
+
+ System.out.println("===================================================================");
+ }
+
+
+ //Void om alle commands uit te printen in de console
+ private void listCommands(){
+ System.out.println();
+ System.out.println("In this game you can use the following commands: ");
+ System.out.println("use x: Every item has a use, so try 'using' an item.");
+ System.out.println("go x: You can use the word 'go' to travel between rooms");
+ System.out.println("get x: Get is used to pick up items");
+ System.out.println("pack: Pack is used to examine all items in your backpack");
+ System.out.println("look: Look at everything in the room");
+ System.out.println("Smack: hit the AI dwarf");
+ System.out.println("Attack x: This will attack a monster in the room(you only have to type his first name)");
+ System.out.println("help: This list");
+ System.out.println("quit: Quit the came");
+ }
+
+
+
+ private void addRoom(String rex, String description, int north, int east, int south,int west){
+// Kijken of de array nog plaats heeft voor een kamer
+ if (getRoomCounter() >= myRooms.length){
+ System.out.println("You have exceeded the maximum number of allowed rooms. So this one will be skipped");
+ }
+ else{
+// Kijken of er niet een verbinding wordt gemaakt met een kamer die niet bestaat.
+ if(north > myRooms.length || north < 0 || east > myRooms.length || east < 0 || south > myRooms.length || south < 0 || west > myRooms.length || west< 0 ){
+ System.out.println("You are trying to make a connection with a room that doesn't exist. Which of course can't be done.");
+ }
+ else{
+// Maak een nieuwe room en hoog de kamercounter op.
+ myRooms[getRoomCounter()] = new Room( rex, description, getRoomCounter() + 1, north, east, south, west);
+ setRoomCounter(getRoomCounter()+ 1);
+ }
+ }
+ }
+
+
+ //void om kamers mee aan te maken
+ private void createRooms(){
+ //maak de kamers
+ // description ,Kamernummer, north, east, south , west
+ addRoom("Welcome to the first room in this game! Try to find your way out muahhahahah."
+ ,"This rooms looks like a pyramid, you can also see a mummy in the corner, and a chest of bones in the center."
+ , 2, 0, 0, 0);
+ addRoom("You have found your way into the second room. This room is filled with..... SPIDERS! muhahahhahah"
+ ,"There are so many spiders in this room that you can't really see anything."
+ , 5, 0, 1, 3);
+ addRoom("I hope you can swim, because this room is full of water. "
+ ,"This room is filled with water, don't forget to come up for air!"
+ , 4, 2, 0, 0);
+ addRoom("Surprise surprise! This room is a giant synchole MUHAHAHHAHAHAH"
+ ,"In this room you will be teleported to another random room."
+ , 0, 0, 3, 0);
+ addRoom("The darkness must not be breached"
+ ,"Darkness..."
+ , 0, 6, 2, 0);
+ addRoom("OMG, are those mutilated bodies hanging from the wall? YES THEY ARE !!"
+ ,"A room filled with chopped up bodies."
+ , 7, 0, 0, 5);
+ addRoom("Nothing to see here, move along."
+ ,"An empty room."
+ , 0, 0, 6, 8);
+ addRoom("Fire, fire! quickly call: 0118 999 881 999 119 7253"
+ ,"This room is on fire"
+ , 9, 7, 0, 0);
+ addRoom("It's time to kick ass and chew bubblegum, and I'm all outta gum"
+ ,"This room looks like a 'nukem' factory"
+ , 10, 0, 8, 0);
+ addRoom("No dice, soldier."
+ ,"This room is filled with heavy weaponary"
+ , 13, 11, 9, 12);
+ addRoom("Do. or Do not, there is no try","This room resembles a forest, also there is a steamy lake in it."
+ , 0, 0, 0, 10);
+ addRoom("Follow me, or perish, sweater monkeys."
+ ,"This room looks like a jungle"
+ , 0, 10, 0, 0);
+ addRoom("How dare you face me !? This will be the last of you!"
+ ,"This room is MASSIVE, it also has pictures of deceased previous players."
+ , 0, 0, 10, 0);
+ }
+
+ //void om kamers items te geven
+ private void fillRooms(){
+// arrayindex = kamernummer -1
+ myRooms[0].addItem("BoneKey", "The Bone Key will open any 'Bone Chest'");
+// Voeg 100 spinnen toe aan de 2de kamer (die gevuld is met spinnen)
+ for(int i = 0; i<100;i++){
+ myRooms[1].addItem("Spider", "Used to scare even the bravest of man");
+ }
+ myRooms[2].addItem("Pearl", "Useless, but valuable");
+ myRooms[4].addItem("Torch", "A lit torch, can be used to find your way out.");
+ myRooms[5].addItem("Leg", "A bloody leg.");
+ myRooms[6].addItem("Helmet", "A helmet worn by the citizens of Skyrim.");
+ myRooms[7].addItem("Ring","Use it in room 8.");
+ myRooms[12].addItem("EndGameItem", " Bring this item to the first room and use it to win the game");
+
+ }
+
+ //Void to print the 'Game over' text
+ private void gameOver(){
+ System.out.println(" GGGGGGGGGGGGG OOOOOOOOO");
+ System.out.println(" GGG::::::::::::G OO:::::::::OO ");
+ System.out.println(" GG:::::::::::::::G OO:::::::::::::OO ");
+ System.out.println(" G:::::GGGGGGGG::::G O:::::::OOO:::::::O ");
+ System.out.println(" G:::::G GGGGGG aaaaaaaaaaaaa mmmmmmm mmmmmmm eeeeeeeeeeee O::::::O O::::::vvvvvvv vvvvvvveeeeeeeeeeee rrrrr rrrrrrrrr ");
+ System.out.println("G:::::G a::::::::::::a mm:::::::m m:::::::mm ee::::::::::::ee O:::::O O:::::Ov:::::v v:::::ee::::::::::::ee r::::rrr:::::::::r ");
+ System.out.println("G:::::G aaaaaaaaa:::::am::::::::::mm::::::::::me::::::eeeee:::::ee O:::::O O:::::O v:::::v v:::::e::::::eeeee:::::er:::::::::::::::::r ");
+ System.out.println("G:::::G GGGGGGGGGG a::::am::::::::::::::::::::::e::::::e e:::::e O:::::O O:::::O v:::::v v:::::e::::::e e:::::rr::::::rrrrr::::::r");
+ System.out.println("G:::::G G::::::::G aaaaaaa:::::am:::::mmm::::::mmm:::::e:::::::eeeee::::::e O:::::O O:::::O v:::::v v:::::ve:::::::eeeee::::::er:::::r r:::::r");
+ System.out.println("G:::::G GGGGG::::G aa::::::::::::am::::m m::::m m::::e:::::::::::::::::e O:::::O O:::::O v:::::v v:::::v e:::::::::::::::::e r:::::r rrrrrrr");
+ System.out.println("G:::::G G::::Ga::::aaaa::::::am::::m m::::m m::::e::::::eeeeeeeeeee O:::::O O:::::O v:::::v:::::v e::::::eeeeeeeeeee r:::::r ");
+ System.out.println(" G:::::G G::::a::::a a:::::am::::m m::::m m::::e:::::::e O::::::O O::::::O v:::::::::v e:::::::e r:::::r ");
+ System.out.println(" G:::::GGGGGGGG::::a::::a a:::::am::::m m::::m m::::e::::::::e O:::::::OOO:::::::O v:::::::v e::::::::e r:::::r ");
+ System.out.println(" GG:::::::::::::::a:::::aaaa::::::am::::m m::::m m::::me::::::::eeeeeeee OO:::::::::::::OO v:::::v e::::::::eeeeeeee r:::::r ");
+ System.out.println(" GGG::::::GGG:::Ga::::::::::aa:::m::::m m::::m m::::m ee:::::::::::::e OO:::::::::OO v:::v ee:::::::::::::e r:::::r ");
+ System.out.println(" GGGGGG GGGG aaaaaaaaaa aaammmmmm mmmmmm mmmmmm eeeeeeeeeeeeee OOOOOOOOO vvv eeeeeeeeeeeeee rrrrrrr ");
+ }
+
+//getters and setters
+
+ public int getRoomCounter() {
+ return roomCounter;
+ }
+
+ public Player getMyPlayer() {
+ return myPlayer;
+ }
+ public void setMyPlayer(Player myPlayer) {
+ this.myPlayer = myPlayer;
+ }
+ public Scanner getInputScanner() {
+ return inputScanner;
+ }
+ public void setInputScanner(Scanner inputScanner) {
+ this.inputScanner = inputScanner;
+ }
+ public Room[] getMyRooms() {
+ return myRooms;
+ }
+ public void setMyRooms(Room[] myRooms) {
+ this.myRooms = myRooms;
+ }
+ public void setRoomCounter(int roomCounter) {
+ this.roomCounter = roomCounter;
+ }
+ public String getVisited() {
+ return visited;
+ }
+
+ public void setVisited(String direction) {
+ switch(direction){
+ case "north":
+// Maak van .getNorth een String
+ String convertString = "" + myRooms[myPlayer.getCurrentroom()].getNorth();
+// Als de visited string het nummer van de kamer al in zich heeft, doe dan niks
+ if (this.visited.contains(convertString)){
+ }
+ else{// Anders, voeg kamernummer toe aan string visited.
+ this.visited = getVisited() + "/" + myRooms[myPlayer.getCurrentroom()].getNorth();
+ }
+ break;
+ case "east":
+ convertString = "" + myRooms[myPlayer.getCurrentroom()].getEast();
+// Als de visited string het nummer van de kamer al in zich heeft, doe dan niks
+ if (this.visited.contains(convertString)){
+ }
+ else{// Anders, voeg kamernummer toe aan string visited.
+ this.visited = getVisited() + "/" + myRooms[myPlayer.getCurrentroom()].getEast();
+ }
+ break;
+ case "south":
+ convertString = "" + myRooms[myPlayer.getCurrentroom()].getSouth();
+// Als de visited string het nummer van de kamer al in zich heeft, doe dan niks
+ if (this.visited.contains(convertString)){
+ }
+ else{// Anders, voeg kamernummer toe aan string visited.
+ this.visited = getVisited() + "/" + myRooms[myPlayer.getCurrentroom()].getSouth();
+ }break;
+ case "west":
+ convertString = "" + myRooms[myPlayer.getCurrentroom()].getWest();
+// Als de visited string het nummer van de kamer al in zich heeft, doe dan niks
+ if (this.visited.contains(convertString)){
+ }
+ else{// Anders, voeg kamernummer toe aan string visited.
+ this.visited = getVisited() + "/" + myRooms[myPlayer.getCurrentroom()].getWest();
+ }
+ break;
+ }
+ }
+
+}
+
+
diff --git a/src/rex/Item.java b/src/rex/Item.java
new file mode 100644
index 0000000..83b3665
--- /dev/null
+++ b/src/rex/Item.java
@@ -0,0 +1,39 @@
+package rex;
+
+public class Item {
+
+ //Maak variabelen aan
+ private String name;
+ private String usageText;
+
+
+ //Constructor
+ public Item(String name, String usageText) {
+ setName(name);
+ setUsageText(usageText);
+
+ }
+
+ //void om iteminfo te typen.
+ public void printItemInfo(){
+ System.out.println(getName() + " - " + usageText);
+ }
+
+
+ //getters & setters
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getUsageText() {
+ return usageText;
+ }
+ public void setUsageText(String usageText) {
+ this.usageText = usageText;
+ }
+
+
+
+}
diff --git a/src/rex/Loot.java b/src/rex/Loot.java
new file mode 100644
index 0000000..1dba75d
--- /dev/null
+++ b/src/rex/Loot.java
@@ -0,0 +1,49 @@
+package rex;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+
+public class Loot {
+
+ ArrayList
- loot = new ArrayList
- ();
+
+
+ Random random = new Random();
+ public Loot(){
+// Name / description
+
+ loot.add(new Item("Sword", "A sword, might be worth some coin back in town"));
+ loot.add(new Item("Axe", "OMG it's really big. Isn't that what she said?"));
+ loot.add(new Item("Sack of gold","Yup, you are rich now!"));
+ loot.add(new Item("Globe","NOPE!, no map of the dungeon hahahha"));
+ loot.add(new Item("Green goo","Yuck!"));
+ loot.add(new Item("White goo","Yuck!"));
+ loot.add(new Item("Flaming dagger","A dager engulfed in flames"));
+ loot.add(new Item("Coal","Reminds Goggan of home"));
+ loot.add(new Item("Dolorean","Don't even try to go 88 Mph"));
+ loot.add(new Item("Torch", "A lit torch, can be used to find your way out."));
+ loot.add(new Item("Potion", "A poisonous potion."));
+ loot.add(new Item("Sammy doll", "A pretty doll, doesn't do much though"));
+ loot.add(new Item("Janco doll", "Annoying little pecker"));
+ loot.add(new Item("Jelle doll", "I'm sexy and I know it!"));
+ loot.add(new Item("Edwin doll", "Looks kind of funny with headphones on"));
+ loot.add(new Item("Rawa doll", "A tiny , tiny doll."));
+ loot.add(new Item("Denis doll", "It moves, although very slowly"));
+ loot.add(new Item("Rob doll", "A very helpgull doll, at times"));
+ loot.add(new Item("Nick doll", "A very defensive doll"));
+ loot.add(new Item("Joost doll", "Don't let him control a radio..."));
+ loot.add(new Item("Danny doll", "This one rides a bike."));
+
+ }
+
+ public Item randomizeLoot(){
+ Item i = null;
+ Random rnd = new Random();
+ i = loot.get(rnd.nextInt(loot.size()));
+ return i;
+
+ }
+
+
+}
diff --git a/src/rex/MainClass.java b/src/rex/MainClass.java
new file mode 100644
index 0000000..5097707
--- /dev/null
+++ b/src/rex/MainClass.java
@@ -0,0 +1,9 @@
+package rex;
+
+public class MainClass {
+ public static void main(String[] args) {
+ //Start game
+ Game rex_game = new Game();
+
+ }
+}
diff --git a/src/rex/Player.java b/src/rex/Player.java
new file mode 100644
index 0000000..1863f5f
--- /dev/null
+++ b/src/rex/Player.java
@@ -0,0 +1,212 @@
+package rex;
+
+// import arraylist for backpack & scanner for input
+import java.util.ArrayList;
+import java.util.Random;
+import java.util.Scanner;
+
+public class Player {
+
+ // maak de variabele aan
+ private int currentroom = 1;
+ Scanner inputScanner = new Scanner(System.in);
+ private String name;
+ private ArrayList
- backpack = new ArrayList
- ();
+ private boolean hasTeleported = false;
+ private int HP = 100;
+ private int base_dmg = 18;
+ private int lives = 3;
+
+ // constructor die meteen de naam opslaat.
+ public Player(String naam) {
+ setName(naam);
+ }
+
+ // Schade aan de speler
+ public void TakeDamage(int damage) {
+ //kijk of de speler overlijd aan de klap, zoniet haal de damage van de hp
+ if (getHP() - damage > 0) {
+ setHP(getHP() - damage);
+ } else {//als de speler dood gaat kijk dan of hij nog levens heeft
+ if (getLives() >= 1) {
+ //er zijn nog levens, dan teleporteer naar de eerste kamer
+ System.out
+ .println("You have died, and will be teleported to the first room.");
+ setLives(getLives() - 1);
+ setCurrentroom(1);
+ System.out.println("You have " + getLives() + "lives left");
+ } else {//geen levens over? -> game over!
+ gameOver();
+ System.exit(0);
+ }
+ }
+ }
+
+ // Doe iets als je IN een kamer komt (room_enter_event)
+ public void DoRoomSpecial() {
+ switch (getCurrentroom() + 1) {// bepaal om welke kamer het gaat
+
+ case 4:
+ Random rnd = new Random();
+ int randomgetal = rnd.nextInt(13);
+ System.out.println("*********************************************");
+ System.out.println("* You are being teleported to a random room *");
+ System.out.println("*********************************************");
+ System.out
+ .println("=======================================================================");
+
+ setHasTeleported(true);
+ setCurrentroom(randomgetal);
+ default:
+ break;
+ }
+
+ }
+
+ // Transfer een item, deze void geeft een item terug die je dan kan
+ // gebruiken
+ public Item transferItem(String itemname) {
+ Item returnitem;
+ for (Item i : backpack) {
+ // Check of item in rugzak zit
+ if (i.getName().toLowerCase().contains(itemname)) {
+ returnitem = i;
+ return returnitem;
+ }
+ }
+ // Return null als de item niet in de backpack zit
+ return null;
+ }
+
+ // Stop het item dat meegegeven wordt in de backpack
+ public void addTobackpack(Item i) {
+ backpack.add(i);
+ }
+
+ // Deze void print de inhoud van de backpack in het console
+ public void printBackpack() {
+ if (backpack.size() > 0) {// check of backpack groter is dan 0
+ System.out.println("I shall open the backpack for you master.");
+ System.out.println("Your backpack contains:");
+ // Doe voor alle items: printItemInfo
+ for (Item i : backpack) {
+ i.printItemInfo();
+ }
+ } else {// Als er geen items in de backpack zitten
+ System.out
+ .println("Your backpack is mighthy empty, we should steal some stuff fast!");
+ }
+ }
+
+ // Kijk of de player een item in zijn backpack heeft
+ public boolean hasItem(String itemname) {
+ boolean roomHasItem = false;
+ // Kijk voor elk item in de backpack of het item bestaat (door de naam
+ // te vergelijken)
+ for (Item i : backpack) {
+ if (i.getName().toLowerCase().equals((itemname).toLowerCase())) {
+ roomHasItem = true;
+ }
+ }
+ return roomHasItem;
+ }
+
+ // Voeg een item toe met naam en usagetext
+ public void addItem(String itemname, String usagetext) {
+ Item i = new Item(itemname, usagetext);
+ backpack.add(i);
+ }
+
+ // Verwijder een item uit de backpack op naam
+ public void removeItemFromBackpack(String itemname) {
+ for (Item i : backpack) {
+ if (i.getName().toLowerCase().equals(itemname)) {
+ backpack.remove(i);
+ break;
+ }
+ }
+ }
+
+ // getters and setters
+ public ArrayList
- getBackpack() {
+ return backpack;
+ }
+
+ public void setBackpack(ArrayList
- backpack) {
+ this.backpack = backpack;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ // check if name isn't empty
+ if (name.equals(null)) {
+ System.out.println("Please choose a better name:");
+ // Ask for a new, valid, name
+ setName(inputScanner.nextLine());
+ } else {
+ this.name = name;
+ }
+ }
+
+ public int getCurrentroom() {
+ return currentroom - 1;
+ }
+
+ public void setCurrentroom(int currentroom) {
+ this.currentroom = currentroom;
+ }
+
+ public boolean isHasTeleported() {
+ return hasTeleported;
+ }
+
+ public void setHasTeleported(boolean hasTeleported) {
+ this.hasTeleported = hasTeleported;
+ }
+
+ public int getHP() {
+ return HP;
+ }
+
+ public void setHP(int hP) {
+ HP = hP;
+ }
+
+ public int getBase_dmg() {
+ return base_dmg;
+ }
+
+ public void setBase_dmg(int base_dmg) {
+ this.base_dmg = base_dmg;
+ }
+
+ public int getLives() {
+ return lives;
+ }
+
+ public void setLives(int lives) {
+ this.lives = lives;
+ }
+ //Void to print the 'Game over' text
+ private void gameOver(){
+ System.out.println(" GGGGGGGGGGGGG OOOOOOOOO");
+ System.out.println(" GGG::::::::::::G OO:::::::::OO ");
+ System.out.println(" GG:::::::::::::::G OO:::::::::::::OO ");
+ System.out.println(" G:::::GGGGGGGG::::G O:::::::OOO:::::::O ");
+ System.out.println(" G:::::G GGGGGG aaaaaaaaaaaaa mmmmmmm mmmmmmm eeeeeeeeeeee O::::::O O::::::vvvvvvv vvvvvvveeeeeeeeeeee rrrrr rrrrrrrrr ");
+ System.out.println("G:::::G a::::::::::::a mm:::::::m m:::::::mm ee::::::::::::ee O:::::O O:::::Ov:::::v v:::::ee::::::::::::ee r::::rrr:::::::::r ");
+ System.out.println("G:::::G aaaaaaaaa:::::am::::::::::mm::::::::::me::::::eeeee:::::ee O:::::O O:::::O v:::::v v:::::e::::::eeeee:::::er:::::::::::::::::r ");
+ System.out.println("G:::::G GGGGGGGGGG a::::am::::::::::::::::::::::e::::::e e:::::e O:::::O O:::::O v:::::v v:::::e::::::e e:::::rr::::::rrrrr::::::r");
+ System.out.println("G:::::G G::::::::G aaaaaaa:::::am:::::mmm::::::mmm:::::e:::::::eeeee::::::e O:::::O O:::::O v:::::v v:::::ve:::::::eeeee::::::er:::::r r:::::r");
+ System.out.println("G:::::G GGGGG::::G aa::::::::::::am::::m m::::m m::::e:::::::::::::::::e O:::::O O:::::O v:::::v v:::::v e:::::::::::::::::e r:::::r rrrrrrr");
+ System.out.println("G:::::G G::::Ga::::aaaa::::::am::::m m::::m m::::e::::::eeeeeeeeeee O:::::O O:::::O v:::::v:::::v e::::::eeeeeeeeeee r:::::r ");
+ System.out.println(" G:::::G G::::a::::a a:::::am::::m m::::m m::::e:::::::e O::::::O O::::::O v:::::::::v e:::::::e r:::::r ");
+ System.out.println(" G:::::GGGGGGGG::::a::::a a:::::am::::m m::::m m::::e::::::::e O:::::::OOO:::::::O v:::::::v e::::::::e r:::::r ");
+ System.out.println(" GG:::::::::::::::a:::::aaaa::::::am::::m m::::m m::::me::::::::eeeeeeee OO:::::::::::::OO v:::::v e::::::::eeeeeeee r:::::r ");
+ System.out.println(" GGG::::::GGG:::Ga::::::::::aa:::m::::m m::::m m::::m ee:::::::::::::e OO:::::::::OO v:::v ee:::::::::::::e r:::::r ");
+ System.out.println(" GGGGGG GGGG aaaaaaaaaa aaammmmmm mmmmmm mmmmmm eeeeeeeeeeeeee OOOOOOOOO vvv eeeeeeeeeeeeee rrrrrrr ");
+ }
+}
diff --git a/src/rex/Room.java b/src/rex/Room.java
new file mode 100644
index 0000000..bb6aa2f
--- /dev/null
+++ b/src/rex/Room.java
@@ -0,0 +1,406 @@
+package rex;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class Room {
+
+ // declare variables
+ private String description;
+ private int east;
+ private int north;
+ private int south;
+ private int west;
+ private int roomnumber;
+ private String rex;
+ private String visited;
+ private ArrayList
- items = new ArrayList
- ();
+ private ArrayList myEnemies = new ArrayList();
+ Enemies my_Enemies = new Enemies();
+
+ // constructor met alle gegevens + deuren
+ public Room(String rex, String description, int roomnumber, int north,
+ int east, int south, int west) {
+ setRex(rex);
+ setRoomnumber(roomnumber);
+ setDescription(description);
+ setEast(east);
+ setNorth(north);
+ setWest(west);
+ setSouth(south);
+ generateEnemy();
+ }
+
+// Do damage to the player
+ public int hitPlayer(String name){
+ int returnint = 0;
+ //Check which enemy does the damge
+ for (Enemy e: myEnemies){
+// Split the name so you only search on first name
+ String[] namesplit = name.split(" ");
+// if first name, or full name is found
+ if (namesplit[0].toLowerCase().equals(name) || e.getName().toLowerCase().equals(name)){
+// call the dodamage void.
+ returnint = e.doDamage();
+ }
+ }
+ return returnint;
+ }
+
+ //check if a specific enemy is alive (by name)
+ public boolean checkAlive(String name){
+ boolean isalive = false;
+// Look through all enemies in a room
+ for(Enemy e: myEnemies){//split de naam, zodat het werkt op alleen de voornaam
+ String[] namesplit = e.getName().split(" ");
+
+ if (namesplit[0].toLowerCase().equals(name) || e.getName().toLowerCase().equals(name)) {
+ if(e.isAlive()){// als hij levend is return dat hij levend is
+ isalive = true;}
+ }
+ }
+
+ return isalive;
+ }
+
+
+ // hit een enemy
+ public void hitEnemy(String name, int damage) {
+ // vind de juiste enemy in de array
+ for (Enemy E : myEnemies) {
+ String[] namesplit = E.getName().split(" ");
+
+ if (namesplit[0].toLowerCase().equals(name) || E.getName().toLowerCase().equals(name)) {
+// Als de enemy levend is
+ if (E.isAlive()) {
+ System.out
+ .println("Goggan: Thats it master! hit the sucker!");
+// Maak een random damage getal
+ Random rnd_dmg = new Random();
+ int dmg = rnd_dmg.nextInt(damage + 1);
+// Als de current hp - het gemaakte damage getal 1 of hoger is dan
+ if (E.getHp() - dmg > 0) {
+// breng de schade in rekening
+ E.setHp(E.getHp() - dmg);
+// Print wat leuke info
+ System.out.println(E.getName() + " has received " + dmg
+ + " points of damage");
+ System.out.println(E.getName() + " has got "+ E.getHp() + " health points left.");
+ break;
+ } else {// Waarde < 1 , dus dood
+ E.setHp(E.getHp() - dmg);
+ E.setAlive(false);
+
+ items.add(E.getloot());
+ System.out.println("You killed " + E.getName());
+ }
+ } else {// Hij is al lang dood :P
+ System.out.println("You already killed " + E.getName());
+ }
+
+ }
+ else{// naam van villain niet goed getypt
+ System.out.println("You have to type at least the monsters first name to attack");
+ }
+ }
+
+ }
+
+ // maak een nieuwe enemy in 40% van de gevallen
+ public void generateEnemy() {
+ // Genereer een random getal tussen 1 en 100
+ Random rnd_gen = new Random();
+ int random = rnd_gen.nextInt(100) + 1;
+ // Als het getal lager is dan 40
+ if (random < 40) {
+ // voeg een random enemy toe uit de my_Enemies klas
+ myEnemies.add(my_Enemies.randomizeEnemy());
+ }
+
+ }
+
+ // Print info van de enemies in de kamer
+ public void listEnemies() {
+ // Controle of er wel enemies zijn
+ if (myEnemies.size() > 0) {
+ System.out.println();
+ System.out.println("Goggan: Master! Master! There is an enemy in this room!:");
+ // voer de void printInfo uit voor alle enemies in de arraylist
+ for (Enemy e : myEnemies) {
+ e.printInfo();
+ }
+ }
+ }
+
+ // Doe iets met de item
+ public void doSpecial(String itemname) {
+ switch (getRoomnumber()) {// bepaal om welke kamer het gaat
+
+ case 1:
+ if (itemname.equals("bonekey")) {// kijk of het juiste item is gebruikt, in de juiste kamer
+ System.out.println("You open the chest with the BoneKey, and... nothing happened!");
+ } else if (itemname.equals("endgameitem")) {
+ winner();
+ System.exit(0);
+ }
+ // Als item niet juist is
+ else {
+ System.out.println("You cannot use '" + itemname
+ + "' in this room.");
+ }
+ // if(itemname.equals(anObject))
+ break;
+
+ case 8: if (itemname.equals("ring")){
+ System.out.println("Gogann: My precious! My precious!");
+ break;
+ }
+ // Als kamer niet juist is
+ default:
+ System.out.println("You cannot use '" + itemname
+ + "' in this room.");
+ break;
+ }
+ }
+
+ // Voeg een item toe aan de backpack
+ public void addItem(String itemname, String usagetext) {
+ // Maak een nieuw item
+ Item i = new Item(itemname, usagetext);
+ items.add(i);
+ }
+
+ // Geef alle items in de room
+ public void getItems() {
+ if (items.size() > 0) {
+ System.out.println();
+ System.out.println("Goggan: Master! Master! I have found items in this room:");
+ for (Item i : items) {
+ i.printItemInfo();
+ }
+ }
+ }
+
+ // verwijder een item uit een kamer.
+ public void removeItem(String itemname) {
+ for (Item i : items) {
+ // Als itemnaam gelijk is aan naam van item in kamer
+ if (i.getName().toLowerCase().equals(itemname.toLowerCase())) {
+ items.remove(i);
+ break;
+ }
+ }
+ }
+
+ // Return een item die je zoekt bij naam
+ public Item transferItem(String itemname) {
+ Item returnitem;
+ for (Item i : items) {
+ if (i.getName().toLowerCase().contains(itemname)) {
+ returnitem = i;
+ return returnitem;
+ }
+ }
+ return null;
+ }
+
+ // voeg een item toe aan de kamer doormiddel van item
+ public void dropInRoom(Item i) {
+ items.add(i);
+ }
+
+ // Print room info
+ public void listRoomInfo() {
+ System.out.println();
+ System.out.println("Here is everything I know about the room master:");
+ System.out.println("We are in room: " + getRoomnumber());
+ System.out.println();
+
+ System.out.println(getDescription());
+ System.out.println();
+ checkdoors();
+ getItems();
+ listEnemies();
+ System.out
+ .println("=======================================================================");
+ }
+
+ // check welke deuren er zijn
+ public void checkdoors() {
+ System.out.println();
+ String convertstring;
+ // Check of er een deur is aan de oostzijde
+ if (getEast() == 0) {
+ } else {// als er een deur is doe dit:
+ System.out.println("There is a door on the east side of the room");
+ convertstring = "" + getEast();
+ // Als de string getvisited het kamernummer in zich heeft, dan heb
+ // je de kamer bezocht en krijg je het nummer te zien.
+ if (getVisited().contains(convertstring)) {
+ System.out.println("The door leads to room: " + getEast());
+ } else {// Als de kamer nog niet bezocht is
+ System.out.println("We haven't been through this door yet.");
+ }
+
+ }
+ // Check of er een deur is aan de zuiderlijke zijde
+ if (getSouth() == 0) {
+ } else {// als er een deur is doe dit:
+ System.out.println("There is a door on the south side of the room");
+ convertstring = "" + getSouth();
+ // Als de string getvisited het kamernummer in zich heeft, dan heb
+ // je de kamer bezocht en krijg je het nummer te zien.
+ if (getVisited().contains(convertstring)) {
+ System.out.println("The door leads to room: " + getSouth());
+ } else {// Als de kamer nog niet bezocht is
+ System.out.println("We haven't been through this door yet.");
+ }
+
+ }
+ // Check of er een deur is aan de westzijde
+ if (getWest() == 0) {
+ } else {// als er een deur is doe dit:
+ System.out.println("There is a door on the west side of the room");
+ convertstring = "" + getWest();
+ // Als de string getvisited het kamernummer in zich heeft, dan heb
+ // je de kamer bezocht en krijg je het nummer te zien.
+ if (getVisited().contains(convertstring)) {
+ System.out.println("The door leads to room: " + getWest());
+ } else {// Als de kamer nog niet bezocht is
+ System.out.println("We haven't been through this door yet.");
+ }
+ }
+ // Check of er een deur is aan de noordzijde
+ if (getNorth() == 0) {
+ } else {// als er een deur is doe dit:
+ System.out.println("There is a door on the north side of the room");
+ convertstring = "" + getNorth();
+ // Als de string getvisited het kamernummer in zich heeft, dan heb
+ // je de kamer bezocht en krijg je het nummer te zien.
+ if (getVisited().contains(convertstring)) {
+ System.out.println("The door leads to room: " + getNorth());
+ } else {// Als de kamer nog niet bezocht is
+ System.out.println("We haven't been through this door yet.");
+ }
+ }
+ }
+
+ // Kijk of de item in de kamer ligt
+ public boolean hasItem(String itemname) {
+ boolean roomHasItem = false;
+ for (Item i : items) {
+ if (i.getName().toLowerCase().contains((itemname).toLowerCase())) {
+ roomHasItem = true;
+ }
+ }
+ return roomHasItem;
+ }
+
+ // void to print the 'You Won !' text
+ private void winner() {
+ System.out
+ .println("YYYYYYY YYYYYYY WWWWWWWW WWWWWWWW !!! ");
+ System.out
+ .println("Y:::::Y Y:::::Y W::::::W W::::::W !!:!!");
+ System.out
+ .println("Y:::::Y Y:::::Y W::::::W W::::::W !:::!");
+ System.out
+ .println("Y::::::Y Y::::::Y W::::::W W::::::W !:::!");
+ System.out
+ .println("YYY:::::Y Y:::::YYYooooooooooo uuuuuu uuuuuu W:::::W WWWWW W:::::W ooooooooooo nnnn nnnnnnnn !:::!");
+ System.out
+ .println(" Y:::::Y Y:::::Y oo:::::::::::oo u::::u u::::u W:::::W W:::::W W:::::Woo:::::::::::oo n:::nn::::::::nn !:::!");
+ System.out
+ .println(" Y:::::Y:::::Y o:::::::::::::::ou::::u u::::u W:::::W W:::::::W W:::::Wo:::::::::::::::on::::::::::::::nn !:::!");
+ System.out
+ .println(" Y:::::::::Y o:::::ooooo:::::ou::::u u::::u W:::::W W:::::::::W W:::::W o:::::ooooo:::::onn:::::::::::::::n !:::!");
+ System.out
+ .println(" Y:::::::Y o::::o o::::ou::::u u::::u W:::::W W:::::W:::::W W:::::W o::::o o::::o n:::::nnnn:::::n !:::!");
+ System.out
+ .println(" Y:::::Y o::::o o::::ou::::u u::::u W:::::W W:::::W W:::::W W:::::W o::::o o::::o n::::n n::::n !:::!");
+ System.out
+ .println(" Y:::::Y o::::o o::::ou::::u u::::u W:::::W:::::W W:::::W:::::W o::::o o::::o n::::n n::::n !!:!!");
+ System.out
+ .println(" Y:::::Y o::::o o::::ou:::::uuuu:::::u W:::::::::W W:::::::::W o::::o o::::o n::::n n::::n !!! ");
+ System.out
+ .println(" Y:::::Y o:::::ooooo:::::ou:::::::::::::::uu W:::::::W W:::::::W o:::::ooooo:::::o n::::n n::::n ");
+ System.out
+ .println(" YYYY:::::YYYY o:::::::::::::::o u:::::::::::::::u W:::::W W:::::W o:::::::::::::::o n::::n n::::n !!! ");
+ System.out
+ .println(" Y:::::::::::Y oo:::::::::::oo uu::::::::uu:::u W:::W W:::W oo:::::::::::oo n::::n n::::n !!:!!");
+ System.out
+ .println(" YYYYYYYYYYYYY ooooooooooo uuuuuuuu uuuu WWW WWW ooooooooooo nnnnnn nnnnnn !!! ");
+ }
+
+ // Getters and setters
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getEast() {
+ return east;
+ }
+
+ public void setEast(int east) {
+ this.east = east;
+ }
+
+ public int getNorth() {
+ return north;
+ }
+
+ public void setNorth(int north) {
+ this.north = north;
+ }
+
+ public int getSouth() {
+ return south;
+ }
+
+ public void setSouth(int south) {
+ this.south = south;
+ }
+
+ public int getWest() {
+ return west;
+ }
+
+ public void setWest(int west) {
+ this.west = west;
+ }
+
+ public int getRoomnumber() {
+ return roomnumber;
+ }
+
+ public void setRoomnumber(int roomnumber) {
+ this.roomnumber = roomnumber;
+ }
+
+ public String getDescription() {
+ System.out.println("The moment we entered the room REX said: ");
+ System.out.println("REX:" + getRex());
+ System.out.println();
+ System.out.println("Here is a small description about the room:");
+ return description;
+
+ }
+
+ public String getVisited() {
+ return visited;
+ }
+
+ public void setVisited(String visited) {
+ this.visited = visited;
+ }
+
+ public String getRex() {
+
+ return rex;
+ }
+
+ public void setRex(String rex) {
+ this.rex = rex;
+ }
+
+}