aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-27 17:19:46 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-27 17:19:46 +0200
commit302455bac062080bf197b44e07ed53a3454be4c5 (patch)
tree8b189ba41699c9a095d27bf00d1114a65aaa420a /src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
parent98407b35ff477f372baa92bf582b90a961d4ad16 (diff)
downloadscalevalapokalypsi-302455bac062080bf197b44e07ed53a3454be4c5.tar.gz
scalevalapokalypsi-302455bac062080bf197b44e07ed53a3454be4c5.zip
Finishing almost the adventure
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala b/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
index fa5602e..c5c8789 100644
--- a/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
+++ b/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
@@ -11,7 +11,7 @@ class Cultist(
identifier: String,
initialLocation: Area,
initialHP: Int = 100,
- maxHP: Int = 100
+ maxHP: Int = 50
) extends NPC(adventure, identifier, initialLocation, initialHP, maxHP):
private val damage = 20
@@ -25,6 +25,7 @@ class Cultist(
.filter(_ != this)
.filter(_ match
case c: Cultist => false
+ case z: Zombie => false
case other => true
)
.toVector
@@ -35,6 +36,16 @@ class Cultist(
this.location.observeEvent(
this.curse(possibleVictims(index))
)
+ else
+ val possibleDirections = this.location.getNeighborNames
+ if possibleDirections.size != 0 then
+ val directionIndex = Random.between(
+ 0,
+ possibleDirections.size
+ )
+ this.go(possibleDirections.toVector(directionIndex)).foreach(
+ this.location.observeEvent(_)
+ )
private def curse(entity: Entity): Event =