aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/Client/Turn.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-14 19:25:19 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-14 19:25:19 +0200
commita43812ed462630850edbf29bda182fbf1e5e1263 (patch)
tree20e84b60adee6fa31ceb970ffccffa5b6b583d86 /src/main/scala/Client/Turn.scala
parentc87263e9e493fe6c130f5ad6a523871c08987f4c (diff)
downloadscalevalapokalypsi-a43812ed462630850edbf29bda182fbf1e5e1263.tar.gz
scalevalapokalypsi-a43812ed462630850edbf29bda182fbf1e5e1263.zip
Immediate printing of actions & no prompt on blocking action & refactoring
Diffstat (limited to 'src/main/scala/Client/Turn.scala')
-rw-r--r--src/main/scala/Client/Turn.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/scala/Client/Turn.scala b/src/main/scala/Client/Turn.scala
new file mode 100644
index 0000000..6b78811
--- /dev/null
+++ b/src/main/scala/Client/Turn.scala
@@ -0,0 +1,32 @@
+package o1game.Client
+
+/** `Turn`s represent information the client has got about a turn.
+ * This class exists essentially so that the client has somewhere
+ * to store data about turns and something to format that data with.
+ */
+class Turn:
+
+ /** Description of the area the player controlled by the client is in
+ * at the end of the turn. */
+ var areaDescription: String = ""
+
+ /** Directions the player controlled by the client can go to. */
+ var possibleDirections: Array[String] = Array.empty
+
+ /** Items the player controlled by the client can see. */
+ var visibleItems: Array[String] = Array.empty
+
+ /** Entities the player controlled by the client can see. */
+ var visibleEntities: Array[String] = Array.empty
+
+ override def toString: String =
+ val itemDesc = "You can see the following items: " +
+ this.visibleItems.mkString(", ")
+ val entityDesc = "The following entities reside in the room: " +
+ this.visibleEntities.mkString(", ")
+ val directionDesc = "There are exits to " +
+ this.possibleDirections.mkString(", ")
+ (s"$areaDescription\n$directionDesc\n" +
+ s"\n$itemDesc\n$entityDesc")
+
+end Turn