aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/esieequest/controller/Performer.java4
-rw-r--r--src/esieequest/model/items/Item.java9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/esieequest/controller/Performer.java b/src/esieequest/controller/Performer.java
index de8d814..8c61f3a 100644
--- a/src/esieequest/controller/Performer.java
+++ b/src/esieequest/controller/Performer.java
@@ -188,6 +188,10 @@ class Performer {
188 * the item's name 188 * the item's name
189 */ 189 */
190 public void dropItem(final String itemName) { 190 public void dropItem(final String itemName) {
191 if (!this.game.getPlayer().getInventory().getItem(itemName).isDroppable()) {
192 this.echo("This item cannot be dropped.");
193 return;
194 }
191 this.moveItem(this.game.getPlayer().getInventory(), this.game.getPlayer().getCurrentRoom().getItems(), itemName); 195 this.moveItem(this.game.getPlayer().getInventory(), this.game.getPlayer().getCurrentRoom().getItems(), itemName);
192 } 196 }
193 197
diff --git a/src/esieequest/model/items/Item.java b/src/esieequest/model/items/Item.java
index b9d6deb..8f5582b 100644
--- a/src/esieequest/model/items/Item.java
+++ b/src/esieequest/model/items/Item.java
@@ -48,4 +48,13 @@ public class Item {
48 return this.weight; 48 return this.weight;
49 } 49 }
50 50
51 /**
52 * Tells whether the item is droppable.
53 *
54 * @return the droppability of the item.
55 */
56 public boolean isDroppable() {
57 return this.droppable;
58 }
59
51} 60}