aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Item.scala
blob: eea70441780a99d77d405d29e4956fcc58c36d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package scalevalapokalypsi.Model

import scalevalapokalypsi.Model.Entities.Entity
import scala.annotation.targetName

/** The class `Item` represents items in a text adventure game. Each item has a
  * name and a longer description. (In later versions of the adventure game,
  * items may have other features as well.)
  *
  * @param name the item’s name
  * @param description the item’s description
  */
class Item(val name: String, val description: String, val weight: Int):

	/** Returns a short textual representation of the item (its name, that is). */
	override def toString = this.name

    /** Makes the caller entity use this Item. Default implementation
      * does nothing, this can be implemented by extending.
      */
	def use(caller: Entity): Option[Event] = None

end Item