aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Adventure.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 17:06:56 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 17:06:56 +0200
commitc954ca4d1ec677a34a6d787a23f9d01396f7e585 (patch)
treec6b00b5046bde3a98c18f9557198f852b4ce9d46 /src/scalevalapokalypsi/Model/Adventure.scala
parenta6b0330c845d4edad87c7059bac56e194a276c6f (diff)
downloadscalevalapokalypsi-c954ca4d1ec677a34a6d787a23f9d01396f7e585.tar.gz
scalevalapokalypsi-c954ca4d1ec677a34a6d787a23f9d01396f7e585.zip
Template for singing, WIP.
* The line to sing is always the same. * The client recovers weirdly from singing before the next turn and my brain is currently too fried to figure out why
Diffstat (limited to 'src/scalevalapokalypsi/Model/Adventure.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Adventure.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/scalevalapokalypsi/Model/Adventure.scala b/src/scalevalapokalypsi/Model/Adventure.scala
index 9d07ba6..0fbf6cd 100644
--- a/src/scalevalapokalypsi/Model/Adventure.scala
+++ b/src/scalevalapokalypsi/Model/Adventure.scala
@@ -36,14 +36,14 @@ class Adventure(val playerNames: Vector[String]):
"Et vielä voi tehdä sillä mitään, koska et edes osaa laula."
))
- val players: Map[String, Player] = Map()
- playerNames.foreach(this.addPlayer(_))
-
val entities: Map[String, Entity] = Map()
private val gruu = Entity("Gruu", northForest)
northForest.addEntity(gruu)
this.entities += gruu.name -> gruu
+ val players: Map[String, Player] = Map()
+ playerNames.foreach(this.addPlayer(_))
+
/** Adds a player entity with the specified name to the game.
*
* @param name the name of the player entity to add
@@ -52,9 +52,10 @@ class Adventure(val playerNames: Vector[String]):
def addPlayer(name: String): Player =
val newPlayer = Player(name, middle)
middle.addEntity(newPlayer)
+ this.entities += name -> newPlayer
players += name -> newPlayer
newPlayer
-
+
/** Gets the player entity with the specified name.
*
* @param name name of the player to find