diff options
author | Aleksi Heikkila <aleksi.e.heikkila@aalto.fi> | 2024-11-27 17:26:16 +0200 |
---|---|---|
committer | Aleksi Heikkila <aleksi.e.heikkila@aalto.fi> | 2024-11-27 17:26:16 +0200 |
commit | b50a8e42b6b69ce4e15773c73cf68d2ac8f2175d (patch) | |
tree | 14a95bc1fd5ec6cfbfd25f795e46fc389ee6625a /src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala | |
parent | 34dc64a1387f2904b4c23ac3fcfea35c9670088e (diff) | |
parent | 302455bac062080bf197b44e07ed53a3454be4c5 (diff) | |
download | scalevalapokalypsi-b50a8e42b6b69ce4e15773c73cf68d2ac8f2175d.tar.gz scalevalapokalypsi-b50a8e42b6b69ce4e15773c73cf68d2ac8f2175d.zip |
help-komento
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Entities/NPCs/Cthulthu.scala | 48 |
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 + |