aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala
diff options
context:
space:
mode:
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 =