diff options
author | Aleksi Heikkila <aleksi.e.heikkila@aalto.fi> | 2024-11-23 22:33:53 +0200 |
---|---|---|
committer | Aleksi Heikkila <aleksi.e.heikkila@aalto.fi> | 2024-11-23 22:33:53 +0200 |
commit | 27dd937617cce1e43df1c16e12050f6e88763d54 (patch) | |
tree | 8247736f7c4d5b1a0c1541c25f477e73e5783944 /src/scalevalapokalypsi/Client/RoomState.scala | |
parent | b11c02e8f1f4dea09847da999c2acb2f96df8a58 (diff) | |
parent | 28b83db50f33cb704311ffe608dcd8c4412635cf (diff) | |
download | scalevalapokalypsi-27dd937617cce1e43df1c16e12050f6e88763d54.tar.gz scalevalapokalypsi-27dd937617cce1e43df1c16e12050f6e88763d54.zip |
Merge branch 'master' of ssh://cron4.fi/~/O1-game
Diffstat (limited to 'src/scalevalapokalypsi/Client/RoomState.scala')
-rw-r--r-- | src/scalevalapokalypsi/Client/RoomState.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/scalevalapokalypsi/Client/RoomState.scala b/src/scalevalapokalypsi/Client/RoomState.scala new file mode 100644 index 0000000..02fe11b --- /dev/null +++ b/src/scalevalapokalypsi/Client/RoomState.scala @@ -0,0 +1,32 @@ +package scalevalapokalypsi.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 RoomState: + + /** 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 RoomState |