diff options
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ö", |