diff options
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/Player.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Entities/Player.scala | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/scalevalapokalypsi/Model/Entities/Player.scala b/src/scalevalapokalypsi/Model/Entities/Player.scala index d6b3529..9fc929d 100644 --- a/src/scalevalapokalypsi/Model/Entities/Player.scala +++ b/src/scalevalapokalypsi/Model/Entities/Player.scala @@ -12,7 +12,11 @@ import scalevalapokalypsi.Model.* * @param name the player's name * @param initialLocation the player’s initial location */ -class Player(name: String, initialLocation: Area) extends Entity(name, initialLocation): +class Player( + adventure: Adventure, + name: String, + initialLocation: Area +) extends Entity(adventure, name, initialLocation): private val observations: Buffer[String] = Buffer.empty private val observedEvents: Buffer[Event] = Buffer.empty @@ -49,8 +53,6 @@ class Player(name: String, initialLocation: Area) extends Entity(name, initialLo * @param singQuality the quality of the song */ def applySingEffect(singQuality: Float): Unit = - val res = this.pendingSingEffect.map(ef => ef(singQuality)) - this.pendingSingEffect = None val qualityDescriptions = if singQuality < .10 then ("säälittävää", "epsilonin suuruinen") @@ -63,11 +65,10 @@ class Player(name: String, initialLocation: Area) extends Entity(name, initialLo else ("erinomaista", "merkittävä") val quality = s"Laulu on ${qualityDescriptions(0)} ja sen vaikutus on ${qualityDescriptions(1)}." - val event = res.map(ev => Event( - ev.inFirstPersons.map((k, v) => (k, s"$quality\n$v")), - s"$quality\n${ev.inThirdPerson}" - )) - event.foreach(this.location.observeEvent(_)) + val event = Event(Map.empty, s"$quality") + this.location.observeEvent(event) + this.pendingSingEffect.map(ef => ef(singQuality)) + this.pendingSingEffect = None |