diff options
Diffstat (limited to 'src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala')
-rw-r--r-- | src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala b/src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala index 21709ba..944f2e6 100644 --- a/src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala +++ b/src/scalevalapokalypsi/Model/Entities/NPCs/NPC.scala @@ -17,19 +17,21 @@ import scala.util.Random * @param initialLocation the NPC’s initial location */ abstract class NPC( + adventure: Adventure, name: String, initialLocation: Area, initialHP: Int, maxHp: Int -) extends Entity(name, initialLocation, initialHP, maxHp): +) extends Entity(adventure, name, initialLocation, initialHP, maxHp): def getDialog: String def act(): Unit class Zombie( + adventure: Adventure, identifier: String, initialLocation: Area, initialHP: Int = 20 -) extends NPC(identifier, initialLocation, initialHP, 20): +) extends NPC(adventure, identifier, initialLocation, initialHP, 20): private val damage = 10 private val dialogs = Vector( @@ -60,7 +62,7 @@ class Zombie( .toVector .lift(directionIndex) .flatMap(this.go(_)) - .map(this.location.observeEvent(_)) + .foreach(this.location.observeEvent(_)) else this.location.observeEvent( this.attack(possibleVictims(index)) |