Fix some PEP8 formatting issues
This commit is contained in:
parent
350876347b
commit
d8dfe5c497
1 changed files with 9 additions and 9 deletions
|
@ -15,6 +15,7 @@ from .monsters import Species
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .ai import AI
|
from .ai import AI
|
||||||
|
|
||||||
|
|
||||||
class RenderOrder(Enum):
|
class RenderOrder(Enum):
|
||||||
'''
|
'''
|
||||||
These values indicate the order that an Entity should be rendered. Higher values are rendered later and therefore on
|
These values indicate the order that an Entity should be rendered. Higher values are rendered later and therefore on
|
||||||
|
@ -24,6 +25,7 @@ class RenderOrder(Enum):
|
||||||
ACTOR = 2000
|
ACTOR = 2000
|
||||||
HERO = 3000
|
HERO = 3000
|
||||||
|
|
||||||
|
|
||||||
class Entity:
|
class Entity:
|
||||||
'''A single-tile drawable entity with a symbol and position
|
'''A single-tile drawable entity with a symbol and position
|
||||||
|
|
||||||
|
@ -47,15 +49,9 @@ class Entity:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# A monotonically increasing identifier to help differentiate between entities that otherwise look identical
|
# A monotonically increasing identifier to help differentiate between entities that otherwise look identical
|
||||||
__NEXT_IDENTIFIER = 1
|
__next_identifier = 1
|
||||||
|
|
||||||
def __init__(self, symbol: str, *,
|
self.identifier = Entity.__next_identifier
|
||||||
position: Optional[Point] = None,
|
|
||||||
blocks_movement: Optional[bool] = True,
|
|
||||||
render_order: RenderOrder = RenderOrder.ITEM,
|
|
||||||
fg: Optional[Tuple[int, int, int]] = None,
|
|
||||||
bg: Optional[Tuple[int, int, int]] = None):
|
|
||||||
self.identifier = Entity.__NEXT_IDENTIFIER
|
|
||||||
self.position = position if position else Point()
|
self.position = position if position else Point()
|
||||||
self.foreground = fg if fg else (255, 255, 255)
|
self.foreground = fg if fg else (255, 255, 255)
|
||||||
self.background = bg
|
self.background = bg
|
||||||
|
@ -63,7 +59,7 @@ class Entity:
|
||||||
self.blocks_movement = blocks_movement
|
self.blocks_movement = blocks_movement
|
||||||
self.render_order = render_order
|
self.render_order = render_order
|
||||||
|
|
||||||
Entity.__NEXT_IDENTIFIER += 1
|
Entity.__next_identifier += 1
|
||||||
|
|
||||||
def print_to_console(self, console: tcod.Console) -> None:
|
def print_to_console(self, console: tcod.Console) -> None:
|
||||||
'''Render this Entity to the console'''
|
'''Render this Entity to the console'''
|
||||||
|
@ -75,6 +71,7 @@ class Entity:
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f'{self.__class__.__name__}({self.symbol!r}, position={self.position!r}, fg={self.foreground!r}, bg={self.background!r})'
|
return f'{self.__class__.__name__}({self.symbol!r}, position={self.position!r}, fg={self.foreground!r}, bg={self.background!r})'
|
||||||
|
|
||||||
|
|
||||||
class Actor(Entity):
|
class Actor(Entity):
|
||||||
'''
|
'''
|
||||||
An actor is an abstract class that defines an object that can act in the game world. Entities that are actors will
|
An actor is an abstract class that defines an object that can act in the game world. Entities that are actors will
|
||||||
|
@ -121,6 +118,7 @@ class Actor(Entity):
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f'{self.__class__.__name__}({self.symbol!r}, position={self.position!r}, fighter={self.fighter!r}, ai={self.ai!r}, fg={self.foreground!r}, bg={self.background!r})'
|
return f'{self.__class__.__name__}({self.symbol!r}, position={self.position!r}, fighter={self.fighter!r}, ai={self.ai!r}, fg={self.foreground!r}, bg={self.background!r})'
|
||||||
|
|
||||||
|
|
||||||
class Hero(Actor):
|
class Hero(Actor):
|
||||||
'''The hero, the player character'''
|
'''The hero, the player character'''
|
||||||
|
|
||||||
|
@ -143,6 +141,7 @@ class Hero(Actor):
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f'Hero!{self.identifier} at {self.position} with {self.fighter.hit_points}/{self.fighter.maximum_hit_points} hp'
|
return f'Hero!{self.identifier} at {self.position} with {self.fighter.hit_points}/{self.fighter.maximum_hit_points} hp'
|
||||||
|
|
||||||
|
|
||||||
class Monster(Actor):
|
class Monster(Actor):
|
||||||
'''An instance of a Species'''
|
'''An instance of a Species'''
|
||||||
|
|
||||||
|
@ -177,6 +176,7 @@ class Monster(Actor):
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f'{self.name}!{self.identifier} with {self.fighter.hit_points}/{self.fighter.maximum_hit_points} hp at {self.position}'
|
return f'{self.name}!{self.identifier} with {self.fighter.hit_points}/{self.fighter.maximum_hit_points} hp at {self.position}'
|
||||||
|
|
||||||
|
|
||||||
class Item(Entity):
|
class Item(Entity):
|
||||||
'''An instance of an Item'''
|
'''An instance of an Item'''
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue