diff --git a/ZorkUML.jpg b/ZorkUML.jpg index 6194ec8..d0a7910 100644 Binary files a/ZorkUML.jpg and b/ZorkUML.jpg differ diff --git a/ZorkUML.ucls b/ZorkUML.ucls index 28f855c..c445545 100644 --- a/ZorkUML.ucls +++ b/ZorkUML.ucls @@ -110,96 +110,101 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - + - - + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + diff --git a/src/com/bayviewglen/zork/Game.java b/src/com/bayviewglen/zork/Game.java index 399961e..c1a6329 100644 --- a/src/com/bayviewglen/zork/Game.java +++ b/src/com/bayviewglen/zork/Game.java @@ -158,6 +158,10 @@ class Game { // Read the Damage Given int damageGiven = Integer.parseInt(enemyScanner.nextLine().split(":")[1].trim()); e.setDamageGiven(damageGiven); + // Read the Loot + String loot = enemyScanner.nextLine().split(":")[1].trim(); + e.setLoot(loot); + masterEnemyMap.put(e, e.getRoom()); } } catch (Exception ex) { } @@ -212,13 +216,16 @@ class Game { if (printWelcome()) { // Enter the main command loop. Here we repeatedly read commands and // execute them until the game is over. - System.out.println( - "\nType 'help' if you need help, consult the wiki \non GitHub if you are confused and enjoy the game!\n"); + System.out.println("\nType 'help' if you need help, consult the wiki \non GitHub if you are confused and enjoy the game!\n"); System.out.println("\n\nEscape Casa Loma"); System.out.println("---------------------\n"); System.out.print(currentRoom.longDescription()); System.out.println(currentRoom.itemString()); System.out.println(currentRoom.exitString()); + player.addToInventory(new Lockpick()); + player.addToInventory(new Key()); + player.addToInventory(new Crowbar()); + player.addToInventory(new Batteringram()); boolean finished = false; while (!finished) { if (currentCombat != null) { @@ -307,20 +314,29 @@ class Game { System.out.println("What do you want to open the door with?"); } boolean hasCrowbar = false; + boolean hasBatteringRam = false; for (int i = 0; i < player.getInventory().size(); i++) { if (player.getInventory().get(i).equals(new Crowbar())) { hasCrowbar = true; break; } + if (player.getInventory().get(i).equals(new Batteringram())) { + hasBatteringRam = true; + break; + } } - if (command.hasDirection() && hasCrowbar) { + if (command.hasDirection() && (hasCrowbar || hasBatteringRam)) { Room nextRoom = currentRoom.nextRoom(command.getDirection()); try { if (nextRoom.getBoarded()) { nextRoom.setBoarded(false); + if(hasCrowbar) { player.removeFromInventory(new Crowbar()); - System.out.println( - "With great effort, you pry the boards off the door with the crowbar! However, it breaks and is no longer useable."); + System.out.println("With great effort, you pry the boards off the door with the crowbar! However, it breaks and is no longer useable."); + } + if(hasBatteringRam) { + System.out.println("With the battering ram, you smash through the boards on the door!"); + } } else { System.out.println("That door is already unboarded!"); }