Reformat some heckin' long initializers in object.py
This commit is contained in:
parent
d8dfe5c497
commit
d4c4b5d879
1 changed files with 26 additions and 13 deletions
|
@ -51,6 +51,15 @@ 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,
|
||||||
|
*,
|
||||||
|
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.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)
|
||||||
|
@ -86,14 +95,17 @@ class Actor(Entity):
|
||||||
defense power, etc live.
|
defense power, etc live.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, symbol: str, *,
|
def __init__(
|
||||||
position: Optional[Point] = None,
|
self,
|
||||||
blocks_movement: Optional[bool] = True,
|
symbol: str,
|
||||||
render_order: RenderOrder = RenderOrder.ACTOR,
|
*,
|
||||||
ai: Optional[Type['AI']] = None,
|
position: Optional[Point] = None,
|
||||||
fighter: Optional[Fighter] = None,
|
blocks_movement: Optional[bool] = True,
|
||||||
fg: Optional[Tuple[int, int, int]] = None,
|
render_order: RenderOrder = RenderOrder.ACTOR,
|
||||||
bg: Optional[Tuple[int, int, int]] = None):
|
ai: Optional[Type['AI']] = None,
|
||||||
|
fighter: Optional[Fighter] = None,
|
||||||
|
fg: Optional[Tuple[int, int, int]] = None,
|
||||||
|
bg: Optional[Tuple[int, int, int]] = None):
|
||||||
super().__init__(symbol, position=position, blocks_movement=blocks_movement, fg=fg, bg=bg, render_order=render_order)
|
super().__init__(symbol, position=position, blocks_movement=blocks_movement, fg=fg, bg=bg, render_order=render_order)
|
||||||
|
|
||||||
# Components
|
# Components
|
||||||
|
@ -123,11 +135,12 @@ class Hero(Actor):
|
||||||
'''The hero, the player character'''
|
'''The hero, the player character'''
|
||||||
|
|
||||||
def __init__(self, position: Point):
|
def __init__(self, position: Point):
|
||||||
super().__init__('@',
|
super().__init__(
|
||||||
position=position,
|
'@',
|
||||||
fighter=Fighter(maximum_hit_points=30, attack_power=5, defense=2),
|
position=position,
|
||||||
render_order=RenderOrder.HERO,
|
fighter=Fighter(maximum_hit_points=30, attack_power=5, defense=2),
|
||||||
fg=tuple(tcod.white))
|
render_order=RenderOrder.HERO,
|
||||||
|
fg=tuple(tcod.white))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue