diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 17:49:14 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 17:49:42 +0200 |
commit | a41c720736ae194f4c67637d9e822d2d4ded09f9 (patch) | |
tree | ceee825b2b53f2e1babee842ab45e397b88f6cf7 /src/scalevalapokalypsi/Model/Adventure.scala | |
parent | b50a8e42b6b69ce4e15773c73cf68d2ac8f2175d (diff) | |
download | scalevalapokalypsi-a41c720736ae194f4c67637d9e822d2d4ded09f9.tar.gz scalevalapokalypsi-a41c720736ae194f4c67637d9e822d2d4ded09f9.zip |
Diffstat (limited to 'src/scalevalapokalypsi/Model/Adventure.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Adventure.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/scalevalapokalypsi/Model/Adventure.scala b/src/scalevalapokalypsi/Model/Adventure.scala index 9f538c5..d493276 100644 --- a/src/scalevalapokalypsi/Model/Adventure.scala +++ b/src/scalevalapokalypsi/Model/Adventure.scala @@ -24,6 +24,10 @@ import scala.math.min */ class Adventure(val playerNames: Vector[String]): + private var gameIsWon = false + def winGame() = this.gameIsWon = true + def isWon = this.gameIsWon + // Structure: // * Area definitions // * Area neighbor definitions @@ -171,6 +175,22 @@ class Adventure(val playerNames: Vector[String]): // Item definitions private val oluttuoppi = Item("oluttuoppi", "Tuopillinen kylmää ja kuohuvaa juomaa. Se tuoksuu aika tujulta.", 1) + + object Key extends Item( + "avain", + "avain, jolla voi avata ovia", + 1 + ): + + override def use(user: Entity): Option[Event] = + if user.location == bossDoor then + bossDoor.setNeighbor("sisään", bossFightRoom) + Some(Event(immutable.Map.empty, "Ovi aukeaa")) + else None + end use + end Key + + storageRoom.addItem(Key) object SeparatorScroll extends Item( "separoitumisen laulukäärö", |