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/SingEffects.scala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/scalevalapokalypsi/Model/SingEffects.scala') diff --git a/src/scalevalapokalypsi/Model/SingEffects.scala b/src/scalevalapokalypsi/Model/SingEffects.scala index 6702df5..42f5188 100644 --- a/src/scalevalapokalypsi/Model/SingEffects.scala +++ b/src/scalevalapokalypsi/Model/SingEffects.scala @@ -1,11 +1,7 @@ package scalevalapokalypsi.Model import scalevalapokalypsi.Model.Entities.Entity - -def defaultSingAttack(targetEntity: Entity)(singQuality: Float): Event = - targetEntity.takeDamage((singQuality * 30).toInt) - val condition = targetEntity.condition - Event(targetEntity, condition(0), condition(1)) +import scala.collection.immutable.Map trait SingEffect(val target: Entity): def apply(singQuality: Float): Event @@ -14,4 +10,4 @@ class DefaultSingAttack(target: Entity) extends SingEffect(target): def apply(singQuality: Float): Event = this.target.takeDamage((singQuality * 50).toInt) // TODO: remove magic value val condition = this.target.condition - Event(target, condition(0), condition(1)) + Event(Map.from(Vector((target, condition(0)))), condition(1)) -- cgit v1.2.3