aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/Model/Item.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-07 01:17:58 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-07 01:17:58 +0200
commitfdaec6534eb7ee902c75be3e4b732b6970abd859 (patch)
treef323d11dc1a33a93ee44417a58df62ef5f9ad98a /src/main/scala/Model/Item.scala
parent12cbf4d451d1002b8872b0028acbe6bd886ca9bd (diff)
downloadscalevalapokalypsi-fdaec6534eb7ee902c75be3e4b732b6970abd859.tar.gz
scalevalapokalypsi-fdaec6534eb7ee902c75be3e4b732b6970abd859.zip
Made the server work with the adventure model
* The model was imported from the wrong version, so that needs to be fixed. * The client side doesn't work at all right now. Use netcat for testing. * There are inconveniences and bugs in the model (eg. it lists the player among entities) * Players can just see each other, not interact in any way But it's a good base.
Diffstat (limited to 'src/main/scala/Model/Item.scala')
-rw-r--r--src/main/scala/Model/Item.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/scala/Model/Item.scala b/src/main/scala/Model/Item.scala
new file mode 100644
index 0000000..3809561
--- /dev/null
+++ b/src/main/scala/Model/Item.scala
@@ -0,0 +1,18 @@
+package o1game.Model
+
+/** The class `Item` represents items in a text adventure game. Each item has a name
+ * and a longer description. (In later versions of the adventure game, items may
+ * have other features as well.)
+ *
+ * N.B. It is assumed, but not enforced by this class, that items have unique names.
+ * That is, no two items in a game world have the same name.
+ *
+ * @param name the item’s name
+ * @param description the item’s description */
+class Item(val name: String, val description: String):
+
+ /** Returns a short textual representation of the item (its name, that is). */
+ override def toString = this.name
+
+end Item
+