aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala b/src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala
new file mode 100644
index 0000000..a8384f2
--- /dev/null
+++ b/src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala
@@ -0,0 +1,48 @@
+
+
+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
+