blob: a8384f2ee1a816dad48fdc50628807646b594274 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package scalevalapokalypsi.Model.Entities.NPCs
import scala.collection.mutable.Buffer
import scalevalapokalypsi.Model.*
import scalevalapokalypsi.Model.Entities.*
import scala.util.Random
class Cthulthu(
adventure: Adventure,
initialLocation: Area,
initialHP: Int = 100
) extends NPC(adventure, "Leijuva lonkero-otus", initialLocation, initialHP, 100):
private var tentacleIndex = 0
private var hp = this.maxHP
override def isAlive = this.hp > 0
def heal(): Boolean =
if this.hp < this.maxHP then
this.hp = this.maxHP
true
else
false
override def getDialog: String =
"sxaCHReeaaaAAARRR!!"
override def act(): Unit =
val playersExist = this.location
.getEntities
.exists(_ match
case p: Player => true
case other => false
)
if playersExist then
this.location.addEntity(Tentacle(
adventure,
s"Lonkero #$tentacleIndex",
this.location
))
this.location.observeEvent(
Event(Map.empty, s"${this.name} ärjyy. Maasta ilmestyy uusi lonkero.")
)
end Cthulthu
|