1
0

Remove some redundancy

This commit is contained in:
Timothy Warren 2022-01-07 16:48:49 -05:00
parent a796e947d1
commit 50ddf8cc01
3 changed files with 3 additions and 12 deletions

View File

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional, Tuple, TYPE_CHECKING
from typing import Optional, Tuple, TYPE_CHECKING, overload
if TYPE_CHECKING:
from engine import Engine
@ -17,6 +17,7 @@ class Action:
"""Return the engine this action belongs to."""
return self.entity.gamemap.engine
@overload
def perform(self) -> None:
"""Perform this action with the objects needed to determine its scope.
@ -26,7 +27,6 @@ class Action:
This method must be overwritten by Action subclasses.
"""
raise NotImplementedError()
class EscapeAction(Action):
@ -51,9 +51,6 @@ class ActionWithDirection(Action):
"""Return the blocking entity at this action's destination."""
return self.engine.game_map.get_blocking_entity_at_location(*self.dest_xy)
def perform(self) -> None:
raise NotImplementedError()
class MeleeAction(ActionWithDirection):
def perform(self) -> None:

View File

@ -10,9 +10,6 @@ from components.base_component import BaseComponent
class BaseAI(Action, BaseComponent):
def perform(self) -> None:
raise NotImplementedError()
def get_path_to(self, dest_x: int, dest_y: int) -> List[Tuple[int, int]]:
"""Compute and return a path to the target position.

View File

@ -26,9 +26,6 @@ class EventHandler(tcod.event.EventDispatch[Action]):
self.engine.handle_enemy_turns()
self.engine.update_fov()
def ev_quit(self, event: tcod.event.Quit) -> Optional[Action]:
raise SystemExit()
def ev_keydown(self, event: tcod.event.KeyDown) -> Optional[Action]:
action: Optional[Action] = None