This commit is contained in:
vleevalerio
2019-05-31 22:02:11 -04:00
3 changed files with 85 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -110,96 +110,101 @@
</display> </display>
</class> </class>
<dependency id="13"> <dependency id="13">
<bendpoint x="346" y="140"/>
<bendpoint x="346" y="247"/>
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="9"/>
<end type="TARGET" refId="2"/> <end type="TARGET" refId="10"/>
</dependency> </dependency>
<dependency id="14"> <dependency id="14">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="4"/>
</dependency>
<generalization id="15">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="3"/>
</generalization>
<dependency id="16">
<end type="SOURCE" refId="6"/>
<end type="TARGET" refId="12"/>
</dependency>
<dependency id="17">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="11"/>
</dependency>
<dependency id="18">
<end type="SOURCE" refId="11"/>
<end type="TARGET" refId="1"/>
</dependency>
<dependency id="19">
<end type="SOURCE" refId="10"/>
<end type="TARGET" refId="12"/>
</dependency>
<dependency id="20">
<end type="SOURCE" refId="7"/>
<end type="TARGET" refId="2"/>
</dependency>
<dependency id="21">
<bendpoint x="881" y="102"/> <bendpoint x="881" y="102"/>
<bendpoint x="880" y="270"/> <bendpoint x="880" y="270"/>
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="9"/>
<end type="TARGET" refId="1"/> <end type="TARGET" refId="1"/>
</dependency> </dependency>
<dependency id="15"> <generalization id="22">
<end type="SOURCE" refId="8"/>
<end type="TARGET" refId="9"/>
</dependency>
<dependency id="16">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="10"/>
</dependency>
<dependency id="17">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="4"/>
</dependency>
<generalization id="18">
<end type="SOURCE" refId="5"/>
<end type="TARGET" refId="3"/>
</generalization>
<generalization id="19">
<end type="SOURCE" refId="1"/> <end type="SOURCE" refId="1"/>
<end type="TARGET" refId="3"/> <end type="TARGET" refId="3"/>
</generalization> </generalization>
<dependency id="20">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="6"/>
</dependency>
<dependency id="21">
<end type="SOURCE" refId="7"/>
<end type="TARGET" refId="2"/>
</dependency>
<dependency id="22">
<end type="SOURCE" refId="10"/>
<end type="TARGET" refId="12"/>
</dependency>
<dependency id="23"> <dependency id="23">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="11"/>
</dependency>
<dependency id="24">
<bendpoint x="902" y="98"/> <bendpoint x="902" y="98"/>
<bendpoint x="906" y="420"/> <bendpoint x="906" y="420"/>
<bendpoint x="610" y="422"/> <bendpoint x="610" y="422"/>
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="9"/>
<end type="TARGET" refId="5"/> <end type="TARGET" refId="5"/>
</dependency> </dependency>
<generalization id="25"> <dependency id="24">
<end type="SOURCE" refId="2"/> <bendpoint x="346" y="140"/>
<end type="TARGET" refId="3"/> <bendpoint x="346" y="247"/>
</generalization>
<dependency id="26">
<end type="SOURCE" refId="11"/>
<end type="TARGET" refId="3"/>
</dependency>
<dependency id="27">
<end type="SOURCE" refId="6"/>
<end type="TARGET" refId="12"/>
</dependency>
<dependency id="28">
<bendpoint x="620" y="148"/>
<bendpoint x="620" y="202"/>
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="9"/>
<end type="TARGET" refId="3"/> <end type="TARGET" refId="2"/>
</dependency> </dependency>
<dependency id="29"> <dependency id="25">
<bendpoint x="338" y="105"/> <bendpoint x="338" y="105"/>
<bendpoint x="338" y="260"/> <bendpoint x="338" y="260"/>
<bendpoint x="338" y="370"/> <bendpoint x="338" y="370"/>
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="9"/>
<end type="TARGET" refId="4"/> <end type="TARGET" refId="4"/>
</dependency> </dependency>
<dependency id="30"> <dependency id="26">
<end type="SOURCE" refId="10"/> <bendpoint x="620" y="148"/>
<bendpoint x="620" y="202"/>
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="3"/>
</dependency>
<dependency id="27">
<bendpoint x="516" y="369"/>
<end type="SOURCE" refId="11"/>
<end type="TARGET" refId="5"/>
</dependency>
<dependency id="28">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="7"/>
</dependency>
<dependency id="29">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="6"/> <end type="TARGET" refId="6"/>
</dependency> </dependency>
<dependency id="30">
<end type="SOURCE" refId="8"/>
<end type="TARGET" refId="9"/>
</dependency>
<dependency id="31"> <dependency id="31">
<end type="SOURCE" refId="11"/> <end type="SOURCE" refId="11"/>
<end type="TARGET" refId="1"/> <end type="TARGET" refId="3"/>
</dependency> </dependency>
<dependency id="32"> <generalization id="32">
<end type="SOURCE" refId="9"/> <end type="SOURCE" refId="5"/>
<end type="TARGET" refId="7"/> <end type="TARGET" refId="3"/>
</generalization>
<dependency id="33">
<end type="SOURCE" refId="10"/>
<end type="TARGET" refId="6"/>
</dependency> </dependency>
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true" <classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true"> sort-features="false" accessors="true" visibility="true">

View File

@@ -158,6 +158,10 @@ class Game {
// Read the Damage Given // Read the Damage Given
int damageGiven = Integer.parseInt(enemyScanner.nextLine().split(":")[1].trim()); int damageGiven = Integer.parseInt(enemyScanner.nextLine().split(":")[1].trim());
e.setDamageGiven(damageGiven); e.setDamageGiven(damageGiven);
// Read the Loot
String loot = enemyScanner.nextLine().split(":")[1].trim();
e.setLoot(loot);
masterEnemyMap.put(e, e.getRoom());
} }
} catch (Exception ex) { } catch (Exception ex) {
} }
@@ -212,13 +216,16 @@ class Game {
if (printWelcome()) { if (printWelcome()) {
// Enter the main command loop. Here we repeatedly read commands and // Enter the main command loop. Here we repeatedly read commands and
// execute them until the game is over. // execute them until the game is over.
System.out.println( System.out.println("\nType 'help' if you need help, consult the wiki \non GitHub if you are confused and enjoy the game!\n");
"\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\nEscape Casa Loma");
System.out.println("---------------------\n"); System.out.println("---------------------\n");
System.out.print(currentRoom.longDescription()); System.out.print(currentRoom.longDescription());
System.out.println(currentRoom.itemString()); System.out.println(currentRoom.itemString());
System.out.println(currentRoom.exitString()); System.out.println(currentRoom.exitString());
player.addToInventory(new Lockpick());
player.addToInventory(new Key());
player.addToInventory(new Crowbar());
player.addToInventory(new Batteringram());
boolean finished = false; boolean finished = false;
while (!finished) { while (!finished) {
if (currentCombat != null) { if (currentCombat != null) {
@@ -307,20 +314,29 @@ class Game {
System.out.println("What do you want to open the door with?"); System.out.println("What do you want to open the door with?");
} }
boolean hasCrowbar = false; boolean hasCrowbar = false;
boolean hasBatteringRam = false;
for (int i = 0; i < player.getInventory().size(); i++) { for (int i = 0; i < player.getInventory().size(); i++) {
if (player.getInventory().get(i).equals(new Crowbar())) { if (player.getInventory().get(i).equals(new Crowbar())) {
hasCrowbar = true; hasCrowbar = true;
break; 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()); Room nextRoom = currentRoom.nextRoom(command.getDirection());
try { try {
if (nextRoom.getBoarded()) { if (nextRoom.getBoarded()) {
nextRoom.setBoarded(false); nextRoom.setBoarded(false);
if(hasCrowbar) {
player.removeFromInventory(new Crowbar()); player.removeFromInventory(new Crowbar());
System.out.println( System.out.println("With great effort, you pry the boards off the door with the crowbar! However, it breaks and is no longer useable.");
"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 { } else {
System.out.println("That door is already unboarded!"); System.out.println("That door is already unboarded!");
} }