aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Action.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 22:32:25 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 22:32:25 +0200
commita98f089035dbcc94c14c9cd6246c3150bee84241 (patch)
tree228ffa0d5e4a3e86c454cd297644c97abc994ef3 /src/scalevalapokalypsi/Model/Action.scala
parentc954ca4d1ec677a34a6d787a23f9d01396f7e585 (diff)
downloadscalevalapokalypsi-a98f089035dbcc94c14c9cd6246c3150bee84241.tar.gz
scalevalapokalypsi-a98f089035dbcc94c14c9cd6246c3150bee84241.zip
Improved client recovery from singing & added better logic for observations
The logic should still be implemented for all observations
Diffstat (limited to 'src/scalevalapokalypsi/Model/Action.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Action.scala7
1 files changed, 4 insertions, 3 deletions
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))