aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-04-16 00:54:30 +0200
committerPacien TRAN-GIRARD2014-04-16 00:54:30 +0200
commitef51d51372df08de05a1ac35903ee4d6d9490328 (patch)
treedb570c770d37ca9f38bfca716b5ab1c91c437940 /src
parent9c539573868dd221088ae069e26a0b0ad35d2903 (diff)
downloadesieequest-ef51d51372df08de05a1ac35903ee4d6d9490328.tar.gz
Implement undroppable items
Diffstat (limited to 'src')
-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}