Instantiate Monsters with a HostileEnemy AI

This commit is contained in:
Eryn Wells 2022-05-08 09:55:10 -07:00
parent 550cde6a8f
commit ee0e4b1dba

View file

@ -10,10 +10,10 @@ from typing import MutableSet
import tcod import tcod
from . import monsters from . import monsters
from .ai import HostileEnemy
from .geometry import Size from .geometry import Size
from .map import Map from .map import Map
from .monsters import Monster from .object import Entity, Hero, Monster
from .object import Entity, Hero
LOG = logging.getLogger('engine') LOG = logging.getLogger('engine')
@ -65,9 +65,9 @@ class Engine:
for _ in range(2): for _ in range(2):
spawn_monster_chance = random.random() spawn_monster_chance = random.random()
if spawn_monster_chance > 0.8: if spawn_monster_chance > 0.8:
monster = Monster(monsters.Troll, position=random_start_position) monster = Monster(monsters.Troll, ai_class=HostileEnemy, position=random_start_position)
else: else:
monster = Monster(monsters.Orc, position=random_start_position) monster = Monster(monsters.Orc, ai_class=HostileEnemy, position=random_start_position)
LOG.info('Spawning monster %s', monster) LOG.info('Spawning monster %s', monster)
self.entities.add(monster) self.entities.add(monster)