From c954ca4d1ec677a34a6d787a23f9d01396f7e585 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sun, 17 Nov 2024 17:06:56 +0200 Subject: 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 --- src/scalevalapokalypsi/Model/Adventure.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/scalevalapokalypsi/Model/Adventure.scala') 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 -- cgit v1.2.3