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/Cultist.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/Cultist.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Entities/NPCs/Cultist.scala | 13 |
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 = |