2020-11-10 22:34:12 +01:00
|
|
|
from random import choice
|
|
|
|
|
2020-11-06 15:33:26 +01:00
|
|
|
from ..interfaces import FightingEntity, Map
|
|
|
|
|
2020-10-16 17:58:00 +02:00
|
|
|
|
2020-10-23 16:51:48 +02:00
|
|
|
class Monster(FightingEntity):
|
2020-11-06 16:13:28 +01:00
|
|
|
def act(self, m: Map) -> None:
|
2020-11-10 22:34:12 +01:00
|
|
|
"""
|
|
|
|
By default, a monster will move randomly where it is possible
|
|
|
|
And if a player is close to the monster, the monster run on the player.
|
|
|
|
"""
|
|
|
|
# TODO If a player is close, move to the player
|
|
|
|
while True:
|
|
|
|
if choice([self.move_up, self.move_down,
|
|
|
|
self.move_left, self.move_right])():
|
|
|
|
break
|
2020-10-23 16:51:48 +02:00
|
|
|
|
2020-11-06 15:33:26 +01:00
|
|
|
|
2020-11-10 21:47:36 +01:00
|
|
|
class Hedgehog(Monster):
|
|
|
|
name = "hedgehog"
|
2020-10-16 17:58:00 +02:00
|
|
|
maxhealth = 10
|
|
|
|
strength = 3
|