diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 12:29:43 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 12:29:43 +0200 |
commit | 98407b35ff477f372baa92bf582b90a961d4ad16 (patch) | |
tree | bb58925090075d1e9e30dd1593547db2cbe03bb6 /src/scalevalapokalypsi/Model/Action.scala | |
parent | 38900e0b291d5e0f59afaaa239cd237f733b6588 (diff) | |
download | scalevalapokalypsi-98407b35ff477f372baa92bf582b90a961d4ad16.tar.gz scalevalapokalypsi-98407b35ff477f372baa92bf582b90a961d4ad16.zip |
Added part of story & improved singing with multiple verses & hemingway distance
Diffstat (limited to 'src/scalevalapokalypsi/Model/Action.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Action.scala | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/scalevalapokalypsi/Model/Action.scala b/src/scalevalapokalypsi/Model/Action.scala index 21e1286..75ce68c 100644 --- a/src/scalevalapokalypsi/Model/Action.scala +++ b/src/scalevalapokalypsi/Model/Action.scala @@ -28,16 +28,16 @@ class Action(input: String): def execute(actor: Player): Boolean = val oldLocation = actor.location val resOption: Option[(Boolean, Event)] = this.verb match - case "go" => + case "mene" => val result = actor.go(this.modifiers) result.foreach(r => if actor.location != oldLocation then oldLocation.observeEvent(r) ) result.map((true, _)) - case "rest" => Some((true, actor.rest())) - case "get" => Some((false, actor.pickUp(this.modifiers))) - case "inventory" => Some((false, actor.inventory)) + case "lepää" => Some((true, actor.rest())) + case "poimi" | "ota" => Some((false, actor.pickUp(this.modifiers))) + case "tavaraluettelo" => Some((false, actor.inventory)) case "sano" => val entityNames = actor.location.getEntityNames.map(_.toLowerCase) val recipientNamePair = entityNames.flatMap(name => @@ -91,7 +91,9 @@ class Action(input: String): )).toMap, fromThirdPerson.getOrElse("")) ) ) - case "drop" => Some((false, actor.drop(this.modifiers))) + case "tiputa" | "pudota" => Some((false, actor.drop(this.modifiers))) + case "käytä" => + Some(true -> actor.useItem(this.modifiers)) case "laula" => val end = modifiers.takeRight("suohon".length) val start = @@ -109,8 +111,8 @@ class Action(input: String): else None case "xyzzy" => Some((false, Event( - Map.from(Vector((actor, "The grue tastes yummy."))), - s"${actor.name} tastes some grue.") + Map.from(Vector((actor, "Grue maistuu."))), + s"${actor.name} maistaa.") )) case other => None |