Add some docstrings to ai.py
This commit is contained in:
parent
ae1c7f5ce2
commit
05eb5c4ade
1 changed files with 9 additions and 0 deletions
|
|
@ -16,7 +16,10 @@ from .object import Entity
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .engine import Engine
|
from .engine import Engine
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
class AI(Component):
|
class AI(Component):
|
||||||
|
'''An abstract class providing AI for an entity.'''
|
||||||
|
|
||||||
def __init__(self, entity: Entity) -> None:
|
def __init__(self, entity: Entity) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.entity = entity
|
self.entity = entity
|
||||||
|
|
@ -26,6 +29,12 @@ class AI(Component):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
class HostileEnemy(AI):
|
class HostileEnemy(AI):
|
||||||
|
'''Entity AI for a hostile enemy.
|
||||||
|
|
||||||
|
The entity will wander around until it sees the hero, at which point it will
|
||||||
|
beeline for her.
|
||||||
|
'''
|
||||||
|
|
||||||
def act(self, engine: 'Engine') -> Optional[Action]:
|
def act(self, engine: 'Engine') -> Optional[Action]:
|
||||||
visible_tiles = tcod.map.compute_fov(
|
visible_tiles = tcod.map.compute_fov(
|
||||||
engine.map.tiles['transparent'],
|
engine.map.tiles['transparent'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue