fixed missing i-- bug
This commit is contained in:
@@ -240,6 +240,7 @@ class Game {
|
|||||||
for (int i = 0; i < player.getInventory().size(); i++) {
|
for (int i = 0; i < player.getInventory().size(); i++) {
|
||||||
currentRoom.addItem(player.getInventory().get(i));
|
currentRoom.addItem(player.getInventory().get(i));
|
||||||
player.removeFromInventory(player.getInventory().get(i));
|
player.removeFromInventory(player.getInventory().get(i));
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
|
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
|
||||||
System.out.println(
|
System.out.println(
|
||||||
@@ -261,6 +262,11 @@ class Game {
|
|||||||
System.out.println("Your health is now " + player.getHealth() + "%");
|
System.out.println("Your health is now " + player.getHealth() + "%");
|
||||||
}
|
}
|
||||||
if(player.getHealth() <= 0) {
|
if(player.getHealth() <= 0) {
|
||||||
|
for (int i = 0; i < player.getInventory().size(); i++) {
|
||||||
|
currentRoom.addItem(player.getInventory().get(i));
|
||||||
|
player.removeFromInventory(player.getInventory().get(i));
|
||||||
|
i--;
|
||||||
|
}
|
||||||
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
|
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Poof! You looked pretty banged up there, so I brought you back to the circle room. Your items are where you died.");
|
"Poof! You looked pretty banged up there, so I brought you back to the circle room. Your items are where you died.");
|
||||||
|
|||||||
Reference in New Issue
Block a user