aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Entities/Player.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/Player.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Entities/Player.scala26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/scalevalapokalypsi/Model/Entities/Player.scala b/src/scalevalapokalypsi/Model/Entities/Player.scala
index 9fc929d..62d4180 100644
--- a/src/scalevalapokalypsi/Model/Entities/Player.scala
+++ b/src/scalevalapokalypsi/Model/Entities/Player.scala
@@ -1,6 +1,7 @@
package scalevalapokalypsi.Model.Entities
import scala.collection.mutable.{Buffer, Map}
+import scala.collection.immutable
import scalevalapokalypsi.Model.*
/** A `Player` object represents a player character controlled by one real-life player
@@ -21,6 +22,15 @@ class Player(
private val observations: Buffer[String] = Buffer.empty
private val observedEvents: Buffer[Event] = Buffer.empty
private var pendingSingEffect: Option[SingEffect] = None
+// private var verseToSing: Option[String] = None
+
+ override def getVerseAgainst: Vector[String] =
+ Vector(
+ "Pian pimeässä suossa",
+ "lepäät levä ympärilläs",
+ "lauluasi lausumahan",
+ "et sikaa paremmin pysty"
+ )
override def observe(event: Event): Unit =
this.observedEvents.append(event)
@@ -44,8 +54,11 @@ class Player(
def setSingEffect(effect: SingEffect): Unit =
this.pendingSingEffect = Some(effect)
- def getSingEffectTarget: Option[Entity] =
- this.pendingSingEffect.map(_.target)
+ def getVerses: Option[Vector[String]] =
+ this.pendingSingEffect.map(_.getVerses)
+
+// def getSingEffectTarget: Option[Entity] =
+// this.pendingSingEffect.map(_.target)
/** Applies the pending sing effect and informs the surronding Entities
* about the effects of the song.
@@ -65,12 +78,11 @@ class Player(
else ("erinomaista", "merkittävä")
val quality =
s"Laulu on ${qualityDescriptions(0)} ja sen vaikutus on ${qualityDescriptions(1)}."
- val event = Event(Map.empty, s"$quality")
+ val event = Event(immutable.Map.empty, s"$quality")
this.location.observeEvent(event)
- this.pendingSingEffect.map(ef => ef(singQuality))
+ this.pendingSingEffect
+ .map(ef => ef(singQuality))
+ .map(this.location.observeEvent(_))
this.pendingSingEffect = None
-
-
-
end Player