aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/Model/Entity.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-07 22:52:25 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-07 22:52:25 +0200
commit239571e3408a3187953bef1dd5d516461bad0e31 (patch)
tree67c062a635affc90c08a92ac61adfed2445985d8 /src/main/scala/Model/Entity.scala
parentdef8975617e5c6da431e41cc889d167b0f2e2bb0 (diff)
downloadscalevalapokalypsi-239571e3408a3187953bef1dd5d516461bad0e31.tar.gz
scalevalapokalypsi-239571e3408a3187953bef1dd5d516461bad0e31.zip
Added turns, time limits and turn order randomization (feature/bug?)
Diffstat (limited to 'src/main/scala/Model/Entity.scala')
-rw-r--r--src/main/scala/Model/Entity.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/scala/Model/Entity.scala b/src/main/scala/Model/Entity.scala
index eb19606..c18ffea 100644
--- a/src/main/scala/Model/Entity.scala
+++ b/src/main/scala/Model/Entity.scala
@@ -47,6 +47,14 @@ class Entity(val name: String, initialLocation: Area):
s"You drop the $itemName"
case None => "You don't have that!"
+ /** Tells whether this entity can drop the specified item
+ * (if an action were to specify so).
+ *
+ * @param itemName the name to check
+ * @return whether this entity has this item and can drop it
+ */
+ def canDrop(itemName: String): Boolean = this.inventory.contains(itemName)
+
/** Causes the player to rest for a short while (this has no substantial effect in game terms).
* Returns a description of what happened. */
def rest() =