package scalevalapokalypsi.Model.Entities.NPCs import scala.collection.mutable.Buffer import scalevalapokalypsi.Model.* import scalevalapokalypsi.Model.Entities.* import scala.util.Random class Cthulthu( adventure: Adventure, initialLocation: Area, initialHP: Int = 100 ) extends NPC(adventure, "Leijuva lonkero-otus", initialLocation, initialHP, 100): private var tentacleIndex = 0 private var hp = this.maxHP override def isAlive = this.hp > 0 def heal(): Boolean = if this.hp < this.maxHP then this.hp = this.maxHP true else false override def getDialog: String = "sxaCHReeaaaAAARRR!!" override def act(): Unit = val playersExist = this.location .getEntities .exists(_ match case p: Player => true case other => false ) if playersExist then this.location.addEntity(Tentacle( adventure, s"Lonkero #$tentacleIndex", this.location )) this.location.observeEvent( Event(Map.empty, s"${this.name} ärjyy. Maasta ilmestyy uusi lonkero.") ) end Cthulthu