From 302455bac062080bf197b44e07ed53a3454be4c5 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Wed, 27 Nov 2024 17:19:46 +0200 Subject: Finishing almost the adventure --- src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala') 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 = -- cgit v1.2.3