diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-26 14:03:23 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-26 14:10:45 +0200 |
commit | 38900e0b291d5e0f59afaaa239cd237f733b6588 (patch) | |
tree | ee04f697ab17a75c9563ee87763cbcdcde8d297b /src/scalevalapokalypsi/Model/Entities/Player.scala | |
parent | 27dd937617cce1e43df1c16e12050f6e88763d54 (diff) | |
download | scalevalapokalypsi-38900e0b291d5e0f59afaaa239cd237f733b6588.tar.gz scalevalapokalypsi-38900e0b291d5e0f59afaaa239cd237f733b6588.zip |
Dying properly
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 |