From fe2543627bcec1ea0f7a429bede20ca293458ba9 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Mon, 18 Nov 2024 02:01:12 +0200 Subject: Major change! Changed Events to have multiple first persons & changed sending action results to clients using this. This improves code and made it easy to finally make arrival/leaving messages when going from one area to another! This commit is too big indeed, and there are probably bugs. I'm annoyed we didn't set up unit testing during the course. I should've taken my time to set up IDEA myself for that. Now the bugs will just have to be fixed in future commits. --- src/scalevalapokalypsi/Model/Entities/Player.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/scalevalapokalypsi/Model/Entities/Player.scala') diff --git a/src/scalevalapokalypsi/Model/Entities/Player.scala b/src/scalevalapokalypsi/Model/Entities/Player.scala index f231c28..cac5bf1 100644 --- a/src/scalevalapokalypsi/Model/Entities/Player.scala +++ b/src/scalevalapokalypsi/Model/Entities/Player.scala @@ -41,7 +41,7 @@ class Player(name: String, initialLocation: Area) extends Entity(name, initialLo */ def setSingEffect(effect: SingEffect): Unit = this.pendingSingEffect = Some(effect) - + def getSingEffectTarget: Option[Entity] = this.pendingSingEffect.map(_.target) @@ -66,8 +66,7 @@ class Player(name: String, initialLocation: Area) extends Entity(name, initialLo val quality = s"Laulu on ${qualityDescriptions(0)} ja sen vaikutus on ${qualityDescriptions(1)}." val event = res.map(ev => Event( - ev.target, - s"$quality\n${ev.inFirstPerson}", + ev.inFirstPersons.map((k, v) => (k, s"$quality\n$v")), s"$quality\n${ev.inThirdPerson}" )) event.foreach(this.location.observeEvent(_)) -- cgit v1.2.3