From a98f089035dbcc94c14c9cd6246c3150bee84241 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sun, 17 Nov 2024 22:32:25 +0200 Subject: Improved client recovery from singing & added better logic for observations The logic should still be implemented for all observations --- src/scalevalapokalypsi/Model/Action.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/scalevalapokalypsi/Model/Action.scala') diff --git a/src/scalevalapokalypsi/Model/Action.scala b/src/scalevalapokalypsi/Model/Action.scala index cee0ee5..30fbf46 100644 --- a/src/scalevalapokalypsi/Model/Action.scala +++ b/src/scalevalapokalypsi/Model/Action.scala @@ -63,7 +63,8 @@ class Action(input: String): if end == "suohon" then val targetEntity = actor.location.getEntity(start) targetEntity - .foreach(e => actor.setSingEffect(defaultSingAttack(e))) + .foreach(e => actor.setSingEffect(DefaultSingAttack(e))) + targetEntity.foreach(_.observeString(s"${actor.name} laulaa sinua suohon!")) targetEntity.map(e => ( "Aloitat suohonlaulun.", s"${actor.name} aloittaa suohonlaulun." @@ -78,9 +79,9 @@ class Action(input: String): resOption.map(_(1)).filter(_.length > 0) .foreach(s => - actor.location.getEntities.filter(_ != actor).foreach(_.observe(s)) + actor.location.getEntities.filter(_ != actor).foreach(_.observeString(s)) if oldLocation != actor.location then - oldLocation.getEntities.foreach(_.observe(s)) + oldLocation.getEntities.foreach(_.observeString(s)) ) resOption.map(_(0)) -- cgit v1.2.3